63 const std::vector<map_location>::const_iterator & begin,
64 const std::vector<map_location>::const_iterator & end,
65 int start_moves,
int timebonus=0,
int village_owner=-1,
69 const map_location& from,
int orig_village_owner,
bool time_bonus);
72 const map_location& from,
int orig_village_owner,
bool time_bonus);
109 void add(std::unique_ptr<undo_action_base>&& action)
110 {
undos_.push_back(std::move(action));
redos_.clear(); }
Class to store the actions that a player can undo and redo.
static std::unique_ptr< undo_action_base > create_action(const config &cfg)
Creates an undo_action based on a config.
void new_side_turn(int side)
Performs some initializations and error checks when starting a new side-turn.
void add_dismissal(const unit_const_ptr u)
Adds a dismissal to the undo stack.
bool can_undo() const
True if there are actions that can be undone.
void read(const config &cfg)
Read the undo_list from the provided config.
undo_list(const undo_list &)=delete
void add_recall(const unit_const_ptr u, const map_location &loc, const map_location &from, int orig_village_owner, bool time_bonus)
Adds a recall to the undo stack.
bool committed_actions_
Tracks if actions have been cleared from the stack since the turn began.
undo_list & operator=(const undo_list &)=delete
void write(config &cfg) const
Write the undo_list into the provided config.
void add(std::unique_ptr< undo_action_base > &&action)
Adds an action to the undo stack.
std::vector< action_ptr_t > action_list
bool commit_vision()
Updates fog/shroud based on the undo stack, then updates stack as needed.
void redo()
Redoes the top action on the redo stack.
bool apply_shroud_changes() const
Applies the pending fog/shroud changes from the undo stack.
std::vector< std::unique_ptr< config > > redos_list
void clear()
Clears the stack of undoable (and redoable) actions.
void add_dummy()
Adds an auto-shroud toggle to the undo stack.
int side_
Tracks the current side.
void add_auto_shroud(bool turned_on)
Adds an auto-shroud toggle to the undo stack.
void add_move(const unit_const_ptr u, const std::vector< map_location >::const_iterator &begin, const std::vector< map_location >::const_iterator &end, int start_moves, int timebonus=0, int village_owner=-1, const map_location::direction dir=map_location::direction::indeterminate)
Adds a move to the undo stack.
void add_update_shroud()
Adds a shroud update to the undo stack.
bool player_acted() const
Returns true if the player has performed any actions this turn.
std::unique_ptr< undo_action_base > action_ptr_t
bool can_redo() const
True if there are actions that can be redone.
void add_recruit(const unit_const_ptr u, const map_location &loc, const map_location &from, int orig_village_owner, bool time_bonus)
Adds a recruit to the undo stack.
void undo()
Undoes the top action on the undo stack.
A config object defines a single node in a WML file, with access to child nodes.
std::shared_ptr< const unit > unit_const_ptr
Encapsulates the map of the game.
direction
Valid directions which can be moved in our hexagonal world.
Various functions implementing vision (through fog of war and shroud).