From c3451b5d9725eef0e1c01fb39636d99f51e97364 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Mon, 17 Nov 2025 22:07:59 +0000 Subject: [PATCH] Codechange: Replace color with colour. --- src/blitter/40bpp_anim.cpp | 8 ++++---- src/company_gui.cpp | 2 +- src/gfx_layout.cpp | 2 +- src/league_base.h | 2 +- src/league_cmd.cpp | 4 ++-- src/openttd.cpp | 2 +- src/os/macosx/string_osx.cpp | 6 +++--- src/script/api/script_league.hpp | 4 ++-- src/settings_type.h | 4 ++-- src/table/sprites.h | 2 +- src/video/cocoa/cocoa_v.h | 4 ++-- src/video/cocoa/cocoa_v.mm | 18 +++++++++--------- src/video/cocoa/cocoa_wnd.mm | 4 ++-- src/video/sdl2_default_v.cpp | 16 ++++++++-------- 14 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/blitter/40bpp_anim.cpp b/src/blitter/40bpp_anim.cpp index 6e6d1233fa..48f09c8c4d 100644 --- a/src/blitter/40bpp_anim.cpp +++ b/src/blitter/40bpp_anim.cpp @@ -240,9 +240,9 @@ inline void Blitter_40bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel if (src_px->a == 255) { src_px += n; do { - /* If the anim buffer contains a color value, the image composition will + /* If the anim buffer contains a colour value, the image composition will * only look at the RGB brightness value. As such, we can simply darken the - * RGB value to darken the anim color. */ + * RGB value to darken the anim colour. */ Colour b = *anim != 0 ? Colour(GetColourBrightness(*dst), 0, 0) : *dst; *dst = this->MakeTransparent(b, 3, 4); anim++; @@ -360,9 +360,9 @@ void Blitter_40bppAnim::DrawColourMappingRect(void *dst, int width, int height, uint8_t *anim = VideoDriver::GetInstance()->GetAnimBuffer() + ((uint32_t *)dst - (uint32_t *)_screen.dst_ptr); if (pal == PALETTE_TO_TRANSPARENT) { - /* If the anim buffer contains a color value, the image composition will + /* If the anim buffer contains a colour value, the image composition will * only look at the RGB brightness value. As such, we can simply darken the - * RGB value to darken the anim color. */ + * RGB value to darken the anim colour. */ do { for (int i = 0; i != width; i++) { Colour b = *anim != 0 ? Colour(GetColourBrightness(*udst), 0, 0) : *udst; diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 29efaf7c3d..957d17e298 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -1095,7 +1095,7 @@ static constexpr std::initializer_list _nested_select_company_liver }; static WindowDesc _select_company_livery_desc( - WDP_AUTO, "company_color_scheme", 0, 0, + WDP_AUTO, "company_colour_scheme", 0, 0, WC_COMPANY_COLOUR, WC_NONE, {}, _nested_select_company_livery_widgets diff --git a/src/gfx_layout.cpp b/src/gfx_layout.cpp index 8c43f7b2c0..32f0f7bd46 100644 --- a/src/gfx_layout.cpp +++ b/src/gfx_layout.cpp @@ -58,7 +58,7 @@ Font::Font(FontSize size, TextColour colour) : * @note In case no ParagraphLayouter could be constructed, line.layout will be nullptr. * @param line The cache item to store our layouter in. * @param str The string to create a layouter for. - * @param state The state of the font and color. + * @param state The state of the font and colour. * @tparam T The type of layouter we want. */ template diff --git a/src/league_base.h b/src/league_base.h index 61ef32a83c..8bf48ac0e5 100644 --- a/src/league_base.h +++ b/src/league_base.h @@ -32,7 +32,7 @@ extern LeagueTablePool _league_table_pool; struct LeagueTableElement : LeagueTableElementPool::PoolItem<&_league_table_element_pool> { LeagueTableID table = LeagueTableID::Invalid(); ///< Id of the table which this element belongs to int64_t rating = 0; ///< Value that determines ordering of elements in the table (higher=better) - CompanyID company = CompanyID::Invalid(); ///< Company Id to show the color blob for or CompanyID::Invalid() + CompanyID company = CompanyID::Invalid(); ///< Company Id to show the colour blob for or CompanyID::Invalid() EncodedString text{}; ///< Text of the element EncodedString score{}; ///< String representation of the score associated with the element Link link{}; ///< What opens when element is clicked diff --git a/src/league_cmd.cpp b/src/league_cmd.cpp index 4fbfc0918d..1dd7687d47 100644 --- a/src/league_cmd.cpp +++ b/src/league_cmd.cpp @@ -73,7 +73,7 @@ std::tuple CmdCreateLeagueTable(DoCommandFlags flags * @param flags type of operation * @param table Id of the league table this element belongs to * @param rating Value that elements are ordered by - * @param company Company to show the color blob for or CompanyID::Invalid() + * @param company Company to show the colour blob for or CompanyID::Invalid() * @param text Text of the element * @param score String representation of the score associated with the element * @param link_type Type of the referenced object @@ -100,7 +100,7 @@ std::tuple CmdCreateLeagueTableElement(DoComm * Update the attributes of a league table element. * @param flags type of operation * @param element Id of the element to update - * @param company Company to show the color blob for or CompanyID::Invalid() + * @param company Company to show the colour blob for or CompanyID::Invalid() * @param text Text of the element * @param link_type Type of the referenced object * @param link_target Id of the referenced object diff --git a/src/openttd.cpp b/src/openttd.cpp index 4317b99e64..1a3cd0c4c7 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -874,7 +874,7 @@ static void MakeNewGameDone() Company *c = Company::Get(CompanyID::Begin()); c->settings = _settings_client.company; - /* Overwrite color from settings if needed + /* Overwrite colour from settings if needed * COLOUR_END corresponds to Random colour */ if (_settings_client.gui.starting_colour != COLOUR_END) { diff --git a/src/os/macosx/string_osx.cpp b/src/os/macosx/string_osx.cpp index 957b801a1e..f142fb48b0 100644 --- a/src/os/macosx/string_osx.cpp +++ b/src/os/macosx/string_osx.cpp @@ -190,9 +190,9 @@ static const CTRunDelegateCallbacks _sprite_font_callback = { } CFAttributedStringSetAttribute(str.get(), CFRangeMake(last, position - last), kCTFontAttributeName, font_handle); - CGColorRef color = CGColorCreateGenericGray((uint8_t)font->colour / 255.0f, 1.0f); // We don't care about the real colours, just that they are different. - CFAttributedStringSetAttribute(str.get(), CFRangeMake(last, position - last), kCTForegroundColorAttributeName, color); - CGColorRelease(color); + CGColorRef colour = CGColorCreateGenericGray((uint8_t)font->colour / 255.0f, 1.0f); // We don't care about the real colours, just that they are different. + CFAttributedStringSetAttribute(str.get(), CFRangeMake(last, position - last), kCTForegroundColorAttributeName, colour); + CGColorRelease(colour); /* Install a size callback for our special private-use sprite glyphs in case the font does not provide them. */ for (ssize_t c = last; c < position; c++) { diff --git a/src/script/api/script_league.hpp b/src/script/api/script_league.hpp index aa335d6af9..d6181e0774 100644 --- a/src/script/api/script_league.hpp +++ b/src/script/api/script_league.hpp @@ -70,7 +70,7 @@ public: * Create a new league table element. * @param table Id of the league table this element belongs to. * @param rating Value that elements are ordered by. - * @param company Company to show the color blob for or COMPANY_INVALID. + * @param company Company to show the colour blob for or COMPANY_INVALID. * @param text Text of the element (can be either a raw string, or ScriptText object). * @param score String representation of the score associated with the element (can be either a raw string, or ScriptText object). * @param link_type Type of the referenced object. @@ -87,7 +87,7 @@ public: /** * Update the attributes of a league table element. * @param element Id of the element to update - * @param company Company to show the color blob for or COMPANY_INVALID. + * @param company Company to show the colour blob for or COMPANY_INVALID. * @param text Text of the element (can be either a raw string, or ScriptText object). * @param link_type Type of the referenced object. * @param link_target Id of the referenced object. diff --git a/src/settings_type.h b/src/settings_type.h index 25a8fd63de..6babceeaab 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -217,8 +217,8 @@ struct GUISettings { uint8_t missing_strings_threshold; ///< the number of missing strings before showing the warning uint8_t graph_line_thickness; ///< the thickness of the lines in the various graph guis uint8_t osk_activation; ///< Mouse gesture to trigger the OSK. - Colours starting_colour; ///< default color scheme for the company to start a new game with - Colours starting_colour_secondary; ///< default secondary color scheme for the company to start a new game with + Colours starting_colour; ///< default colour scheme for the company to start a new game with + Colours starting_colour_secondary; ///< default secondary colour scheme for the company to start a new game with bool show_newgrf_name; ///< Show the name of the NewGRF in the build vehicle window bool show_cargo_in_vehicle_lists; ///< Show the cargoes the vehicles can carry in the list windows bool auto_remove_signals; ///< automatically remove signals when in the way during rail construction diff --git a/src/table/sprites.h b/src/table/sprites.h index caef133af7..0564fc6b18 100644 --- a/src/table/sprites.h +++ b/src/table/sprites.h @@ -1622,6 +1622,6 @@ static const PaletteID PALETTE_CRASH = 804; ///< Recolour sprite static const PaletteID PALETTE_CHURCH_RED = 1438; ///< Recolour sprite for reddish churches static const PaletteID PALETTE_CHURCH_CREAM = 1439; ///< Recolour sprite for white churches -static const PaletteID PALETTE_ALL_BLACK = SPR_PALETTE_BASE; ///< Exchange any color by black, needed for painting fictive tiles outside map +static const PaletteID PALETTE_ALL_BLACK = SPR_PALETTE_BASE; ///< Exchange any colour by black, needed for painting fictive tiles outside map #endif /* SPRITES_H */ diff --git a/src/video/cocoa/cocoa_v.h b/src/video/cocoa/cocoa_v.h index 738a796805..a8d18057f4 100644 --- a/src/video/cocoa/cocoa_v.h +++ b/src/video/cocoa/cocoa_v.h @@ -30,7 +30,7 @@ public: OTTD_CocoaWindow *window; ///< Pointer to window object OTTD_CocoaView *cocoaview; ///< Pointer to view object - CGColorSpaceRef color_space; ///< Window color space + CGColorSpaceRef colour_space; ///< Window colour space OTTD_CocoaWindowDelegate *delegate; //!< Window delegate object @@ -101,7 +101,7 @@ private: uint32_t palette[256]; ///< Colour Palette void BlitIndexedToView32(int left, int top, int right, int bottom); - void UpdatePalette(uint first_color, uint num_colors); + void UpdatePalette(uint first_colour, uint num_colours); public: CGContextRef cgcontext; ///< Context reference for Quartz subdriver diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm index 31f390fe09..860b31eacf 100644 --- a/src/video/cocoa/cocoa_v.mm +++ b/src/video/cocoa/cocoa_v.mm @@ -99,7 +99,7 @@ VideoDriver_Cocoa::VideoDriver_Cocoa(bool uses_hardware_acceleration) this->cocoaview = nil; this->delegate = nil; - this->color_space = nullptr; + this->colour_space = nullptr; this->dirty_rect = {}; } @@ -116,7 +116,7 @@ void VideoDriver_Cocoa::Stop() [ this->cocoaview release ]; [ this->delegate release ]; - CGColorSpaceRelease(this->color_space); + CGColorSpaceRelease(this->colour_space); _cocoa_video_started = false; } @@ -432,10 +432,10 @@ bool VideoDriver_Cocoa::MakeWindow(int width, int height) [ draw_view release ]; [ this->window setColorSpace:[ NSColorSpace sRGBColorSpace ] ]; - CGColorSpaceRelease(this->color_space); - this->color_space = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); - if (this->color_space == nullptr) this->color_space = CGColorSpaceCreateDeviceRGB(); - if (this->color_space == nullptr) FatalError("Could not get a valid colour space for drawing."); + CGColorSpaceRelease(this->colour_space); + this->colour_space = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); + if (this->colour_space == nullptr) this->colour_space = CGColorSpaceCreateDeviceRGB(); + if (this->colour_space == nullptr) FatalError("Could not get a valid colour space for drawing."); this->setup = false; @@ -654,7 +654,7 @@ void VideoDriver_CocoaQuartz::AllocateBackingStore(bool) this->window_height, // height 8, // bits per component this->window_pitch * 4, // bytes per row - this->color_space, // color space + this->colour_space, // colour space kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host ); @@ -704,11 +704,11 @@ void VideoDriver_CocoaQuartz::BlitIndexedToView32(int left, int top, int right, } /** Update the palette */ -void VideoDriver_CocoaQuartz::UpdatePalette(uint first_color, uint num_colors) +void VideoDriver_CocoaQuartz::UpdatePalette(uint first_colour, uint num_colours) { if (this->buffer_depth != 8) return; - for (uint i = first_color; i < first_color + num_colors; i++) { + for (uint i = first_colour; i < first_colour + num_colours; i++) { uint32_t clr = 0xff000000; clr |= (uint32_t)_local_palette.palette[i].r << 16; clr |= (uint32_t)_local_palette.palette[i].g << 8; diff --git a/src/video/cocoa/cocoa_wnd.mm b/src/video/cocoa/cocoa_wnd.mm index 43f8ee266b..dcc7873185 100644 --- a/src/video/cocoa/cocoa_wnd.mm +++ b/src/video/cocoa/cocoa_wnd.mm @@ -177,8 +177,8 @@ static NSImage *NSImageFromSprite(SpriteID sprite_id, ZoomLevel zoom) if (!data) return nullptr; CGBitmapInfo info = kCGImageAlphaFirst | kCGBitmapByteOrder32Host; - CFAutoRelease color_space(CGColorSpaceCreateWithName(kCGColorSpaceSRGB)); - CFAutoRelease bitmap(CGImageCreate(dim.width, dim.height, 8, 32, dim.width * 4, color_space.get(), info, data.get(), nullptr, false, kCGRenderingIntentDefault)); + CFAutoRelease colour_space(CGColorSpaceCreateWithName(kCGColorSpaceSRGB)); + CFAutoRelease bitmap(CGImageCreate(dim.width, dim.height, 8, 32, dim.width * 4, colour_space.get(), info, data.get(), nullptr, false, kCGRenderingIntentDefault)); if (!bitmap) return nullptr; return [ [ [ NSImage alloc ] initWithCGImage:bitmap.get() size:NSZeroSize ] autorelease ]; diff --git a/src/video/sdl2_default_v.cpp b/src/video/sdl2_default_v.cpp index b7e94dae48..6ad0ad42eb 100644 --- a/src/video/sdl2_default_v.cpp +++ b/src/video/sdl2_default_v.cpp @@ -67,22 +67,22 @@ void VideoDriver_SDL_Default::MakePalette() if (_sdl_surface != _sdl_real_surface) { /* When using a shadow surface, also set our palette on the real screen. This lets SDL - * allocate as many colors (or approximations) as + * allocate as many colours (or approximations) as * possible, instead of using only the default SDL - * palette. This allows us to get more colors exactly + * palette. This allows us to get more colours exactly * right and might allow using better approximations for - * other colors. + * other colours. * - * Note that colors allocations are tried in-order, so - * this favors colors further up into the palette. Also - * note that if two colors from the same animation - * sequence are approximated using the same color, that + * Note that colours allocations are tried in-order, so + * this favors colours further up into the palette. Also + * note that if two colours from the same animation + * sequence are approximated using the same colour, that * animation will stop working. * * Since changing the system palette causes the colours * to change right away, and allocations might * drastically change, we can't use this for animation, - * since that could cause weird coloring between the + * since that could cause weird colouring between the * palette change and the blitting below, so we only set * the real palette during initialisation. */