The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
undo_recruit_action.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "undo_action.hpp"
5 #include "units/ptr.hpp"
6 #include "units/unit.hpp"
7 
8 namespace actions
9 {
10 namespace undo
11 {
12 
14 {
15  const unit_type & u_type;
17 
18 
19  recruit_action(const unit_const_ptr recruited, const map_location& loc,
20  const map_location& from, int orig_village_owner, bool time_bonus)
21  : undo_action()
22  , shroud_clearing_action(recruited, loc, orig_village_owner, time_bonus)
23  , u_type(recruited->type())
24  , recruit_from(from)
25  {
26  }
27  recruit_action(const config & cfg, const unit_type & type, const map_location& from)
28  : undo_action(cfg)
30  , u_type(type)
31  , recruit_from(from)
32  {}
33  virtual const char* get_type() const { return "recruit"; }
34  virtual ~recruit_action() {}
35 
36  /// Writes this into the provided config.
37  virtual void write(config & cfg) const;
38 
39  /// Undoes this action.
40  virtual bool undo(int side);
41  /// Redoes this action.
42  virtual bool redo(int side);
43 };
44 
45 }
46 }
base class for classes that clear srhoud (move/recruit/recall)
virtual bool undo(int side)
Undoes this action.
virtual const char * get_type() const
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1221
recruit_action(const unit_const_ptr recruited, const map_location &loc, const map_location &from, int orig_village_owner, bool time_bonus)
virtual void write(config &cfg) const
Writes this into the provided config.
Encapsulates the map of the game.
Definition: location.hpp:38
virtual bool redo(int side)
Redoes this action.
recruit_action(const config &cfg, const unit_type &type, const map_location &from)
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
actions that are undoable (this does not include update_shroud and auto_shroud)
Definition: undo_action.hpp:47