use color_range.mid() instead of rep()

unless high contrast is needed over a map or minimap
This commit is contained in:
Patrick Parker 2007-07-19 02:38:30 +00:00
parent eb3cd360c7
commit b85eb7a68a
5 changed files with 7 additions and 5 deletions

View file

@ -44,6 +44,7 @@ public:
Uint32 mid() const{return(mid_);};
Uint32 max() const{return(max_);};
Uint32 min() const{return(min_);};
//note: use mid() instead of rep() unless high contrast is needed over a map or minimap!
Uint32 rep() const{return(rep_);};
bool operator<(const color_range& b) const
{

View file

@ -614,7 +614,7 @@ void game_display::draw_minimap_units(int x, int y, int w, int h)
}
const int side = u->second.side();
const SDL_Color col = team::get_side_colour(side);
const SDL_Color col = team::get_minimap_colour(side);
const Uint32 mapped_col = SDL_MapRGB(video().getSurface()->format,col.r,col.g,col.b);
SDL_Rect rect = { x + (u->first.x * w) / map_.x(),
y + (u->first.y * h + (is_odd(u->first.x) ? h / 2 : 0)) / map_.y(),

View file

@ -1424,7 +1424,7 @@ namespace events{
team_name = gui_->labels().team_name();
}
else {
colour = team::get_side_colour(gui_->viewing_team() + 1);
colour = team::get_minimap_colour(gui_->viewing_team() + 1);
}
const terrain_label *res = gui_->labels().set_label(mousehandler.get_last_hex(), d.textbox_text(), team_name, colour);
if (res)

View file

@ -762,8 +762,9 @@ const color_range team::get_side_color_range(int side){
return(color_range(0x00FF0000,0x00FFFFFF,0x00000000,0x00FF0000));
}
const SDL_Color team::get_side_colour(int side)
const SDL_Color team::get_minimap_colour(int side)
{
//note: use mid() instead of rep() unless high contrast is needed over a map or minimap!
return int_to_color(get_side_color_range(side).rep());
}
@ -784,7 +785,7 @@ std::string team::get_side_colour_index(int side)
std::string team::get_side_highlight(int side)
{
return rgb2highlight(get_side_color_range(side+1).rep());
return rgb2highlight(get_side_color_range(side+1).mid());
}
void team::log_recruitable(){

View file

@ -247,7 +247,7 @@ public:
static const Uint32 get_side_rgb(int side) { return(get_side_color_range(side).mid()); }
static const Uint32 get_side_rgb_max(int side) { return(get_side_color_range(side).max()); }
static const Uint32 get_side_rgb_min(int side) { return(get_side_color_range(side).min()); }
static const SDL_Color get_side_colour(int side);
static const SDL_Color get_minimap_colour(int side);
static std::string get_side_colour_index(int side);
static std::string get_side_highlight(int side);