actions that are undoable (this does not include update_shroud and auto_shroud) More...
#include <undo_action.hpp>
Public Types | |
typedef std::vector< undo_event > | event_vector |
actions wml (specified by wml) that should be executed when undoing this command. More... | |
Public Member Functions | |
undo_action () | |
Default constructor. More... | |
undo_action (const config &cfg) | |
virtual | ~undo_action () |
virtual void | write (config &cfg) const |
Writes this into the provided config. More... | |
virtual bool | undo (int side)=0 |
Undoes this action. More... | |
virtual bool | redo (int side)=0 |
Redoes this action. More... | |
void | execute_undo_umc_wml () |
void | execute_redo_umc_wml () |
![]() | |
undo_action_base () | |
Default constructor. More... | |
virtual | ~undo_action_base () |
virtual const char * | get_type () const =0 |
Static Public Member Functions | |
static void | read_event_vector (event_vector &vec, const config &cfg, const std::string &tag) |
static void | write_event_vector (const event_vector &vec, config &cfg, const std::string &tag) |
Public Attributes | |
config | replay_data |
the replay data to do this action, this is only !empty() when this action is on the redo stack we need this because we don't recalculate the redos like they would be in real game, but even undoable commands can have "dependent" (= user_input) commands, which we save here. More... | |
int | unit_id_diff |
the difference in the unit ids TODO: does it really make sense to allow undoing if the unit id counter has changed? More... | |
event_vector | umc_commands_undo |
event_vector | umc_commands_redo |
actions that are undoable (this does not include update_shroud and auto_shroud)
Definition at line 47 of file undo_action.hpp.
typedef std::vector<undo_event> actions::undo_action::event_vector |
actions wml (specified by wml) that should be executed when undoing this command.
Definition at line 74 of file undo_action.hpp.
actions::undo_action::undo_action | ( | ) |
Default constructor.
It is assumed that undo actions are contructed after the action is performed so that the unit id diff does not change after this contructor.
Definition at line 49 of file undo_action.cpp.
References synced_context::get_redo_commands(), synced_context::get_undo_commands(), redo(), umc_commands_redo, umc_commands_undo, and undo().
actions::undo_action::undo_action | ( | const config & | cfg | ) |
Definition at line 65 of file undo_action.cpp.
References read_event_vector(), umc_commands_redo, and umc_commands_undo.
|
inlinevirtual |
Definition at line 55 of file undo_action.hpp.
void actions::undo_action::execute_redo_umc_wml | ( | ) |
Definition at line 138 of file undo_action.cpp.
References resources::gamedata, resources::lua_kernel, and umc_commands_redo.
Referenced by actions::undo::dismiss_action::redo(), and actions::undo::move_action::redo().
void actions::undo_action::execute_undo_umc_wml | ( | ) |
Definition at line 130 of file undo_action.cpp.
References umc_commands_undo.
Referenced by actions::undo::dismiss_action::undo(), actions::undo::recruit_action::undo(), actions::undo::recall_action::undo(), and actions::undo::move_action::undo().
|
static |
Definition at line 157 of file undo_action.cpp.
References config::child_range().
Referenced by undo_action().
|
pure virtual |
Redoes this action.
Implemented in actions::undo_dummy_action, actions::undo::move_action, actions::undo::recall_action, actions::undo::recruit_action, and actions::undo::dismiss_action.
Referenced by undo_action().
|
pure virtual |
Undoes this action.
Implemented in actions::undo_dummy_action, actions::undo::move_action, actions::undo::recall_action, actions::undo::recruit_action, and actions::undo::dismiss_action.
Referenced by undo_action().
Writes this into the provided config.
Reimplemented from actions::undo_action_base.
Reimplemented in actions::undo::move_action, actions::undo::recall_action, actions::undo::recruit_action, and actions::undo::dismiss_action.
Definition at line 148 of file undo_action.cpp.
References config::add_child(), replay_data, umc_commands_redo, umc_commands_undo, unit_id_diff, actions::undo_action_base::write(), and write_event_vector().
Referenced by actions::undo::dismiss_action::write(), actions::undo::recruit_action::write(), actions::undo::recall_action::write(), and actions::undo::move_action::write().
|
static |
Definition at line 164 of file undo_action.cpp.
References config::add_child().
Referenced by write().
config actions::undo_action::replay_data |
the replay data to do this action, this is only !empty() when this action is on the redo stack we need this because we don't recalculate the redos like they would be in real game, but even undoable commands can have "dependent" (= user_input) commands, which we save here.
Definition at line 69 of file undo_action.hpp.
Referenced by actions::undo::dismiss_action::redo(), actions::undo::recruit_action::redo(), actions::undo::recall_action::redo(), actions::undo::move_action::redo(), and write().
event_vector actions::undo_action::umc_commands_redo |
Definition at line 76 of file undo_action.hpp.
Referenced by execute_redo_umc_wml(), undo_action(), and write().
event_vector actions::undo_action::umc_commands_undo |
Definition at line 75 of file undo_action.hpp.
Referenced by execute_undo_umc_wml(), undo_action(), and write().
int actions::undo_action::unit_id_diff |
the difference in the unit ids TODO: does it really make sense to allow undoing if the unit id counter has changed?
Definition at line 72 of file undo_action.hpp.
Referenced by write().