The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
undo_dismiss_action.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "undo_action.hpp"
4 #include "units/ptr.hpp"
5 #include "units/unit.hpp"
6 
7 namespace actions
8 {
9 namespace undo
10 {
11 
13 {
15 
16 
17  explicit dismiss_action(const unit_const_ptr dismissed)
18  : undo_action()
19  , dismissed_unit(new unit(*dismissed))
20  {
21  }
22  explicit dismiss_action(const config & cfg, const config & unit_cfg)
23  : undo_action(cfg)
24  , dismissed_unit(new unit(unit_cfg))
25  {
26  }
27  virtual const char* get_type() const { return "dismiss"; }
28  virtual ~dismiss_action() {};
29 
30  /// Writes this into the provided config.
31  virtual void write(config & cfg) const;
32 
33  /// Undoes this action.
34  virtual bool undo(int side);
35  /// Redoes this action.
36  virtual bool redo(int side);
37 };
38 
39 }
40 }
Definition: unit.hpp:95
dismiss_action(const unit_const_ptr dismissed)
virtual bool redo(int side)
Redoes this action.
dismiss_action(const config &cfg, const config &unit_cfg)
virtual const char * get_type() const
virtual void write(config &cfg) const
Writes this into the provided config.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
virtual bool undo(int side)
Undoes this action.
actions that are undoable (this does not include update_shroud and auto_shroud)
Definition: undo_action.hpp:47