The Battle for Wesnoth  1.19.5+dev
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
actions::undo_action Struct Referenceabstract

actions that are undoable (this does not include update_shroud and auto_shroud) More...

#include <undo_action.hpp>

Inheritance diagram for actions::undo_action:

Public Types

typedef std::vector< undo_eventevent_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...
 
void execute_undo_umc_wml ()
 
- Public Member Functions inherited from actions::undo_action_base
 undo_action_base (const undo_action_base &)=delete
 
undo_action_baseoperator= (const undo_action_base &)=delete
 
 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

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
 

Detailed Description

actions that are undoable (this does not include update_shroud and auto_shroud)

Definition at line 65 of file undo_action.hpp.

Member Typedef Documentation

◆ event_vector

actions wml (specified by wml) that should be executed when undoing this command.

Definition at line 91 of file undo_action.hpp.

Constructor & Destructor Documentation

◆ undo_action() [1/2]

actions::undo_action::undo_action ( )

Default constructor.

It is assumed that undo actions are constructed after the action is performed so that the unit id diff does not change after this constructor

Definition at line 87 of file undo_action.cpp.

References synced_context::get_undo_commands(), p, umc_commands_undo, and undo().

◆ undo_action() [2/2]

actions::undo_action::undo_action ( const config cfg)

Definition at line 103 of file undo_action.cpp.

References read_event_vector(), and umc_commands_undo.

◆ ~undo_action()

virtual actions::undo_action::~undo_action ( )
inlinevirtual

Definition at line 75 of file undo_action.hpp.

Member Function Documentation

◆ execute_undo_umc_wml()

void actions::undo_action::execute_undo_umc_wml ( )

◆ read_event_vector()

void actions::undo_action::read_event_vector ( event_vector vec,
const config cfg,
const std::string &  tag 
)
static

Definition at line 171 of file undo_action.cpp.

References c, config::child_range(), and markup::tag().

Referenced by undo_action().

◆ undo()

virtual bool actions::undo_action::undo ( int  side)
pure virtual

Undoes this action.

Returns
true on success; false on an error.

Implemented in actions::undo_dummy_action, actions::undo::recruit_action, actions::undo::recall_action, actions::undo::move_action, and actions::undo::dismiss_action.

Referenced by undo_action().

◆ write()

void actions::undo_action::write ( config cfg) const
virtual

◆ write_event_vector()

void actions::undo_action::write_event_vector ( const event_vector vec,
config cfg,
const std::string &  tag 
)
static

Definition at line 178 of file undo_action.cpp.

References config::add_child(), and markup::tag().

Referenced by write().

Member Data Documentation

◆ umc_commands_undo

event_vector actions::undo_action::umc_commands_undo

Definition at line 92 of file undo_action.hpp.

Referenced by execute_undo_umc_wml(), undo_action(), and write().

◆ unit_id_diff

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 89 of file undo_action.hpp.

Referenced by write().


The documentation for this struct was generated from the following files: