20 #ifndef ACTIONS_UNDO_H_INCLUDED
21 #define ACTIONS_UNDO_H_INCLUDED
28 #include <boost/noncopyable.hpp>
29 #include <boost/ptr_container/ptr_vector.hpp>
30 #include <boost/optional.hpp>
60 const std::vector<map_location>::const_iterator & begin,
61 const std::vector<map_location>::const_iterator &
end,
62 int start_moves,
int timebonus=0,
int village_owner=-1,
66 const map_location& from,
int orig_village_owner,
bool time_bonus);
69 const map_location& from,
int orig_village_owner,
bool time_bonus);
void clear()
Clears the stack of undoable (and redoable) actions.
bool committed_actions_
Tracks if actions have been cleared from the stack since the turn began.
Various functions implementing vision (through fog of war and shroud).
void undo()
Undoes the top action on the undo stack.
void add(undo_action_base *action)
Adds an action to the undo stack.
int side_
Tracks the current side.
void new_side_turn(int side)
Performs some initializations and error checks when starting a new side-turn.
bool apply_shroud_changes() const
Applies the pending fog/shroud changes from the undo stack.
bool can_undo() const
True if there are actions that can be undone.
boost::ptr_vector< undo_action_base > action_list
Records information to be able to undo an action.
void read(const config &cfg)
Read the undo_list from the provided config.
bool can_redo() const
True if there are actions that can be redone.
void commit_vision()
Updates fog/shroud based on the undo stack, then updates stack as needed.
Encapsulates the map of the game.
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 add_dismissal(const unit_const_ptr u)
Adds a dismissal to the undo stack.
static undo_action_base * create_action(const config &cfg)
Creates an undo_action based on a config.
void redo()
Redoes the top action on the redo stack.
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.
boost::ptr_vector< undo_action > redos_list
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::NDIRECTIONS)
Adds a move to the undo stack.
DIRECTION
Valid directions which can be moved in our hexagonal world.
void add_update_shroud()
Adds a shroud update to the undo stack.
Class to store the actions that a player can undo and redo.
bool player_acted() const
Returns true if the player has performed any actions this turn.
void add_dummy()
Adds an auto-shroud toggle to the undo stack.
void add_auto_shroud(bool turned_on)
Adds an auto-shroud toggle to the undo stack.
A config object defines a single node in a WML file, with access to child nodes.
undo_list(const config &cfg)
Constructor.
void write(config &cfg) const
Write the undo_list into the provided config.