Replace all uses of 'colour' by 'color' in code.

This commit is contained in:
Ali El Gariani 2010-06-03 01:47:06 +00:00
parent 0684320813
commit 51ab72860e
70 changed files with 428 additions and 428 deletions

View file

@ -2523,21 +2523,21 @@ size_t move_unit(move_unit_spectator *move_spectator,
symbols["friends"] = lexical_cast<std::string>(nfriends);
symbols["enemies"] = lexical_cast<std::string>(nenemies);
std::string message;
SDL_Color msg_colour;
SDL_Color msg_color;
if(nfriends == 0 || nenemies == 0) {
if(nfriends > 0) {
message = vngettext("Friendly unit sighted", "$friends friendly units sighted", nfriends, symbols);
msg_colour = font::GOOD_COLOR;
msg_color = font::GOOD_COLOR;
} else if(nenemies > 0) {
message = vngettext("Enemy unit sighted!", "$enemies enemy units sighted!", nenemies, symbols);
msg_colour = font::BAD_COLOR;
msg_color = font::BAD_COLOR;
}
}
else {
symbols["friendphrase"] = vngettext("Part of 'Units sighted! (...)' sentence^1 friendly", "$friends friendly", nfriends, symbols);
symbols["enemyphrase"] = vngettext("Part of 'Units sighted! (...)' sentence^1 enemy", "$enemies enemy", nenemies, symbols);
message = vgettext("Units sighted! ($friendphrase, $enemyphrase)", symbols);
msg_colour = font::NORMAL_COLOR;
msg_color = font::NORMAL_COLOR;
}
if(steps.size() < route.size()) {
@ -2549,7 +2549,7 @@ size_t move_unit(move_unit_spectator *move_spectator,
}
}
disp.announce(message, msg_colour);
disp.announce(message, msg_color);
redraw = true;
}

View file

@ -1248,10 +1248,10 @@ private:
game_display* gui = game_display::get_singleton();
std::string team_name;
SDL_Color colour = int_to_color(team::get_side_rgb(ai_.get_side()));
SDL_Color color = int_to_color(team::get_side_rgb(ai_.get_side()));
const terrain_label *res;
res = gui->labels().set_label(location, text, team_name, colour);
res = gui->labels().set_label(location, text, team_name, color);
if (res)
recorder.add_label(res);
}

View file

@ -26,9 +26,9 @@
#include <iostream>
static bool use_colour_cursors()
static bool use_color_cursors()
{
return game_config::editor == false && preferences::use_colour_cursors();
return game_config::editor == false && preferences::use_color_cursors();
}
static SDL_Cursor* create_cursor(surface surf)
@ -89,7 +89,7 @@ const std::string bw_images[cursor::NUM_CURSORS] = { "normal.png", "wait-alt.png
const std::string bw_images[cursor::NUM_CURSORS] = { "normal.png", "wait.png", "move.png", "attack.png", "select.png", "move_drag.png", "attack_drag.png", "no_cursor.png"};
#endif
const std::string colour_images[cursor::NUM_CURSORS] = { "normal.png", "wait.png", "move.png", "attack.png", "select.png", "move_drag.png", "attack_drag.png", ""};
const std::string color_images[cursor::NUM_CURSORS] = { "normal.png", "wait.png", "move.png", "attack.png", "select.png", "move_drag.png", "attack_drag.png", ""};
// Position of the hotspot of the cursor, from the normal topleft
const int shift_x[cursor::NUM_CURSORS] = {0, 0, 0, 0, 0, 2, 3, 0};
@ -100,7 +100,7 @@ cursor::CURSOR_TYPE current_cursor = cursor::NORMAL;
int cursor_x = -1, cursor_y = -1;
surface cursor_buf = NULL;
bool have_focus = true;
bool colour_ready = false;
bool color_ready = false;
}
@ -155,7 +155,7 @@ void set(CURSOR_TYPE type)
current_cursor = NORMAL;
}
const CURSOR_TYPE new_cursor = use_colour_cursors() && colour_ready ? cursor::NO_CURSOR : current_cursor;
const CURSOR_TYPE new_cursor = use_color_cursors() && color_ready ? cursor::NO_CURSOR : current_cursor;
SDL_Cursor * cursor_image = get_cursor(new_cursor);
@ -195,7 +195,7 @@ void set_focus(bool focus)
{
have_focus = focus;
if (focus==false) {
colour_ready = false;
color_ready = false;
set();
}
}
@ -212,7 +212,7 @@ setter::~setter()
void draw(surface screen)
{
if(use_colour_cursors() == false) {
if(use_color_cursors() == false) {
return;
}
@ -225,20 +225,20 @@ void draw(surface screen)
return;
}
if (!colour_ready) {
if (!color_ready) {
// Display start to draw cursor
// so it can now display colour cursor
colour_ready = true;
// so it can now display color cursor
color_ready = true;
// Reset the cursor to be sure that we hide the b&w
set();
}
/** @todo FIXME: don't parse the file path every time */
const surface surf(image::get_image("cursors/" + colour_images[current_cursor]));
const surface surf(image::get_image("cursors/" + color_images[current_cursor]));
if(surf == NULL) {
// Fall back to b&w cursors
std::cerr << "could not load colour cursors. Falling back to hardware cursors\n";
preferences::set_colour_cursors(false);
std::cerr << "could not load color cursors. Falling back to hardware cursors\n";
preferences::set_color_cursors(false);
return;
}
@ -274,7 +274,7 @@ void draw(surface screen)
void undraw(surface screen)
{
if(use_colour_cursors() == false) {
if(use_color_cursors() == false) {
return;
}

View file

@ -178,7 +178,7 @@ bool animate_unit_advancement(const map_location &loc, size_t choice)
}
// When the unit advances, it fades to white, and then switches
// to the new unit, then fades back to the normal colour
// to the new unit, then fades back to the normal color
if (!resources::screen->video().update_locked()) {
unit_animator animator;
@ -921,7 +921,7 @@ const unit_types_preview_pane::details unit_types_preview_pane::get_details() co
//FIXME: There should be a better way to deal with this
unit_types.find(t->id(), unit_type::WITHOUT_ANIMATIONS);
std::string mod = "~RC(" + t->flag_rgb() + ">" + team::get_side_colour_index(side_) + ")";
std::string mod = "~RC(" + t->flag_rgb() + ">" + team::get_side_color_index(side_) + ")";
det.image = image::get_image(t->image()+mod);
det.name = "";

View file

@ -691,11 +691,11 @@ std::vector<surface> display::get_terrain_images(const map_location &loc,
const image::locator& image = preferences::animate_map() ?
it->get_current_frame() : it->get_first_frame();
// We prevent ToD colouring and brightening of off-map tiles,
// We prevent ToD coloring and brightening of off-map tiles,
// except if we are not in_game and so in the editor.
// We need to test for the tile to be rendered and
// not the location, since the transitions are rendered
// over the offmap-terrain and these need a ToD colouring.
// over the offmap-terrain and these need a ToD coloring.
const bool off_map = (image.get_filename() == off_map_name);
const surface surface(image::get_image(image,
off_map ? image::UNMASKED : image_type));
@ -858,7 +858,7 @@ void display::update_display()
font::floating_label flabel(stream.str());
flabel.set_font_size(12);
flabel.set_colour(benchmark ? font::BAD_COLOR : font::NORMAL_COLOR);
flabel.set_color(benchmark ? font::BAD_COLOR : font::NORMAL_COLOR);
flabel.set_position(10, 100);
flabel.set_alignement(font::LEFT_ALIGN);
@ -1112,7 +1112,7 @@ void display::set_diagnostic(const std::string& msg)
if(msg != "") {
font::floating_label flabel(msg);
flabel.set_font_size(font::SIZE_PLUS);
flabel.set_colour(font::YELLOW_COLOR);
flabel.set_color(font::YELLOW_COLOR);
flabel.set_position(300, 50);
flabel.set_clip_rect(map_outside_area());
@ -1242,11 +1242,11 @@ void display::enable_menu(const std::string& item, bool enable)
}
}
void display::announce(const std::string& message, const SDL_Color& colour)
void display::announce(const std::string& message, const SDL_Color& color)
{
font::floating_label flabel(message);
flabel.set_font_size(font::SIZE_XLARGE);
flabel.set_colour(colour);
flabel.set_color(color);
flabel.set_position(map_outside_area().w/2, map_outside_area().h/3);
flabel.set_lifetime(100);
flabel.set_clip_rect(map_outside_area());
@ -2142,7 +2142,7 @@ void display::refresh_report(reports::TYPE report_num, reports::report report)
// Draw a text element.
font::ttext text;
if (item->font_rgb_set()) {
text.set_foreground_colour(item->font_rgb());
text.set_foreground_color(item->font_rgb());
}
std::string t = e->text;
bool eol = false;

View file

@ -449,7 +449,7 @@ public:
/** Announce a message prominently. */
void announce(const std::string& msg,
const SDL_Color& colour = font::GOOD_COLOR);
const SDL_Color& color = font::GOOD_COLOR);
/**
* Schedule the minimap for recalculation.
@ -695,7 +695,7 @@ public:
* reverse: if the image should be flipped across the x axis
* greyscale: used for instance to give the petrified appearance to a unit image
* alpha: the merging to use with the background
* blendto: blend to this colour using blend_ratio
* blendto: blend to this color using blend_ratio
* submerged: the amount of the unit out of 1.0 that is submerged
* (presumably under water) and thus shouldn't be drawn
*/

View file

@ -121,7 +121,7 @@ editor_controller::editor_controller(const config &game_config, CVideo& video, m
hotkey::get_hotkey(hotkey::HOTKEY_QUIT_GAME).set_description(_("Quit Editor"));
get_map_context().set_starting_position_labels(gui());
cursor::set(cursor::NORMAL);
image::set_colour_adjustment(preferences::editor::tod_r(), preferences::editor::tod_g(), preferences::editor::tod_b());
image::set_color_adjustment(preferences::editor::tod_r(), preferences::editor::tod_g(), preferences::editor::tod_b());
theme& theme = gui().get_theme();
const theme::menu* default_tool_menu = NULL;
foreach (const theme::menu& m, theme.menus()) {
@ -378,13 +378,13 @@ void editor_controller::editor_settings_dialog()
dialog.set_tods(tods_);
dialog.set_current_adjustment(preferences::editor::tod_r(), preferences::editor::tod_g(), preferences::editor::tod_b());
dialog.set_redraw_callback(boost::bind(&editor_controller::editor_settings_dialog_redraw_callback, this, _1, _2, _3));
image::colour_adjustment_resetter adjust_resetter;
image::color_adjustment_resetter adjust_resetter;
dialog.set_use_mdi(use_mdi_);
dialog.show(gui().video());
int res = dialog.get_retval();
if(res == gui2::twindow::OK) {
image::set_colour_adjustment(dialog.get_red(), dialog.get_green(), dialog.get_blue());
image::set_color_adjustment(dialog.get_red(), dialog.get_green(), dialog.get_blue());
preferences::editor::set_tod_r(dialog.get_red());
preferences::editor::set_tod_g(dialog.get_green());
preferences::editor::set_tod_b(dialog.get_blue());
@ -399,7 +399,7 @@ void editor_controller::editor_settings_dialog()
void editor_controller::editor_settings_dialog_redraw_callback(int r, int g, int b)
{
SCOPE_ED;
image::set_colour_adjustment(r, g, b);
image::set_color_adjustment(r, g, b);
gui().redraw_everything();
}

View file

@ -66,7 +66,7 @@ namespace gui{
font::remove_floating_label(label_);
font::floating_label flabel(label_string_);
flabel.set_colour(font::YELLOW_COLOR);
flabel.set_color(font::YELLOW_COLOR);
flabel.set_position(area.x + border_size, ypos);
flabel.set_alignement(font::LEFT_ALIGN);
flabel.set_clip_rect(area);

View file

@ -690,7 +690,7 @@ text_surface &text_cache::find(text_surface const &t)
}
static surface render_text(const std::string& text, int fontsize, const SDL_Color& colour, int style, bool use_markup)
static surface render_text(const std::string& text, int fontsize, const SDL_Color& color, int style, bool use_markup)
{
// we keep blank lines and spaces (may be wanted for indentation)
const std::vector<std::string> lines = utils::split(text, '\n', 0);
@ -705,7 +705,7 @@ static surface render_text(const std::string& text, int fontsize, const SDL_Colo
std::string::const_iterator after_markup = use_markup ?
parse_markup(ln->begin(), ln->end(), &sz, NULL, &text_style) : ln->begin();
text_surface txt_surf(sz, colour, text_style);
text_surface txt_surf(sz, color, text_style);
if (after_markup == ln->end() && (ln+1 != ln_end || lines.begin()+1 == ln_end)) {
// we replace empty line by a space (to have a line height)
@ -763,18 +763,18 @@ static surface render_text(const std::string& text, int fontsize, const SDL_Colo
}
surface get_rendered_text(const std::string& str, int size, const SDL_Color& colour, int style)
surface get_rendered_text(const std::string& str, int size, const SDL_Color& color, int style)
{
// TODO maybe later also to parse markup here, but a lot to check
return render_text(str, size, colour, style, false);
return render_text(str, size, color, style, false);
}
SDL_Rect draw_text_line(surface gui_surface, const SDL_Rect& area, int size,
const SDL_Color& colour, const std::string& text,
const SDL_Color& color, const std::string& text,
int x, int y, bool use_tooltips, int style)
{
if (gui_surface.null()) {
text_surface const &u = text_cache::find(text_surface(text, size, colour, style));
text_surface const &u = text_cache::find(text_surface(text, size, color, style));
SDL_Rect res = {0, 0, u.width(), u.height()};
return res;
}
@ -787,7 +787,7 @@ SDL_Rect draw_text_line(surface gui_surface, const SDL_Rect& area, int size,
const std::string etext = make_text_ellipsis(text, size, area.w);
// for the main current use, we already parsed markup
surface surface(render_text(etext,size,colour,style,false));
surface surface(render_text(etext,size,color,style,false));
if(surface == NULL) {
SDL_Rect res = {0,0,0,0};
return res;
@ -799,7 +799,7 @@ SDL_Rect draw_text_line(surface gui_surface, const SDL_Rect& area, int size,
#ifdef HAVE_FRIBIDI
// Oron -- Conditional, until all draw_text_line calls have fixed area parameter
if(getenv("NO_RTL") == NULL) {
bool is_rtl = text_cache::find(text_surface(text, size, colour, style)).is_rtl();
bool is_rtl = text_cache::find(text_surface(text, size, color, style)).is_rtl();
if(is_rtl)
dest.x = area.x + area.w - surface->w - (x - area.x);
}
@ -926,7 +926,7 @@ namespace font {
floating_label::floating_label(const std::string& text)
: surf_(NULL), buf_(NULL), text_(text),
font_size_(SIZE_NORMAL),
colour_(NORMAL_COLOR), bgcolour_(), bgalpha_(0),
color_(NORMAL_COLOR), bgcolor_(), bgalpha_(0),
xpos_(0), ypos_(0),
xmove_(0), ymove_(0), lifetime_(-1),
width_(-1),
@ -957,7 +957,7 @@ surface floating_label::create_surface()
{
if (surf_.null()) {
font::ttext text;
text.set_foreground_colour((colour_.r << 24) | (colour_.g << 16) | (colour_.b << 8) | 255);
text.set_foreground_color((color_.r << 24) | (color_.g << 16) | (color_.b << 8) | 255);
text.set_font_size(font_size_);
text.set_maximum_width(width_ < 0 ? clip_rect_.w : width_);
text.set_maximum_height(clip_rect_.h);
@ -982,7 +982,7 @@ surface floating_label::create_surface()
return surf_;
}
Uint32 color = SDL_MapRGBA(foreground->format, bgcolour_.r,bgcolour_.g, bgcolour_.b, bgalpha_);
Uint32 color = SDL_MapRGBA(foreground->format, bgcolor_.r,bgcolor_.g, bgcolor_.b, bgalpha_);
SDL_FillRect(background,NULL, color);
// we make the text less transparent, because the blitting on the

View file

@ -46,7 +46,7 @@ private:
void deinit() const;
};
//various standard colours
//various standard colors
extern const SDL_Color NORMAL_COLOR, GRAY_COLOR, LOBBY_COLOR, GOOD_COLOR, BAD_COLOR,
BLACK_COLOR, YELLOW_COLOR, BUTTON_COLOR, BIGMAP_COLOR,
PETRIFIED_COLOR, TITLE_COLOR, DISABLED_COLOR, LABEL_COLOR;
@ -85,11 +85,11 @@ const int
;
#endif
// Returns a SDL surface containing the text rendered in a given colour.
surface get_rendered_text(const std::string& text, int size, const SDL_Color& colour, int style=0);
// Returns a SDL surface containing the text rendered in a given color.
surface get_rendered_text(const std::string& text, int size, const SDL_Color& color, int style=0);
SDL_Rect draw_text_line(surface gui_surface, const SDL_Rect& area, int size,
const SDL_Color& colour, const std::string& text,
const SDL_Color& color, const std::string& text,
int x, int y, bool use_tooltips, int style);
// Returns the maximum height of a font, in pixels
@ -148,10 +148,10 @@ public:
}
// set the number of frames to display the text for, or -1 to display until removed
void set_lifetime(int lifetime) {lifetime_ = lifetime;}
void set_colour(const SDL_Color& colour) {colour_ = colour;}
void set_bg_colour(const SDL_Color& bg_colour) {
bgcolour_ = bg_colour;
bgalpha_ = bg_colour.unused;
void set_color(const SDL_Color& color) {color_ = color;}
void set_bg_color(const SDL_Color& bg_color) {
bgcolor_ = bg_color;
bgalpha_ = bg_color.unused;
}
void set_border_size(int border) {border_ = border;}
// set width for word wrapping (use -1 to disable it)
@ -181,7 +181,7 @@ private:
surface surf_, buf_;
std::string text_;
int font_size_;
SDL_Color colour_, bgcolour_;
SDL_Color color_, bgcolor_;
int bgalpha_;
double xpos_, ypos_, xmove_, ymove_;
int lifetime_;

View file

@ -93,7 +93,7 @@ game_display::game_display(unit_map& units, CVideo& video, const gamemap& map,
side_colors.reserve(teams_.size());
for(size_t i = 0; i != teams_.size(); ++i) {
std::string side_color = team::get_side_colour_index(i+1);
std::string side_color = team::get_side_color_index(i+1);
side_colors.push_back(side_color);
std::string flag = teams_[i].flag();
std::string old_rgb = game_config::flag_rgb;
@ -196,16 +196,16 @@ void game_display::new_turn()
first_turn_ = false;
image::set_colour_adjustment(tod.red,tod.green,tod.blue);
image::set_color_adjustment(tod.red,tod.green,tod.blue);
invalidate_all();
draw();
}
void game_display::adjust_colours(int r, int g, int b)
void game_display::adjust_colors(int r, int g, int b)
{
const time_of_day& tod = tod_manager_.get_time_of_day();
image::set_colour_adjustment(tod.red+r,tod.green+g,tod.blue+b);
image::set_color_adjustment(tod.red+r,tod.green+g,tod.blue+b);
}
void game_display::select_hex(map_location hex)
@ -474,7 +474,7 @@ void game_display::draw_minimap_units()
}
int side = u->side();
const SDL_Color col = team::get_minimap_colour(side);
const SDL_Color col = team::get_minimap_color(side);
const Uint32 mapped_col = SDL_MapRGB(video().getSurface()->format,col.r,col.g,col.b);
double u_x = u->get_location().x * xscaling;
@ -817,7 +817,7 @@ void game_display::float_label(const map_location& loc, const std::string& text,
font::floating_label flabel(text);
flabel.set_font_size(font::SIZE_XLARGE);
const SDL_Color color = {red,green,blue,255};
flabel.set_colour(color);
flabel.set_color(color);
flabel.set_position(get_location_x(loc)+zoom_/2, get_location_y(loc));
flabel.set_move(0, -2 * turbo_speed());
flabel.set_lifetime(60/turbo_speed());
@ -826,11 +826,11 @@ void game_display::float_label(const map_location& loc, const std::string& text,
font::add_floating_label(flabel);
}
struct is_energy_colour {
bool operator()(Uint32 colour) const { return (colour&0xFF000000) > 0x10000000 &&
(colour&0x00FF0000) < 0x00100000 &&
(colour&0x0000FF00) < 0x00001000 &&
(colour&0x000000FF) < 0x00000010; }
struct is_energy_color {
bool operator()(Uint32 color) const { return (color&0xFF000000) > 0x10000000 &&
(color&0x00FF0000) < 0x00100000 &&
(color&0x0000FF00) < 0x00001000 &&
(color&0x000000FF) < 0x00000010; }
};
const SDL_Rect& game_display::calculate_energy_bar(surface surf)
@ -850,8 +850,8 @@ const SDL_Rect& game_display::calculate_energy_bar(surface surf)
for(int y = 0; y != image->h; ++y) {
const Uint32* const i1 = begin + image->w*y;
const Uint32* const i2 = i1 + image->w;
const Uint32* const itor = std::find_if(i1,i2,is_energy_colour());
const int count = std::count_if(itor,i2,is_energy_colour());
const Uint32* const itor = std::find_if(i1,i2,is_energy_color());
const int count = std::count_if(itor,i2,is_energy_color());
if(itor != i2) {
if(first_row == -1) {
@ -1261,7 +1261,7 @@ namespace {
const int chat_message_border = 5;
const int chat_message_x = 10;
const int chat_message_y = 10;
const SDL_Color chat_message_colour = {255,255,255,255};
const SDL_Color chat_message_color = {255,255,255,255};
const SDL_Color chat_message_bg = {0,0,0,140};
}
@ -1317,19 +1317,19 @@ void game_display::add_chat_message(const time_t& time, const std::string& speak
ypos += std::max(font::get_floating_label_rect(m->handle).h,
font::get_floating_label_rect(m->speaker_handle).h);
}
SDL_Color speaker_colour = {255,255,255,255};
SDL_Color speaker_color = {255,255,255,255};
if(side >= 1) {
speaker_colour = int_to_color(team::get_side_color_range(side).mid());
speaker_color = int_to_color(team::get_side_color_range(side).mid());
}
SDL_Color message_colour = chat_message_colour;
SDL_Color message_color = chat_message_color;
std::stringstream str;
std::stringstream message_str;
if(type == events::chat_handler::MESSAGE_PUBLIC) {
if(action) {
str << "<" << speaker << " " << msg << ">";
message_colour = speaker_colour;
message_color = speaker_color;
message_str << " ";
} else {
if (!speaker.empty())
@ -1339,7 +1339,7 @@ void game_display::add_chat_message(const time_t& time, const std::string& speak
} else {
if(action) {
str << "*" << speaker << " " << msg << "*";
message_colour = speaker_colour;
message_color = speaker_color;
message_str << " ";
} else {
if (!speaker.empty())
@ -1356,11 +1356,11 @@ void game_display::add_chat_message(const time_t& time, const std::string& speak
font::floating_label spk_flabel(message_complete.str());
spk_flabel.set_font_size(font::SIZE_SMALL);
spk_flabel.set_colour(speaker_colour);
spk_flabel.set_color(speaker_color);
spk_flabel.set_position(rect.x + chat_message_x, rect.y + ypos);
spk_flabel.set_clip_rect(rect);
spk_flabel.set_alignement(font::LEFT_ALIGN);
spk_flabel.set_bg_colour(chat_message_bg);
spk_flabel.set_bg_color(chat_message_bg);
spk_flabel.set_border_size(chat_message_border);
spk_flabel.use_markup(false);
@ -1368,12 +1368,12 @@ void game_display::add_chat_message(const time_t& time, const std::string& speak
font::floating_label msg_flabel(message_str.str());
msg_flabel.set_font_size(font::SIZE_SMALL);
msg_flabel.set_colour(message_colour);
msg_flabel.set_color(message_color);
msg_flabel.set_position(rect.x + chat_message_x + font::get_floating_label_rect(speaker_handle).w,
rect.y + ypos);
msg_flabel.set_clip_rect(rect);
msg_flabel.set_alignement(font::LEFT_ALIGN);
msg_flabel.set_bg_colour(chat_message_bg);
msg_flabel.set_bg_color(chat_message_bg);
msg_flabel.set_border_size(chat_message_border);
msg_flabel.use_markup(false);

View file

@ -62,11 +62,11 @@ public:
void new_turn();
/**
* Add r,g,b to the colours for all images displayed on the map.
* Add r,g,b to the colors for all images displayed on the map.
*
* Used for special effects like flashes.
*/
void adjust_colours(int r, int g, int b);
void adjust_colors(int r, int g, int b);
/**
* Scrolls to the leader of a certain side.
@ -315,7 +315,7 @@ private:
/**
* Finds the start and end rows on the energy bar image.
*
* White pixels are substituted for the colour of the energy.
* White pixels are substituted for the color of the energy.
*/
const SDL_Rect& calculate_energy_bar(surface surf);
std::map<surface,SDL_Rect> energy_bar_rects_;

View file

@ -779,7 +779,7 @@ WML_HANDLER_FUNCTION(colour_adjust, /*event_info*/, cfg)
const int r = atoi(red.c_str());
const int g = atoi(green.c_str());
const int b = atoi(blue.c_str());
screen.adjust_colours(r,g,b);
screen.adjust_colors(r,g,b);
screen.invalidate_all();
screen.draw(true,true);
}
@ -884,7 +884,7 @@ WML_HANDLER_FUNCTION(modify_side, /*event_info*/, cfg)
const config& parsed = cfg.get_parsed_config();
const config::const_child_itors &ai = parsed.child_range("ai");
/**
* @todo also allow client to modify a side's colour if it is possible
* @todo also allow client to modify a side's color if it is possible
* to change it on the fly without causing visual glitches
*/
std::string switch_ai = cfg["switch_ai"];
@ -999,7 +999,7 @@ WML_HANDLER_FUNCTION(store_side, /*event_info*/, cfg)
state_of_game->get_variable(var_name+".name") = teams[team_index].name();
state_of_game->get_variable(var_name+".team_name") = teams[team_index].team_name();
state_of_game->get_variable(var_name+".user_team_name") = teams[team_index].user_team_name();
state_of_game->get_variable(var_name+".color") = teams[team_index].map_colour_to();
state_of_game->get_variable(var_name+".color") = teams[team_index].map_color_to();
state_of_game->get_variable(var_name+".gold") = str_cast(teams[team_index].gold());
}
@ -2007,13 +2007,13 @@ WML_HANDLER_FUNCTION(print, /*event_info*/, cfg)
const int green = lexical_cast_default<int>(green_str,0);
const int blue = lexical_cast_default<int>(blue_str,0);
SDL_Color colour = {red,green,blue,255};
SDL_Color color = {red,green,blue,255};
const SDL_Rect& rect = resources::screen->map_outside_area();
font::floating_label flabel(text);
flabel.set_font_size(size);
flabel.set_colour(colour);
flabel.set_color(color);
flabel.set_position(rect.w/2,rect.h/2);
flabel.set_lifetime(lifetime);
flabel.set_clip_rect(rect);
@ -2584,7 +2584,7 @@ WML_HANDLER_FUNCTION(label, /*event_info*/, cfg)
terrain_label label(screen.labels(), cfg.get_config());
screen.labels().set_label(label.location(), label.text(),
label.team_name(), label.colour(), label.visible_in_fog(), label.visible_in_shroud(), label.immutable());
label.team_name(), label.color(), label.visible_in_fog(), label.visible_in_shroud(), label.immutable());
}
WML_HANDLER_FUNCTION(heal_unit, event_info, cfg)

View file

@ -616,12 +616,12 @@ void set_show_ai_moves(bool value)
preferences::set("show_ai_moves", value);
}
void set_show_side_colours(bool value)
void set_show_side_colors(bool value)
{
preferences::set("show_side_colours", value);
}
bool show_side_colours()
bool show_side_colors()
{
return preferences::get("show_side_colours", true);
}

View file

@ -151,8 +151,8 @@ namespace preferences {
bool show_ai_moves();
void set_show_ai_moves(bool value);
void set_show_side_colours(bool value);
bool show_side_colours();
void set_show_side_colors(bool value);
bool show_side_colors();
bool save_replays();
void set_save_replays(bool value);

View file

@ -110,7 +110,7 @@ private:
friends_add_friend_button_, friends_add_ignore_button_,
friends_remove_button_, show_floating_labels_button_,
turn_dialog_button_, delay_shroud_updates_button_, turn_bell_button_,
show_team_colours_button_, show_colour_cursors_button_,
show_team_colors_button_, show_color_cursors_button_,
show_haloing_button_, video_mode_button_,
theme_button_, hotkeys_button_,
flip_time_button_, advanced_button_, sound_button_,
@ -178,8 +178,8 @@ preferences_dialog::preferences_dialog(display& disp, const config& game_cfg)
turn_dialog_button_(disp.video(), _("Turn Dialog"), gui::button::TYPE_CHECK),
delay_shroud_updates_button_(disp.video(), _("Delay Shroud Updates on Start"), gui::button::TYPE_CHECK),
turn_bell_button_(disp.video(), _("Turn Bell"), gui::button::TYPE_CHECK),
show_team_colours_button_(disp.video(), _("Show Team Colors"), gui::button::TYPE_CHECK),
show_colour_cursors_button_(disp.video(), _("Show Color Cursors"), gui::button::TYPE_CHECK),
show_team_colors_button_(disp.video(), _("Show Team Colors"), gui::button::TYPE_CHECK),
show_color_cursors_button_(disp.video(), _("Show Color Cursors"), gui::button::TYPE_CHECK),
show_haloing_button_(disp.video(), _("Show Haloing Effects"), gui::button::TYPE_CHECK),
video_mode_button_(disp.video(), _("Change Resolution")),
theme_button_(disp.video(), _("Theme")),
@ -391,14 +391,14 @@ preferences_dialog::preferences_dialog(display& disp, const config& game_cfg)
turn_bell_button_.set_check(turn_bell());
turn_bell_button_.set_help_string(_("Play a bell sound at the beginning of your turn"));
show_team_colours_button_.set_check(show_side_colours());
show_team_colours_button_.set_help_string(_("Show a colored circle around the base of each unit to show which side it is on"));
show_team_colors_button_.set_check(show_side_colors());
show_team_colors_button_.set_help_string(_("Show a colored circle around the base of each unit to show which side it is on"));
flip_time_button_.set_check(flip_time());
flip_time_button_.set_help_string(_("Choose whether the sun moves left-to-right or right-to-left"));
show_colour_cursors_button_.set_check(use_colour_cursors());
show_colour_cursors_button_.set_help_string(_("Use colored mouse cursors (may be slower)"));
show_color_cursors_button_.set_check(use_color_cursors());
show_color_cursors_button_.set_help_string(_("Use colored mouse cursors (may be slower)"));
show_haloing_button_.set_check(show_haloes());
show_haloing_button_.set_help_string(_("Use graphical special effects (may be slower)"));
@ -450,8 +450,8 @@ handler_vector preferences_dialog::handler_members()
h.push_back(&delay_shroud_updates_button_);
h.push_back(&turn_bell_button_);
h.push_back(&UI_sound_button_);
h.push_back(&show_team_colours_button_);
h.push_back(&show_colour_cursors_button_);
h.push_back(&show_team_colors_button_);
h.push_back(&show_color_cursors_button_);
h.push_back(&show_haloing_button_);
h.push_back(&video_mode_button_);
h.push_back(&theme_button_);
@ -534,11 +534,11 @@ void preferences_dialog::update_location(SDL_Rect const &rect)
ypos = rect.y + top_border;
fullscreen_button_.set_location(rect.x, ypos);
ypos += item_interline; scroll_to_action_button_.set_location(rect.x, ypos);
ypos += item_interline; show_colour_cursors_button_.set_location(rect.x, ypos);
ypos += item_interline; show_color_cursors_button_.set_location(rect.x, ypos);
ypos += item_interline; flip_time_button_.set_location(rect.x,ypos);
ypos += item_interline; show_floating_labels_button_.set_location(rect.x, ypos);
ypos += item_interline; show_haloing_button_.set_location(rect.x, ypos);
ypos += item_interline; show_team_colours_button_.set_location(rect.x, ypos);
ypos += item_interline; show_team_colors_button_.set_location(rect.x, ypos);
ypos += item_interline; show_grid_button_.set_location(rect.x, ypos);
ypos += item_interline; idle_anim_button_.set_location(rect.x, ypos);
ypos += short_interline;
@ -694,8 +694,8 @@ void preferences_dialog::process_event()
set_turn_dialog(turn_dialog_button_.checked());
if (delay_shroud_updates_button_.pressed())
set_delay_shroud_updates_on_start(delay_shroud_updates_button_.checked());
if (show_team_colours_button_.pressed())
set_show_side_colours(show_team_colours_button_.checked());
if (show_team_colors_button_.pressed())
set_show_side_colors(show_team_colors_button_.checked());
if (hotkeys_button_.pressed()) {
show_hotkeys_dialog(disp_);
parent->clear_buttons();
@ -733,8 +733,8 @@ void preferences_dialog::process_event()
: video_mode_change_exception::MAKE_WINDOWED);
if (scroll_to_action_button_.pressed())
set_scroll_to_action(scroll_to_action_button_.checked());
if (show_colour_cursors_button_.pressed())
set_colour_cursors(show_colour_cursors_button_.checked());
if (show_color_cursors_button_.pressed())
set_color_cursors(show_color_cursors_button_.checked());
if (show_haloing_button_.pressed())
set_show_haloes(show_haloing_button_.checked());
if (flip_time_button_.pressed())
@ -1093,7 +1093,7 @@ void preferences_dialog::set_selection(int index)
const bool hide_display = tab_ != DISPLAY_TAB;
show_floating_labels_button_.hide(hide_display);
show_colour_cursors_button_.hide(hide_display);
show_color_cursors_button_.hide(hide_display);
show_haloing_button_.hide(hide_display);
fullscreen_button_.hide(hide_display);
scroll_to_action_button_.hide(hide_display);
@ -1105,7 +1105,7 @@ void preferences_dialog::set_selection(int index)
video_mode_button_.hide(hide_display);
theme_button_.hide(hide_display);
flip_time_button_.hide(hide_display);
show_team_colours_button_.hide(hide_display);
show_team_colors_button_.hide(hide_display);
show_grid_button_.hide(hide_display);
const bool hide_sound = tab_ != SOUND_TAB;

View file

@ -109,7 +109,7 @@ report generate_report(TYPE type,
case UNIT_SIDE: {
std::string flag_icon = teams[u->side() - 1].flag_icon();
std::string old_rgb = game_config::flag_rgb;
std::string new_rgb = team::get_side_colour_index(u->side());
std::string new_rgb = team::get_side_color_index(u->side());
std::string mods = "~RC(" + old_rgb + ">" + new_rgb + ")";
if(flag_icon.empty()) {
@ -647,7 +647,7 @@ report generate_report(TYPE type,
case SIDE_PLAYING: {
std::string flag_icon = teams[playing_side-1].flag_icon();
std::string old_rgb = game_config::flag_rgb;
std::string new_rgb = team::get_side_colour_index(playing_side);
std::string new_rgb = team::get_side_color_index(playing_side);
std::string mods = "~RC(" + old_rgb + ">" + new_rgb + ")";
if(flag_icon.empty()) {

View file

@ -75,19 +75,19 @@ namespace {
*
* @param start The memory address which is the start of the surface
* buffer to draw in.
* @param colour The colour of the pixel to draw.
* @param color The color of the pixel to draw.
* @param w The width of the surface.
* @param x The x coordinate of the pixel to draw.
* @param y The y coordinate of the pixel to draw.
*/
static void put_pixel(
const ptrdiff_t start
, const Uint32 colour
, const Uint32 color
, const unsigned w
, const unsigned x
, const unsigned y)
{
*reinterpret_cast<Uint32*>(start + (y * w * 4) + x * 4) = colour;
*reinterpret_cast<Uint32*>(start + (y * w * 4) + x * 4) = color;
}
/**
@ -95,7 +95,7 @@ static void put_pixel(
*
* @param canvas The canvas to draw upon, the caller should lock the
* surface before calling.
* @param colour The colour of the line to draw.
* @param color The color of the line to draw.
* @param x1 The start x coordinate of the line to draw.
* @param y1 The start y coordinate of the line to draw.
* @param x2 The end x coordinate of the line to draw.
@ -103,17 +103,17 @@ static void put_pixel(
*/
static void draw_line(
surface& canvas
, Uint32 colour
, Uint32 color
, const unsigned x1
, unsigned y1
, const unsigned x2
, unsigned y2)
{
colour = SDL_MapRGBA(canvas->format,
((colour & 0xFF000000) >> 24),
((colour & 0x00FF0000) >> 16),
((colour & 0x0000FF00) >> 8),
((colour & 0x000000FF)));
color = SDL_MapRGBA(canvas->format,
((color & 0xFF000000) >> 24),
((color & 0x00FF0000) >> 16),
((color & 0x0000FF00) >> 8),
((color & 0x000000FF)));
ptrdiff_t start = reinterpret_cast<ptrdiff_t>(canvas->pixels);
unsigned w = canvas->w;
@ -135,7 +135,7 @@ static void draw_line(
}
for(unsigned y = y1; y <= y2; ++y) {
put_pixel(start, colour, w, x1, y);
put_pixel(start, color, w, x1, y);
}
return;
}
@ -143,7 +143,7 @@ static void draw_line(
// use a special case for horizontal lines
if(y1 == y2) {
for(unsigned x = x1; x <= x2; ++x) {
put_pixel(start, colour, w, x, y1);
put_pixel(start, color, w, x, y1);
}
return;
}
@ -165,7 +165,7 @@ static void draw_line(
// Blit
for (unsigned x = x1; x <= x2; ++x) {
put_pixel(start, colour, w, x, y);
put_pixel(start, color, w, x, y);
if (d <= 0) {
d += incE;
} else {
@ -203,8 +203,8 @@ private:
x2_, /**< The end x coordinate of the line. */
y2_; /**< The end y coordinate of the line. */
/** The colour of the line. */
Uint32 colour_;
/** The color of the line. */
Uint32 color_;
/**
* The thickness of the line.
@ -221,7 +221,7 @@ tline::tline(const config& cfg)
, y1_(cfg["y1"])
, x2_(cfg["x2"])
, y2_(cfg["y2"])
, colour_(decode_colour(cfg.get_old_attribute("color","colour")))
, color_(decode_color(cfg.get_old_attribute("color","colour")))
, thickness_(cfg["thickness"])
{
/*WIKI
@ -238,7 +238,7 @@ tline::tline(const config& cfg)
* y1 (f_unsigned = 0) The y coordinate of the startpoint.
* x2 (f_unsigned = 0) The x coordinate of the endpoint.
* y2 (f_unsigned = 0) The y coordinate of the endpoint.
* colour (colour = "") The colour of the line.
* color (color = "") The color of the line.
* thickness = (unsigned = 0) The thickness of the line if 0 nothing
* is drawn.
* debug = (string = "") Debug message to show upon creation
@ -348,11 +348,11 @@ tline::tline(const config& cfg)
* tstring A translatable string.
* f_tstring Formula returning a translatable string.
*
* colour A string which contains the colour, this
* color A string which contains the color, this
* a group of 4 numbers between 0 and 255
* separated by a comma. The numbers are red
* component, green component, blue
* component and alpha. A colour of 0 is not
* component and alpha. A color of 0 is not
* available. An alpha of 255 is fully
* transparent. Omitted values are set to 0.
*
@ -491,9 +491,9 @@ void tline::draw(surface& canvas
surface_lock locker(canvas);
if(x1 > x2) {
// invert points
draw_line(canvas, colour_, x2, y2, x1, y1);
draw_line(canvas, color_, x2, y2, x1, y1);
} else {
draw_line(canvas, colour_, x1, y1, x2, y2);
draw_line(canvas, color_, x1, y1, x2, y2);
}
}
@ -528,23 +528,23 @@ private:
/**
* Border thickness.
*
* If 0 the fill colour is used for the entire widget.
* If 0 the fill color is used for the entire widget.
*/
unsigned border_thickness_;
/**
* The border colour of the rectangle.
* The border color of the rectangle.
*
* If the colour is fully transparent the border isn't drawn.
* If the color is fully transparent the border isn't drawn.
*/
Uint32 border_colour_;
Uint32 border_color_;
/**
* The border colour of the rectangle.
* The border color of the rectangle.
*
* If the colour is fully transparent the rectangle won't be filled.
* If the color is fully transparent the rectangle won't be filled.
*/
Uint32 fill_colour_;
Uint32 fill_color_;
};
trectangle::trectangle(const config& cfg)
@ -553,8 +553,8 @@ trectangle::trectangle(const config& cfg)
, w_(cfg["w"])
, h_(cfg["h"])
, border_thickness_(cfg["border_thickness"])
, border_colour_(decode_colour(cfg["border_colour"]))
, fill_colour_(decode_colour(cfg["fill_colour"]))
, border_color_(decode_color(cfg["border_colour"]))
, fill_color_(decode_color(cfg["fill_colour"]))
{
/*WIKI
* @page = GUICanvasWML
@ -573,9 +573,9 @@ trectangle::trectangle(const config& cfg)
* h (f_unsigned = 0) The height of the rectangle.
* border_thickness (unsigned = 0) The thickness of the border if the
* thickness is zero it's not drawn.
* border_colour (colour = "") The colour of the border if empty it's
* border_color (color = "") The color of the border if empty it's
* not drawn.
* fill_colour (colour = "") The colour of the interior if omitted
* fill_color (color = "") The color of the interior if omitted
* it's not drawn.
* debug = (string = "") Debug message to show upon creation
* this message is not stored.
@ -584,7 +584,7 @@ trectangle::trectangle(const config& cfg)
* See [[#general_variables|Line]].
*
*/
if(border_colour_ == 0) {
if(border_color_ == 0) {
border_thickness_ = 0;
}
@ -630,21 +630,21 @@ void trectangle::draw(surface& canvas
const unsigned bottom = top + h - (i * 2) - 1;
// top horizontal (left -> right)
draw_line(canvas, border_colour_, left, top, right, top);
draw_line(canvas, border_color_, left, top, right, top);
// right vertical (top -> bottom)
draw_line(canvas, border_colour_, right, top, right, bottom);
draw_line(canvas, border_color_, right, top, right, bottom);
// bottom horizontal (left -> right)
draw_line(canvas, border_colour_, left, bottom, right, bottom);
draw_line(canvas, border_color_, left, bottom, right, bottom);
// left vertical (top -> bottom)
draw_line(canvas, border_colour_, left, top, left, bottom);
draw_line(canvas, border_color_, left, top, left, bottom);
}
// The fill_rect_alpha code below fails, can't remember the exact cause
// so use the slow line drawing method to fill the rect.
if(fill_colour_) {
if(fill_color_) {
const unsigned left = x + border_thickness_;
const unsigned right = left + w - (2 * border_thickness_) - 1;
@ -653,7 +653,7 @@ void trectangle::draw(surface& canvas
for(unsigned i = top; i < bottom; ++i) {
draw_line(canvas, fill_colour_, left, i, right, i);
draw_line(canvas, fill_color_, left, i, right, i);
}
}
}
@ -1014,8 +1014,8 @@ private:
/** The alignment of the text. */
tformula<PangoAlignment> text_alignment_;
/** The colour of the text. */
Uint32 colour_;
/** The color of the text. */
Uint32 color_;
/** The text to draw. */
tformula<t_string> text_;
@ -1038,7 +1038,7 @@ ttext::ttext(const config& cfg)
, font_size_(cfg["font_size"])
, font_style_(decode_font_style(cfg["font_style"]))
, text_alignment_(cfg["text_alignment"])
, colour_(decode_colour(cfg.get_old_attribute("color","colour")))
, color_(decode_color(cfg.get_old_attribute("color","colour")))
, text_(cfg["text"])
, text_markup_(cfg["text_markup"], false)
, maximum_width_(cfg["maximum_width"], -1)
@ -1063,7 +1063,7 @@ ttext::ttext(const config& cfg)
* font_style (font_style = "") The style of the text.
* text_alignment (f_h_align = "left")
* The alignment of the text.
* colour (colour = "") The colour of the text.
* color (color = "") The color of the text.
* text (f_tstring = "") The text to draw (translatable).
* text_markup (f_bool = false) Can the text have markup?
* maximum_width (f_int = -1) The maximum width the text is allowed to
@ -1115,7 +1115,7 @@ void ttext::draw(surface& canvas
text_renderer.set_font_size(font_size_)
.set_font_style(font_style_)
.set_alignment(text_alignment_(variables))
.set_foreground_colour(colour_)
.set_foreground_color(color_)
.set_maximum_width(maximum_width_(variables))
.set_maximum_height(maximum_height_(variables))
.set_ellipse_mode(variables.has_key("text_wrap_mode")

View file

@ -36,7 +36,7 @@ tbuilder_control::tbuilder_control(const config& cfg)
utils::string_bool("use_tooltip_on_label_overflow", true))
#ifndef LOW_MEM
, debug_border_mode(lexical_cast_default<int>(cfg["debug_border_mode"]))
, debug_border_colour(decode_colour(cfg["debug_border_colour"]))
, debug_border_color(decode_color(cfg["debug_border_colour"]))
#endif
{
if(definition.empty()) {
@ -60,7 +60,7 @@ void tbuilder_control::init_control(tcontrol* control) const
control->set_use_tooltip_on_label_overflow(use_tooltip_on_label_overflow);
#ifndef LOW_MEM
control->set_debug_border_mode(debug_border_mode);
control->set_debug_border_colour(debug_border_colour);
control->set_debug_border_color(debug_border_color);
#endif
}
@ -131,7 +131,7 @@ void tbuilder_control::init_control(tcontrol* control) const
* @* 1 1 pixel border.
* @* 2 floodfill the widget area.
*
* debug_border_colour (colour = "") The colour of the debug border.
* debug_border_color (color = "") The color of the debug border.
* @end_table
*/

View file

@ -42,7 +42,7 @@ public:
bool use_tooltip_on_label_overflow;
#ifndef LOW_MEM
int debug_border_mode;
unsigned debug_border_colour;
unsigned debug_border_color;
#endif
};

View file

@ -49,7 +49,7 @@ namespace gui2 {
*
* (custom_tod_toggle) (toggle_button) ()
* Allow to set the ToD mask by selecting the
* colour components manually.
* color components manually.
* (custom_tod_red) (slider) ()
* Sets the red component of the custom ToD
* mask.

View file

@ -49,7 +49,7 @@ tcontrol::tcontrol(const unsigned canvas_count)
void tcontrol::set_members(const string_map& data)
{
/** @todo document this feature on the wiki. */
/** @todo do we need to add the debug colours here as well? */
/** @todo do we need to add the debug colors here as well? */
string_map::const_iterator itor = data.find("id");
if(itor != data.end()) {
set_id(itor->second);

View file

@ -83,9 +83,9 @@ unsigned decode_font_style(const std::string& style)
return TTF_STYLE_NORMAL;
}
Uint32 decode_colour(const std::string& colour)
Uint32 decode_color(const std::string& color)
{
std::vector<std::string> fields = utils::split(colour);
std::vector<std::string> fields = utils::split(color);
// make sure we have four fields
while(fields.size() < 4) fields.push_back("0");

View file

@ -84,15 +84,15 @@ std::ostream &operator<<(std::ostream &stream, const tpoint& point);
SDL_Rect create_rect(const tpoint& origin, const tpoint& size);
/**
* Converts a colour string to a colour.
* Converts a color string to a color.
*
* @param colour A colour string see
* @param color A color string see
* http://www.wesnoth.org/wiki/GUIVariable for
* more info.
*
* @returns The colour.
* @returns The color.
*/
Uint32 decode_colour(const std::string& colour);
Uint32 decode_color(const std::string& color);
/**
* Converts a text alignment string to a text alignment.

View file

@ -35,7 +35,7 @@ twidget::twidget()
, linked_group_()
#ifndef LOW_MEM
, debug_border_mode_(0)
, debug_border_colour_(0)
, debug_border_color_(0)
#endif
#ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
, last_best_size_(tpoint(0,0))
@ -299,10 +299,10 @@ void twidget::draw_debug_border(surface& frame_buffer)
break;
case 1:
draw_rectangle(r.x, r.y, r.w, r.h
, debug_border_colour_, frame_buffer);
, debug_border_color_, frame_buffer);
break;
case 2:
SDL_FillRect(frame_buffer, &r, debug_border_colour_);
SDL_FillRect(frame_buffer, &r, debug_border_color_);
break;
default:
assert(false);

View file

@ -436,9 +436,9 @@ public:
debug_border_mode_ = debug_border_mode;
}
void set_debug_border_colour(const unsigned debug_border_colour)
void set_debug_border_color(const unsigned debug_border_color)
{
debug_border_colour_ = debug_border_colour;
debug_border_color_ = debug_border_color;
}
#endif
@ -622,7 +622,7 @@ private:
unsigned debug_border_mode_;
/** The color for the debug border. */
unsigned debug_border_colour_;
unsigned debug_border_color_;
void draw_debug_border(surface& frame_buffer);
#else

View file

@ -592,7 +592,7 @@ void twindow::draw()
}
if(dirty_list_.empty()) {
if(preferences::use_colour_cursors() || sunset_) {
if(preferences::use_color_cursors() || sunset_) {
surface frame_buffer = get_video_surface();
if(sunset_) {

View file

@ -805,7 +805,7 @@ void set_pixel_format(SDL_PixelFormat* format)
last_pixel_format = *format;
}
void set_colour_adjustment(int r, int g, int b)
void set_color_adjustment(int r, int g, int b)
{
if(r != red_adjust || g != green_adjust || b != blue_adjust) {
red_adjust = r;
@ -818,14 +818,14 @@ void set_colour_adjustment(int r, int g, int b)
}
}
colour_adjustment_resetter::colour_adjustment_resetter()
color_adjustment_resetter::color_adjustment_resetter()
: r_(red_adjust), g_(green_adjust), b_(blue_adjust)
{
}
void colour_adjustment_resetter::reset()
void color_adjustment_resetter::reset()
{
set_colour_adjustment(r_, g_, b_);
set_color_adjustment(r_, g_, b_);
}
void set_team_colors(const std::vector<std::string>* colors)
@ -881,10 +881,10 @@ static surface get_scaled_to_hex(const locator& i_locator)
{
surface res(get_image(i_locator, UNMASKED));
// Adjusts colour if necessary.
// Adjusts color if necessary.
if (red_adjust != 0 ||
green_adjust != 0 || blue_adjust != 0) {
res = surface(adjust_surface_colour(res,
res = surface(adjust_surface_color(res,
red_adjust, green_adjust, blue_adjust));
}

View file

@ -224,14 +224,14 @@ namespace image {
void set_wm_icon();
///will make all scaled images have these rgb values added to all
///their pixels. i.e. add a certain colour hint to images. useful
///their pixels. i.e. add a certain color hint to images. useful
///for representing day/night. Invalidates all scaled images.
void set_colour_adjustment(int r, int g, int b);
void set_color_adjustment(int r, int g, int b);
class colour_adjustment_resetter
class color_adjustment_resetter
{
public:
colour_adjustment_resetter();
color_adjustment_resetter();
void reset();
private:
int r_, g_, b_;

View file

@ -107,7 +107,7 @@ surface cs_function::operator()(const surface& src) const
{
return(
(r_ != 0 || g_ != 0 || b_ != 0) ?
adjust_surface_colour(src, r_, g_, b_) :
adjust_surface_color(src, r_, g_, b_) :
src
);
}

View file

@ -34,7 +34,7 @@ leader_list_manager::leader_list_manager(const std::vector<const config *> &side
side_list_(side_list),
leader_combo_(leader_combo),
gender_combo_(gender_combo),
colour_(0)
color_(0)
{
}
@ -251,11 +251,11 @@ std::string leader_list_manager::get_gender() const
}
#ifdef LOW_MEM
std::string leader_list_manager::get_RC_suffix(const std::string& /*unit_colour*/) const {
std::string leader_list_manager::get_RC_suffix(const std::string& /*unit_color*/) const {
return "";
}
#else
std::string leader_list_manager::get_RC_suffix(const std::string& unit_colour) const {
return "~RC("+unit_colour+">"+lexical_cast<std::string>(colour_+1) +")";
std::string leader_list_manager::get_RC_suffix(const std::string& unit_color) const {
return "~RC("+unit_color+">"+lexical_cast<std::string>(color_+1) +")";
}
#endif

View file

@ -40,8 +40,8 @@ public:
std::string get_gender() const;
void set_leader(const std::string& leader);
void set_gender(const std::string& gender);
void set_colour(int colour) {colour_ = colour;};
std::string get_RC_suffix(const std::string& unit_colour) const;
void set_color(int color) {color_ = color;};
std::string get_RC_suffix(const std::string& unit_color) const;
private:
void populate_leader_combo(int selected_index);
@ -51,7 +51,7 @@ private:
std::vector<const config *> side_list_;
gui::combo* leader_combo_;
gui::combo* gender_combo_;
int colour_;
int color_;
};
#endif

View file

@ -128,7 +128,7 @@ void map_labels::set_team(const team* team)
const terrain_label* map_labels::set_label(const map_location& loc,
const t_string& text,
const std::string& team_name,
const SDL_Color colour,
const SDL_Color color,
const bool visible_in_fog,
const bool visible_in_shroud,
const bool immutable)
@ -144,7 +144,7 @@ const terrain_label* map_labels::set_label(const map_location& loc,
if(text.str().empty())
{
current_label->second->set_text("");
res = new terrain_label("",team_name,loc,*this,colour,visible_in_fog,visible_in_shroud,immutable);
res = new terrain_label("",team_name,loc,*this,color,visible_in_fog,visible_in_shroud,immutable);
delete current_label->second;
current_label_map->second.erase(loc);
@ -163,7 +163,7 @@ const terrain_label* map_labels::set_label(const map_location& loc,
}
else
{
current_label->second->update_info(text, team_name, colour);
current_label->second->update_info(text, team_name, color);
res = current_label->second;
}
}
@ -181,7 +181,7 @@ const terrain_label* map_labels::set_label(const map_location& loc,
team_name,
loc,
*this,
colour,
color,
visible_in_fog,
visible_in_shroud,
immutable);
@ -273,7 +273,7 @@ terrain_label::terrain_label(const t_string& text,
const std::string& team_name,
const map_location& loc,
const map_labels& parent,
const SDL_Color colour,
const SDL_Color color,
const bool visible_in_fog,
const bool visible_in_shroud,
const bool immutable) :
@ -283,7 +283,7 @@ terrain_label::terrain_label(const t_string& text,
visible_in_fog_(visible_in_fog),
visible_in_shroud_(visible_in_shroud),
immutable_(immutable),
colour_(colour),
color_(color),
parent_(&parent),
loc_(loc)
{
@ -299,7 +299,7 @@ terrain_label::terrain_label(const map_labels &parent, const config &cfg) :
visible_in_fog_(true),
visible_in_shroud_(false),
immutable_(true),
colour_(),
color_(),
parent_(&parent),
loc_()
{
@ -317,8 +317,8 @@ void terrain_label::read(const config &cfg)
{
const variable_set &vs = *resources::state_of_game;
loc_ = map_location(cfg, &vs);
SDL_Color colour = font::LABEL_COLOR;
std::string tmp_colour = cfg.get_old_attribute("color","colour");
SDL_Color color = font::LABEL_COLOR;
std::string tmp_color = cfg.get_old_attribute("color","colour");
text_ = cfg["text"];
team_name_ = cfg["team_name"].str();
@ -328,20 +328,20 @@ void terrain_label::read(const config &cfg)
text_ = utils::interpolate_variables_into_tstring(text_, vs); // Not moved to rendering, as that would depend on variables at render-time
team_name_ = utils::interpolate_variables_into_string(team_name_, vs);
tmp_colour = utils::interpolate_variables_into_string(tmp_colour, vs);
tmp_color = utils::interpolate_variables_into_string(tmp_color, vs);
if(!tmp_colour.empty()) {
if(!tmp_color.empty()) {
std::vector<Uint32> temp_rgb;
try {
temp_rgb = string2rgb(tmp_colour);
temp_rgb = string2rgb(tmp_color);
} catch(bad_lexical_cast&) {
//throw config::error(_("Invalid color range: ") + name);
}
if(!temp_rgb.empty()) {
colour = int_to_color(temp_rgb[0]);
color = int_to_color(temp_rgb[0]);
}
}
colour_ = colour;
color_ = color;
}
void terrain_label::write(config& cfg) const
@ -349,7 +349,7 @@ void terrain_label::write(config& cfg) const
loc_.write(cfg);
cfg["text"] = text();
cfg["team_name"] = (this->team_name());
cfg["color"] = cfg_colour();
cfg["color"] = cfg_color();
cfg["visible_in_fog"] = visible_in_fog_;
cfg["visible_in_shroud"] = visible_in_shroud_;
cfg["immutable"] = immutable_;
@ -385,18 +385,18 @@ const map_location& terrain_label::location() const
return loc_;
}
const SDL_Color& terrain_label::colour() const
const SDL_Color& terrain_label::color() const
{
return colour_;
return color_;
}
std::string terrain_label::cfg_colour() const
std::string terrain_label::cfg_color() const
{
std::stringstream buf;
const unsigned int red = static_cast<unsigned int>(colour_.r);
const unsigned int green = static_cast<unsigned int>(colour_.g);
const unsigned int blue = static_cast<unsigned int>(colour_.b);
const unsigned int alpha = static_cast<unsigned int>(colour_.unused);
const unsigned int red = static_cast<unsigned int>(color_.r);
const unsigned int green = static_cast<unsigned int>(color_.g);
const unsigned int blue = static_cast<unsigned int>(color_.b);
const unsigned int alpha = static_cast<unsigned int>(color_.unused);
buf << red << ","
<< green << ","
<< blue << ","
@ -411,9 +411,9 @@ void terrain_label::set_text(const t_string& text)
void terrain_label::update_info(const t_string& text,
const std::string& team_name,
const SDL_Color colour)
const SDL_Color color)
{
colour_ = colour;
color_ = color;
text_ = text;
check_text_length();
team_name_ = team_name;
@ -450,13 +450,13 @@ void terrain_label::draw()
parent_->disp().get_location_x(loc_nextx)*2)/3;
const int yloc = parent_->disp().get_location_y(loc_nexty) - font::SIZE_NORMAL;
// If a colour is specified don't allow to override it with markup. (prevents faking map labels for example)
// If a color is specified don't allow to override it with markup. (prevents faking map labels for example)
// FIXME: @todo Better detect if it's team label and not provided by
// the scenario.
bool use_markup = colour_ == font::LABEL_COLOR;
bool use_markup = color_ == font::LABEL_COLOR;
font::floating_label flabel(text_.str());
flabel.set_colour(colour_);
flabel.set_color(color_);
flabel.set_position(xloc, yloc);
flabel.set_clip_rect(parent_->disp().map_outside_area());
flabel.set_scroll_mode(font::ANCHOR_LABEL_MAP);

View file

@ -47,7 +47,7 @@ public:
const terrain_label* set_label(const map_location& loc,
const t_string& text,
const std::string& team = "",
const SDL_Color colour = font::NORMAL_COLOR,
const SDL_Color color = font::NORMAL_COLOR,
const bool visible_in_fog = true,
const bool visible_in_shroud = false,
const bool immutable = false);
@ -88,7 +88,7 @@ public:
const std::string&,
const map_location&,
const map_labels&,
const SDL_Color colour = font::NORMAL_COLOR,
const SDL_Color color = font::NORMAL_COLOR,
const bool visible_in_fog = true,
const bool visible_in_shroud = false,
const bool immutable = false);
@ -106,7 +106,7 @@ public:
bool visible_in_shroud() const;
bool immutable() const;
const map_location& location() const;
const SDL_Color& colour() const;
const SDL_Color& color() const;
void set_text(const t_string&);
@ -124,7 +124,7 @@ private:
void draw();
bool visible() const;
void check_text_length();
std::string cfg_colour() const;
std::string cfg_color() const;
int handle_;
@ -134,7 +134,7 @@ private:
bool visible_in_shroud_;
bool immutable_;
SDL_Color colour_;
SDL_Color color_;
const map_labels* parent_;
map_location loc_;

View file

@ -53,7 +53,7 @@ const SDL_Color
std::string::const_iterator parse_markup(std::string::const_iterator i1,
std::string::const_iterator i2,
int* font_size,
SDL_Color* colour, int* style)
SDL_Color* color, int* style)
{
std::string::const_iterator i_start=i1;
while(i1 != i2) {
@ -63,19 +63,19 @@ std::string::const_iterator parse_markup(std::string::const_iterator i1,
// quoted backslash - either way, remove leading backslash
break;
case BAD_TEXT:
if (colour) *colour = BAD_COLOR;
if (color) *color = BAD_COLOR;
break;
case GOOD_TEXT:
if (colour) *colour = GOOD_COLOR;
if (color) *color = GOOD_COLOR;
break;
case NORMAL_TEXT:
if (colour) *colour = NORMAL_COLOR;
if (color) *color = NORMAL_COLOR;
break;
case BLACK_TEXT:
if (colour) *colour = BLACK_COLOR;
if (color) *color = BLACK_COLOR;
break;
case GRAY_TEXT:
if (colour) *colour = GRAY_COLOR;
if (color) *color = GRAY_COLOR;
break;
case LARGE_TEXT:
if (font_size) *font_size += 2;
@ -123,7 +123,7 @@ std::string::const_iterator parse_markup(std::string::const_iterator i1,
blue=temp;
if (i1 != i2 && '>' == (*i1)) {
SDL_Color temp_color = {red, green, blue, 0};
if (colour) *colour = temp_color;
if (color) *color = temp_color;
} else {
// stop parsing and do not consume any chars
return start;
@ -183,7 +183,7 @@ SDL_Rect text_area(const std::string& text, int size, int style)
}
SDL_Rect draw_text(surface dst, const SDL_Rect& area, int size,
const SDL_Color& colour, const std::string& txt,
const SDL_Color& color, const std::string& txt,
int x, int y, bool use_tooltips, int style)
{
// Make sure there's always at least a space,
@ -200,7 +200,7 @@ SDL_Rect draw_text(surface dst, const SDL_Rect& area, int size,
std::string::const_iterator i1 = text.begin();
std::string::const_iterator i2 = std::find(i1,text.end(),'\n');
for(;;) {
SDL_Color col = colour;
SDL_Color col = color;
int sz = size;
int text_style = style;
@ -230,10 +230,10 @@ SDL_Rect draw_text(surface dst, const SDL_Rect& area, int size,
}
SDL_Rect draw_text(CVideo* gui, const SDL_Rect& area, int size,
const SDL_Color& colour, const std::string& txt,
const SDL_Color& color, const std::string& txt,
int x, int y, bool use_tooltips, int style)
{
return draw_text(gui != NULL ? gui->getSurface() : NULL, area, size, colour, txt, x, y, use_tooltips, style);
return draw_text(gui != NULL ? gui->getSurface() : NULL, area, size, color, txt, x, y, use_tooltips, style);
}
bool is_format_char(char c)
@ -524,11 +524,11 @@ std::string word_wrap_text(const std::string& unwrapped_text, int font_size,
}
SDL_Rect draw_wrapped_text(CVideo* gui, const SDL_Rect& area, int font_size,
const SDL_Color& colour, const std::string& text,
const SDL_Color& color, const std::string& text,
int x, int y, int max_width)
{
std::string wrapped_text = word_wrap_text(text, font_size, max_width);
return font::draw_text(gui, area, font_size, colour, wrapped_text, x, y, false);
return font::draw_text(gui, area, font_size, color, wrapped_text, x, y, false);
}
} // end namespace font

View file

@ -37,7 +37,7 @@ extern const SDL_Color weapon_color, weapon_details_color, unit_type_color, race
std::string::const_iterator parse_markup(std::string::const_iterator i1,
std::string::const_iterator i2,
int* font_size,
SDL_Color* colour, int* style);
SDL_Color* color, int* style);
/**
* Function to draw text on a surface.
@ -53,7 +53,7 @@ std::string::const_iterator parse_markup(std::string::const_iterator i1,
* - any line beginning in @ will be displayed in GOOD_COLOR (green)
* - any line beginning in + will be displayed with size increased by 2
* - any line beginning in - will be displayed with size decreased by 2
* - any line beginning with 0x0n will be displayed in the colour of side n
* - any line beginning with 0x0n will be displayed in the color of side n
*
* The above special characters can be quoted using a C-style backslash.
*
@ -61,12 +61,12 @@ std::string::const_iterator parse_markup(std::string::const_iterator i1,
* text will not be drawn, and a bounding rectangle only will be returned.
*/
SDL_Rect draw_text(surface dst, const SDL_Rect& area, int size,
const SDL_Color& colour, const std::string& text,
const SDL_Color& color, const std::string& text,
int x, int y, bool use_tooltips = false, int style = 0);
/** wrapper of the previous function, gui can also be NULL */
SDL_Rect draw_text(CVideo* gui, const SDL_Rect& area, int size,
const SDL_Color& colour, const std::string& text,
const SDL_Color& color, const std::string& text,
int x, int y, bool use_tooltips = false, int style = 0);
/** Calculate the size of a text (in pixels) if it were to be drawn. */
@ -125,7 +125,7 @@ std::string word_wrap_text(const std::string& unwrapped_text, int font_size,
* @returns A bounding rectangle of the text.
*/
SDL_Rect draw_wrapped_text(CVideo* gui, const SDL_Rect& area, int font_size,
const SDL_Color& colour, const std::string& text,
const SDL_Color& color, const std::string& text,
int x, int y, int max_width);
} // end namespace font

View file

@ -393,7 +393,7 @@ void menu_handler::status_table(int selected)
//to see details about the other sides, only their own
//side, allied sides and a ??? is shown to demonstrate
//lack of information about the other sides But he see
//all names with in colours
//all names with in colors
for(size_t n = 0; n != teams_.size(); ++n) {
if(teams_[n].is_empty()||teams_[n].hidden()) {
continue;
@ -410,7 +410,7 @@ void menu_handler::status_table(int selected)
unit_map::const_iterator leader = units_.find_leader(n + 1);
std::string leader_name;
//output the number of the side first, and this will
//cause it to be displayed in the correct colour
//cause it to be displayed in the correct color
if(leader != units_.end()) {
// Add leader image. If it's fogged
@ -428,7 +428,7 @@ void menu_handler::status_table(int selected)
leader_name = teams_[n].current_player();
#ifndef LOW_MEM
str << "~RC(" << leader->team_color() << '>' << team::get_side_colour_index(n+1) << ')';
str << "~RC(" << leader->team_color() << '>' << team::get_side_color_index(n+1) << ')';
#endif
} else {
leader_bools.push_back(false);
@ -539,7 +539,7 @@ void menu_handler::scenario_settings_table(int selected)
}
#ifndef LOW_MEM
str << "~RC(" << leader->team_color() << '>'
<< team::get_side_colour_index(n+1) << ")";
<< team::get_side_color_index(n+1) << ")";
#endif
} else {
leader_bools.push_back(false);
@ -694,7 +694,7 @@ void menu_handler::recruit(int side_num, const map_location &last_hex)
description << font::IMAGE << type->image();
#ifndef LOW_MEM
description << "~RC(" << type->flag_rgb() << '>'
<< team::get_side_colour_index(side_num) << ')';
<< team::get_side_color_index(side_num) << ')';
#endif
description << COLUMN_SEPARATOR << font::LARGE_TEXT << prefix << type->type_name() << "\n"
<< prefix << type->cost() << " " << sngettext("unit^Gold", "Gold", type->cost());
@ -864,7 +864,7 @@ void menu_handler::recall(int side_num, const map_location &last_hex)
option << IMAGE_PREFIX << u.absolute_image();
#ifndef LOW_MEM
option << "~RC(" << u.team_color() << '>'
<< team::get_side_colour_index(side_num) << ')';
<< team::get_side_color_index(side_num) << ')';
#endif
option << COLUMN_SEPARATOR
<< u.type_name() << COLUMN_SEPARATOR
@ -1552,20 +1552,20 @@ void menu_handler::label_terrain(mouse_handler& mousehandler, bool team_only)
if(!d.show()) {
std::string team_name;
SDL_Color colour = font::LABEL_COLOR;
SDL_Color color = font::LABEL_COLOR;
if (d.option_checked()) {
team_name = gui_->labels().team_name();
} else {
colour = int_to_color(team::get_side_rgb(gui_->viewing_side()));
color = int_to_color(team::get_side_rgb(gui_->viewing_side()));
}
const std::string& old_team_name = old_label ? old_label->team_name() : "";
// remove the old label if we changed the team_name
if (d.option_checked() == (old_team_name == "")) {
const terrain_label* old = gui_->labels().set_label(loc, "", old_team_name, colour);
const terrain_label* old = gui_->labels().set_label(loc, "", old_team_name, color);
if (old) recorder.add_label(old);
}
const terrain_label* res = gui_->labels().set_label(loc, d.textbox_text(), team_name, colour);
const terrain_label* res = gui_->labels().set_label(loc, d.textbox_text(), team_name, color);
if (res)
recorder.add_label(res);
}

View file

@ -124,7 +124,7 @@ surface getMinimap(int w, int h, const gamemap &map, const team *vw)
surf = i->second;
if (need_fogging) {
surf = surface(adjust_surface_colour(surf,-50,-50,-50));
surf = surface(adjust_surface_color(surf,-50,-50,-50));
fog_cache->insert(cache_map::value_type(terrain,surf));
}

View file

@ -540,13 +540,13 @@ static void enter_lobby_mode(game_display& disp, const config& game_config, mp::
lobby_info li(game_config);
// Force a black background
const Uint32 colour = SDL_MapRGBA(disp.video().getSurface()->format
const Uint32 color = SDL_MapRGBA(disp.video().getSurface()->format
, 0
, 0
, 0
, 255);
SDL_FillRect(disp.video().getSurface(), NULL, colour);
SDL_FillRect(disp.video().getSurface(), NULL, color);
gui2::tlobby_main dlg(game_config, li, disp);
dlg.set_preferences_callback(

View file

@ -68,7 +68,7 @@ connect::side::side(connect& parent, const config& cfg, int index) :
controller_(CNTR_NETWORK),
faction_(cfg["faction"]),
team_(0),
colour_(index),
color_(index),
gold_(cfg["gold"].to_int(100)),
income_(cfg["income"]),
leader_(),
@ -78,7 +78,7 @@ connect::side::side(connect& parent, const config& cfg, int index) :
gold_lock_(cfg["gold_lock"].to_bool()),
income_lock_(cfg["income_lock"].to_bool()),
team_lock_(cfg["team_lock"].to_bool()),
colour_lock_(cfg["colour_lock"].to_bool()),
color_lock_(cfg["colour_lock"].to_bool()),
player_number_(parent.video(), str_cast(index + 1), font::SIZE_LARGE, font::LOBBY_COLOR),
combo_controller_(new gui::combo_drag(parent.disp(), parent.player_types_, parent.combo_control_group_)),
orig_controller_(parent.video(), current_player_, font::SIZE_SMALL),
@ -87,7 +87,7 @@ connect::side::side(connect& parent, const config& cfg, int index) :
combo_leader_(parent.disp(), std::vector<std::string>()),
combo_gender_(parent.disp(), std::vector<std::string>()),
combo_team_(parent.disp(), parent.player_teams_),
combo_colour_(parent.disp(), parent.player_colours_),
combo_color_(parent.disp(), parent.player_colors_),
slider_gold_(parent.video()),
slider_income_(parent.video()),
label_gold_(parent.video(), "100", font::SIZE_SMALL, font::LOBBY_COLOR),
@ -145,7 +145,7 @@ connect::side::side(connect& parent, const config& cfg, int index) :
combo_leader_.enable(enabled_);
combo_gender_.enable(enabled_);
combo_team_.enable(enabled_);
combo_colour_.enable(enabled_);
combo_color_.enable(enabled_);
slider_gold_.hide(!enabled_);
slider_income_.hide(!enabled_);
label_gold_.hide(!enabled_);
@ -161,9 +161,9 @@ connect::side::side(connect& parent, const config& cfg, int index) :
team_ = itor - parent_->team_names_.begin();
}
if (cfg.has_old_attribute("color","colour")) {
colour_ = game_config::color_info(cfg.get_old_attribute("color","colour")).index() - 1;
color_ = game_config::color_info(cfg.get_old_attribute("color","colour")).index() - 1;
}
llm_.set_colour(colour_);
llm_.set_color(color_);
update_faction_combo();
@ -226,13 +226,13 @@ connect::side::side(connect& parent, const config& cfg, int index) :
combo_gender_.set_items(gender_name_pseudolist);
combo_gender_.set_selected(0);
} else if(parent_->params_.use_map_settings) {
// gold, income, team, and colour are only suggestions unless explicitly locked
// gold, income, team, and color are only suggestions unless explicitly locked
slider_gold_.enable(!gold_lock_);
label_gold_.enable(!gold_lock_);
slider_income_.enable(!income_lock_);
label_income_.enable(!income_lock_);
combo_team_.enable(!team_lock_);
combo_colour_.enable(!colour_lock_);
combo_color_.enable(!color_lock_);
// Set the leader and gender
leader_ = cfg["type"].str();
@ -331,7 +331,7 @@ connect::side::side(const side& a) :
index_(a.index_), id_(a.id_), player_id_(a.player_id_), save_id_(a.save_id_),
current_player_(a.current_player_),
controller_(a.controller_),
faction_(a.faction_), team_(a.team_), colour_(a.colour_),
faction_(a.faction_), team_(a.team_), color_(a.color_),
gold_(a.gold_), income_(a.income_), leader_(a.leader_),
gender_(a.gender_),
ai_algorithm_(a.ai_algorithm_),
@ -339,18 +339,18 @@ connect::side::side(const side& a) :
gold_lock_(a.gold_lock_),
income_lock_(a.income_lock_),
team_lock_(a.team_lock_),
colour_lock_(a.colour_lock_),
color_lock_(a.color_lock_),
player_number_(a.player_number_), combo_controller_(a.combo_controller_),
orig_controller_(a.orig_controller_),
combo_ai_algorithm_(a.combo_ai_algorithm_),
combo_faction_(a.combo_faction_), combo_leader_(a.combo_leader_), combo_gender_(a.combo_gender_),
combo_team_(a.combo_team_), combo_colour_(a.combo_colour_),
combo_team_(a.combo_team_), combo_color_(a.combo_color_),
slider_gold_(a.slider_gold_), slider_income_(a.slider_income_),
label_gold_(a.label_gold_), label_income_(a.label_income_),
allow_player_(a.allow_player_), allow_changes_(a.allow_changes_),
enabled_(a.enabled_), changed_(a.changed_), llm_(a.llm_)
{
llm_.set_colour(colour_);
llm_.set_color(color_);
llm_.set_leader_combo((enabled_ && leader_.empty()) ? &combo_leader_ : NULL);
llm_.set_gender_combo((enabled_ && leader_.empty()) ? &combo_gender_ : NULL);
// FIXME: this is an ugly hack to force updating the gender list when the side
@ -369,7 +369,7 @@ void connect::side::add_widgets_to_scrollpane(gui::scrollpane& pane, int pos)
pane.add_widget(&combo_leader_, 135, 35 + pos);
pane.add_widget(&combo_gender_, 250, 35 + pos);
pane.add_widget(&combo_team_, 250, 5 + pos);
pane.add_widget(&combo_colour_, 365, 5 + pos);
pane.add_widget(&combo_color_, 365, 5 + pos);
pane.add_widget(&slider_gold_, 475, 5 + pos);
pane.add_widget(&label_gold_, 475, 35 + pos);
pane.add_widget(&slider_income_, 475 + slider_gold_.width(), 5 + pos);
@ -437,9 +437,9 @@ void connect::side::process_event()
if(!enabled_)
return;
if (combo_colour_.changed() && combo_colour_.selected() >= 0) {
colour_ = combo_colour_.selected();
llm_.set_colour(colour_);
if (combo_color_.changed() && combo_color_.selected() >= 0) {
color_ = combo_color_.selected();
llm_.set_color(color_);
update_faction_combo();
llm_.set_leader_combo(&combo_leader_);
llm_.set_gender_combo(&combo_gender_);
@ -597,7 +597,7 @@ void connect::side::update_faction_combo()
if (rgb.empty())
rgb = "magenta";
factions.push_back(IMAGE_PREFIX + icon + "~RC(" + rgb + ">" + lexical_cast<std::string>(colour_+1) + ")" + COLUMN_SEPARATOR + name);
factions.push_back(IMAGE_PREFIX + icon + "~RC(" + rgb + ">" + lexical_cast<std::string>(color_+1) + ")" + COLUMN_SEPARATOR + name);
} else {
factions.push_back(name);
}
@ -615,7 +615,7 @@ void connect::side::update_ui()
}
combo_team_.set_selected(team_);
combo_colour_.set_selected(colour_);
combo_color_.set_selected(color_);
slider_gold_.set_value(gold_);
label_gold_.set_text(str_cast(gold_));
slider_income_.set_value(income_);
@ -730,7 +730,7 @@ config connect::side::get_config() const
res["team_name"] = parent_->team_names_[team_];
res["user_team_name"] = parent_->user_team_names_[team_];
res["allow_player"] = allow_player_;
res["color"] = colour_ + 1;
res["color"] = color_ + 1;
res["gold"] = gold_;
res["income"] = income_;
@ -988,7 +988,7 @@ connect::connect(game_display& disp, const config& game_config,
player_types_(),
player_factions_(),
player_teams_(),
player_colours_(),
player_colors_(),
ai_algorithms_(),
team_names_(),
user_team_names_(),
@ -1002,7 +1002,7 @@ connect::connect(game_display& disp, const config& game_config,
type_title_label_(video(), _("Player/Type"), font::SIZE_SMALL, font::LOBBY_COLOR),
faction_title_label_(video(), _("Faction"), font::SIZE_SMALL, font::LOBBY_COLOR),
team_title_label_(video(), _("Team/Gender"), font::SIZE_SMALL, font::LOBBY_COLOR),
colour_title_label_(video(), _("Color"), font::SIZE_SMALL, font::LOBBY_COLOR),
color_title_label_(video(), _("Color"), font::SIZE_SMALL, font::LOBBY_COLOR),
gold_title_label_(video(), _("Gold"), font::SIZE_SMALL, font::LOBBY_COLOR),
income_title_label_(video(), _("Income"), font::SIZE_SMALL, font::LOBBY_COLOR),
@ -1173,7 +1173,7 @@ void connect::hide_children(bool hide)
}
faction_title_label_.hide(hide);
team_title_label_.hide(hide);
colour_title_label_.hide(hide);
color_title_label_.hide(hide);
if (!params_.saved_game) {
gold_title_label_.hide(hide);
income_title_label_.hide(hide);
@ -1428,7 +1428,7 @@ void connect::layout_children(const SDL_Rect& rect)
type_title_label_.set_location(left+30, top+35);
faction_title_label_.set_location((left+145), top+35);
team_title_label_.set_location((left+260), top+35);
colour_title_label_.set_location((left+375), top+35);
color_title_label_.set_location((left+375), top+35);
gold_title_label_.set_location((left+493), top+35);
income_title_label_.set_location((left+560), top+35);
@ -1519,9 +1519,9 @@ void connect::lists_init()
}
}
// Colours
// Colors
for(int i = 0; i < gamemap::MAX_PLAYERS; ++i) {
player_colours_.push_back(get_colour_string(i));
player_colors_.push_back(get_color_string(i));
}
// Populates "sides_" from the level configuration

View file

@ -149,7 +149,7 @@ public:
mp::controller controller_;
int faction_;
int team_;
int colour_;
int color_;
int gold_;
int income_;
std::string leader_;
@ -161,7 +161,7 @@ public:
bool gold_lock_;
bool income_lock_;
bool team_lock_;
bool colour_lock_;
bool color_lock_;
// Widgets for this side
gui::label player_number_;
@ -172,7 +172,7 @@ public:
gui::combo combo_leader_;
gui::combo combo_gender_;
gui::combo combo_team_;
gui::combo combo_colour_;
gui::combo combo_color_;
gui::slider slider_gold_;
gui::slider slider_income_;
gui::label label_gold_;
@ -289,7 +289,7 @@ private:
std::vector<std::string> player_types_;
std::vector<std::string> player_factions_;
std::vector<std::string> player_teams_;
std::vector<std::string> player_colours_;
std::vector<std::string> player_colors_;
std::vector<ai::description*> ai_algorithms_;
// team_name list and "Team" prefix
@ -311,7 +311,7 @@ private:
gui::label type_title_label_;
gui::label faction_title_label_;
gui::label team_title_label_;
gui::label colour_title_label_;
gui::label color_title_label_;
gui::label gold_title_label_;
gui::label income_title_label_;

View file

@ -185,7 +185,7 @@ void level_to_gamestate(config& level, game_state& state)
}
}
std::string get_colour_string(int id)
std::string get_color_string(int id)
{
std::string prefix = team::get_side_highlight(id);
std::map<std::string, t_string>::iterator name = game_config::team_rgb_name.find(str_cast(id + 1));

View file

@ -38,7 +38,7 @@ void check_response(network::connection res, const config& data);
void level_to_gamestate(config& level, game_state& state);
std::string get_colour_string(int id);
std::string get_color_string(int id);
/** this class memorizes a chat session. */
class chat

View file

@ -48,7 +48,7 @@ wait::leader_preview_pane::leader_preview_pane(game_display& disp,
leaders_(side_list, &leader_combo_, &gender_combo_),
selection_(0)
{
leaders_.set_colour(color_);
leaders_.set_color(color_);
set_location(leader_pane_position);
}
@ -519,12 +519,12 @@ void wait::generate_menu()
}
} else {
/**
* @todo we fall back to the side colour, but that's ugly rather
* make the colour mandatory in 1.5.
* @todo we fall back to the side color, but that's ugly rather
* make the color mandatory in 1.5.
*/
disp_color = sd["side"];
}
str << COLUMN_SEPARATOR << get_colour_string(disp_color - 1);
str << COLUMN_SEPARATOR << get_color_string(disp_color - 1);
details.push_back(str.str());
}

View file

@ -470,7 +470,7 @@ void play_controller::fire_start(bool execute){
void play_controller::init_gui(){
gui_->begin_game();
gui_->adjust_colours(0,0,0);
gui_->adjust_colors(0,0,0);
for(std::vector<team>::iterator t = teams_.begin(); t != teams_.end(); ++t) {
::clear_shroud(t - teams_.begin() + 1);

View file

@ -224,8 +224,8 @@ void playmp_controller::play_human_turn(){
{
font::floating_label flabel(_("Undoing moves not yet transmitted to the server."));
SDL_Color colour = {255,255,255,255};
flabel.set_colour(colour);
SDL_Color color = {255,255,255,255};
flabel.set_color(color);
SDL_Rect rect = gui_->map_area();
flabel.set_position(rect.w/2, rect.h/2);
flabel.set_lifetime(150);

View file

@ -910,7 +910,7 @@ void playsingle_controller::store_gold(bool obs)
if ((*side_it)["save_id"] == t.save_id()) {
(*side_it)["gold"] = str_cast<int>(carryover_gold);
(*side_it)["gold_add"] = end_level.carryover_add;
(*side_it)["color"] = t.colour();
(*side_it)["color"] = t.color();
(*side_it)["current_player"] = t.current_player();
(*side_it)["name"] = t.name();
break;
@ -924,7 +924,7 @@ void playsingle_controller::store_gold(bool obs)
new_side["save_id"] = t.save_id();
new_side["gold"] = str_cast<int>(carryover_gold);
new_side["gold_add"] = end_level.carryover_add;
new_side["color"] = t.colour();
new_side["color"] = t.color();
new_side["current_player"] = t.current_player();
new_side["name"] = t.name();
}

View file

@ -37,7 +37,7 @@ static lg::log_domain log_filesystem("filesystem");
namespace {
bool colour_cursors = false;
bool color_cursors = false;
bool no_preferences_save = false;
@ -548,15 +548,15 @@ void set_draw_delay(int value)
draw_delay_ = value;
}
bool use_colour_cursors()
bool use_color_cursors()
{
return colour_cursors;
return color_cursors;
}
void _set_colour_cursors(bool value)
void _set_color_cursors(bool value)
{
preferences::set("colour_cursors", value);
colour_cursors = value;
color_cursors = value;
}
void load_hotkeys() {

View file

@ -120,8 +120,8 @@ namespace preferences {
void add_alias(const std::string& alias, const std::string& command);
const config &get_alias();
bool use_colour_cursors();
void _set_colour_cursors(bool value);
bool use_color_cursors();
void _set_color_cursors(bool value);
int scroll_speed();
void set_scroll_speed(const int scroll);

View file

@ -47,7 +47,7 @@ display_manager::display_manager(display* d)
set_turbo_speed(turbo_speed());
set_fullscreen(fullscreen());
set_scroll_to_action(scroll_to_action());
set_colour_cursors(preferences::get("colour_cursors", false));
set_color_cursors(preferences::get("colour_cursors", false));
}
display_manager::~display_manager()
@ -128,7 +128,7 @@ void set_fullscreen(CVideo& video, const bool ison)
gui2::show_transient_message(video,"",_("The video mode could not be changed. Your window manager must be set to 16 bits per pixel to run the game in windowed mode. Your display must support 1024x768x16 to run the game full screen."));
}
// We reinit color cursors, because SDL on Mac seems to forget the SDL_Cursor
set_colour_cursors(preferences::get("colour_cursors", false));
set_color_cursors(preferences::get("colour_cursors", false));
}
}
}
@ -234,9 +234,9 @@ void set_grid(bool ison)
}
}
void set_colour_cursors(bool value)
void set_color_cursors(bool value)
{
_set_colour_cursors(value);
_set_color_cursors(value);
cursor::set();
}

View file

@ -63,7 +63,7 @@ namespace preferences {
void set_ellipses(bool ison);
void set_grid(bool ison);
void set_turbo_speed(double speed);
void set_colour_cursors(bool value);
void set_color_cursors(bool value);
// Control unit idle animations
void set_idle_anim(bool ison);

View file

@ -855,7 +855,7 @@ bool do_replay_handle(int side_num, const std::string &do_untill)
resources::screen->labels().set_label(label.location(),
label.text(),
label.team_name(),
label.colour());
label.color());
}
else if (const config &child = cfg->child("clear_labels"))
{

View file

@ -618,7 +618,7 @@ surface scale_surface_blended(const surface &surf, int w, int h, bool optimize)
return optimize ? create_optimized_surface(dst) : dst;
}
surface adjust_surface_colour(const surface &surf, int red, int green, int blue, bool optimize)
surface adjust_surface_color(const surface &surf, int red, int green, int blue, bool optimize)
{
if((red == 0 && green == 0 && blue == 0) || surf == NULL)
return create_optimized_surface(surf);
@ -1303,7 +1303,7 @@ surface cut_surface(const surface &surf, SDL_Rect const &r)
return res;
}
surface blend_surface(const surface &surf, double amount, Uint32 colour, bool optimize)
surface blend_surface(const surface &surf, double amount, Uint32 color, bool optimize)
{
if(surf== NULL) {
return NULL;
@ -1322,7 +1322,7 @@ surface blend_surface(const surface &surf, double amount, Uint32 colour, bool op
Uint32* end = beg + nsurf->w*surf->h;
Uint8 red, green, blue, alpha;
SDL_GetRGBA(colour,nsurf->format,&red,&green,&blue,&alpha);
SDL_GetRGBA(color,nsurf->format,&red,&green,&blue,&alpha);
red = Uint8(red * amount);
green = Uint8(green * amount);
@ -1581,10 +1581,10 @@ void blit_surface(const surface& src,
void fill_rect_alpha(SDL_Rect &rect, Uint32 colour, Uint8 alpha, const surface &target)
void fill_rect_alpha(SDL_Rect &rect, Uint32 color, Uint8 alpha, const surface &target)
{
if(alpha == SDL_ALPHA_OPAQUE) {
SDL_FillRect(target,&rect,colour);
SDL_FillRect(target,&rect,color);
return;
} else if(alpha == SDL_ALPHA_TRANSPARENT) {
return;
@ -1596,7 +1596,7 @@ void fill_rect_alpha(SDL_Rect &rect, Uint32 colour, Uint8 alpha, const surface &
}
SDL_Rect r = {0,0,rect.w,rect.h};
SDL_FillRect(tmp,&r,colour);
SDL_FillRect(tmp,&r,color);
SDL_SetAlpha(tmp,SDL_SRCALPHA,alpha);
SDL_BlitSurface(tmp,NULL,target,&rect);
}
@ -1734,11 +1734,11 @@ bool operator!=(const SDL_Color& a, const SDL_Color& b) {
return !operator==(a,b);
}
SDL_Color inverse(const SDL_Color& colour) {
SDL_Color inverse(const SDL_Color& color) {
SDL_Color inverse;
inverse.r = 255 - colour.r;
inverse.g = 255 - colour.g;
inverse.b = 255 - colour.b;
inverse.r = 255 - color.r;
inverse.g = 255 - color.g;
inverse.b = 255 - color.b;
inverse.unused = 0;
return inverse;
}
@ -1794,7 +1794,7 @@ void surface_restorer::cancel()
surface_.assign(NULL);
}
void draw_rectangle(int x, int y, int w, int h, Uint32 colour,surface target)
void draw_rectangle(int x, int y, int w, int h, Uint32 color,surface target)
{
SDL_Rect top = {x,y,w,1};
@ -1802,10 +1802,10 @@ void draw_rectangle(int x, int y, int w, int h, Uint32 colour,surface target)
SDL_Rect left = {x,y,1,h};
SDL_Rect right = {x+w-1,y,1,h};
SDL_FillRect(target,&top,colour);
SDL_FillRect(target,&bot,colour);
SDL_FillRect(target,&left,colour);
SDL_FillRect(target,&right,colour);
SDL_FillRect(target,&top,color);
SDL_FillRect(target,&bot,color);
SDL_FillRect(target,&left,color);
SDL_FillRect(target,&right,color);
}
void draw_solid_tinted_rectangle(int x, int y, int w, int h,

View file

@ -203,7 +203,7 @@ surface scale_surface(const surface &surf, int w, int h, bool optimize=true);
surface scale_opaque_surface(const surface &surf, int w, int h, bool optimize_format=false);
surface scale_surface_blended(const surface &surf, int w, int h, bool optimize=true);
surface adjust_surface_colour(const surface &surf, int r, int g, int b, bool optimize=true);
surface adjust_surface_color(const surface &surf, int r, int g, int b, bool optimize=true);
surface greyscale_image(const surface &surf, bool optimize=true);
/** create an heavy shadow of the image, by blurring, increasing alpha and darkening */
surface shadow_image(const surface &surf, bool optimize=true);
@ -272,7 +272,7 @@ surface blur_alpha_surface(const surface &surf, int depth = 1, bool optimize=tru
/** Cuts a rectangle from a surface. */
surface cut_surface(const surface &surf, SDL_Rect const &r);
surface blend_surface(const surface &surf, double amount, Uint32 colour, bool optimize=true);
surface blend_surface(const surface &surf, double amount, Uint32 color, bool optimize=true);
surface flip_surface(const surface &surf, bool optimize=true);
surface flop_surface(const surface &surf, bool optimize=true);
surface create_compatible_surface(const surface &surf, int width = -1, int height = -1);
@ -294,7 +294,7 @@ surface create_compatible_surface(const surface &surf, int width = -1, int heigh
void blit_surface(const surface& src,
const SDL_Rect* srcrect, surface& dst, const SDL_Rect* dstrect);
void fill_rect_alpha(SDL_Rect &rect, Uint32 colour, Uint8 alpha, const surface &target);
void fill_rect_alpha(SDL_Rect &rect, Uint32 color, Uint8 alpha, const surface &target);
SDL_Rect get_non_transparent_portion(const surface &surf);
@ -302,7 +302,7 @@ bool operator==(const SDL_Rect& a, const SDL_Rect& b);
bool operator!=(const SDL_Rect& a, const SDL_Rect& b);
bool operator==(const SDL_Color& a, const SDL_Color& b);
bool operator!=(const SDL_Color& a, const SDL_Color& b);
SDL_Color inverse(const SDL_Color& colour);
SDL_Color inverse(const SDL_Color& color);
SDL_Color int_to_color(const Uint32 rgb);
/**
@ -363,7 +363,7 @@ private:
};
void draw_rectangle(int x, int y, int w, int h, Uint32 colour, surface tg);
void draw_rectangle(int x, int y, int w, int h, Uint32 color, surface tg);
void draw_solid_tinted_rectangle(int x, int y, int w, int h,
int r, int g, int b,

View file

@ -274,7 +274,7 @@ void part_ui::render_title_box()
t.set_font_style(font::ttext::STYLE_NORMAL)
.set_font_size(titlebox_font_size)
.set_foreground_colour(titlebox_font_color)
.set_foreground_color(titlebox_font_color)
.set_maximum_width(titlebox_max_w)
.set_maximum_height(titlebox_max_h);
surface txtsurf = t.render();
@ -392,7 +392,7 @@ void part_ui::render_story_box()
}
t.set_font_style(font::ttext::STYLE_NORMAL)
.set_font_size(storybox_font_size)
.set_foreground_colour(storybox_font_color)
.set_foreground_color(storybox_font_color)
.set_maximum_width(max_width)
.set_maximum_height(max_height);
surface txtsurf = t.render();

View file

@ -75,7 +75,7 @@ team::team_info::team_info(const config& cfg) :
no_leader(cfg["no_leader"].to_bool()),
hidden(cfg["hidden"].to_bool()),
music(cfg["music"]),
colour(cfg.has_old_attribute("color","colour") ? cfg.get_old_attribute("color","colour") : cfg["side"]),
color(cfg.has_old_attribute("color","colour") ? cfg.get_old_attribute("color","colour") : cfg["side"]),
side(cfg["side"].to_int(1)),
persistent(false)
{
@ -217,7 +217,7 @@ void team::team_info::write(config& cfg) const
if(music.empty() == false)
cfg["music"] = music;
cfg["color"] = str_cast(colour);
cfg["color"] = str_cast(color);
cfg["persistent"] = persistent;
@ -670,7 +670,7 @@ bool team::shroud_map::copy_from(const std::vector<const shroud_map*>& maps)
std::map<int, color_range> team::team_color_range_;
const color_range team::get_side_color_range(int side){
std::string index = get_side_colour_index(side);
std::string index = get_side_color_index(side);
std::map<std::string, color_range>::iterator gp=game_config::team_rgb_range.find(index);
if(gp != game_config::team_rgb_range.end()){
@ -680,19 +680,19 @@ const color_range team::get_side_color_range(int side){
return(color_range(0x00FF0000,0x00FFFFFF,0x00000000,0x00FF0000));
}
const SDL_Color team::get_minimap_colour(int side)
const SDL_Color team::get_minimap_color(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());
}
std::string team::get_side_colour_index(int side)
std::string team::get_side_color_index(int side)
{
size_t index = size_t(side-1);
if(teams != NULL && index < teams->size()) {
const std::string side_map = (*teams)[index].map_colour_to();
const std::string side_map = (*teams)[index].map_color_to();
if(side_map.size()) {
return side_map;
}

View file

@ -105,7 +105,7 @@ public:
std::string music;
std::string colour;
std::string color;
int side;
bool persistent;
@ -195,7 +195,7 @@ public:
}
team_info::CONTROLLER controller() const { return info_.controller; }
const std::string& colour() const { return info_.colour; }
const std::string& color() const { return info_.color; }
bool is_human() const { return info_.controller == team_info::HUMAN; }
bool is_human_ai() const { return info_.controller == team_info::HUMAN_AI; }
bool is_network_human() const { return info_.controller == team_info::NETWORK; }
@ -247,7 +247,7 @@ public:
bool auto_shroud_updates() const { return auto_shroud_updates_; }
void set_auto_shroud_updates(bool value) { auto_shroud_updates_ = value; }
bool get_disallow_observers() const {return info_.disallow_observers; };
std::string map_colour_to() const { return info_.colour; };
std::string map_color_to() const { return info_.color; };
bool no_leader() const { return info_.no_leader; }
void have_leader(bool value=true) { info_.no_leader = !value; }
bool hidden() const { return info_.hidden; }
@ -256,13 +256,13 @@ public:
static int nteams();
//function which, when given a 1-based side will return the colour used by that side.
//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 Uint32 get_side_rgb(int side) { return(get_side_color_range(side).mid()); }
static Uint32 get_side_rgb_max(int side) { return(get_side_color_range(side).max()); }
static Uint32 get_side_rgb_min(int side) { return(get_side_color_range(side).min()); }
static const SDL_Color get_minimap_colour(int side);
static std::string get_side_colour_index(int side);
static const SDL_Color get_minimap_color(int side);
static std::string get_side_color_index(int side);
static std::string get_side_highlight(int side);
void log_recruitable();

View file

@ -77,7 +77,7 @@ ttext::ttext() :
markedup_text_(false),
font_size_(14),
font_style_(STYLE_NORMAL),
foreground_colour_(0xFFFFFFFF), // solid white
foreground_color_(0xFFFFFFFF), // solid white
maximum_width_(-1),
maximum_height_(-1),
ellipse_mode_(PANGO_ELLIPSIZE_END),
@ -331,10 +331,10 @@ ttext& ttext::set_font_style(const unsigned font_style)
return *this;
}
ttext& ttext::set_foreground_colour(const Uint32 colour)
ttext& ttext::set_foreground_color(const Uint32 color)
{
if(colour != foreground_colour_) {
foreground_colour_ = colour;
if(color != foreground_color_) {
foreground_color_ = color;
surface_dirty_ = true;
}
@ -601,12 +601,12 @@ void ttext::rerender(const bool force) const
CAIRO_FORMAT_ARGB32, width, height, stride);
cairo_t *cr = cairo_create(cairo_surface);
/* set colour (used for foreground). */
/* set color (used for foreground). */
cairo_set_source_rgba(cr,
(foreground_colour_ >> 24) / 256.0,
((foreground_colour_ >> 16) & 0xFF) / 256.0,
((foreground_colour_ >> 8) & 0xFF) / 256.0,
(foreground_colour_ & 0xFF) / 256.0);
(foreground_color_ >> 24) / 256.0,
((foreground_color_ >> 16) & 0xFF) / 256.0,
((foreground_color_ >> 8) & 0xFF) / 256.0,
(foreground_color_ & 0xFF) / 256.0);
pango_cairo_show_layout(cr, layout_);

View file

@ -32,7 +32,7 @@ namespace gui2 {
namespace font {
// add background colour and also font markup.
// add background color and also font markup.
/**
* Text class.
@ -169,7 +169,7 @@ public:
ttext& set_font_style(const unsigned font_style);
ttext& set_foreground_colour(const Uint32 colour);
ttext& set_foreground_color(const Uint32 color);
ttext& set_maximum_width(int width);
@ -203,8 +203,8 @@ private:
/** The style of the font, this is an orred mask of the font flags. */
unsigned font_style_;
/** The foreground colour. */
Uint32 foreground_colour_;
/** The foreground color. */
Uint32 foreground_color_;
/**
* The maximum width of the text.

View file

@ -57,7 +57,7 @@ struct time_of_day
std::string image_mask;
/**
* The colour modifications that should be made
* The color modifications that should be made
* to the game board to reflect the time of day.
*/
int red, green, blue;

View file

@ -143,10 +143,10 @@ bool image_empty(surface surf)
Uint32* beg = lock.pixels();
Uint32* end = beg + surf->w*surf->h;
Uint32 colour = *beg;
Uint32 color = *beg;
while(beg != end) {
if((*beg & 0xff000000) != 0 && (*beg != colour))
if((*beg & 0xff000000) != 0 && (*beg != color))
return false;
++beg;

View file

@ -66,7 +66,7 @@ static void show_tooltip(const tooltip& tip)
clear_tooltip();
const SDL_Color bgcolour = {0,0,0,160};
const SDL_Color bgcolor = {0,0,0,160};
SDL_Rect area = screen_area();
#ifdef USE_TINY_GUI
@ -77,11 +77,11 @@ static void show_tooltip(const tooltip& tip)
font::floating_label flabel(tip.message);
flabel.set_font_size(font_size);
flabel.set_colour(font::NORMAL_COLOR);
flabel.set_color(font::NORMAL_COLOR);
flabel.set_clip_rect(area);
flabel.set_width(text_width);
flabel.set_alignement(font::LEFT_ALIGN);
flabel.set_bg_colour(bgcolour);
flabel.set_bg_color(bgcolor);
flabel.set_border_size(border);
tooltip_handle = font::add_floating_label(flabel);

View file

@ -944,75 +944,75 @@ std::string unit::transparent() const {
SDL_Color unit::hp_color() const
{
double unit_energy = 0.0;
SDL_Color energy_colour = {0,0,0,0};
SDL_Color energy_color = {0,0,0,0};
if(max_hitpoints() > 0) {
unit_energy = double(hitpoints())/double(max_hitpoints());
}
if(1.0 == unit_energy){
energy_colour.r = 33;
energy_colour.g = 225;
energy_colour.b = 0;
energy_color.r = 33;
energy_color.g = 225;
energy_color.b = 0;
} else if(unit_energy > 1.0) {
energy_colour.r = 100;
energy_colour.g = 255;
energy_colour.b = 100;
energy_color.r = 100;
energy_color.g = 255;
energy_color.b = 100;
} else if(unit_energy >= 0.75) {
energy_colour.r = 170;
energy_colour.g = 255;
energy_colour.b = 0;
energy_color.r = 170;
energy_color.g = 255;
energy_color.b = 0;
} else if(unit_energy >= 0.5) {
energy_colour.r = 255;
energy_colour.g = 175;
energy_colour.b = 0;
energy_color.r = 255;
energy_color.g = 175;
energy_color.b = 0;
} else if(unit_energy >= 0.25) {
energy_colour.r = 255;
energy_colour.g = 155;
energy_colour.b = 0;
energy_color.r = 255;
energy_color.g = 155;
energy_color.b = 0;
} else {
energy_colour.r = 255;
energy_colour.g = 0;
energy_colour.b = 0;
energy_color.r = 255;
energy_color.g = 0;
energy_color.b = 0;
}
return energy_colour;
return energy_color;
}
SDL_Color unit::xp_color() const
{
const SDL_Color near_advance_colour = {255,255,255,0};
const SDL_Color mid_advance_colour = {150,255,255,0};
const SDL_Color far_advance_colour = {0,205,205,0};
const SDL_Color normal_colour = {0,160,225,0};
const SDL_Color near_amla_colour = {225,0,255,0};
const SDL_Color mid_amla_colour = {169,30,255,0};
const SDL_Color far_amla_colour = {139,0,237,0};
const SDL_Color amla_colour = {170,0,255,0};
const SDL_Color near_advance_color = {255,255,255,0};
const SDL_Color mid_advance_color = {150,255,255,0};
const SDL_Color far_advance_color = {0,205,205,0};
const SDL_Color normal_color = {0,160,225,0};
const SDL_Color near_amla_color = {225,0,255,0};
const SDL_Color mid_amla_color = {169,30,255,0};
const SDL_Color far_amla_color = {139,0,237,0};
const SDL_Color 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;
const bool far_advance = max_experience() - experience() <= game_config::kill_experience*3;
SDL_Color colour=normal_colour;
SDL_Color color=normal_color;
if(advances_to().size()){
if(near_advance){
colour=near_advance_colour;
color=near_advance_color;
} else if(mid_advance){
colour=mid_advance_colour;
color=mid_advance_color;
} else if(far_advance){
colour=far_advance_colour;
color=far_advance_color;
}
} else if (get_modification_advances().size()){
if(near_advance){
colour=near_amla_colour;
color=near_amla_color;
} else if(mid_advance){
colour=mid_amla_colour;
color=mid_amla_color;
} else if(far_advance){
colour=far_amla_colour;
color=far_amla_color;
} else {
colour=amla_colour;
color=amla_color;
}
}
return(colour);
return(color);
}
std::string unit::side_id() const {return teams_manager::get_teams()[side()-1].save_id(); }
@ -1842,7 +1842,7 @@ void unit::redraw_unit()
surface ellipse_front(NULL);
surface ellipse_back(NULL);
int ellipse_floating = 0;
if(draw_bars && preferences::show_side_colours()) {
if(draw_bars && preferences::show_side_colors()) {
// The division by 2 seems to have no real meaning,
// It just works fine with the current center of ellipse
// and prevent a too large adjust if submerge = 1.0
@ -1857,7 +1857,7 @@ void unit::redraw_unit()
// Load the ellipse parts recolored to match team color
char buf[100];
std::string tc=team::get_side_colour_index(side_);
std::string tc=team::get_side_color_index(side_);
snprintf(buf,sizeof(buf),"%s-%stop.png~RC(ellipse_red>%s)",ellipse.c_str(),selected,tc.c_str());
ellipse_back.assign(image::get_image(image::locator(buf), image::SCALED_TO_ZOOM));
@ -1926,9 +1926,9 @@ void unit::redraw_unit()
const int xp_bar_height = static_cast<int>(max_experience()*game_config::xp_bar_scaling / std::max<int>(level_,1));
SDL_Color colour=xp_color();
SDL_Color color=xp_color();
disp.draw_bar(*energy_file, xsrc, ysrc +adjusted_params.y,
loc_, xp_bar_height, filled, colour, bar_alpha);
loc_, xp_bar_height, filled, color, bar_alpha);
}
if (can_recruit()) {
@ -2824,7 +2824,7 @@ temporary_unit_mover::~temporary_unit_mover()
std::string unit::TC_image_mods() const{
std::stringstream modifier;
if(flag_rgb_.size()){
modifier << "~RC("<< flag_rgb_ << ">" << team::get_side_colour_index(side()) << ")";
modifier << "~RC("<< flag_rgb_ << ">" << team::get_side_color_index(side()) << ")";
}
return modifier.str();
}

View file

@ -660,11 +660,11 @@ const frame_parameters unit_frame::merge_parameters(int current_time,const frame
assert(engine_val.text_color == 0);
result.text_color = current_val.text_color?current_val.text_color:animation_val.text_color;
/** engine provide a blend colour for poisoned units */
/** engine provide a blend color for poisoned units */
result.blend_with = current_val.blend_with?current_val.blend_with:animation_val.blend_with;
if(primary&& engine_val.blend_with) result.blend_with = display::max_rgb(engine_val.blend_with,result.blend_with);
/** engine provide a blend colour for poisoned units */
/** engine provide a blend color for poisoned units */
result.blend_ratio = current_val.blend_ratio?current_val.blend_ratio:animation_val.blend_ratio;
if(primary && engine_val.blend_ratio) result.blend_ratio = std::min(result.blend_ratio + engine_val.blend_ratio,1.0);

View file

@ -457,7 +457,7 @@ int CVideo::set_help_string(const std::string& str)
{
font::remove_floating_label(help_string_);
const SDL_Color colour = { 0, 0, 0, 0xbb };
const SDL_Color color = { 0, 0, 0, 0xbb };
#ifdef USE_TINY_GUI
int size = font::SIZE_NORMAL;
@ -482,7 +482,7 @@ int CVideo::set_help_string(const std::string& str)
font::floating_label flabel(str);
flabel.set_font_size(size);
flabel.set_position(getx()/2, gety());
flabel.set_bg_colour(colour);
flabel.set_bg_color(color);
flabel.set_border_size(border);
help_string_ = font::add_floating_label(flabel);

View file

@ -226,13 +226,13 @@ void button::draw_contents()
textx = loc.x + image_w + checkbox_horizontal_padding / 2;
}
SDL_Color button_colour = font::BUTTON_COLOR;
SDL_Color button_color = font::BUTTON_COLOR;
if (!enabled()) {
static const Uint32 disabled_btn_color = 0xAAAAAA;
static const double disabled_btn_adjust = 0.18;
image = blend_surface(greyscale_image(image), disabled_btn_adjust, disabled_btn_color);
button_colour = font::GRAY_COLOR;
button_color = font::GRAY_COLOR;
}
video().blit_surface(loc.x, loc.y, image);
@ -241,7 +241,7 @@ void button::draw_contents()
clipArea.y += offset;
clipArea.w -= 2*offset;
clipArea.h -= 2*offset;
font::draw_text(&video(), clipArea, font_size, button_colour, label_, textx, texty);
font::draw_text(&video(), clipArea, font_size, button_color, label_, textx, texty);
}
update_rect(loc);

View file

@ -21,7 +21,7 @@
namespace gui {
label::label(CVideo& video, const std::string& text, int size, const SDL_Color& colour, const bool auto_join) : widget(video, auto_join), text_(text), size_(size), colour_(colour)
label::label(CVideo& video, const std::string& text, int size, const SDL_Color& color, const bool auto_join) : widget(video, auto_join), text_(text), size_(size), color_(color)
{
update_label_size();
}
@ -42,23 +42,23 @@ const std::string& label::get_text() const
return text_;
}
const SDL_Color& label::set_colour(const SDL_Color& colour)
const SDL_Color& label::set_color(const SDL_Color& color)
{
colour_ = colour;
color_ = color;
set_dirty();
return get_colour();
return get_color();
}
const SDL_Color& label::get_colour() const
const SDL_Color& label::get_color() const
{
return (enabled()) ? colour_ : font::DISABLED_COLOR;
return (enabled()) ? color_ : font::DISABLED_COLOR;
}
void label::draw_contents()
{
const SDL_Rect& loc = location();
if (!text_.empty() && loc.w > 0 && loc.h > 0)
font::draw_text(&video(), loc, size_, get_colour(), text_, loc.x, loc.y);
font::draw_text(&video(), loc, size_, get_color(), text_, loc.x, loc.y);
}
void label::update_label_size()

View file

@ -25,12 +25,12 @@ class label : public widget
{
public:
label(CVideo& video, const std::string& text, int size=font::SIZE_NORMAL,
const SDL_Color& colour=font::NORMAL_COLOR, const bool auto_join=true);
const SDL_Color& color=font::NORMAL_COLOR, const bool auto_join=true);
const std::string& set_text(const std::string& text);
const std::string& get_text() const;
const SDL_Color& set_colour(const SDL_Color& colour);
const SDL_Color& get_colour() const;
const SDL_Color& set_color(const SDL_Color& color);
const SDL_Color& get_color() const;
virtual void draw_contents();
private:
@ -38,7 +38,7 @@ private:
std::string text_;
int size_;
SDL_Color colour_;
SDL_Color color_;
};
}

View file

@ -142,10 +142,10 @@ void slider::draw_contents()
surface image(state_ != NORMAL ? highlightedImage_ : image_);
if (image == NULL)
return;
SDL_Color line_colour = font::NORMAL_COLOR;
SDL_Color line_color = font::NORMAL_COLOR;
if (!enabled()) {
image = greyscale_image(image);
line_colour = font::DISABLED_COLOR;
line_color = font::DISABLED_COLOR;
}
SDL_Rect const &loc = location();
@ -156,7 +156,7 @@ void slider::draw_contents()
SDL_Rect line_rect = { loc.x + image->w / 2, loc.y + loc.h / 2, loc.w - image->w, 1 };
SDL_FillRect(screen, &line_rect, SDL_MapRGB(screen->format,
line_colour.r, line_colour.g, line_colour.b));
line_color.r, line_color.g, line_color.b));
SDL_Rect const &slider = slider_area();
video().blit_surface(slider.x, slider.y, image);

View file

@ -178,8 +178,8 @@ void textbox::draw_contents()
const clip_rect_setter clipper(surf, &loc);
Uint32 colour = SDL_MapRGB(surf->format, 0, 0, 160);
fill_rect_alpha(rect, colour, 140, surf);
Uint32 color = SDL_MapRGB(surf->format, 0, 0, 160);
fill_rect_alpha(rect, color, 140, surf);
starty += int(line_height_);
startx = 0;