42 return recruit->print(s);
47 return recruit->print(s);
58 unit_name_(unit_name),
59 recruit_hex_(recruit_hex),
60 temp_unit_(create_corresponding_unit()),
69 , unit_name_(cfg[
"unit_name_"])
70 , recruit_hex_(cfg.child(
"recruit_hex_")[
"x"],cfg.child(
"recruit_hex_")[
"y"])
118 success = complete =
result;
127 <<
"] at position " <<
temp_unit_->get_location() <<
".\n";
151 const double x_offset = 0.5;
152 const double y_offset = 0.7;
154 std::stringstream number_text;
157 SDL_Color
color; color.r = 255; color.g = 0; color.b = 0;
175 bool real_unit =
false;
177 result->set_movement(0,
true);
178 result->set_attacks(0);
190 const std::set<std::string>& recruits = (*resources::teams)[
team_index()].recruits();
191 if(recruits.find(
unit_name_) == recruits.end()) {
210 final_cfg[
"type"] =
"recruit";
217 final_cfg.
add_child(
"recruit_hex_",loc_cfg);
play_controller * controller
void reset()
Reset the internal unit pointer, and deregister from the manager. This fake_unit_ptr is now dissassoc...
void invalidate_game_status()
Function to invalidate the game status displayed on the sidebar.
bool invalidate(const map_location &loc)
Function to invalidate a specific tile for redrawing.
virtual config to_config() const
Constructs and returns a config object representing this object.
GLuint GLuint GLsizei GLenum type
void place_on_fake_unit_manager(fake_unit_manager *d)
Place this on manager's fake_units_ dequeue.
boost::shared_ptr< recruit > shared_from_this()
unit * find_recruiter(size_t team_index, map_location const &hex)
map_location const get_recruit_hex() const
virtual void visit(move_ptr move)=0
unit_type_data unit_types
virtual void execute(bool &success, bool &complete)
Output parameters: success: Whether or not to continue an execute-all after this execution complete: ...
virtual void apply_temp_modifier(unit_map &unit_map)
Applies temporarily the result of this action to the specified unit map.
void draw_text_in_hex(const map_location &loc, const tdrawing_layer layer, const std::string &text, size_t font_size, SDL_Color color, double x_in_hex=0.5, double y_in_hex=0.5)
Draw text on a hex.
virtual void do_hide()
Called by the non-virtual hide() and show(), respectively.
static config unit_name(const unit *u)
virtual void draw_hex(map_location const &hex)
Gets called by display when drawing a hex, to allow actions to draw to the screen.
const std::string unicode_minus
bool valid()
Returns whether this action is valid or not.
size_t team_index() const
Returns the index of the team that owns this action.
std::vector< team > * teams
std::pair< unit_iterator, bool > insert(unit_ptr p)
Adds the unit to the map.
unit_ptr create_corresponding_unit()
config & add_child(const std::string &key)
fake_unit_manager * fake_units
virtual void accept(visitor &v)
bool do_recruit(const std::string &name, int side_num, const map_location &last_hex)
Encapsulates the map of the game.
Move numbering for the whiteboard.
virtual void redraw()
Redrawing function, called each time the action situation might have changed.
virtual std::ostream & print(std::ostream &s) const
map_location recruit_hex_
recruit(size_t team_index, bool hidden, const std::string &unit_name, const map_location &recruit_hex)
bool find(E event, F functor)
Tests whether an event handler is available.
events::menu_handler & get_menu_handler()
virtual config to_config() const
Constructs and returns a config object representing this object.
unit_ptr extract(const map_location &loc)
Extracts a unit from the map.
Container associating units to locations.
std::ostream & operator<<(std::ostream &s, action_ptr action)
const unit_type * find(const std::string &key, unit_type::BUILD_STATUS status=unit_type::FULL) const
Finds a unit_type by its id() and makes sure it is built to the specified level.
visitor is an abstract interface : action.accept(visitor) calls visitor.visit(action) ...
Abstract base class for all the whiteboard planned actions.
A config object defines a single node in a WML file, with access to child nodes.
virtual void remove_temp_modifier(unit_map &unit_map)
Removes the result of this action from the specified unit map.
GLsizei const GLcharARB ** string
virtual error check_validity() const
Check the validity of the action.
Abstract base class for all the visitors (cf GoF Visitor Design Pattern) the whiteboard uses...