Whiteboard: show recruit cost on planned recruits and recalls.

New experimental feature.
This commit is contained in:
Gabriel Morin 2010-09-01 03:57:53 +00:00
parent 00d0961466
commit 4d1ed35060
5 changed files with 34 additions and 2 deletions

View file

@ -50,6 +50,8 @@ Version 1.9.0+svn:
* Added events: turn end and turn X end_text
* Added events: side turn end, side X turn end, side turn X end,
and side X turn Y end
* Whiteboard
* Added cost display for planned recruits and recalls
* Miscellaneous and bug fixes:
* Removed: statistics upload code.
* Changed: compiler mode set to c++98

View file

@ -130,6 +130,20 @@ void recall::remove_temp_modifier(unit_map& unit_map)
resources::screen->invalidate_game_status();
}
void recall::draw_hex(map_location const& hex)
{
if (hex == recall_hex_)
{
const double x_offset = 0.5;
const double y_offset = 0.7;
//position 0,0 in the hex is the upper left corner
std::stringstream number_text;
number_text << "-" << resources::teams->at(team_index()).recall_cost();
size_t font_size = 16;
SDL_Color color; color.r = 255; color.g = 0; color.b = 0; //red
resources::screen->draw_text_in_hex(hex, display::LAYER_ACTIONS_NUMBERING,
number_text.str(), font_size, color, x_offset, y_offset);
}
}
} //end namespace wb

View file

@ -52,7 +52,7 @@ public:
virtual void remove_temp_modifier(unit_map& unit_map);
/** Gets called by display when drawing a hex, to allow actions to draw to the screen. */
virtual void draw_hex(const map_location&) { }
virtual void draw_hex(const map_location& hex);
/**
* Indicates whether this hex is the preferred hex to draw the numbering for this action.

View file

@ -120,6 +120,22 @@ void recruit::remove_temp_modifier(unit_map& unit_map)
resources::screen->invalidate_game_status();
}
void recruit::draw_hex(map_location const& hex)
{
if (hex == recruit_hex_)
{
const double x_offset = 0.5;
const double y_offset = 0.7;
//position 0,0 in the hex is the upper left corner
std::stringstream number_text;
number_text << "-" << temp_unit_->type()->cost();
size_t font_size = 16;
SDL_Color color; color.r = 255; color.g = 0; color.b = 0; //red
resources::screen->draw_text_in_hex(hex, display::LAYER_ACTIONS_NUMBERING,
number_text.str(), font_size, color, x_offset, y_offset);
}
}
unit* recruit::create_corresponding_unit()
{
unit_type const* type = unit_types.find(unit_name_);

View file

@ -56,7 +56,7 @@ public:
virtual void remove_temp_modifier(unit_map& unit_map);
/** Gets called by display when drawing a hex, to allow actions to draw to the screen. */
virtual void draw_hex(const map_location&){ }
virtual void draw_hex(map_location const& hex);
/**
* Indicates whether this hex is the preferred hex to draw the numbering for this action.