Avoid copy initialization of colors when possible
This commit is contained in:
parent
3c4e6f0f71
commit
61992429d0
10 changed files with 21 additions and 21 deletions
|
@ -1834,7 +1834,7 @@ void display::draw_minimap()
|
|||
const surface& screen(screen_.getSurface());
|
||||
clip_rect_setter clip_setter(screen, &area);
|
||||
|
||||
color_t back_color = {31,31,23,SDL_ALPHA_OPAQUE};
|
||||
color_t back_color {31,31,23,SDL_ALPHA_OPAQUE};
|
||||
draw_centered_on_background(minimap_, area, back_color, screen);
|
||||
|
||||
//update the minimap location for mouse and units functions
|
||||
|
|
|
@ -33,8 +33,8 @@ static lg::log_domain log_engine("engine");
|
|||
namespace {
|
||||
const int chat_message_border = 5;
|
||||
const int chat_message_x = 10;
|
||||
const color_t chat_message_color = {255,255,255,SDL_ALPHA_OPAQUE};
|
||||
const color_t chat_message_bg = {0,0,0,140};
|
||||
const color_t chat_message_color {255,255,255,SDL_ALPHA_OPAQUE};
|
||||
const color_t chat_message_bg {0,0,0,140};
|
||||
}
|
||||
|
||||
display_chat_manager::chat_message::chat_message(int speaker, int h)
|
||||
|
@ -113,7 +113,7 @@ void display_chat_manager::add_chat_message(const time_t& time, const std::strin
|
|||
ypos += std::max(font::get_floating_label_rect(m->handle).h,
|
||||
font::get_floating_label_rect(m->speaker_handle).h);
|
||||
}
|
||||
color_t speaker_color = {255,255,255,SDL_ALPHA_OPAQUE};
|
||||
color_t speaker_color {255,255,255,SDL_ALPHA_OPAQUE};
|
||||
if(side >= 1) {
|
||||
speaker_color = team::get_side_color_range(side).mid();
|
||||
}
|
||||
|
|
|
@ -429,7 +429,7 @@ SDL_Rect line_size(const std::string& line, int font_size, int style)
|
|||
|
||||
SDL_Rect res;
|
||||
|
||||
const color_t col = { 0, 0, 0, 0 };
|
||||
const color_t col { 0, 0, 0, 0 };
|
||||
text_surface s(line, font_size, col, style);
|
||||
|
||||
res.w = s.width();
|
||||
|
|
|
@ -145,7 +145,7 @@ void playmp_controller::play_human_turn()
|
|||
{
|
||||
font::floating_label flabel(_("Undoing moves not yet transmitted to the server."));
|
||||
|
||||
color_t color = {255,255,255,SDL_ALPHA_OPAQUE};
|
||||
color_t color {255,255,255,SDL_ALPHA_OPAQUE};
|
||||
flabel.set_color(color);
|
||||
SDL_Rect rect = gui_->map_area();
|
||||
flabel.set_position(rect.w/2, rect.h/2);
|
||||
|
|
|
@ -56,8 +56,8 @@ namespace {
|
|||
const int titlebox_font_size = 20; // pt?
|
||||
const int storybox_font_size = 17; // pt?
|
||||
|
||||
const color_t titlebox_font_color = {255, 255, 255};
|
||||
const color_t storybox_font_color = {221, 221, 255};
|
||||
const color_t titlebox_font_color {255, 255, 255};
|
||||
const color_t storybox_font_color {221, 221, 255};
|
||||
|
||||
// Hard-coded path to a suitable (tileable) pic for the storytxt box border.
|
||||
const std::string storybox_top_border_path = "dialogs/translucent54-border-top.png";
|
||||
|
|
|
@ -70,7 +70,7 @@ static void show_tooltip(const tooltip& tip)
|
|||
|
||||
clear_tooltip();
|
||||
|
||||
const color_t bgcolor = {0,0,0,160};
|
||||
const color_t bgcolor {0,0,0,160};
|
||||
SDL_Rect area = screen_area();
|
||||
|
||||
unsigned int border = 10;
|
||||
|
|
|
@ -1039,7 +1039,7 @@ const std::string& unit::flag_rgb() const
|
|||
static color_t hp_color_impl(int hitpoints, int max_hitpoints)
|
||||
{
|
||||
double unit_energy = 0.0;
|
||||
color_t energy_color = {0,0,0,0};
|
||||
color_t energy_color {0,0,0,0};
|
||||
|
||||
if(max_hitpoints > 0) {
|
||||
unit_energy = double(hitpoints)/double(max_hitpoints);
|
||||
|
@ -1086,14 +1086,14 @@ color_t unit::hp_color(int new_hitpoints) const
|
|||
|
||||
color_t unit::xp_color() const
|
||||
{
|
||||
const color_t near_advance_color = {255,255,255,0};
|
||||
const color_t mid_advance_color = {150,255,255,0};
|
||||
const color_t far_advance_color = {0,205,205,0};
|
||||
const color_t normal_color = {0,160,225,0};
|
||||
const color_t near_amla_color = {225,0,255,0};
|
||||
const color_t mid_amla_color = {169,30,255,0};
|
||||
const color_t far_amla_color = {139,0,237,0};
|
||||
const color_t amla_color = {170,0,255,0};
|
||||
const color_t near_advance_color {255,255,255,0};
|
||||
const color_t mid_advance_color {150,255,255,0};
|
||||
const color_t far_advance_color {0,205,205,0};
|
||||
const color_t normal_color {0,160,225,0};
|
||||
const color_t near_amla_color {225,0,255,0};
|
||||
const color_t mid_amla_color {169,30,255,0};
|
||||
const color_t far_amla_color {139,0,237,0};
|
||||
const color_t amla_color {170,0,255,0};
|
||||
|
||||
const bool near_advance = max_experience() - experience() <= game_config::kill_experience;
|
||||
const bool mid_advance = max_experience() - experience() <= game_config::kill_experience*2;
|
||||
|
|
|
@ -389,7 +389,7 @@ int CVideo::set_help_string(const std::string& str)
|
|||
{
|
||||
font::remove_floating_label(help_string_);
|
||||
|
||||
const color_t color = { 0, 0, 0, 0xbb };
|
||||
const color_t color { 0, 0, 0, 0xbb };
|
||||
|
||||
int size = font::SIZE_LARGE;
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ void recall::draw_hex(map_location const& hex)
|
|||
number_text << font::unicode_minus << cost;
|
||||
}
|
||||
size_t font_size = 16;
|
||||
color_t color; color.r = 255; color.g = 0; color.b = 0; //red
|
||||
color_t color {255, 0, 0}; //red
|
||||
resources::screen->draw_text_in_hex(hex, display::LAYER_ACTIONS_NUMBERING,
|
||||
number_text.str(), font_size, color, x_offset, y_offset);
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ void recruit::draw_hex(map_location const& hex)
|
|||
std::stringstream number_text;
|
||||
number_text << font::unicode_minus << cost_;
|
||||
size_t font_size = 16;
|
||||
color_t color; color.r = 255; color.g = 0; color.b = 0; //red
|
||||
color_t color {255, 0, 0}; //red
|
||||
resources::screen->draw_text_in_hex(hex, display::LAYER_ACTIONS_NUMBERING,
|
||||
number_text.str(), font_size, color, x_offset, y_offset);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue