Whiteboard/side_actions: highlight numbers whenever...
...their corresponding actions are highlighted.
This commit is contained in:
parent
5fec2fe97f
commit
f9990e113a
1 changed files with 25 additions and 1 deletions
|
@ -23,6 +23,7 @@
|
|||
#include "move.hpp"
|
||||
#include "recall.hpp"
|
||||
#include "recruit.hpp"
|
||||
#include "highlight_visitor.hpp"
|
||||
#include "validate_visitor.hpp"
|
||||
|
||||
#include "foreach.hpp"
|
||||
|
@ -72,6 +73,10 @@ void side_actions::set_team_index(size_t team_index)
|
|||
void side_actions::draw_hex(const map_location& hex)
|
||||
{
|
||||
std::vector<int> numbers_to_draw;
|
||||
int main_number = -1;
|
||||
std::set<int> secondary_numbers;
|
||||
boost::shared_ptr<highlight_visitor> highlighter =
|
||||
resources::whiteboard->get_highlighter().lock();
|
||||
|
||||
const_iterator it;
|
||||
for(it = begin(); it != end(); ++it)
|
||||
|
@ -84,6 +89,20 @@ void side_actions::draw_hex(const map_location& hex)
|
|||
//store number corresponding to iterator's position + 1
|
||||
size_t number = (it - begin()) + 1;
|
||||
numbers_to_draw.push_back(number);
|
||||
if (highlighter)
|
||||
{
|
||||
if (highlighter->get_main_highlight().lock() == *it) {
|
||||
main_number = number;
|
||||
}
|
||||
|
||||
foreach(weak_action_ptr action, highlighter->get_secondary_highlights())
|
||||
{
|
||||
if (action.lock() == *it)
|
||||
{
|
||||
secondary_numbers.insert(number);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,7 +118,12 @@ void side_actions::draw_hex(const map_location& hex)
|
|||
{
|
||||
std::stringstream number_text;
|
||||
number_text << number;
|
||||
const size_t font_size = 15;
|
||||
size_t font_size = 15;
|
||||
if (number == main_number) font_size = 19;
|
||||
foreach(int secondary_number, secondary_numbers)
|
||||
{
|
||||
if (number == secondary_number) font_size = 17;
|
||||
}
|
||||
SDL_Color color; color.r = 255; color.g = 255; color.b = 0; //yellow
|
||||
const double x_in_hex = x_origin + x_offset;
|
||||
const double y_in_hex = y_origin + y_offset;
|
||||
|
|
Loading…
Add table
Reference in a new issue