implemented feature to allow coloured hexes to be drawn around units...
...to show which side they're on
This commit is contained in:
parent
e010c95315
commit
eff4ceca35
4 changed files with 16 additions and 3 deletions
|
@ -1063,7 +1063,13 @@ void display::draw_tile(int x, int y, SDL_Surface* unit_image,
|
|||
|
||||
SDL_Surface* const dst = screen_.getSurface();
|
||||
|
||||
const Pixel grid_colour = SDL_MapRGB(dst->format,0,0,0);
|
||||
Pixel grid_colour = SDL_MapRGB(dst->format,0,0,0);
|
||||
|
||||
const bool show_unit_colour = preferences::show_side_colours() && it != units_.end();
|
||||
if(show_unit_colour) {
|
||||
const SDL_Color& colour = font::get_side_colour(it->second.side());
|
||||
grid_colour = SDL_MapRGB(dst->format,colour.r,colour.g,colour.b);
|
||||
}
|
||||
|
||||
int j;
|
||||
for(j = ypos; j != yend; ++j) {
|
||||
|
@ -1158,7 +1164,7 @@ void display::draw_tile(int x, int y, SDL_Surface* unit_image,
|
|||
std::fill(dst,dst+extra,beg[-1]);
|
||||
}
|
||||
|
||||
if(grid_ && startsrc < endsrc) {
|
||||
if((grid_ || show_unit_colour) && startsrc < endsrc) {
|
||||
*startdst = grid_colour;
|
||||
*(startdst+len-1) = grid_colour;
|
||||
if(j == ypos || j == yend-1) {
|
||||
|
|
|
@ -116,7 +116,7 @@ const SDL_Color& get_side_colour(int side)
|
|||
{
|
||||
side -= 1;
|
||||
|
||||
static const SDL_Color sides[] = { {0xAA,0x00,0x00,0},
|
||||
static const SDL_Color sides[] = { {0xFF,0x00,0x00,0},
|
||||
{0x00,0x00,0xFF,0},
|
||||
{0x00,0xFF,0x00,0},
|
||||
{0xFF,0xFF,0x00,0},
|
||||
|
|
|
@ -328,6 +328,11 @@ bool show_ai_moves()
|
|||
return prefs["show_ai_moves"] != "no";
|
||||
}
|
||||
|
||||
bool show_side_colours()
|
||||
{
|
||||
return prefs["show_side_colours"] == "yes";
|
||||
}
|
||||
|
||||
std::string client_type()
|
||||
{
|
||||
if(prefs["client_type"] == "ai")
|
||||
|
|
|
@ -77,6 +77,8 @@ namespace preferences {
|
|||
|
||||
bool show_ai_moves();
|
||||
|
||||
bool show_side_colours();
|
||||
|
||||
std::string client_type();
|
||||
|
||||
void show_preferences_dialog(display& disp);
|
||||
|
|
Loading…
Add table
Reference in a new issue