Team: cleaned up some redundancy in color getters
* The one case of get_side_color_range().mid() was converted to get_side_color();
These are equivalent
* get_side_rgb() was removed. Before color_range was refactored to use color_t
(f2ab245e8d
), the only difference between it and
get_side_color() was that the former used to return uint32_t (the color they returned
was the same.
* get_side_rgb_min() and get_side_rgb_max() were renamed to get_side_color_min() and
get_side_color_max(), respectively. Both were unused in any case.
* get_side_highlight_pango() was renamed get_side_color_pango() and now takes a 1-indexed
side like the other color functions instead of taking 0-indexed and adding 1.
This commit is contained in:
parent
594877aaaa
commit
b82516ffe6
7 changed files with 20 additions and 11 deletions
|
@ -928,7 +928,7 @@ DEFINE_FAI_FUNCTION(debug_label, 2, 2)
|
|||
display* gui = display::get_singleton();
|
||||
std::string team_name;
|
||||
|
||||
color_t color = team::get_side_rgb(ai_.get_side());
|
||||
color_t color = team::get_side_color(ai_.get_side());
|
||||
|
||||
const terrain_label *res;
|
||||
res = gui->labels().set_label(location, text, ai_.get_side() - 1, team_name, color);
|
||||
|
|
|
@ -107,7 +107,7 @@ void display_chat_manager::add_chat_message(const time_t& time, const std::strin
|
|||
}
|
||||
color_t speaker_color {255,255,255,SDL_ALPHA_OPAQUE};
|
||||
if(side >= 1) {
|
||||
speaker_color = team::get_side_color_range(side).mid();
|
||||
speaker_color = team::get_side_color(side);
|
||||
}
|
||||
|
||||
color_t message_color = chat_message_color;
|
||||
|
|
|
@ -120,7 +120,7 @@ void game_stats::pre_show(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
leader_name = "<span color='" + team::get_side_highlight_pango(team.side() - 1) + "'>" + leader_name + "</span>";
|
||||
leader_name = "<span color='" + team::get_side_color_pango(team.side()) + "'>" + leader_name + "</span>";
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -790,7 +790,7 @@ void menu_handler::label_terrain(mouse_handler& mousehandler, bool team_only)
|
|||
if(team_only) {
|
||||
team_name = gui_->labels().team_name();
|
||||
} else {
|
||||
color = team::get_side_rgb(gui_->viewing_side());
|
||||
color = team::get_side_color(gui_->viewing_side());
|
||||
}
|
||||
const terrain_label* res = gui_->labels().set_label(loc, label, gui_->viewing_team(), team_name, color);
|
||||
if(res) {
|
||||
|
|
|
@ -157,7 +157,7 @@ chat_msg::chat_msg(const config &cfg)
|
|||
if (side==0) {
|
||||
color_ = "white";//observers
|
||||
} else {
|
||||
color_ = team::get_side_highlight_pango(side-1);
|
||||
color_ = team::get_side_color_pango(side);
|
||||
}
|
||||
time_ = get_time(cfg);
|
||||
/*
|
||||
|
|
14
src/team.cpp
14
src/team.cpp
|
@ -930,6 +930,16 @@ color_t team::get_side_color(int side)
|
|||
return get_side_color_range(side).mid();
|
||||
}
|
||||
|
||||
color_t team::get_side_color_min(int side)
|
||||
{
|
||||
return get_side_color_range(side).min();
|
||||
}
|
||||
|
||||
color_t team::get_side_color_max(int side)
|
||||
{
|
||||
return get_side_color_range(side).max();
|
||||
}
|
||||
|
||||
color_t team::get_minimap_color(int side)
|
||||
{
|
||||
// Note: use mid() instead of rep() unless
|
||||
|
@ -984,9 +994,9 @@ std::string team::get_side_color_id_from_config(const config& cfg)
|
|||
return c.str();
|
||||
}
|
||||
|
||||
std::string team::get_side_highlight_pango(int side)
|
||||
std::string team::get_side_color_pango(int side)
|
||||
{
|
||||
return get_side_color_range(side + 1).mid().to_hex_string();
|
||||
return get_side_color(side).to_hex_string();
|
||||
}
|
||||
|
||||
void team::log_recruitable() const
|
||||
|
|
|
@ -364,15 +364,14 @@ public:
|
|||
//function which, when given a 1-based side will return the color used by that side.
|
||||
static const color_range get_side_color_range(int side);
|
||||
|
||||
static color_t get_side_rgb(int side) { return(get_side_color_range(side).mid()); }
|
||||
static color_t get_side_rgb_max(int side) { return(get_side_color_range(side).max()); }
|
||||
static color_t get_side_rgb_min(int side) { return(get_side_color_range(side).min()); }
|
||||
static color_t get_side_color(int side);
|
||||
static color_t get_side_color_min(int side);
|
||||
static color_t get_side_color_max(int side);
|
||||
static color_t get_minimap_color(int side);
|
||||
|
||||
static std::string get_side_color_id(unsigned side);
|
||||
static std::string get_side_color_id_from_config(const config& cfg);
|
||||
static std::string get_side_highlight_pango(int side);
|
||||
static std::string get_side_color_pango(int side);
|
||||
|
||||
void log_recruitable() const;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue