55 const std::vector<map_location>::const_iterator & begin,
56 const std::vector<map_location>::const_iterator & end,
66 template<
class T,
class... Args>
69 add(std::make_unique<T>(std::forward<Args>(args)...));
88 void read(
const config & cfg,
int current_side);
117 void add(std::unique_ptr<undo_action>&& action)
Class to store the actions that a player can undo and redo.
void new_side_turn(int side)
Performs some initializations and error checks when starting a new side-turn.
bool can_undo() const
True if there are actions that can be undone.
void add_dismissal(const unit_const_ptr &u)
Adds a dismissal to the undo stack.
undo_list(const undo_list &)=delete
void add_recall(const unit_const_ptr &u, const map_location &loc, const map_location &from)
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 add(std::unique_ptr< undo_action > &&action)
Adds an undo step to the current action.
void write(config &cfg) const
Write the undo_list into the provided config.
void add_custom(Args &&... args)
std::vector< action_ptr_t > action_list
bool commit_vision()
Updates fog/shroud based on the undo stack, then updates stack as needed.
void read(const config &cfg, int current_side)
Read the undo_list from the provided config.
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, const map_location::direction dir=map_location::direction::indeterminate)
Adds a move to the undo stack.
void redo()
Redoes the top action on the redo stack.
void cleanup_action()
called after a user action, removes empty actions
bool apply_shroud_changes() const
Applies the pending fog/shroud changes from the undo stack.
std::vector< std::unique_ptr< config > > redos_list
undo_action_container * get_current()
void clear()
Clears the stack of undoable (and redoable) actions.
int side_
Tracks the current side.
void init_action()
called before a user action, starts collecting undo steps for the new action.
void add_auto_shroud(bool turned_on)
Adds an auto-shroud toggle to the undo stack.
void add_recruit(const unit_const_ptr &u, const map_location &loc, const map_location &from)
Adds a recruit to the undo stack.
std::unique_ptr< undo_action_container > action_ptr_t
void finish_action(bool can_undo)
called after a user action, pushes the collected undo steps on the undo stack.
bool player_acted() const
Returns true if the player has performed any actions this turn.
bool can_redo() const
True if there are actions that can be redone.
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).