From 6860a86d4554bc4d7594c9ef9718ddbac1a24c72 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Tue, 16 Jan 2024 22:33:53 +0100 Subject: [PATCH 01/10] Codechange: remove all u8 prefix in favour of compile-time option (#11807) --- cmake/CompileFlags.cmake | 7 + src/currency.cpp | 86 +-- src/misc_gui.cpp | 126 ++--- src/string_type.h | 4 +- src/table/townname.h | 1152 +++++++++++++++++++------------------- src/textfile_gui.cpp | 2 +- src/townname.cpp | 2 +- 7 files changed, 693 insertions(+), 686 deletions(-) diff --git a/cmake/CompileFlags.cmake b/cmake/CompileFlags.cmake index 7cdbc42c96..a85a915c3b 100644 --- a/cmake/CompileFlags.cmake +++ b/cmake/CompileFlags.cmake @@ -16,6 +16,13 @@ macro(compile_flags) endif() endif() + # Our strings are UTF-8. + if(MSVC) + add_compile_options(/utf-8) + else() + add_compile_options(-finput-charset=utf-8) + endif() + # Add some -D flags for Debug builds. We cannot use add_definitions(), because # it does not appear to support the $<> tags. add_compile_options( diff --git a/src/currency.cpp b/src/currency.cpp index fa1db5639e..323d302582 100644 --- a/src/currency.cpp +++ b/src/currency.cpp @@ -27,49 +27,49 @@ * | | | | | | | | */ /** The original currency specifications. */ static const CurrencySpec origin_currency_specs[CURRENCY_END] = { - { 1, "", CF_NOEURO, u8"\u00a3", "", "GBP", 0, STR_GAME_OPTIONS_CURRENCY_GBP }, ///< british pound - { 2, "", CF_NOEURO, "$", "", "USD", 0, STR_GAME_OPTIONS_CURRENCY_USD }, ///< american dollar - { 2, "", CF_ISEURO, u8"\u20ac", "", "EUR", 0, STR_GAME_OPTIONS_CURRENCY_EUR }, ///< euro - { 220, "", CF_NOEURO, u8"\u00a5", "", "JPY", 0, STR_GAME_OPTIONS_CURRENCY_JPY }, ///< japanese yen - { 27, "", 2002, "", NBSP "S.", "ATS", 1, STR_GAME_OPTIONS_CURRENCY_ATS }, ///< austrian schilling - { 81, "", 2002, "BEF" NBSP, "", "BEF", 0, STR_GAME_OPTIONS_CURRENCY_BEF }, ///< belgian franc - { 2, "", CF_NOEURO, "CHF" NBSP, "", "CHF", 0, STR_GAME_OPTIONS_CURRENCY_CHF }, ///< swiss franc - { 41, "", CF_NOEURO, "", NBSP u8"K\u010d", "CZK", 1, STR_GAME_OPTIONS_CURRENCY_CZK }, ///< czech koruna - { 4, "", 2002, "DM" NBSP, "", "DEM", 0, STR_GAME_OPTIONS_CURRENCY_DEM }, ///< deutsche mark - { 11, "", CF_NOEURO, "", NBSP "kr", "DKK", 1, STR_GAME_OPTIONS_CURRENCY_DKK }, ///< danish krone - { 333, "", 2002, "Pts" NBSP, "", "ESP", 0, STR_GAME_OPTIONS_CURRENCY_ESP }, ///< spanish peseta - { 12, "", 2002, "", NBSP "mk", "FIM", 1, STR_GAME_OPTIONS_CURRENCY_FIM }, ///< finnish markka - { 13, "", 2002, "FF" NBSP, "", "FRF", 0, STR_GAME_OPTIONS_CURRENCY_FRF }, ///< french franc - { 681, "", 2002, "", "Dr.", "GRD", 1, STR_GAME_OPTIONS_CURRENCY_GRD }, ///< greek drachma - { 378, "", CF_NOEURO, "", NBSP "Ft", "HUF", 1, STR_GAME_OPTIONS_CURRENCY_HUF }, ///< hungarian forint - { 130, "", CF_NOEURO, "", NBSP "Kr", "ISK", 1, STR_GAME_OPTIONS_CURRENCY_ISK }, ///< icelandic krona - { 3873, "", 2002, "", NBSP "L.", "ITL", 1, STR_GAME_OPTIONS_CURRENCY_ITL }, ///< italian lira - { 4, "", 2002, "NLG" NBSP, "", "NLG", 0, STR_GAME_OPTIONS_CURRENCY_NLG }, ///< dutch gulden - { 12, "", CF_NOEURO, "", NBSP "Kr", "NOK", 1, STR_GAME_OPTIONS_CURRENCY_NOK }, ///< norwegian krone - { 6, "", CF_NOEURO, "", NBSP u8"z\u0142", "PLN", 1, STR_GAME_OPTIONS_CURRENCY_PLN }, ///< polish zloty - { 5, "", CF_NOEURO, "", NBSP "Lei", "RON", 1, STR_GAME_OPTIONS_CURRENCY_RON }, ///< romanian leu - { 50, "", CF_NOEURO, "", NBSP "p", "RUR", 1, STR_GAME_OPTIONS_CURRENCY_RUR }, ///< russian rouble - { 479, "", 2007, "", NBSP "SIT", "SIT", 1, STR_GAME_OPTIONS_CURRENCY_SIT }, ///< slovenian tolar - { 13, "", CF_NOEURO, "", NBSP "Kr", "SEK", 1, STR_GAME_OPTIONS_CURRENCY_SEK }, ///< swedish krona - { 3, "", CF_NOEURO, "", NBSP "TL", "TRY", 1, STR_GAME_OPTIONS_CURRENCY_TRY }, ///< turkish lira - { 60, "", 2009, "", NBSP "Sk", "SKK", 1, STR_GAME_OPTIONS_CURRENCY_SKK }, ///< slovak koruna - { 4, "", CF_NOEURO, "R$" NBSP, "", "BRL", 0, STR_GAME_OPTIONS_CURRENCY_BRL }, ///< brazil real - { 31, "", 2011, "", NBSP "EEK", "EEK", 1, STR_GAME_OPTIONS_CURRENCY_EEK }, ///< estonian krooni - { 4, "", 2015, "", NBSP "Lt", "LTL", 1, STR_GAME_OPTIONS_CURRENCY_LTL }, ///< lithuanian litas - { 1850, "", CF_NOEURO, u8"\u20a9", "", "KRW", 0, STR_GAME_OPTIONS_CURRENCY_KRW }, ///< south korean won - { 13, "", CF_NOEURO, "R" NBSP, "", "ZAR", 0, STR_GAME_OPTIONS_CURRENCY_ZAR }, ///< south african rand - { 1, "", CF_NOEURO, "", "", "", 2, STR_GAME_OPTIONS_CURRENCY_CUSTOM }, ///< custom currency (add further languages below) - { 3, "", CF_NOEURO, "", NBSP "GEL", "GEL", 1, STR_GAME_OPTIONS_CURRENCY_GEL }, ///< Georgian Lari - { 4901, "", CF_NOEURO, "", NBSP "Rls", "IRR", 1, STR_GAME_OPTIONS_CURRENCY_IRR }, ///< Iranian Rial - { 80, "", CF_NOEURO, "", NBSP "rub", "RUB", 1, STR_GAME_OPTIONS_CURRENCY_RUB }, ///< New Russian Ruble - { 24, "", CF_NOEURO, "$", "", "MXN", 0, STR_GAME_OPTIONS_CURRENCY_MXN }, ///< Mexican peso - { 40, "", CF_NOEURO, "NTD" NBSP, "", "NTD", 0, STR_GAME_OPTIONS_CURRENCY_NTD }, ///< new taiwan dollar - { 8, "", CF_NOEURO, u8"\u00a5", "", "CNY", 0, STR_GAME_OPTIONS_CURRENCY_CNY }, ///< chinese renminbi - { 10, "", CF_NOEURO, "HKD" NBSP, "", "HKD", 0, STR_GAME_OPTIONS_CURRENCY_HKD }, ///< hong kong dollar - { 90, "", CF_NOEURO, u8"\u20b9", "", "INR", 0, STR_GAME_OPTIONS_CURRENCY_INR }, ///< Indian Rupee - { 19, "", CF_NOEURO, "Rp", "", "IDR", 0, STR_GAME_OPTIONS_CURRENCY_IDR }, ///< Indonesian Rupiah - { 5, "", CF_NOEURO, "RM", "", "MYR", 0, STR_GAME_OPTIONS_CURRENCY_MYR }, ///< Malaysian Ringgit - { 1, "", 2014, "", NBSP "Ls", "LVL", 1, STR_GAME_OPTIONS_CURRENCY_LVL }, ///< latvian lats + { 1, "", CF_NOEURO, "\u00a3", "", "GBP", 0, STR_GAME_OPTIONS_CURRENCY_GBP }, ///< british pound + { 2, "", CF_NOEURO, "$", "", "USD", 0, STR_GAME_OPTIONS_CURRENCY_USD }, ///< american dollar + { 2, "", CF_ISEURO, "\u20ac", "", "EUR", 0, STR_GAME_OPTIONS_CURRENCY_EUR }, ///< euro + { 220, "", CF_NOEURO, "\u00a5", "", "JPY", 0, STR_GAME_OPTIONS_CURRENCY_JPY }, ///< japanese yen + { 27, "", 2002, "", NBSP "S.", "ATS", 1, STR_GAME_OPTIONS_CURRENCY_ATS }, ///< austrian schilling + { 81, "", 2002, "BEF" NBSP, "", "BEF", 0, STR_GAME_OPTIONS_CURRENCY_BEF }, ///< belgian franc + { 2, "", CF_NOEURO, "CHF" NBSP, "", "CHF", 0, STR_GAME_OPTIONS_CURRENCY_CHF }, ///< swiss franc + { 41, "", CF_NOEURO, "", NBSP "K\u010d", "CZK", 1, STR_GAME_OPTIONS_CURRENCY_CZK }, ///< czech koruna + { 4, "", 2002, "DM" NBSP, "", "DEM", 0, STR_GAME_OPTIONS_CURRENCY_DEM }, ///< deutsche mark + { 11, "", CF_NOEURO, "", NBSP "kr", "DKK", 1, STR_GAME_OPTIONS_CURRENCY_DKK }, ///< danish krone + { 333, "", 2002, "Pts" NBSP, "", "ESP", 0, STR_GAME_OPTIONS_CURRENCY_ESP }, ///< spanish peseta + { 12, "", 2002, "", NBSP "mk", "FIM", 1, STR_GAME_OPTIONS_CURRENCY_FIM }, ///< finnish markka + { 13, "", 2002, "FF" NBSP, "", "FRF", 0, STR_GAME_OPTIONS_CURRENCY_FRF }, ///< french franc + { 681, "", 2002, "", "Dr.", "GRD", 1, STR_GAME_OPTIONS_CURRENCY_GRD }, ///< greek drachma + { 378, "", CF_NOEURO, "", NBSP "Ft", "HUF", 1, STR_GAME_OPTIONS_CURRENCY_HUF }, ///< hungarian forint + { 130, "", CF_NOEURO, "", NBSP "Kr", "ISK", 1, STR_GAME_OPTIONS_CURRENCY_ISK }, ///< icelandic krona + { 3873, "", 2002, "", NBSP "L.", "ITL", 1, STR_GAME_OPTIONS_CURRENCY_ITL }, ///< italian lira + { 4, "", 2002, "NLG" NBSP, "", "NLG", 0, STR_GAME_OPTIONS_CURRENCY_NLG }, ///< dutch gulden + { 12, "", CF_NOEURO, "", NBSP "Kr", "NOK", 1, STR_GAME_OPTIONS_CURRENCY_NOK }, ///< norwegian krone + { 6, "", CF_NOEURO, "", NBSP "z\u0142", "PLN", 1, STR_GAME_OPTIONS_CURRENCY_PLN }, ///< polish zloty + { 5, "", CF_NOEURO, "", NBSP "Lei", "RON", 1, STR_GAME_OPTIONS_CURRENCY_RON }, ///< romanian leu + { 50, "", CF_NOEURO, "", NBSP "p", "RUR", 1, STR_GAME_OPTIONS_CURRENCY_RUR }, ///< russian rouble + { 479, "", 2007, "", NBSP "SIT", "SIT", 1, STR_GAME_OPTIONS_CURRENCY_SIT }, ///< slovenian tolar + { 13, "", CF_NOEURO, "", NBSP "Kr", "SEK", 1, STR_GAME_OPTIONS_CURRENCY_SEK }, ///< swedish krona + { 3, "", CF_NOEURO, "", NBSP "TL", "TRY", 1, STR_GAME_OPTIONS_CURRENCY_TRY }, ///< turkish lira + { 60, "", 2009, "", NBSP "Sk", "SKK", 1, STR_GAME_OPTIONS_CURRENCY_SKK }, ///< slovak koruna + { 4, "", CF_NOEURO, "R$" NBSP, "", "BRL", 0, STR_GAME_OPTIONS_CURRENCY_BRL }, ///< brazil real + { 31, "", 2011, "", NBSP "EEK", "EEK", 1, STR_GAME_OPTIONS_CURRENCY_EEK }, ///< estonian krooni + { 4, "", 2015, "", NBSP "Lt", "LTL", 1, STR_GAME_OPTIONS_CURRENCY_LTL }, ///< lithuanian litas + { 1850, "", CF_NOEURO, "\u20a9", "", "KRW", 0, STR_GAME_OPTIONS_CURRENCY_KRW }, ///< south korean won + { 13, "", CF_NOEURO, "R" NBSP, "", "ZAR", 0, STR_GAME_OPTIONS_CURRENCY_ZAR }, ///< south african rand + { 1, "", CF_NOEURO, "", "", "", 2, STR_GAME_OPTIONS_CURRENCY_CUSTOM }, ///< custom currency (add further languages below) + { 3, "", CF_NOEURO, "", NBSP "GEL", "GEL", 1, STR_GAME_OPTIONS_CURRENCY_GEL }, ///< Georgian Lari + { 4901, "", CF_NOEURO, "", NBSP "Rls", "IRR", 1, STR_GAME_OPTIONS_CURRENCY_IRR }, ///< Iranian Rial + { 80, "", CF_NOEURO, "", NBSP "rub", "RUB", 1, STR_GAME_OPTIONS_CURRENCY_RUB }, ///< New Russian Ruble + { 24, "", CF_NOEURO, "$", "", "MXN", 0, STR_GAME_OPTIONS_CURRENCY_MXN }, ///< Mexican peso + { 40, "", CF_NOEURO, "NTD" NBSP, "", "NTD", 0, STR_GAME_OPTIONS_CURRENCY_NTD }, ///< new taiwan dollar + { 8, "", CF_NOEURO, "\u00a5", "", "CNY", 0, STR_GAME_OPTIONS_CURRENCY_CNY }, ///< chinese renminbi + { 10, "", CF_NOEURO, "HKD" NBSP, "", "HKD", 0, STR_GAME_OPTIONS_CURRENCY_HKD }, ///< hong kong dollar + { 90, "", CF_NOEURO, "\u20b9", "", "INR", 0, STR_GAME_OPTIONS_CURRENCY_INR }, ///< Indian Rupee + { 19, "", CF_NOEURO, "Rp", "", "IDR", 0, STR_GAME_OPTIONS_CURRENCY_IDR }, ///< Indonesian Rupiah + { 5, "", CF_NOEURO, "RM", "", "MYR", 0, STR_GAME_OPTIONS_CURRENCY_MYR }, ///< Malaysian Ringgit + { 1, "", 2014, "", NBSP "Ls", "LVL", 1, STR_GAME_OPTIONS_CURRENCY_LVL }, ///< latvian lats }; /** Array of currencies used by the system */ diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 1b4794abb4..dbf191c95e 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -401,69 +401,69 @@ static WindowDesc _about_desc(__FILE__, __LINE__, ); static const char * const _credits[] = { - u8"Original design by Chris Sawyer", - u8"Original graphics by Simon Foster", - u8"", - u8"The OpenTTD team (in alphabetical order):", - u8" Matthijs Kooijman (blathijs) - Pathfinder-guru, Debian port (since 0.3)", - u8" Christoph Elsenhans (frosch) - General coding (since 0.6)", - u8" Lo\u00efc Guilloux (glx) - General / Windows Expert (since 0.4.5)", - u8" Charles Pigott (LordAro) - General / Correctness police (since 1.9)", - u8" Michael Lutz (michi_cc) - Path based signals (since 0.7)", - u8" Niels Martin Hansen (nielsm) - Music system, general coding (since 1.9)", - u8" Owen Rudge (orudge) - Forum host, OS/2 port (since 0.1)", - u8" Peter Nelson (peter1138) - Spiritual descendant from NewGRF gods (since 0.4.5)", - u8" Remko Bijker (Rubidium) - Coder and way more (since 0.4.5)", - u8" Patric Stout (TrueBrain) - NoProgrammer (since 0.3), sys op", - u8" Tyler Trahan (2TallTyler) - General coding (since 13)", - u8"", - u8"Inactive Developers:", - u8" Grzegorz Duczy\u0144ski (adf88) - General coding (1.7 - 1.8)", - u8" Albert Hofkamp (Alberth) - GUI expert (0.7 - 1.9)", - u8" Jean-Fran\u00e7ois Claeys (Belugas) - GUI, NewGRF and more (0.4.5 - 1.0)", - u8" Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles (0.3 - 0.7)", - u8" Victor Fischer (Celestar) - Programming everywhere you need him to (0.3 - 0.6)", - u8" Ulf Hermann (fonsinchen) - Cargo Distribution (1.3 - 1.6)", - u8" Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;) (0.4.5 - 0.6)", - u8" Jonathan Coome (Maedhros) - High priest of the NewGRF Temple (0.5 - 0.6)", - u8" Attila B\u00e1n (MiHaMiX) - Developer WebTranslator 1 and 2 (0.3 - 0.5)", - u8" Ingo von Borstel (planetmaker) - General coding, Support (1.1 - 1.9)", - u8" Zden\u011bk Sojka (SmatZ) - Bug finder and fixer (0.6 - 1.3)", - u8" Jos\u00e9 Soler (Terkhen) - General coding (1.0 - 1.4)", - u8" Christoph Mallon (Tron) - Programmer, code correctness police (0.3 - 0.5)", - u8" Thijs Marinussen (Yexo) - AI Framework, General (0.6 - 1.3)", - u8" Leif Linse (Zuu) - AI/Game Script (1.2 - 1.6)", - u8"", - u8"Retired Developers:", - u8" Tam\u00e1s Farag\u00f3 (Darkvater) - Ex-Lead coder (0.3 - 0.5)", - u8" Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3 - 0.3)", - u8" Emil Djupfeld (egladil) - MacOSX (0.4.5 - 0.6)", - u8" Simon Sasburg (HackyKid) - Many bugfixes (0.4 - 0.4.5)", - u8" Ludvig Strigeus (ludde) - Original author of OpenTTD, main coder (0.1 - 0.3)", - u8" Cian Duffy (MYOB) - BeOS port / manual writing (0.1 - 0.3)", - u8" Petr Baudi\u0161 (pasky) - Many patches, NewGRF support (0.3 - 0.3)", - u8" Benedikt Br\u00fcggemeier (skidd13) - Bug fixer and code reworker (0.6 - 0.7)", - u8" Serge Paquet (vurlix) - 2nd contributor after ludde (0.1 - 0.3)", - u8"", - u8"Special thanks go out to:", - u8" Josef Drexler - For his great work on TTDPatch", - u8" Marcin Grzegorczyk - Track foundations and for describing TTD internals", - u8" Stefan Mei\u00dfner (sign_de) - For his work on the console", - u8" Mike Ragsdale - OpenTTD installer", - u8" Christian Rosentreter (tokai) - MorphOS / AmigaOS port", - u8" Richard Kempton (richK) - additional airports, initial TGP implementation", - u8" Alberto Demichelis - Squirrel scripting language \u00a9 2003-2008", - u8" L. Peter Deutsch - MD5 implementation \u00a9 1999, 2000, 2002", - u8" Michael Blunck - Pre-signals and semaphores \u00a9 2003", - u8" George - Canal/Lock graphics \u00a9 2003-2004", - u8" Andrew Parkhouse (andythenorth) - River graphics", - u8" David Dallaston (Pikka) - Tram tracks", - u8" All Translators - Who made OpenTTD a truly international game", - u8" Bug Reporters - Without whom OpenTTD would still be full of bugs!", - u8"", - u8"", - u8"And last but not least:", - u8" Chris Sawyer - For an amazing game!" + "Original design by Chris Sawyer", + "Original graphics by Simon Foster", + "", + "The OpenTTD team (in alphabetical order):", + " Matthijs Kooijman (blathijs) - Pathfinder-guru, Debian port (since 0.3)", + " Christoph Elsenhans (frosch) - General coding (since 0.6)", + " Lo\u00efc Guilloux (glx) - General / Windows Expert (since 0.4.5)", + " Charles Pigott (LordAro) - General / Correctness police (since 1.9)", + " Michael Lutz (michi_cc) - Path based signals (since 0.7)", + " Niels Martin Hansen (nielsm) - Music system, general coding (since 1.9)", + " Owen Rudge (orudge) - Forum host, OS/2 port (since 0.1)", + " Peter Nelson (peter1138) - Spiritual descendant from NewGRF gods (since 0.4.5)", + " Remko Bijker (Rubidium) - Coder and way more (since 0.4.5)", + " Patric Stout (TrueBrain) - NoProgrammer (since 0.3), sys op", + " Tyler Trahan (2TallTyler) - General coding (since 13)", + "", + "Inactive Developers:", + " Grzegorz Duczy\u0144ski (adf88) - General coding (1.7 - 1.8)", + " Albert Hofkamp (Alberth) - GUI expert (0.7 - 1.9)", + " Jean-Fran\u00e7ois Claeys (Belugas) - GUI, NewGRF and more (0.4.5 - 1.0)", + " Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles (0.3 - 0.7)", + " Victor Fischer (Celestar) - Programming everywhere you need him to (0.3 - 0.6)", + " Ulf Hermann (fonsinchen) - Cargo Distribution (1.3 - 1.6)", + " Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;) (0.4.5 - 0.6)", + " Jonathan Coome (Maedhros) - High priest of the NewGRF Temple (0.5 - 0.6)", + " Attila B\u00e1n (MiHaMiX) - Developer WebTranslator 1 and 2 (0.3 - 0.5)", + " Ingo von Borstel (planetmaker) - General coding, Support (1.1 - 1.9)", + " Zden\u011bk Sojka (SmatZ) - Bug finder and fixer (0.6 - 1.3)", + " Jos\u00e9 Soler (Terkhen) - General coding (1.0 - 1.4)", + " Christoph Mallon (Tron) - Programmer, code correctness police (0.3 - 0.5)", + " Thijs Marinussen (Yexo) - AI Framework, General (0.6 - 1.3)", + " Leif Linse (Zuu) - AI/Game Script (1.2 - 1.6)", + "", + "Retired Developers:", + " Tam\u00e1s Farag\u00f3 (Darkvater) - Ex-Lead coder (0.3 - 0.5)", + " Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3 - 0.3)", + " Emil Djupfeld (egladil) - MacOSX (0.4.5 - 0.6)", + " Simon Sasburg (HackyKid) - Many bugfixes (0.4 - 0.4.5)", + " Ludvig Strigeus (ludde) - Original author of OpenTTD, main coder (0.1 - 0.3)", + " Cian Duffy (MYOB) - BeOS port / manual writing (0.1 - 0.3)", + " Petr Baudi\u0161 (pasky) - Many patches, NewGRF support (0.3 - 0.3)", + " Benedikt Br\u00fcggemeier (skidd13) - Bug fixer and code reworker (0.6 - 0.7)", + " Serge Paquet (vurlix) - 2nd contributor after ludde (0.1 - 0.3)", + "", + "Special thanks go out to:", + " Josef Drexler - For his great work on TTDPatch", + " Marcin Grzegorczyk - Track foundations and for describing TTD internals", + " Stefan Mei\u00dfner (sign_de) - For his work on the console", + " Mike Ragsdale - OpenTTD installer", + " Christian Rosentreter (tokai) - MorphOS / AmigaOS port", + " Richard Kempton (richK) - additional airports, initial TGP implementation", + " Alberto Demichelis - Squirrel scripting language \u00a9 2003-2008", + " L. Peter Deutsch - MD5 implementation \u00a9 1999, 2000, 2002", + " Michael Blunck - Pre-signals and semaphores \u00a9 2003", + " George - Canal/Lock graphics \u00a9 2003-2004", + " Andrew Parkhouse (andythenorth) - River graphics", + " David Dallaston (Pikka) - Tram tracks", + " All Translators - Who made OpenTTD a truly international game", + " Bug Reporters - Without whom OpenTTD would still be full of bugs!", + "", + "", + "And last but not least:", + " Chris Sawyer - For an amazing game!" }; struct AboutWindow : public Window { diff --git a/src/string_type.h b/src/string_type.h index 9835e0c944..df330fc1fc 100644 --- a/src/string_type.h +++ b/src/string_type.h @@ -13,10 +13,10 @@ #include "core/enum_type.hpp" /** A non-breaking space. */ -#define NBSP u8"\u00a0" +#define NBSP "\u00a0" /** A left-to-right marker, marks the next character as left-to-right. */ -#define LRM u8"\u200e" +#define LRM "\u200e" /** * Valid filter types for IsValidChar. diff --git a/src/table/townname.h b/src/table/townname.h index b3f197a046..638a838302 100644 --- a/src/table/townname.h +++ b/src/table/townname.h @@ -310,7 +310,7 @@ static const char * const _name_austrian_a2[] = { "Aus", "Alten", "Braun", - u8"V\u00f6sl", + "V\u00f6sl", "Mittern", "Nuss", "Neu", @@ -332,9 +332,9 @@ static const char * const _name_austrian_a2[] = { "Frauen", "Herren", "Hof", - u8"H\u00fctt", + "H\u00fctt", "Kaisers", - u8"K\u00f6nigs", + "K\u00f6nigs", "Knittel", "Lang", "Ober", @@ -346,7 +346,7 @@ static const char * const _name_austrian_a2[] = { "Stocker", "Unter", "Utten", - u8"V\u00f6sen", + "V\u00f6sen", "Vill", "Weissen", }; @@ -392,7 +392,7 @@ static const char * const _name_austrian_a5[] = { static const char * const _name_austrian_a6[] = { "Aegyd", - u8"Andr\u00e4", + "Andr\u00e4", "Georgen", "Jakob", "Johann", @@ -405,7 +405,7 @@ static const char * const _name_austrian_a6[] = { "Nikolai", "Oswald", "Peter", - u8"P\u00f6lten", + "P\u00f6lten", "Stefan", "Stephan", "Thomas", @@ -466,10 +466,10 @@ static const char * const _name_german_real[] = { "Gera", "Kassel", "Kiel", - u8"K\u00f6ln", - u8"L\u00fcbeck", + "K\u00f6ln", + "L\u00fcbeck", "Magdeburg", - u8"M\u00fcnchen", + "M\u00fcnchen", "Potsdam", "Stuttgart", "Wiesbaden", @@ -492,7 +492,7 @@ static const char * const _name_german_1[] = { "Cloppen", "Co", "Duis", - u8"D\u00fcssel", + "D\u00fcssel", "Dannen", "Elb", "Els", @@ -506,7 +506,7 @@ static const char * const _name_german_1[] = { "Frei", "Freuden", "Fried", - u8"F\u00fcrsten", + "F\u00fcrsten", "Hahn", "Ham", "Harz", @@ -527,10 +527,10 @@ static const char * const _name_german_1[] = { "Langen", "Lim", "Lohr", - u8"L\u00fcne", + "L\u00fcne", "Mel", "Michels", - u8"M\u00fchl", + "M\u00fchl", "Naum", "Nest", "Nord", @@ -538,7 +538,7 @@ static const char * const _name_german_1[] = { "Nien", "Nidda", "Nieder", - u8"N\u00fcrn", + "N\u00fcrn", "Ober", "Offen", "Osna", @@ -552,18 +552,18 @@ static const char * const _name_german_1[] = { "Regens", "Rott", "Ros", - u8"R\u00fcssels", + "R\u00fcssels", "Saal", "Saar", "Salz", - u8"Sch\u00f6ne", + "Sch\u00f6ne", "Schwein", "Sonder", "Sonnen", "Stein", "Strals", "Straus", - u8"S\u00fcd", + "S\u00fcd", "Ton", "Unter", "Ur", @@ -574,14 +574,14 @@ static const char * const _name_german_1[] = { "Wester", "Witten", "Wolfs", - u8"W\u00fcrz", + "W\u00fcrz", }; static const char * const _name_german_2[] = { "bach", "berg", - u8"br\u00fcck", - u8"br\u00fccken", + "br\u00fcck", + "br\u00fccken", "burg", "dorf", "feld", @@ -591,7 +591,7 @@ static const char * const _name_german_2[] = { "heim", "horst", "mund", - u8"m\u00fcnster", + "m\u00fcnster", "stadt", "wald", }; @@ -625,9 +625,9 @@ static const char * const _name_spanish_real[] = { "Morrocoy", "Cata", "Cataito", - u8"Ciudad Bol\u00edvar", + "Ciudad Bol\u00edvar", "Barquisimeto", - u8"M\u00e9rida", + "M\u00e9rida", "Puerto Ordaz", "Santa Elena", "San Juan", @@ -636,58 +636,58 @@ static const char * const _name_spanish_real[] = { "Santiago", "Barcelona", "Barinas", - u8"San Crist\u00f3bal", + "San Crist\u00f3bal", "San Francisco", - u8"San Mart\u00edn", + "San Mart\u00edn", "Guayana", "San Carlos", - u8"El Lim\u00f3n", + "El Lim\u00f3n", "Coro", "Coro Coro", "Puerto Ayacucho", "Elorza", "Arismendi", "Trujillo", - u8"Car\u00fapano", + "Car\u00fapano", "Anaco", "Lima", "Cuzco", "Iquitos", "Callao", "Huacho", - u8"Caman\u00e1", + "Caman\u00e1", "Puerto Chala", "Santa Cruz", "Quito", "Cuenca", - u8"Medell\u00edn", - u8"Tulc\u00e1n", + "Medell\u00edn", + "Tulc\u00e1n", "Esmeraldas", "Ibarra", "San Lorenzo", "Macas", - u8"Mora\u00f1a", + "Mora\u00f1a", "Machala", "Zamora", "Latacunga", "Tena", "Cochabamba", - u8"Ascensi\u00f3n", + "Ascensi\u00f3n", "Magdalena", "Santa Ana", "Manoa", "Sucre", "Oruro", "Uyuni", - u8"Potos\u00ed", + "Potos\u00ed", "Tupiza", "La Quiaca", - u8"Yacu\u00edba", + "Yacu\u00edba", "San Borja", "Fuerte Olimpo", - u8"Fort\u00edn Esteros", + "Fort\u00edn Esteros", "Campo Grande", - u8"Bogot\u00e1", + "Bogot\u00e1", "El Banco", "Zaragoza", "Neiva", @@ -715,7 +715,7 @@ static const char * const _name_french_real[] = { "Bordeaux", "Bayonne", "Montpellier", - u8"Mont\u00e9limar", + "Mont\u00e9limar", "Valence", "Digne", "Nice", @@ -723,16 +723,16 @@ static const char * const _name_french_real[] = { "St. Tropez", "Marseille", "Narbonne", - u8"S\u00e8te", + "S\u00e8te", "Aurillac", - u8"Gu\u00e9ret", + "Gu\u00e9ret", "Le Creusot", "Nevers", "Auxerre", "Versailles", "Meaux", - u8"Ch\u00e2lons", - u8"Compi\u00e8gne", + "Ch\u00e2lons", + "Compi\u00e8gne", "Metz", "Chaumont", "Langres", @@ -745,8 +745,8 @@ static const char * const _name_french_real[] = { "Le Mans", "Angers", "Nantes", - u8"Ch\u00e2teauroux", - u8"Orl\u00e9ans", + "Ch\u00e2teauroux", + "Orl\u00e9ans", "Lisieux", "Cherbourg", "Morlaix", @@ -757,7 +757,7 @@ static const char * const _name_french_real[] = { "Troyes", "Charolles", "Toulouse", - u8"Chamb\u00e9ry", + "Chamb\u00e9ry", "Tours", "St. Brieuc", "St. Malo", @@ -771,11 +771,11 @@ static const char * const _name_french_real[] = { "Albi", "Paris", "Biarritz", - u8"B\u00e9ziers", - u8"N\u00eemes", + "B\u00e9ziers", + "N\u00eemes", "Chamonix", - u8"Angoul\u00e8me", - u8"Alen\u00e7on", + "Angoul\u00e8me", + "Alen\u00e7on", }; static const char * const _name_silly_1[] = { @@ -903,7 +903,7 @@ static const char * const _name_swedish_2[] = { "Es", "Fin", "Fisk", - u8"Gr\u00f6n", + "Gr\u00f6n", "Hag", "Halm", "Karl", @@ -922,17 +922,17 @@ static const char * const _name_swedish_2[] = { "Skog", "Stock", "Stor", - u8"Str\u00f6m", + "Str\u00f6m", "Sund", - u8"S\u00f6der", + "S\u00f6der", "Tall", "Tratt", "Troll", "Upp", "Var", - u8"V\u00e4ster", - u8"\u00c4ngel", - u8"\u00d6ster", + "V\u00e4ster", + "\u00c4ngel", + "\u00d6ster", }; static const char * const _name_swedish_2a[] = { @@ -987,9 +987,9 @@ static const char * const _name_swedish_2b[] = { "o", "u", "y", - u8"\u00e5", - u8"\u00e4", - u8"\u00f6", + "\u00e5", + "\u00e4", + "\u00f6", }; static const char * const _name_swedish_2c[] = { @@ -1035,25 +1035,25 @@ static const char * const _name_swedish_3[] = { "hamn", "holm", "hus", - u8"h\u00e4ttan", + "h\u00e4ttan", "kulle", - u8"k\u00f6ping", + "k\u00f6ping", "lund", - u8"l\u00f6v", + "l\u00f6v", "sala", "skrona", - u8"sl\u00e4tt", - u8"sp\u00e5ng", + "sl\u00e4tt", + "sp\u00e5ng", "stad", "sund", "svall", "svik", - u8"s\u00e5ker", + "s\u00e5ker", "udde", "valla", "viken", - u8"\u00e4lv", - u8"\u00e5s", + "\u00e4lv", + "\u00e5s", }; static const char * const _name_dutch_1[] = { @@ -1220,7 +1220,7 @@ static const char * const _name_finnish_real[] = { "Espoo", "Helsinki", "Tapiola", - u8"J\u00e4rvel\u00e4", + "J\u00e4rvel\u00e4", "Lahti", "Kotka", "Hamina", @@ -1255,26 +1255,26 @@ static const char * const _name_finnish_1[] = { "Sauna", "Uusi", "Vanha", - u8"Kes\u00e4", + "Kes\u00e4", "Kuusi", "Pelto", "Tuomi", "Terva", "Olki", - u8"Hein\u00e4", - u8"Sein\u00e4", + "Hein\u00e4", + "Sein\u00e4", "Rova", "Koivu", "Kokko", - u8"M\u00e4nty", + "M\u00e4nty", "Pihlaja", - u8"Pet\u00e4j\u00e4", + "Pet\u00e4j\u00e4", "Kielo", "Kauha", "Viita", "Kivi", "Riihi", - u8"\u00c4\u00e4ne", + "\u00c4\u00e4ne", "Niini", }; @@ -1283,27 +1283,27 @@ static const char * const _name_finnish_2[] = { "Lohjan", "Savon", "Lapin", - u8"Pit\u00e4j\u00e4n", + "Pit\u00e4j\u00e4n", "Martin", "Kuusan", "Kemi", "Keri", - u8"H\u00e4meen", + "H\u00e4meen", "Kangas", }; static const char * const _name_finnish_3[] = { "harju", "linna", - u8"j\u00e4rvi", + "j\u00e4rvi", "kallio", - u8"m\u00e4ki", + "m\u00e4ki", "nummi", "joki", - u8"kyl\u00e4", + "kyl\u00e4", "lampi", "lahti", - u8"mets\u00e4", + "mets\u00e4", "suo", "laakso", "niitty", @@ -1316,56 +1316,56 @@ static const char * const _name_finnish_3[] = { static const char * const _name_polish_1_m[] = { "Wielki ", - u8"Ma\u0142y ", - u8"Z\u0142y ", + "Ma\u0142y ", + "Z\u0142y ", "Dobry ", "Nowy ", "Stary ", - u8"Z\u0142oty ", + "Z\u0142oty ", "Zielony ", - u8"Bia\u0142y ", + "Bia\u0142y ", "Modry ", - u8"D\u0119bowy ", + "D\u0119bowy ", }; static const char * const _name_polish_1_f[] = { "Wielka ", - u8"Ma\u0142a ", - u8"Z\u0142a ", + "Ma\u0142a ", + "Z\u0142a ", "Dobra ", "Nowa ", "Stara ", - u8"Z\u0142ota ", + "Z\u0142ota ", "Zielona ", - u8"Bia\u0142a ", + "Bia\u0142a ", "Modra ", - u8"D\u0119bowa ", + "D\u0119bowa ", }; static const char * const _name_polish_1_n[] = { "Wielkie ", - u8"Ma\u0142e ", - u8"Z\u0142e ", + "Ma\u0142e ", + "Z\u0142e ", "Dobre ", "Nowe ", "Stare ", - u8"Z\u0142ote ", + "Z\u0142ote ", "Zielone ", - u8"Bia\u0142e ", + "Bia\u0142e ", "Modre ", - u8"D\u0119bowe ", + "D\u0119bowe ", }; static const char * const _name_polish_2_o[] = { "Frombork", "Gniezno", "Olsztyn", - u8"Toru\u0144", + "Toru\u0144", "Bydgoszcz", "Terespol", - u8"Krak\u00f3w", - u8"Pozna\u0144", - u8"Wroc\u0142aw", + "Krak\u00f3w", + "Pozna\u0144", + "Wroc\u0142aw", "Katowice", "Cieszyn", "Bytom", @@ -1376,7 +1376,7 @@ static const char * const _name_polish_2_o[] = { "Malbork", "Sopot", "Sosnowiec", - u8"Gda\u0144sk", + "Gda\u0144sk", "Gdynia", "Sieradz", "Sandomierz", @@ -1384,9 +1384,9 @@ static const char * const _name_polish_2_o[] = { "Szczytno", "Szczecin", "Zakopane", - u8"Szklarska Por\u0119ba", + "Szklarska Por\u0119ba", "Bochnia", - u8"Golub-Dobrzy\u0144", + "Golub-Dobrzy\u0144", "Chojnice", "Ostrowiec", "Otwock", @@ -1396,13 +1396,13 @@ static const char * const _name_polish_2_o[] = { static const char * const _name_polish_2_m[] = { "Jarocin", "Gogolin", - u8"Tomasz\u00f3w", - u8"Piotrk\u00f3w", + "Tomasz\u00f3w", + "Piotrk\u00f3w", "Lidzbark", "Rypin", "Radzymin", - u8"Wo\u0142omin", - u8"Pruszk\u00f3w", + "Wo\u0142omin", + "Pruszk\u00f3w", "Olsztynek", "Rypin", "Cisek", @@ -1412,7 +1412,7 @@ static const char * const _name_polish_2_m[] = { "Lubicz", "Milicz", "Targ", - u8"Ostr\u00f3w", + "Ostr\u00f3w", "Ozimek", "Puck", "Rzepin", @@ -1425,7 +1425,7 @@ static const char * const _name_polish_2_m[] = { "Strzepcz", "Strzebielin", "Sochaczew", - u8"Gr\u0119bocin", + "Gr\u0119bocin", "Gniew", "Lubliniec", "Lubasz", @@ -1447,7 +1447,7 @@ static const char * const _name_polish_2_m[] = { static const char * const _name_polish_2_f[] = { "Szprotawa", "Pogorzelica", - u8"Mot\u0142awa", + "Mot\u0142awa", "Lubawa", "Nidzica", "Kruszwica", @@ -1501,7 +1501,7 @@ static const char * const _name_polish_2_n[] = { "Braniewo", "Sulinowo", "Chmielno", - u8"Jastrz\u0119bie", + "Jastrz\u0119bie", "Gryfino", "Koronowo", "Lubichowo", @@ -1510,182 +1510,182 @@ static const char * const _name_polish_2_n[] = { static const char * const _name_polish_3_m[] = { " Wybudowanie", - u8" \u015awi\u0119tokrzyski", - u8" G\u00f3rski", + " \u015awi\u0119tokrzyski", + " G\u00f3rski", " Morski", - u8" Zdr\u00f3j", + " Zdr\u00f3j", " Wody", " Bajoro", - u8" Kraje\u0144ski", - u8" \u015al\u0105ski", + " Kraje\u0144ski", + " \u015al\u0105ski", " Mazowiecki", " Pomorski", " Wielki", " Maly", - u8" Warmi\u0144ski", + " Warmi\u0144ski", " Mazurski", " Mniejszy", - u8" Wi\u0119kszy", - u8" G\u00f3rny", + " Wi\u0119kszy", + " G\u00f3rny", " Dolny", " Wielki", " Stary", " Nowy", " Wielkopolski", - u8" Wzg\u00f3rze", + " Wzg\u00f3rze", " Mosty", " Kujawski", - u8" Ma\u0142opolski", + " Ma\u0142opolski", " Podlaski", " Lesny", }; static const char * const _name_polish_3_f[] = { " Wybudowanie", - u8" \u015awi\u0119tokrzyska", - u8" G\u00f3rska", + " \u015awi\u0119tokrzyska", + " G\u00f3rska", " Morska", - u8" Zdr\u00f3j", + " Zdr\u00f3j", " Woda", " Bajoro", - u8" Kraje\u0144ska", - u8" \u015al\u0105ska", + " Kraje\u0144ska", + " \u015al\u0105ska", " Mazowiecka", " Pomorska", " Wielka", - u8" Ma\u0142a", - u8" Warmi\u0144ska", + " Ma\u0142a", + " Warmi\u0144ska", " Mazurska", " Mniejsza", - u8" Wi\u0119ksza", - u8" G\u00f3rna", + " Wi\u0119ksza", + " G\u00f3rna", " Dolna", " Wielka", " Stara", " Nowa", " Wielkopolska", - u8" Wzg\u00f3rza", + " Wzg\u00f3rza", " Mosty", " Kujawska", " Malopolska", " Podlaska", - u8" Le\u015bna", + " Le\u015bna", }; static const char * const _name_polish_3_n[] = { " Wybudowanie", - u8" \u015awietokrzyskie", - u8" G\u00f3rskie", + " \u015awietokrzyskie", + " G\u00f3rskie", " Morskie", - u8" Zdr\u00f3j", + " Zdr\u00f3j", " Wody", " Bajoro", - u8" Kraje\u0144skie", - u8" \u015al\u0105skie", + " Kraje\u0144skie", + " \u015al\u0105skie", " Mazowieckie", " Pomorskie", " Wielkie", - u8" Ma\u0142e", - u8" Warmi\u0144skie ", + " Ma\u0142e", + " Warmi\u0144skie ", " Mazurskie ", " Mniejsze", - u8" Wi\u0119ksze", - u8" G\u00f3rne", + " Wi\u0119ksze", + " G\u00f3rne", " Dolne", " Wielkie", " Stare", " Nowe", " Wielkopolskie", - u8" Wzg\u00f3rze", + " Wzg\u00f3rze", " Mosty", " Kujawskie", - u8" Ma\u0142opolskie", + " Ma\u0142opolskie", " Podlaskie", - u8" Le\u015bne", + " Le\u015bne", }; static const char * const _name_czech_real[] = { - u8"A\u0161", - u8"Bene\u0161ov", + "A\u0161", + "Bene\u0161ov", "Beroun", - u8"Bezdru\u017eice", + "Bezdru\u017eice", "Blansko", - u8"B\u0159eclav", + "B\u0159eclav", "Brno", - u8"Brunt\u00e1l", - u8"\u010cesk\u00e1 L\u00edpa", - u8"\u010cesk\u00e9 Bud\u011bjovice", - u8"\u010cesk\u00fd Krumlov", - u8"D\u011b\u010d\u00edn", - u8"Doma\u017elice", - u8"Dub\u00ed", - u8"Fr\u00fddek-M\u00edstek", - u8"Havl\u00ed\u010dk\u016fv Brod", - u8"Hodon\u00edn", - u8"Hradec Kr\u00e1lov\u00e9", + "Brunt\u00e1l", + "\u010cesk\u00e1 L\u00edpa", + "\u010cesk\u00e9 Bud\u011bjovice", + "\u010cesk\u00fd Krumlov", + "D\u011b\u010d\u00edn", + "Doma\u017elice", + "Dub\u00ed", + "Fr\u00fddek-M\u00edstek", + "Havl\u00ed\u010dk\u016fv Brod", + "Hodon\u00edn", + "Hradec Kr\u00e1lov\u00e9", "Humpolec", "Cheb", "Chomutov", "Chrudim", "Jablonec nad Nisou", - u8"Jesen\u00edk", - u8"Ji\u010d\u00edn", + "Jesen\u00edk", + "Ji\u010d\u00edn", "Jihlava", - u8"Jind\u0159ich\u016fv Hradec", + "Jind\u0159ich\u016fv Hradec", "Karlovy Vary", - u8"Karvin\u00e1", + "Karvin\u00e1", "Kladno", "Klatovy", - u8"Kol\u00edn", + "Kol\u00edn", "Kosmonosy", - u8"Krom\u011b\u0159\u00ed\u017e", - u8"Kutn\u00e1 Hora", + "Krom\u011b\u0159\u00ed\u017e", + "Kutn\u00e1 Hora", "Liberec", - u8"Litom\u011b\u0159ice", + "Litom\u011b\u0159ice", "Louny", - u8"Man\u011bt\u00edn", - u8"M\u011bln\u00edk", - u8"Mlad\u00e1 Boleslav", + "Man\u011bt\u00edn", + "M\u011bln\u00edk", + "Mlad\u00e1 Boleslav", "Most", - u8"N\u00e1chod", - u8"Nov\u00fd Ji\u010d\u00edn", + "N\u00e1chod", + "Nov\u00fd Ji\u010d\u00edn", "Nymburk", "Olomouc", "Opava", - u8"Or\u00e1\u010dov", + "Or\u00e1\u010dov", "Ostrava", "Pardubice", - u8"Pelh\u0159imov", - u8"Pol\u017eice", - u8"P\u00edsek", - u8"Plze\u0148", + "Pelh\u0159imov", + "Pol\u017eice", + "P\u00edsek", + "Plze\u0148", "Praha", "Prachatice", - u8"P\u0159erov", - u8"P\u0159\u00edbram", - u8"Prost\u011bjov", - u8"Rakovn\u00edk", + "P\u0159erov", + "P\u0159\u00edbram", + "Prost\u011bjov", + "Rakovn\u00edk", "Rokycany", - u8"Rudn\u00e1", - u8"Rychnov nad Kn\u011b\u017enou", + "Rudn\u00e1", + "Rychnov nad Kn\u011b\u017enou", "Semily", "Sokolov", "Strakonice", - u8"St\u0159edokluky", - u8"\u0160umperk", + "St\u0159edokluky", + "\u0160umperk", "Svitavy", - u8"T\u00e1bor", + "T\u00e1bor", "Tachov", "Teplice", - u8"T\u0159eb\u00ed\u010d", + "T\u0159eb\u00ed\u010d", "Trutnov", - u8"Uhersk\u00e9 Hradi\u0161t\u011b", - u8"\u00dast\u00ed nad Labem", - u8"\u00dast\u00ed nad Orlic\u00ed", - u8"Vset\u00edn", - u8"Vy\u0161kov", - u8"\u017d\u010f\u00e1r nad S\u00e1zavou", - u8"Zl\u00edn", + "Uhersk\u00e9 Hradi\u0161t\u011b", + "\u00dast\u00ed nad Labem", + "\u00dast\u00ed nad Orlic\u00ed", + "Vset\u00edn", + "Vy\u0161kov", + "\u017d\u010f\u00e1r nad S\u00e1zavou", + "Zl\u00edn", "Znojmo", }; @@ -1719,12 +1719,12 @@ enum CzechPattern { * by this. * XXX: [CZG_SMASC][CZP_PRIVL] needs special handling: -ovX -> -uv. */ static const char * const _name_czech_patmod[][3] = { - /* CZG_SMASC */ { u8"\u00ed", u8"\u00fd", "X" }, - /* CZG_SFEM */ { u8"\u00ed", u8"\u00e1", "a" }, - /* CZG_SNEUT */ { u8"\u00ed", u8"\u00e9", "o" }, - /* CZG_PMASC */ { u8"\u00ed", u8"\u00e9", "y" }, - /* CZG_PFEM */ { u8"\u00ed", u8"\u00e9", "y" }, - /* CZG_PNEUT */ { u8"\u00ed", u8"\u00e1", "a" } + /* CZG_SMASC */ { "\u00ed", "\u00fd", "X" }, + /* CZG_SFEM */ { "\u00ed", "\u00e1", "a" }, + /* CZG_SNEUT */ { "\u00ed", "\u00e9", "o" }, + /* CZG_PMASC */ { "\u00ed", "\u00e9", "y" }, + /* CZG_PFEM */ { "\u00ed", "\u00e9", "y" }, + /* CZG_PNEUT */ { "\u00ed", "\u00e1", "a" } }; /* This way the substantive can choose only some adjectives/endings: @@ -1764,52 +1764,52 @@ struct CzechNameAdj { /* Some of items which should be common are doubled. */ static const CzechNameAdj _name_czech_adj[] = { - { CZP_JARNI, CZC_ANY, u8"Horn\u00ed" }, - { CZP_JARNI, CZC_ANY, u8"Horn\u00ed" }, - { CZP_JARNI, CZC_ANY, u8"Doln\u00ed" }, - { CZP_JARNI, CZC_ANY, u8"Doln\u00ed" }, - { CZP_JARNI, CZC_ANY, u8"P\u0159edn\u00ed" }, - { CZP_JARNI, CZC_ANY, u8"Zadn\u00ed" }, - { CZP_JARNI, CZC_ANY, u8"Kosteln\u00ed" }, - { CZP_JARNI, CZC_ANY, u8"Havran\u00ed" }, - { CZP_JARNI, CZC_ANY, u8"\u0158\u00ed\u010dn\u00ed" }, - { CZP_JARNI, CZC_ANY, u8"Jezern\u00ed" }, - { CZP_MLADY, CZC_ANY, u8"Velk\u00fd" }, - { CZP_MLADY, CZC_ANY, u8"Velk\u00fd" }, - { CZP_MLADY, CZC_ANY, u8"Mal\u00fd" }, - { CZP_MLADY, CZC_ANY, u8"Mal\u00fd" }, - { CZP_MLADY, CZC_ANY, u8"Vysok\u00fd" }, - { CZP_MLADY, CZC_ANY, u8"\u010cesk\u00fd" }, - { CZP_MLADY, CZC_ANY, u8"Moravsk\u00fd" }, - { CZP_MLADY, CZC_ANY, u8"Slov\u00e1ck\u00fd" }, - { CZP_MLADY, CZC_ANY, u8"Slezsk\u00fd" }, - { CZP_MLADY, CZC_ANY, u8"Uhersk\u00fd" }, - { CZP_MLADY, CZC_ANY, u8"Star\u00fd" }, - { CZP_MLADY, CZC_ANY, u8"Star\u00fd" }, - { CZP_MLADY, CZC_ANY, u8"Nov\u00fd" }, - { CZP_MLADY, CZC_ANY, u8"Nov\u00fd" }, - { CZP_MLADY, CZC_ANY, u8"Mlad\u00fd" }, - { CZP_MLADY, CZC_ANY, u8"Kr\u00e1lovsk\u00fd" }, - { CZP_MLADY, CZC_ANY, u8"Kamenn\u00fd" }, - { CZP_MLADY, CZC_ANY, u8"Cihlov\u00fd" }, - { CZP_MLADY, CZC_ANY, u8"Divn\u00fd" }, - { CZP_MLADY, CZC_COLOR, u8"\u010cerven\u00e1" }, - { CZP_MLADY, CZC_COLOR, u8"\u010cerven\u00e1" }, - { CZP_MLADY, CZC_COLOR, u8"\u010cerven\u00e1" }, - { CZP_MLADY, CZC_COLOR, u8"Zelen\u00e1" }, - { CZP_MLADY, CZC_COLOR, u8"\u017dlut\u00e1" }, - { CZP_MLADY, CZC_COLOR, u8"Siv\u00e1" }, - { CZP_MLADY, CZC_COLOR, u8"\u0160ed\u00e1" }, - { CZP_MLADY, CZC_COLOR, u8"B\u00edl\u00e1" }, - { CZP_MLADY, CZC_COLOR, u8"B\u00edl\u00e1" }, - { CZP_MLADY, CZC_COLOR, u8"Modr\u00e1" }, - { CZP_MLADY, CZC_COLOR, u8"R\u016f\u017eov\u00e1" }, - { CZP_MLADY, CZC_COLOR, u8"\u010cern\u00e1" }, - { CZP_PRIVL, CZC_ANY, u8"Kr\u00e1lova" }, + { CZP_JARNI, CZC_ANY, "Horn\u00ed" }, + { CZP_JARNI, CZC_ANY, "Horn\u00ed" }, + { CZP_JARNI, CZC_ANY, "Doln\u00ed" }, + { CZP_JARNI, CZC_ANY, "Doln\u00ed" }, + { CZP_JARNI, CZC_ANY, "P\u0159edn\u00ed" }, + { CZP_JARNI, CZC_ANY, "Zadn\u00ed" }, + { CZP_JARNI, CZC_ANY, "Kosteln\u00ed" }, + { CZP_JARNI, CZC_ANY, "Havran\u00ed" }, + { CZP_JARNI, CZC_ANY, "\u0158\u00ed\u010dn\u00ed" }, + { CZP_JARNI, CZC_ANY, "Jezern\u00ed" }, + { CZP_MLADY, CZC_ANY, "Velk\u00fd" }, + { CZP_MLADY, CZC_ANY, "Velk\u00fd" }, + { CZP_MLADY, CZC_ANY, "Mal\u00fd" }, + { CZP_MLADY, CZC_ANY, "Mal\u00fd" }, + { CZP_MLADY, CZC_ANY, "Vysok\u00fd" }, + { CZP_MLADY, CZC_ANY, "\u010cesk\u00fd" }, + { CZP_MLADY, CZC_ANY, "Moravsk\u00fd" }, + { CZP_MLADY, CZC_ANY, "Slov\u00e1ck\u00fd" }, + { CZP_MLADY, CZC_ANY, "Slezsk\u00fd" }, + { CZP_MLADY, CZC_ANY, "Uhersk\u00fd" }, + { CZP_MLADY, CZC_ANY, "Star\u00fd" }, + { CZP_MLADY, CZC_ANY, "Star\u00fd" }, + { CZP_MLADY, CZC_ANY, "Nov\u00fd" }, + { CZP_MLADY, CZC_ANY, "Nov\u00fd" }, + { CZP_MLADY, CZC_ANY, "Mlad\u00fd" }, + { CZP_MLADY, CZC_ANY, "Kr\u00e1lovsk\u00fd" }, + { CZP_MLADY, CZC_ANY, "Kamenn\u00fd" }, + { CZP_MLADY, CZC_ANY, "Cihlov\u00fd" }, + { CZP_MLADY, CZC_ANY, "Divn\u00fd" }, + { CZP_MLADY, CZC_COLOR, "\u010cerven\u00e1" }, + { CZP_MLADY, CZC_COLOR, "\u010cerven\u00e1" }, + { CZP_MLADY, CZC_COLOR, "\u010cerven\u00e1" }, + { CZP_MLADY, CZC_COLOR, "Zelen\u00e1" }, + { CZP_MLADY, CZC_COLOR, "\u017dlut\u00e1" }, + { CZP_MLADY, CZC_COLOR, "Siv\u00e1" }, + { CZP_MLADY, CZC_COLOR, "\u0160ed\u00e1" }, + { CZP_MLADY, CZC_COLOR, "B\u00edl\u00e1" }, + { CZP_MLADY, CZC_COLOR, "B\u00edl\u00e1" }, + { CZP_MLADY, CZC_COLOR, "Modr\u00e1" }, + { CZP_MLADY, CZC_COLOR, "R\u016f\u017eov\u00e1" }, + { CZP_MLADY, CZC_COLOR, "\u010cern\u00e1" }, + { CZP_PRIVL, CZC_ANY, "Kr\u00e1lova" }, { CZP_PRIVL, CZC_ANY, "Janova" }, { CZP_PRIVL, CZC_ANY, "Karlova" }, - { CZP_PRIVL, CZC_ANY, u8"Kry\u0161tofova" }, - { CZP_PRIVL, CZC_ANY, u8"Ji\u0159\u00edkova" }, + { CZP_PRIVL, CZC_ANY, "Kry\u0161tofova" }, + { CZP_PRIVL, CZC_ANY, "Ji\u0159\u00edkova" }, { CZP_PRIVL, CZC_ANY, "Petrova" }, { CZP_PRIVL, CZC_ANY, "Sudovo" }, }; @@ -1819,17 +1819,17 @@ static const CzechNameSubst _name_czech_subst_full[] = { { CZG_SMASC, CZA_ALL, CZC_COLOR, "Sedlec" }, { CZG_SMASC, CZA_ALL, CZC_COLOR, "Brod" }, { CZG_SMASC, CZA_ALL, CZC_COLOR, "Brod" }, - { CZG_SMASC, CZA_ALL, CZC_NONE, u8"\u00daval" }, - { CZG_SMASC, CZA_ALL, CZC_COLOR, u8"\u017d\u010f\u00e1r" }, + { CZG_SMASC, CZA_ALL, CZC_NONE, "\u00daval" }, + { CZG_SMASC, CZA_ALL, CZC_COLOR, "\u017d\u010f\u00e1r" }, { CZG_SMASC, CZA_ALL, CZC_COLOR, "Smrk" }, { CZG_SFEM, CZA_ALL, CZC_COLOR, "Hora" }, { CZG_SFEM, CZA_ALL, CZC_COLOR, "Lhota" }, { CZG_SFEM, CZA_ALL, CZC_COLOR, "Lhota" }, { CZG_SFEM, CZA_ALL, CZC_COLOR, "Hlava" }, - { CZG_SFEM, CZA_ALL, CZC_COLOR, u8"L\u00edpa" }, + { CZG_SFEM, CZA_ALL, CZC_COLOR, "L\u00edpa" }, { CZG_SNEUT, CZA_ALL, CZC_COLOR, "Pole" }, - { CZG_SNEUT, CZA_ALL, CZC_COLOR, u8"\u00dadol\u00ed" }, - { CZG_PMASC, CZA_ALL, CZC_NONE, u8"\u00davaly" }, + { CZG_SNEUT, CZA_ALL, CZC_COLOR, "\u00dadol\u00ed" }, + { CZG_PMASC, CZA_ALL, CZC_NONE, "\u00davaly" }, { CZG_PFEM, CZA_ALL, CZC_COLOR, "Luka" }, { CZG_PNEUT, CZA_ALL, CZC_COLOR, "Pole" }, }; @@ -1837,46 +1837,46 @@ static const CzechNameSubst _name_czech_subst_full[] = { /* TODO: More stems needed. --pasky */ static const CzechNameSubst _name_czech_subst_stem[] = { { CZG_SMASC, CZA_MIDDLE, CZC_COLOR, "Kostel" }, - { CZG_SMASC, CZA_MIDDLE, CZC_COLOR, u8"Kl\u00e1\u0161ter" }, + { CZG_SMASC, CZA_MIDDLE, CZC_COLOR, "Kl\u00e1\u0161ter" }, { CZG_SMASC, CZA_SHORT, CZC_COLOR, "Lhot" }, { CZG_SFEM, CZA_SHORT, CZC_COLOR, "Lhot" }, { CZG_SFEM, CZA_SHORT, CZC_COLOR, "Hur" }, { CZG_FREE, CZA_MIDDLE | CZA_LONG, CZC_NONE, "Sedl" }, { CZG_FREE, CZA_SHORT | CZA_MIDDLE | CZA_LONG, CZC_COLOR, "Hrad" }, { CZG_NFREE, CZA_MIDDLE, CZC_NONE, "Pras" }, - { CZG_NFREE, CZA_MIDDLE, CZC_NONE, u8"Ba\u017e" }, + { CZG_NFREE, CZA_MIDDLE, CZC_NONE, "Ba\u017e" }, { CZG_NFREE, CZA_MIDDLE, CZC_NONE, "Tes" }, - { CZG_NFREE, CZA_MIDDLE, CZC_NONE, u8"U\u017e" }, - { CZG_NFREE, CZA_MIDDLE | CZA_LONG, CZC_POSTFIX, u8"B\u0159" }, + { CZG_NFREE, CZA_MIDDLE, CZC_NONE, "U\u017e" }, + { CZG_NFREE, CZA_MIDDLE | CZA_LONG, CZC_POSTFIX, "B\u0159" }, { CZG_NFREE, CZA_MIDDLE | CZA_LONG, CZC_NONE, "Vod" }, { CZG_NFREE, CZA_MIDDLE | CZA_LONG, CZC_NONE, "Jan" }, { CZG_NFREE, CZA_LONG, CZC_NONE, "Prach" }, { CZG_NFREE, CZA_LONG, CZC_NONE, "Kunr" }, { CZG_NFREE, CZA_LONG, CZC_NONE, "Strak" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, u8"V\u00edt" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, u8"Vy\u0161" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, u8"\u017dat" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, u8"\u017der" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, u8"St\u0159ed" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "V\u00edt" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "Vy\u0161" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "\u017dat" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "\u017der" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "St\u0159ed" }, { CZG_NFREE, CZA_LONG, CZC_NONE, "Harv" }, { CZG_NFREE, CZA_LONG, CZC_NONE, "Pruh" }, { CZG_NFREE, CZA_LONG, CZC_NONE, "Tach" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, u8"P\u00edsn" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "P\u00edsn" }, { CZG_NFREE, CZA_LONG, CZC_NONE, "Jin" }, { CZG_NFREE, CZA_LONG, CZC_NONE, "Jes" }, { CZG_NFREE, CZA_LONG, CZC_NONE, "Jar" }, { CZG_NFREE, CZA_LONG, CZC_NONE, "Sok" }, { CZG_NFREE, CZA_LONG, CZC_NONE, "Hod" }, { CZG_NFREE, CZA_LONG, CZC_NONE, "Net" }, - { CZG_FREE, CZA_LONG, CZC_NONE, u8"Pra\u017e" }, + { CZG_FREE, CZA_LONG, CZC_NONE, "Pra\u017e" }, { CZG_FREE, CZA_LONG, CZC_NONE, "Nerat" }, { CZG_FREE, CZA_LONG, CZC_NONE, "Kral" }, { CZG_FREE, CZA_LONG, CZC_NONE, "Hut" }, { CZG_FREE, CZA_LONG, CZC_NOPOSTFIX, "Pan" }, - { CZG_FREE, CZA_SHORT | CZA_MIDDLE | CZA_LONG, CZC_NOPOSTFIX, u8"Odst\u0159ed" }, + { CZG_FREE, CZA_SHORT | CZA_MIDDLE | CZA_LONG, CZC_NOPOSTFIX, "Odst\u0159ed" }, { CZG_FREE, CZA_SHORT | CZA_MIDDLE | CZA_LONG, CZC_COLOR, "Mrat" }, { CZG_FREE, CZA_LONG, CZC_COLOR, "Hlav" }, - { CZG_FREE, CZA_SHORT | CZA_MIDDLE, CZC_NONE, u8"M\u011b\u0159" }, + { CZG_FREE, CZA_SHORT | CZA_MIDDLE, CZC_NONE, "M\u011b\u0159" }, { CZG_FREE, CZA_MIDDLE | CZA_LONG, CZC_NONE, "Lip" }, }; @@ -1890,47 +1890,47 @@ static const char * const _name_czech_subst_postfix[] = { /* This array must have the both neutral genders at the end! */ static const CzechNameSubst _name_czech_subst_ending[] = { { CZG_SMASC, CZA_SHORT | CZA_MIDDLE, CZC_ANY, "ec" }, - { CZG_SMASC, CZA_SHORT | CZA_MIDDLE, CZC_ANY, u8"\u00edn" }, + { CZG_SMASC, CZA_SHORT | CZA_MIDDLE, CZC_ANY, "\u00edn" }, { CZG_SMASC, CZA_SHORT | CZA_MIDDLE | CZA_LONG, CZC_ANY, "ov" }, { CZG_SMASC, CZA_SHORT | CZA_LONG, CZC_ANY, "kov" }, - { CZG_SMASC, CZA_LONG, CZC_POSTFIX, u8"\u00edn" }, - { CZG_SMASC, CZA_LONG, CZC_POSTFIX, u8"n\u00edk" }, + { CZG_SMASC, CZA_LONG, CZC_POSTFIX, "\u00edn" }, + { CZG_SMASC, CZA_LONG, CZC_POSTFIX, "n\u00edk" }, { CZG_SMASC, CZA_LONG, CZC_ANY, "burk" }, { CZG_SFEM, CZA_SHORT, CZC_ANY, "ka" }, { CZG_SFEM, CZA_MIDDLE, CZC_ANY, "inka" }, - { CZG_SFEM, CZA_MIDDLE, CZC_ANY, u8"n\u00e1" }, + { CZG_SFEM, CZA_MIDDLE, CZC_ANY, "n\u00e1" }, { CZG_SFEM, CZA_LONG, CZC_ANY, "ava" }, - { CZG_PMASC, CZA_LONG, CZC_POSTFIX, u8"\u00edky" }, + { CZG_PMASC, CZA_LONG, CZC_POSTFIX, "\u00edky" }, { CZG_PMASC, CZA_LONG, CZC_ANY, "upy" }, { CZG_PMASC, CZA_LONG, CZC_ANY, "olupy" }, { CZG_PFEM, CZA_LONG, CZC_ANY, "avy" }, { CZG_PFEM, CZA_SHORT | CZA_MIDDLE | CZA_LONG, CZC_ANY, "ice" }, - { CZG_PFEM, CZA_SHORT | CZA_MIDDLE | CZA_LONG, CZC_ANY, u8"i\u010dky" }, + { CZG_PFEM, CZA_SHORT | CZA_MIDDLE | CZA_LONG, CZC_ANY, "i\u010dky" }, { CZG_PNEUT, CZA_SHORT | CZA_MIDDLE, CZC_ANY, "na" }, { CZG_SNEUT, CZA_SHORT | CZA_MIDDLE, CZC_ANY, "no" }, - { CZG_SNEUT, CZA_LONG, CZC_ANY, u8"i\u0161t\u011b" }, + { CZG_SNEUT, CZA_LONG, CZC_ANY, "i\u0161t\u011b" }, }; static const char * const _name_czech_suffix[] = { "nad Cidlinou", - u8"nad Dyj\u00ed", + "nad Dyj\u00ed", "nad Jihlavou", "nad Labem", "nad Lesy", "nad Moravou", "nad Nisou", "nad Odrou", - u8"nad Ostravic\u00ed", - u8"nad S\u00e1zavou", + "nad Ostravic\u00ed", + "nad S\u00e1zavou", "nad Vltavou", - u8"pod Prad\u011bdem", - u8"pod Radho\u0161t\u011bm", - u8"pod \u0158\u00edpem", - u8"pod Sn\u011b\u017ekou", - u8"pod \u0160pi\u010d\u00e1kem", + "pod Prad\u011bdem", + "pod Radho\u0161t\u011bm", + "pod \u0158\u00edpem", + "pod Sn\u011b\u017ekou", + "pod \u0160pi\u010d\u00e1kem", "pod Sedlem", - u8"v \u010cech\u00e1ch", - u8"na Morav\u011b", + "v \u010cech\u00e1ch", + "na Morav\u011b", }; @@ -1940,197 +1940,197 @@ static const char * const _name_romanian_real[] = { "Alba Iulia", "Alexandria", "Babadag", - u8"Bac\u0103u", + "Bac\u0103u", "Baia Mare", - u8"B\u0103ile Herculane", - u8"B\u0103ile\u0219ti", - u8"B\u00e2rlad", + "B\u0103ile Herculane", + "B\u0103ile\u0219ti", + "B\u00e2rlad", "Bicaz", - u8"Bistri\u021ba", + "Bistri\u021ba", "Blaj", "Borsec", - u8"Boto\u0219ani", - u8"Br\u0103ila", - u8"Bra\u0219ov", - u8"Bucure\u0219ti", + "Boto\u0219ani", + "Br\u0103ila", + "Bra\u0219ov", + "Bucure\u0219ti", "Buftea", - u8"Buz\u0103u", - u8"C\u0103l\u0103ra\u0219i", - u8"Caransebe\u0219", - u8"Cernavod\u0103", + "Buz\u0103u", + "C\u0103l\u0103ra\u0219i", + "Caransebe\u0219", + "Cernavod\u0103", "Cluj-Napoca", - u8"Constan\u021ba", + "Constan\u021ba", "Covasna", "Craiova", "Dej", "Deva", "Dorohoi", "Drobeta-Turnu Severin", - u8"Dr\u0103g\u0103\u0219ani", - u8"F\u0103g\u0103ra\u0219", - u8"F\u0103lticeni", - u8"Fete\u0219ti", - u8"Foc\u0219ani", - u8"Gala\u021bi", + "Dr\u0103g\u0103\u0219ani", + "F\u0103g\u0103ra\u0219", + "F\u0103lticeni", + "Fete\u0219ti", + "Foc\u0219ani", + "Gala\u021bi", "Gheorgheni", "Giurgiu", - u8"H\u00e2r\u0219ova", + "H\u00e2r\u0219ova", "Hunedoara", - u8"Hu\u0219i", - u8"Ia\u0219i", + "Hu\u0219i", + "Ia\u0219i", "Isaccea", "Lugoj", - u8"M\u0103cin", + "M\u0103cin", "Mangalia", "Medgidia", - u8"Media\u0219", + "Media\u0219", "Miercurea Ciuc", "Mizil", "Motru", - u8"N\u0103s\u0103ud", - u8"N\u0103vodari", - u8"Odobe\u0219ti", - u8"Olteni\u021ba", - u8"One\u0219ti", + "N\u0103s\u0103ud", + "N\u0103vodari", + "Odobe\u0219ti", + "Olteni\u021ba", + "One\u0219ti", "Oradea", - u8"Or\u0219ova", - u8"Petro\u0219ani", - u8"Piatra Neam\u021b", - u8"Pite\u0219ti", - u8"Ploie\u0219ti", + "Or\u0219ova", + "Petro\u0219ani", + "Piatra Neam\u021b", + "Pite\u0219ti", + "Ploie\u0219ti", "Predeal", - u8"R\u00e2mnicu V\u00e2lcea", + "R\u00e2mnicu V\u00e2lcea", "Reghin", - u8"Re\u0219i\u021ba", + "Re\u0219i\u021ba", "Roman", - u8"Ro\u0219iorii de Vede", + "Ro\u0219iorii de Vede", "Satu Mare", - u8"Sebe\u0219", - u8"Sf\u00e2ntu Gheorghe", + "Sebe\u0219", + "Sf\u00e2ntu Gheorghe", "Sibiu", - u8"Sighi\u0219oara", + "Sighi\u0219oara", "Sinaia", "Slatina", "Slobozia", "Sovata", "Suceava", "Sulina", - u8"\u021a\u0103nd\u0103rei", - u8"T\u00e2rgovi\u0219te", - u8"T\u00e2rgu Jiu", - u8"T\u00e2rgu Mure\u0219", + "\u021a\u0103nd\u0103rei", + "T\u00e2rgovi\u0219te", + "T\u00e2rgu Jiu", + "T\u00e2rgu Mure\u0219", "Tecuci", - u8"Timi\u0219oara", + "Timi\u0219oara", "Tulcea", "Turda", - u8"Turnu M\u0103gurele", + "Turnu M\u0103gurele", "Urziceni", "Vaslui", "Vatra Dornei", "Victoria", "Videle", - u8"Zal\u0103u", + "Zal\u0103u", }; static const char * const _name_slovak_real[] = { "Bratislava", - u8"B\u00e1novce nad Bebravou", - u8"Bansk\u00e1 Bystrica", - u8"Bansk\u00e1 \u0160tiavnica", + "B\u00e1novce nad Bebravou", + "Bansk\u00e1 Bystrica", + "Bansk\u00e1 \u0160tiavnica", "Bardejov", "Brezno", "Brezova pod Bradlom", - u8"Byt\u010da", - u8"\u010cadca", - u8"\u010cierna nad Tisou", + "Byt\u010da", + "\u010cadca", + "\u010cierna nad Tisou", "Detva", - u8"Pre\u0161ov", + "Pre\u0161ov", "Dolny Kubin", - u8"Spi\u0161sk\u00e1 Nov\u00e1 Ves", - u8"Dunajsk\u00e1 Streda", - u8"Gab\u010d\u00edikovo", + "Spi\u0161sk\u00e1 Nov\u00e1 Ves", + "Dunajsk\u00e1 Streda", + "Gab\u010d\u00edikovo", "Galanta", "Gbely", "Gelnica", - u8"Handlov\u00e1", + "Handlov\u00e1", "Hlohovec", - u8"Hol\u00ed\u010d", - u8"Humenn\u00e9", + "Hol\u00ed\u010d", + "Humenn\u00e9", "Hurbanovo", "Kezmarok", - u8"Kom\u00e1rno", - u8"Ko\u0161ice", + "Kom\u00e1rno", + "Ko\u0161ice", "Kremnica", "Krompachy", "Kuty", "Leopoldov", - u8"Levo\u010da", - u8"Liptovsk\u00fd Mikul\u00e1\u0161", - u8"Lu\u010denec", + "Levo\u010da", + "Liptovsk\u00fd Mikul\u00e1\u0161", + "Lu\u010denec", "Malacky", "Martin", "Medzilaborce", "Michalovce", "Modra", "Myjava", - u8"N\u00e1mestovo", + "N\u00e1mestovo", "Nitra", - u8"Nov\u00e1 Ba\u0148a", - u8"Nov\u00e9 Mesto nad V\u00e1hom", - u8"Nov\u00e9 Z\u00e1mky", - u8"Partiz\u00e1nske", + "Nov\u00e1 Ba\u0148a", + "Nov\u00e9 Mesto nad V\u00e1hom", + "Nov\u00e9 Z\u00e1mky", + "Partiz\u00e1nske", "Pezinok", - u8"Pie\u0161\u0165any", - u8"Polt\u00e1r", + "Pie\u0161\u0165any", + "Polt\u00e1r", "Poprad", - u8"Pova\u017esk\u00e1 Bystrica", + "Pova\u017esk\u00e1 Bystrica", "Prievidza", - u8"P\u00fachov", - u8"Rev\u00faca", - u8"Rimavsk\u00e1 Sobota", - u8"Ro\u017e\u0148ava", - u8"Ru\u017eomberok", + "P\u00fachov", + "Rev\u00faca", + "Rimavsk\u00e1 Sobota", + "Ro\u017e\u0148ava", + "Ru\u017eomberok", "Sabinov", - u8"\u0160a\u013ea", + "\u0160a\u013ea", "Senec", "Senica", - u8"Sere\u010f", + "Sere\u010f", "Skalica", - u8"Sl\u00e1dkovi\u00cdovo", + "Sl\u00e1dkovi\u00cdovo", "Smolenice", "Snina", - u8"Star\u00e1 \u013dubov\u0148a", - u8"Star\u00e1 Tur\u00e1", - u8"Str\u00e1\u017eske", + "Star\u00e1 \u013dubov\u0148a", + "Star\u00e1 Tur\u00e1", + "Str\u00e1\u017eske", "Stropkov", "Stupava", - u8"\u0160t\u00farovo", - u8"\u0120ulekovo", - u8"Topo\u013e\u010dany", - u8"Trebi\u0161ov", - u8"Tren\u010d\u00edn", + "\u0160t\u00farovo", + "\u0120ulekovo", + "Topo\u013e\u010dany", + "Trebi\u0161ov", + "Tren\u010d\u00edn", "Trnava", - u8"Tur\u010dianske Teplice", - u8"Tvrdo\u0161\u00edn", - u8"Vr\u00e1ble", - u8"Vranov nad Top\u013eou", - u8"Z\u00e1horsk\u00e1 Bystrica", - u8"\u017ddiar", - u8"\u013diar nad Hronom", - u8"\u017dilina", - u8"Zlat\u00e9 Moravce", + "Tur\u010dianske Teplice", + "Tvrdo\u0161\u00edn", + "Vr\u00e1ble", + "Vranov nad Top\u013eou", + "Z\u00e1horsk\u00e1 Bystrica", + "\u017ddiar", + "\u013diar nad Hronom", + "\u017dilina", + "Zlat\u00e9 Moravce", "Zvolen", }; static const char * const _name_norwegian_1[] = { "Arna", "Aust", - u8"Bj\u00f8rk", - u8"Bj\u00f8rn", + "Bj\u00f8rk", + "Bj\u00f8rn", "Brand", - u8"B\u00f8ver", + "B\u00f8ver", "Drag", - u8"Dr\u00f8", + "Dr\u00f8", "Eids", "Egge", "Fager", @@ -2143,12 +2143,12 @@ static const char * const _name_norwegian_1[] = { "Gaus", "Galte", "Geir", - u8"Gl\u00f8s", + "Gl\u00f8s", "Gran", "Grind", "Grims", - u8"Gr\u00f8n", - u8"Gr\u00f8t", + "Gr\u00f8n", + "Gr\u00f8t", "Gulle", "Haka", "Hammer", @@ -2163,7 +2163,7 @@ static const char * const _name_norwegian_1[] = { "Kjerring", "Knatte", "Krok", - u8"K\u00f8y", + "K\u00f8y", "Lang", "Lauv", "Leir", @@ -2171,7 +2171,7 @@ static const char * const _name_norwegian_1[] = { "Logn", "Lo", "Lyng", - u8"L\u00f8n", + "L\u00f8n", "Mesna", "Mel", "Mo", @@ -2191,9 +2191,9 @@ static const char * const _name_norwegian_1[] = { "Sel", "Sol", "Sjur", - u8"Sk\u00e5r", - u8"Sl\u00e5tt", - u8"Stj\u00f8r", + "Sk\u00e5r", + "Sl\u00e5tt", + "Stj\u00f8r", "Stor", "Svart", "Svens", @@ -2206,7 +2206,7 @@ static const char * const _name_norwegian_1[] = { "Vest", "Vesle", "Vik", - u8"V\u00e5g", + "V\u00e5g", }; static const char * const _name_norwegian_2[] = { @@ -2221,7 +2221,7 @@ static const char * const _name_norwegian_2[] = { "bugen", "by", "bygd", - u8"b\u00f8", + "b\u00f8", "dal", "egga", "eid", @@ -2239,10 +2239,10 @@ static const char * const _name_norwegian_2[] = { "heim", "hella", "hovda", - u8"h\u00f8a", - u8"h\u00f8gda", + "h\u00f8a", + "h\u00f8gda", "kampen", - u8"kj\u00f8len", + "kj\u00f8len", "kollen", "kroken", "land", @@ -2257,7 +2257,7 @@ static const char * const _name_norwegian_2[] = { "rud", "sand", "set", - u8"sj\u00f8en", + "sj\u00f8en", "skogen", "slette", "snipa", @@ -2266,7 +2266,7 @@ static const char * const _name_norwegian_2[] = { "stulen", "sund", "svingen", - u8"s\u00e6tra", + "s\u00e6tra", "tinden", "tun", "vang", @@ -2274,9 +2274,9 @@ static const char * const _name_norwegian_2[] = { "veid", "vik", "voll", - u8"v\u00e5g", + "v\u00e5g", "um", - u8"\u00e5sen", + "\u00e5sen", }; static const char * const _name_norwegian_real[] = { @@ -2284,12 +2284,12 @@ static const char * const _name_norwegian_real[] = { "Arendal", "Askim", "Bergen", - u8"Bod\u00f8", + "Bod\u00f8", "Brevik", "Bryne", - u8"Br\u00f8nn\u00f8ysund", + "Br\u00f8nn\u00f8ysund", "Drammen", - u8"Dr\u00f8bak", + "Dr\u00f8bak", "Egersund", "Elverum", "Farsund", @@ -2297,10 +2297,10 @@ static const char * const _name_norwegian_real[] = { "Finnsnes", "Flekkefjord", "Flora", - u8"Fosnav\u00e5g", + "Fosnav\u00e5g", "Fredrikstad", - u8"F\u00f8rde", - u8"Gj\u00f8vik", + "F\u00f8rde", + "Gj\u00f8vik", "Grimstad", "Halden", "Hamar", @@ -2309,13 +2309,13 @@ static const char * const _name_norwegian_real[] = { "Haugesund", "Holmestrand", "Horten", - u8"J\u00f8rpeland", + "J\u00f8rpeland", "Kirkenes", "Kolvereid", "Kongsberg", "Kongsvinger", "Kopervik", - u8"Krager\u00f8", + "Krager\u00f8", "Kristiansand", "Kristiansund", "Langesund", @@ -2325,16 +2325,16 @@ static const char * const _name_norwegian_real[] = { "Levanger", "Lillehammer", "Lillesand", - u8"Lillestr\u00f8m", + "Lillestr\u00f8m", "Lyngdal", - u8"L\u00f8renskog", + "L\u00f8renskog", "Mandal", "Mo i Rana", "Molde", - u8"Mosj\u00f8en", + "Mosj\u00f8en", "Moss", "Mysen", - u8"M\u00e5l\u00f8y", + "M\u00e5l\u00f8y", "Namsos", "Narvik", "Notodden", @@ -2343,11 +2343,11 @@ static const char * const _name_norwegian_real[] = { "Otta", "Porsgrunn", "Ringerike", - u8"Ris\u00f8r", + "Ris\u00f8r", "Rjukan", "Sandefjord", "Sandnes", - u8"Sandnessj\u00f8en", + "Sandnessj\u00f8en", "Sandvika", "Sarpsborg", "Sauda", @@ -2358,152 +2358,152 @@ static const char * const _name_norwegian_real[] = { "Stathelle", "Stavanger", "Steinkjer", - u8"Stj\u00f8rdal", + "Stj\u00f8rdal", "Stokmarknes", "Stord", "Svelvik", - u8"Svolv\u00e6r", - u8"Troms\u00f8", + "Svolv\u00e6r", + "Troms\u00f8", "Trondheim", "Tvedestrand", - u8"T\u00f8nsberg", + "T\u00f8nsberg", "Ulsteinvik", - u8"Vads\u00f8", - u8"Vard\u00f8", - u8"Verdals\u00f8ra", - u8"\u00c5krehamn", - u8"\u00c5lesund", - u8"\u00c5ndalsnes", + "Vads\u00f8", + "Vard\u00f8", + "Verdals\u00f8ra", + "\u00c5krehamn", + "\u00c5lesund", + "\u00c5ndalsnes", }; static const char * const _name_hungarian_1[] = { "Nagy-", "Kis-", - u8"Fels\u0151-", - u8"Als\u00f3-", - u8"\u00daj-", + "Fels\u0151-", + "Als\u00f3-", + "\u00daj-", }; static const char * const _name_hungarian_2[] = { "Bodrog", - u8"Dr\u00e1va", + "Dr\u00e1va", "Duna", - u8"Hej\u0151", - u8"Hern\u00e1d", - u8"R\u00e1ba", - u8"Saj\u00f3", + "Hej\u0151", + "Hern\u00e1d", + "R\u00e1ba", + "Saj\u00f3", "Szamos", "Tisza", "Zala", "Balaton", - u8"Fert\u0151", + "Fert\u0151", "Bakony", - u8"Cserh\u00e1t", + "Cserh\u00e1t", "Bihar", - u8"Hajd\u00fa", - u8"J\u00e1sz", + "Hajd\u00fa", + "J\u00e1sz", "Kun", "Magyar", - u8"N\u00f3gr\u00e1d", - u8"Ny\u00edr", + "N\u00f3gr\u00e1d", + "Ny\u00edr", "Somogy", - u8"Sz\u00e9kely", + "Sz\u00e9kely", "Buda", - u8"Gy\u0151r", + "Gy\u0151r", "Pest", - u8"Feh\u00e9r", - u8"Cser\u00e9p", - u8"Erd\u0151", + "Feh\u00e9r", + "Cser\u00e9p", + "Erd\u0151", "Hegy", "Homok", - u8"Mez\u0151", + "Mez\u0151", "Puszta", - u8"S\u00e1r", - u8"Cs\u00e1sz\u00e1r", + "S\u00e1r", + "Cs\u00e1sz\u00e1r", "Herceg", - u8"Kir\u00e1ly", + "Kir\u00e1ly", "Nemes", - u8"P\u00fcsp\u00f6k", + "P\u00fcsp\u00f6k", "Szent", - u8"Alm\u00e1s", - u8"Szilv\u00e1s", + "Alm\u00e1s", + "Szilv\u00e1s", "Agg", "Aranyos", - u8"B\u00e9k\u00e9s", - u8"Egyh\u00e1zas", + "B\u00e9k\u00e9s", + "Egyh\u00e1zas", "Gagy", "Heves", "Kapos", - u8"T\u00e1pi\u00f3", + "T\u00e1pi\u00f3", "Torna", "Vas", - u8"V\u00e1mos", - u8"V\u00e1s\u00e1ros", + "V\u00e1mos", + "V\u00e1s\u00e1ros", }; static const char * const _name_hungarian_3[] = { - u8"ap\u00e1ti", - u8"b\u00e1ba", + "ap\u00e1ti", + "b\u00e1ba", "bikk", "dob", "fa", - u8"f\u00f6ld", + "f\u00f6ld", "hegyes", "kak", "kereszt", - u8"k\u00fcrt", - u8"lad\u00e1ny", - u8"m\u00e9rges", + "k\u00fcrt", + "lad\u00e1ny", + "m\u00e9rges", "szalonta", "telek", "vas", - u8"v\u00f6lgy", + "v\u00f6lgy", }; static const char * const _name_hungarian_4[] = { "alja", - u8"egyh\u00e1za", - u8"h\u00e1za", - u8"\u00far", - u8"v\u00e1r", + "egyh\u00e1za", + "h\u00e1za", + "\u00far", + "v\u00e1r", }; static const char * const _name_hungarian_real[] = { "Ajka", - u8"Asz\u00f3d", + "Asz\u00f3d", "Badacsony", "Baja", "Budapest", "Debrecen", "Eger", - u8"Fony\u00f3d", - u8"G\u00f6d\u00f6ll\u0151", - u8"Gy\u0151r", + "Fony\u00f3d", + "G\u00f6d\u00f6ll\u0151", + "Gy\u0151r", "Gyula", "Karcag", - u8"Kecskem\u00e9t", + "Kecskem\u00e9t", "Keszthely", - u8"Kisk\u00f6re", + "Kisk\u00f6re", "Kocsord", - u8"Kom\u00e1rom", - u8"K\u0151szeg", - u8"Mak\u00f3", - u8"Moh\u00e1cs", + "Kom\u00e1rom", + "K\u0151szeg", + "Mak\u00f3", + "Moh\u00e1cs", "Miskolc", - u8"\u00d3zd", + "\u00d3zd", "Paks", - u8"P\u00e1pa", - u8"P\u00e9cs", - u8"Polg\u00e1r", + "P\u00e1pa", + "P\u00e9cs", + "Polg\u00e1r", "Sarkad", - u8"Si\u00f3fok", + "Si\u00f3fok", "Szeged", "Szentes", "Szolnok", "Tihany", "Tokaj", - u8"V\u00e1c", - u8"Z\u00e1hony", + "V\u00e1c", + "Z\u00e1hony", "Zirc", }; @@ -2514,7 +2514,7 @@ static const char * const _name_swiss_real[] = { "Arosa", "Appenzell", "Arbon", - u8"Altst\u00e4tten", + "Altst\u00e4tten", "Baar", "Baden", "Bellinzona", @@ -2525,20 +2525,20 @@ static const char * const _name_swiss_real[] = { "Burgdorf", "Bern", "Basel", - u8"B\u00fclach", + "B\u00fclach", "Carouge", "Cham", "Chiasso", "Chur", "Davos", - u8"Del\u00e9mont", + "Del\u00e9mont", "Dietikon", - u8"D\u00fcbendorf", + "D\u00fcbendorf", "Emmen", - u8"Freienbach-Pf\u00e4ffikon", + "Freienbach-Pf\u00e4ffikon", "Fribourg", "Frauenfeld", - u8"Gen\u00e8ve", + "Gen\u00e8ve", "Glarus", "Gossau", "Grenchen", @@ -2550,9 +2550,9 @@ static const char * const _name_swiss_real[] = { "Jona", "Kriens", "Kloten", - u8"K\u00f6niz", + "K\u00f6niz", "Kreuzlingen", - u8"K\u00fcsnacht", + "K\u00fcsnacht", "Agen", "Lancy", "La Chaux-de-Fonds", @@ -2569,7 +2569,7 @@ static const char * const _name_swiss_real[] = { "Lyss", "Luzern", "Martigny", - u8"M\u00fcnchenstein", + "M\u00fcnchenstein", "Meyrin", "Montreux", "Monthey", @@ -2577,7 +2577,7 @@ static const char * const _name_swiss_real[] = { "Murten", "Moutier", "Muttenz", - u8"Neuch\u00e2tel", + "Neuch\u00e2tel", "Neuhausen am Rheinfall", "Nyon", "Olten", @@ -2606,11 +2606,11 @@ static const char * const _name_swiss_real[] = { "St. Moritz", "Sion", "Spiez", - u8"St\u00e4fa", + "St\u00e4fa", "Sursee", "Schwyz", "Thalwil", - u8"Th\u00f4nex", + "Th\u00f4nex", "Thun", "Uster", "Uzwil", @@ -2618,7 +2618,7 @@ static const char * const _name_swiss_real[] = { "Volketswil", "Versoix", "Vevey", - u8"W\u00e4denswil", + "W\u00e4denswil", "Wettingen", "Wil", "Wallisellen", @@ -2629,7 +2629,7 @@ static const char * const _name_swiss_real[] = { "Yverdon-les-Bains", "Zollikon", "Zofingen", - u8"Z\u00fcrich", + "Z\u00fcrich", "Zug", }; @@ -2639,12 +2639,12 @@ static const char * const _name_danish_1[] = { "Nye ", "Store ", "Kirke ", - u8"N\u00f8rre ", + "N\u00f8rre ", "Vester ", - u8"S\u00f8nder ", - u8"\u00d8ster ", + "S\u00f8nder ", + "\u00d8ster ", "Hvide ", - u8"H\u00f8je ", + "H\u00f8je ", "Kongens ", }; @@ -2656,7 +2656,7 @@ static const char * const _name_danish_2[] = { "Bede", "Birke", "Bjerring", - u8"Bj\u00e6ver", + "Bj\u00e6ver", "Blommens", "Blok", "Bolder", @@ -2669,7 +2669,7 @@ static const char * const _name_danish_2[] = { "Fredens", "Frederiks", "Fugle", - u8"F\u00e5re", + "F\u00e5re", "Gille", "Gis", "Givs", @@ -2686,11 +2686,11 @@ static const char * const _name_danish_2[] = { "Hol", "Horn", "Humle", - u8"H\u00f8j", - u8"H\u00f8r", + "H\u00f8j", + "H\u00f8r", "Is", "Jyde", - u8"J\u00e6gers", + "J\u00e6gers", "Karls", "Klov", "Kokke", @@ -2702,24 +2702,24 @@ static const char * const _name_danish_2[] = { "Ny", "Oks", "Ring", - u8"R\u00f8de", + "R\u00f8de", "Rung", - u8"R\u00f8r", + "R\u00f8r", "Rud", "Saks", "Salt", "Skam", "Silke", "Skod", - u8"Sk\u00e6l", - u8"Sk\u00e6r", + "Sk\u00e6l", + "Sk\u00e6r", "Sol", "Svend", "Svine", "Strand", "Stubbe", "Ting", - u8"Tj\u00e6re", + "Tj\u00e6re", "Tore", "Uger", "Ulf", @@ -2727,9 +2727,9 @@ static const char * const _name_danish_2[] = { "Vand", "Vej", "Vor", - u8"V\u00e6r", - u8"\u00d8r", - u8"\u00c5l", + "V\u00e6r", + "\u00d8r", + "\u00c5l", }; static const char * const _name_danish_3[] = { @@ -2742,21 +2742,21 @@ static const char * const _name_danish_3[] = { "strup", "holm", "hus", - u8"k\u00f8bing", + "k\u00f8bing", "lund", "lunde", "sund", "ovre", - u8"h\u00f8j", + "h\u00f8j", "dal", "sted", "sten", - u8"l\u00f8se", - u8"r\u00f8d", + "l\u00f8se", + "r\u00f8d", "magle", - u8"s\u00f8", + "s\u00f8", "bjerg", - u8"b\u00e6k", + "b\u00e6k", "drup", "lev", "bo", @@ -2766,32 +2766,32 @@ static const char * const _name_danish_3[] = { }; static const char * const _name_turkish_prefix[] = { - u8"Ak\u00e7a", - u8"Alt\u0131n", - u8"Bah\u00e7e", + "Ak\u00e7a", + "Alt\u0131n", + "Bah\u00e7e", "Boz", - u8"B\u00fcy\u00fck", - u8"\u00c7ay", - u8"Do\u011fu", + "B\u00fcy\u00fck", + "\u00c7ay", + "Do\u011fu", "Eski", - u8"G\u00fczel", - u8"K\u0131z\u0131l", - u8"K\u00fc\u00e7\u00fck", + "G\u00fczel", + "K\u0131z\u0131l", + "K\u00fc\u00e7\u00fck", "Orta", - u8"Sar\u0131", + "Sar\u0131", "Sultan", "Ulu", "Yeni", }; static const char * const _name_turkish_middle[] = { - u8"aga\u00e7", + "aga\u00e7", "ayva", - u8"\u00e7am", + "\u00e7am", "elma", "kurt", "pazar", - u8"yal\u0131", + "yal\u0131", }; static const char * const _name_turkish_suffix[] = { @@ -2800,10 +2800,10 @@ static const char * const _name_turkish_suffix[] = { "kale", "kaya", "kent", - u8"k\u00f6y", + "k\u00f6y", "ova", - u8"\u00f6z\u00fc", - u8"\u00f6ren", + "\u00f6z\u00fc", + "\u00f6ren", "pazar", "saray", "tepe", @@ -2813,48 +2813,48 @@ static const char * const _name_turkish_suffix[] = { static const char * const _name_turkish_real[] = { "Adana", - u8"Ad\u0131yaman", + "Ad\u0131yaman", "Afyon", - u8"A\u011fr\u0131", + "A\u011fr\u0131", "Amasya", "Antalya", "Artvin", - u8"Bal\u0131kesir", + "Bal\u0131kesir", "Bilecik", "Bitlis", "Bolu", "Burdur", "Bursa", - u8"\u00c7anakkale", - u8"\u00c7ank\u0131r\u0131", + "\u00c7anakkale", + "\u00c7ank\u0131r\u0131", "Denizli", - u8"Diyarbak\u0131r", + "Diyarbak\u0131r", "Edirne", - u8"Elaz\u0131\u011f", + "Elaz\u0131\u011f", "Erzurum", - u8"Eski\u015fehir", + "Eski\u015fehir", "Giresun", - u8"G\u00fcm\u00fc\u015fhane", + "G\u00fcm\u00fc\u015fhane", "Hatay", "Isparta", - u8"\u0130\u00e7el", - u8"\u0130stanbul", - u8"\u0130zmir", + "\u0130\u00e7el", + "\u0130stanbul", + "\u0130zmir", "Kars", "Kastamonu", "Kayseri", "Kirklareli", "Kocaeli", "Konya", - u8"K\u00fctahya", + "K\u00fctahya", "Malatya", "Manisa", - u8"Kahramanmara\u015f", + "Kahramanmara\u015f", "Mardin", - u8"Mu\u011fla", - u8"Mu\u015f", - u8"Nev\u015fehir", - u8"Ni\u011fde", + "Mu\u011fla", + "Mu\u015f", + "Nev\u015fehir", + "Ni\u011fde", "Rize", "Sakarya", "Samsun", @@ -2862,21 +2862,21 @@ static const char * const _name_turkish_real[] = { "Sinop", "Sivas", "Trabzon", - u8"\u015eanl\u0131urfa", + "\u015eanl\u0131urfa", "Van", "Yozgat", "Zonguldak", "Aksaray", "Bayburt", "Karaman", - u8"\u015e\u0131rnak", - u8"Bart\u0131n", + "\u015e\u0131rnak", + "Bart\u0131n", "Ardahan", - u8"I\u011fd\u0131r", + "I\u011fd\u0131r", "Yalova", - u8"Karab\u00fck", + "Karab\u00fck", "Osmaniye", - u8"D\u00fczce", + "D\u00fczce", }; static const char * const _name_italian_real[] = { @@ -3168,7 +3168,7 @@ static const char * const _name_catalan_real[] = { "Banyoles", "Figueres", "Balaguer", - u8"Vilafranca del Pened\u00e8s", + "Vilafranca del Pened\u00e8s", "La Seu d'Urgell", "El Pont de Suert", "Igualada", @@ -3184,21 +3184,21 @@ static const char * const _name_catalan_real[] = { "Ripoll", "Cervera", "Gandesa", - u8"Matar\u00f3", + "Matar\u00f3", "Montblanc", - u8"Vilanova i la Geltr\u00fa", - u8"T\u00e0rrega", + "Vilanova i la Geltr\u00fa", + "T\u00e0rrega", "Camprodon", - u8"Campdev\u00e0nol", + "Campdev\u00e0nol", "Cambrils", "Begur", "Setcases", "Palafrugell", "Begues", "El Bruc", - u8"Cadaqu\u00e9s", - u8"Collbat\u00f3", - u8"Cervell\u00f3", + "Cadaqu\u00e9s", + "Collbat\u00f3", + "Cervell\u00f3", "Esparreguera", "Abrera", "Alp", @@ -3209,7 +3209,7 @@ static const char * const _name_catalan_real[] = { "Molins de Rei", "Monistrol", "Rocallaura", - u8"Rub\u00ed", + "Rub\u00ed", "Ripollet", "Sitges", "Roses", @@ -3239,14 +3239,14 @@ static const char * const _name_catalan_pref[] = { "Sant Joan de ", "Sant Feliu de ", "Sant Quirze de ", - u8"Sant Sadurn\u00ed de ", + "Sant Sadurn\u00ed de ", "Santa Coloma de ", "Santa Margarida de ", "Santa Maria de ", - u8"Sant Mart\u00ed de ", + "Sant Mart\u00ed de ", "Sant Pere de ", - u8"Sant Juli\u00e0 de ", - u8"Sant Vicen\u00e7 de ", + "Sant Juli\u00e0 de ", + "Sant Vicen\u00e7 de ", }; @@ -3275,10 +3275,10 @@ static const char * const _name_catalan_2m[] = { "baix", "fosc", "pelat", - u8"vent\u00f3s", + "vent\u00f3s", "negre", "roig", - u8"gr\u00eds", + "gr\u00eds", }; static const char * const _name_catalan_2f[] = { @@ -3293,14 +3293,14 @@ static const char * const _name_catalan_2f[] = { }; static const char * const _name_catalan_3[] = { - u8" Desp\u00ed", + " Desp\u00ed", " Desvern", - u8" del Cam\u00ed", + " del Cam\u00ed", " de Mar", " de Dalt", " de Baix", - u8" del Vall\u00e8s", - u8" de Bergued\u00e0", + " del Vall\u00e8s", + " de Bergued\u00e0", " de Conflent", " de la Plana", }; @@ -3311,5 +3311,5 @@ static const char * const _name_catalan_river1[] = { " de Llobregat", " d'Ebre", " de Segre", - u8" de Francol\u00ed", + " de Francol\u00ed", }; diff --git a/src/textfile_gui.cpp b/src/textfile_gui.cpp index 710ab3b526..a8db38b0b5 100644 --- a/src/textfile_gui.cpp +++ b/src/textfile_gui.cpp @@ -796,7 +796,7 @@ static void Xunzip(byte **bufp, size_t *sizep) std::string_view sv_buf(buf, filesize); /* Check for the byte-order-mark, and skip it if needed. */ - if (StrStartsWith(sv_buf, u8"\ufeff")) sv_buf.remove_prefix(3); + if (StrStartsWith(sv_buf, "\ufeff")) sv_buf.remove_prefix(3); /* Update the filename. */ this->filepath = textfile; diff --git a/src/townname.cpp b/src/townname.cpp index 9850fdad57..d518b66605 100644 --- a/src/townname.cpp +++ b/src/townname.cpp @@ -501,7 +501,7 @@ static void MakeFinnishTownName(StringBuilder &builder, uint32_t seed) if (view.find_first_of("aouAOU") != std::string_view::npos) { builder += "la"; } else { - builder += u8"l\u00e4"; + builder += "l\u00e4"; } return; } From 7eecd7512f75599923b646cfcf0f22c1a9dc1862 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Mon, 15 Jan 2024 22:49:23 +0000 Subject: [PATCH 02/10] Codechange: Remove redundant struct keyword. --- src/bootstrap_gui.cpp | 2 +- src/console_gui.cpp | 2 +- src/main_gui.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bootstrap_gui.cpp b/src/bootstrap_gui.cpp index b3eac7456a..3eb3609691 100644 --- a/src/bootstrap_gui.cpp +++ b/src/bootstrap_gui.cpp @@ -32,7 +32,7 @@ #include "safeguards.h" /** Widgets for the background window to prevent smearing. */ -static const struct NWidgetPart _background_widgets[] = { +static const NWidgetPart _background_widgets[] = { NWidget(WWT_PANEL, COLOUR_DARK_BLUE, WID_BB_BACKGROUND), SetResize(1, 1), EndContainer(), }; diff --git a/src/console_gui.cpp b/src/console_gui.cpp index 412efe0d3e..225168e844 100644 --- a/src/console_gui.cpp +++ b/src/console_gui.cpp @@ -98,7 +98,7 @@ static inline void IConsoleResetHistoryPos() static const char *IConsoleHistoryAdd(const char *cmd); static void IConsoleHistoryNavigate(int direction); -static const struct NWidgetPart _nested_console_window_widgets[] = { +static const NWidgetPart _nested_console_window_widgets[] = { NWidget(WWT_EMPTY, INVALID_COLOUR, WID_C_BACKGROUND), SetResize(1, 1), }; diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 7be47653b3..dcc4eb8015 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -176,7 +176,7 @@ void FixTitleGameZoom(int zoom_adjust) vp->virtual_height = ScaleByZoom(vp->height, vp->zoom); } -static const struct NWidgetPart _nested_main_window_widgets[] = { +static const NWidgetPart _nested_main_window_widgets[] = { NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_M_VIEWPORT), SetResize(1, 1), }; From 68843e3a96b5e2ac45de3b6c17c1418e01ab12fd Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Mon, 15 Jan 2024 22:49:59 +0000 Subject: [PATCH 03/10] Codechange: Move WidgetDimensions::unscaled to header to allow const use. --- src/widget.cpp | 155 +++-------------------------------------------- src/window_gui.h | 148 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 155 insertions(+), 148 deletions(-) diff --git a/src/widget.cpp b/src/widget.cpp index a84fb546e9..962e3f3148 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -25,145 +25,6 @@ #include "safeguards.h" -/** Distances used in drawing widgets. */ -enum WidgetDrawDistances { - /* WWT_IMGBTN(_2) */ - WD_IMGBTN_LEFT = 1, ///< Left offset of the image in the button. - WD_IMGBTN_RIGHT = 1, ///< Right offset of the image in the button. - WD_IMGBTN_TOP = 1, ///< Top offset of image in the button. - WD_IMGBTN_BOTTOM = 1, ///< Bottom offset of image in the button. - - /* WWT_INSET */ - WD_INSET_LEFT = 2, ///< Left offset of string. - WD_INSET_RIGHT = 2, ///< Right offset of string. - WD_INSET_TOP = 1, ///< Top offset of string. - - WD_VSCROLLBAR_LEFT = 2, ///< Left offset of vertical scrollbar. - WD_VSCROLLBAR_RIGHT = 2, ///< Right offset of vertical scrollbar. - WD_VSCROLLBAR_TOP = 3, ///< Top offset of vertical scrollbar. - WD_VSCROLLBAR_BOTTOM = 3, ///< Bottom offset of vertical scrollbar. - - WD_HSCROLLBAR_LEFT = 3, ///< Left offset of horizontal scrollbar. - WD_HSCROLLBAR_RIGHT = 3, ///< Right offset of horizontal scrollbar. - WD_HSCROLLBAR_TOP = 2, ///< Top offset of horizontal scrollbar. - WD_HSCROLLBAR_BOTTOM = 2, ///< Bottom offset of horizontal scrollbar. - - /* Size of the pure frame bevel without any padding. */ - WD_BEVEL_LEFT = 1, ///< Width of left bevel border. - WD_BEVEL_RIGHT = 1, ///< Width of right bevel border. - WD_BEVEL_TOP = 1, ///< Height of top bevel border. - WD_BEVEL_BOTTOM = 1, ///< Height of bottom bevel border. - - /* FrameRect widgets, all text buttons, panel, editbox */ - WD_FRAMERECT_LEFT = 2, ///< Offset at left to draw the frame rectangular area - WD_FRAMERECT_RIGHT = 2, ///< Offset at right to draw the frame rectangular area - WD_FRAMERECT_TOP = 1, ///< Offset at top to draw the frame rectangular area - WD_FRAMERECT_BOTTOM = 1, ///< Offset at bottom to draw the frame rectangular area - - /* WWT_FRAME */ - WD_FRAMETEXT_LEFT = 6, ///< Left offset of the text of the frame. - WD_FRAMETEXT_RIGHT = 6, ///< Right offset of the text of the frame. - WD_FRAMETEXT_TOP = 6, ///< Top offset of the text of the frame - WD_FRAMETEXT_BOTTOM = 6, ///< Bottom offset of the text of the frame - - /* WWT_MATRIX */ - WD_MATRIX_LEFT = 2, ///< Offset at left of a matrix cell. - WD_MATRIX_RIGHT = 2, ///< Offset at right of a matrix cell. - WD_MATRIX_TOP = 3, ///< Offset at top of a matrix cell. - WD_MATRIX_BOTTOM = 1, ///< Offset at bottom of a matrix cell. - - /* WWT_SHADEBOX */ - WD_SHADEBOX_WIDTH = 12, ///< Width of a standard shade box widget. - WD_SHADEBOX_LEFT = 2, ///< Left offset of shade sprite. - WD_SHADEBOX_RIGHT = 2, ///< Right offset of shade sprite. - WD_SHADEBOX_TOP = 3, ///< Top offset of shade sprite. - WD_SHADEBOX_BOTTOM = 3, ///< Bottom offset of shade sprite. - - /* WWT_STICKYBOX */ - WD_STICKYBOX_WIDTH = 12, ///< Width of a standard sticky box widget. - WD_STICKYBOX_LEFT = 2, ///< Left offset of sticky sprite. - WD_STICKYBOX_RIGHT = 2, ///< Right offset of sticky sprite. - WD_STICKYBOX_TOP = 3, ///< Top offset of sticky sprite. - WD_STICKYBOX_BOTTOM = 3, ///< Bottom offset of sticky sprite. - - /* WWT_DEBUGBOX */ - WD_DEBUGBOX_WIDTH = 12, ///< Width of a standard debug box widget. - WD_DEBUGBOX_LEFT = 2, ///< Left offset of debug sprite. - WD_DEBUGBOX_RIGHT = 2, ///< Right offset of debug sprite. - WD_DEBUGBOX_TOP = 3, ///< Top offset of debug sprite. - WD_DEBUGBOX_BOTTOM = 3, ///< Bottom offset of debug sprite. - - /* WWT_DEFSIZEBOX */ - WD_DEFSIZEBOX_WIDTH = 12, ///< Width of a standard defsize box widget. - WD_DEFSIZEBOX_LEFT = 2, ///< Left offset of defsize sprite. - WD_DEFSIZEBOX_RIGHT = 2, ///< Right offset of defsize sprite. - WD_DEFSIZEBOX_TOP = 3, ///< Top offset of defsize sprite. - WD_DEFSIZEBOX_BOTTOM = 3, ///< Bottom offset of defsize sprite. - - /* WWT_RESIZEBOX */ - WD_RESIZEBOX_WIDTH = 12, ///< Width of a resize box widget. - WD_RESIZEBOX_LEFT = 2, ///< Left offset of resize sprite. - WD_RESIZEBOX_RIGHT = 2, ///< Right offset of resize sprite. - WD_RESIZEBOX_TOP = 2, ///< Top offset of resize sprite. - WD_RESIZEBOX_BOTTOM = 2, ///< Bottom offset of resize sprite. - - /* WWT_CLOSEBOX */ - WD_CLOSEBOX_WIDTH = 11, ///< Width of a close box widget. - WD_CLOSEBOX_LEFT = 2, ///< Left offset of closebox string. - WD_CLOSEBOX_RIGHT = 1, ///< Right offset of closebox string. - WD_CLOSEBOX_TOP = 2, ///< Top offset of closebox string. - WD_CLOSEBOX_BOTTOM = 2, ///< Bottom offset of closebox string. - - /* WWT_CAPTION */ - WD_CAPTION_HEIGHT = 14, ///< Height of a title bar. - WD_CAPTIONTEXT_LEFT = 2, ///< Offset of the caption text at the left. - WD_CAPTIONTEXT_RIGHT = 2, ///< Offset of the caption text at the right. - WD_CAPTIONTEXT_TOP = 2, ///< Offset of the caption text at the top. - WD_CAPTIONTEXT_BOTTOM = 2, ///< Offset of the caption text at the bottom. - - /* Dropdown widget. */ - WD_DROPDOWN_HEIGHT = 12, ///< Height of a drop down widget. - WD_DROPDOWNTEXT_LEFT = 2, ///< Left offset of the dropdown widget string. - WD_DROPDOWNTEXT_RIGHT = 2, ///< Right offset of the dropdown widget string. - WD_DROPDOWNTEXT_TOP = 1, ///< Top offset of the dropdown widget string. - WD_DROPDOWNTEXT_BOTTOM = 1, ///< Bottom offset of the dropdown widget string. - - WD_PAR_VSEP_NORMAL = 2, ///< Normal amount of vertical space between two paragraphs of text. - WD_PAR_VSEP_WIDE = 8, ///< Large amount of vertical space between two paragraphs of text. -}; - -const WidgetDimensions WidgetDimensions::unscaled = { - {WD_IMGBTN_LEFT, WD_IMGBTN_TOP, WD_IMGBTN_RIGHT, WD_IMGBTN_BOTTOM}, ///< imgbtn - {WD_INSET_LEFT, WD_INSET_TOP, WD_INSET_RIGHT, WD_BEVEL_BOTTOM}, ///< inset - {WD_VSCROLLBAR_LEFT, WD_VSCROLLBAR_TOP, WD_VSCROLLBAR_RIGHT, WD_VSCROLLBAR_BOTTOM}, ///< vscrollbar - {WD_HSCROLLBAR_LEFT, WD_HSCROLLBAR_TOP, WD_HSCROLLBAR_RIGHT, WD_HSCROLLBAR_BOTTOM}, ///< hscrollbar - {WD_BEVEL_LEFT, WD_BEVEL_TOP, WD_BEVEL_RIGHT, WD_BEVEL_BOTTOM}, ///< bevel - {WD_BEVEL_LEFT, WD_BEVEL_TOP, WD_BEVEL_RIGHT, WD_BEVEL_BOTTOM}, ///< fullbevel - {WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM}, ///< framerect - {WD_FRAMETEXT_LEFT, WD_FRAMETEXT_TOP, WD_FRAMETEXT_RIGHT, WD_FRAMETEXT_BOTTOM}, ///< frametext - {WD_MATRIX_LEFT, WD_MATRIX_TOP, WD_MATRIX_RIGHT, WD_MATRIX_BOTTOM}, ///< matrix - {WD_SHADEBOX_LEFT, WD_SHADEBOX_TOP, WD_SHADEBOX_RIGHT, WD_SHADEBOX_BOTTOM}, ///< shadebox - {WD_STICKYBOX_LEFT, WD_STICKYBOX_TOP, WD_STICKYBOX_RIGHT, WD_STICKYBOX_BOTTOM}, ///< stickybox - {WD_DEBUGBOX_LEFT, WD_DEBUGBOX_TOP, WD_DEBUGBOX_RIGHT, WD_DEBUGBOX_BOTTOM}, ///< debugbox - {WD_DEFSIZEBOX_LEFT, WD_DEFSIZEBOX_TOP, WD_DEFSIZEBOX_RIGHT, WD_DEFSIZEBOX_BOTTOM}, ///< defsizebox - {WD_RESIZEBOX_LEFT, WD_RESIZEBOX_TOP, WD_RESIZEBOX_RIGHT, WD_RESIZEBOX_BOTTOM}, ///< resizebox - {WD_CLOSEBOX_LEFT, WD_CLOSEBOX_TOP, WD_CLOSEBOX_RIGHT, WD_CLOSEBOX_BOTTOM}, ///< closebox - {WD_CAPTIONTEXT_LEFT, WD_CAPTIONTEXT_TOP, WD_CAPTIONTEXT_RIGHT, WD_CAPTIONTEXT_BOTTOM}, ///< captiontext - {WD_DROPDOWNTEXT_LEFT, WD_DROPDOWNTEXT_TOP, WD_DROPDOWNTEXT_RIGHT, WD_DROPDOWNTEXT_BOTTOM}, ///< dropdowntext - {WD_BEVEL_LEFT, WD_BEVEL_TOP * 2, WD_BEVEL_RIGHT, WD_BEVEL_BOTTOM * 2}, ///< dropdownmenu - {20, 10, 20, 10}, ///< modalpopup - {3, 3, 3, 3}, ///< picker - {10, 8, 10, 8}, ///< sparse window padding - {10, 8, 10, 0}, ///< resizable sparse window padding - 1, ///< vsep_picker - WD_PAR_VSEP_NORMAL, ///< vsep_normal - 4, ///< vsep_sparse - WD_PAR_VSEP_WIDE, ///< vsep_wide - 2, ///< hsep_normal - 6, ///< hsep_wide - 10, ///< hsep_indent -}; - WidgetDimensions WidgetDimensions::scaled = {}; /** @@ -2650,50 +2511,50 @@ NWidgetLeaf::NWidgetLeaf(WidgetType tp, Colours colour, WidgetID index, uint32_t case WWT_CAPTION: this->SetFill(1, 0); this->SetResize(1, 0); - this->SetMinimalSize(0, WD_CAPTION_HEIGHT); + this->SetMinimalSize(0, WidgetDimensions::WD_CAPTION_HEIGHT); this->SetMinimalTextLines(1, WidgetDimensions::unscaled.captiontext.Vertical(), FS_NORMAL); this->SetDataTip(data, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS); break; case WWT_STICKYBOX: this->SetFill(0, 0); - this->SetMinimalSize(WD_STICKYBOX_WIDTH, WD_CAPTION_HEIGHT); + this->SetMinimalSize(WidgetDimensions::WD_STICKYBOX_WIDTH, WidgetDimensions::WD_CAPTION_HEIGHT); this->SetDataTip(STR_NULL, STR_TOOLTIP_STICKY); break; case WWT_SHADEBOX: this->SetFill(0, 0); - this->SetMinimalSize(WD_SHADEBOX_WIDTH, WD_CAPTION_HEIGHT); + this->SetMinimalSize(WidgetDimensions::WD_SHADEBOX_WIDTH, WidgetDimensions::WD_CAPTION_HEIGHT); this->SetDataTip(STR_NULL, STR_TOOLTIP_SHADE); break; case WWT_DEBUGBOX: this->SetFill(0, 0); - this->SetMinimalSize(WD_DEBUGBOX_WIDTH, WD_CAPTION_HEIGHT); + this->SetMinimalSize(WidgetDimensions::WD_DEBUGBOX_WIDTH, WidgetDimensions::WD_CAPTION_HEIGHT); this->SetDataTip(STR_NULL, STR_TOOLTIP_DEBUG); break; case WWT_DEFSIZEBOX: this->SetFill(0, 0); - this->SetMinimalSize(WD_DEFSIZEBOX_WIDTH, WD_CAPTION_HEIGHT); + this->SetMinimalSize(WidgetDimensions::WD_DEFSIZEBOX_WIDTH, WidgetDimensions::WD_CAPTION_HEIGHT); this->SetDataTip(STR_NULL, STR_TOOLTIP_DEFSIZE); break; case WWT_RESIZEBOX: this->SetFill(0, 0); - this->SetMinimalSize(WD_RESIZEBOX_WIDTH, 12); + this->SetMinimalSize(WidgetDimensions::WD_RESIZEBOX_WIDTH, 12); this->SetDataTip(RWV_SHOW_BEVEL, STR_TOOLTIP_RESIZE); break; case WWT_CLOSEBOX: this->SetFill(0, 0); - this->SetMinimalSize(WD_CLOSEBOX_WIDTH, WD_CAPTION_HEIGHT); + this->SetMinimalSize(WidgetDimensions::WD_CLOSEBOX_WIDTH, WidgetDimensions::WD_CAPTION_HEIGHT); this->SetDataTip(STR_NULL, STR_TOOLTIP_CLOSE_WINDOW); break; case WWT_DROPDOWN: this->SetFill(0, 0); - this->SetMinimalSize(0, WD_DROPDOWN_HEIGHT); + this->SetMinimalSize(0, WidgetDimensions::WD_DROPDOWN_HEIGHT); this->SetAlignment(SA_TOP | SA_LEFT); break; diff --git a/src/window_gui.h b/src/window_gui.h index 3464af8a51..903581332e 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -31,7 +31,8 @@ enum FrameFlags { DECLARE_ENUM_AS_BIT_SET(FrameFlags) -struct WidgetDimensions { +class WidgetDimensions { +public: RectPadding imgbtn; RectPadding inset; RectPadding vscrollbar; @@ -65,6 +66,151 @@ struct WidgetDimensions { static const WidgetDimensions unscaled; ///< Unscaled widget dimensions. static WidgetDimensions scaled; ///< Widget dimensions scaled for current zoom level. + +private: + /** + * Distances used in drawing widgets. + * These constants should not be used elsewhere, use scaled/unscaled WidgetDimensions instead. + */ + enum WidgetDrawDistances { + /* WWT_IMGBTN(_2) */ + WD_IMGBTN_LEFT = 1, ///< Left offset of the image in the button. + WD_IMGBTN_RIGHT = 2, ///< Right offset of the image in the button. + WD_IMGBTN_TOP = 1, ///< Top offset of image in the button. + WD_IMGBTN_BOTTOM = 2, ///< Bottom offset of image in the button. + + /* WWT_INSET */ + WD_INSET_LEFT = 2, ///< Left offset of string. + WD_INSET_RIGHT = 2, ///< Right offset of string. + WD_INSET_TOP = 1, ///< Top offset of string. + + WD_VSCROLLBAR_LEFT = 2, ///< Left offset of vertical scrollbar. + WD_VSCROLLBAR_RIGHT = 2, ///< Right offset of vertical scrollbar. + WD_VSCROLLBAR_TOP = 3, ///< Top offset of vertical scrollbar. + WD_VSCROLLBAR_BOTTOM = 3, ///< Bottom offset of vertical scrollbar. + + WD_HSCROLLBAR_LEFT = 3, ///< Left offset of horizontal scrollbar. + WD_HSCROLLBAR_RIGHT = 3, ///< Right offset of horizontal scrollbar. + WD_HSCROLLBAR_TOP = 2, ///< Top offset of horizontal scrollbar. + WD_HSCROLLBAR_BOTTOM = 2, ///< Bottom offset of horizontal scrollbar. + + /* Size of the pure frame bevel without any padding. */ + WD_BEVEL_LEFT = 1, ///< Width of left bevel border. + WD_BEVEL_RIGHT = 1, ///< Width of right bevel border. + WD_BEVEL_TOP = 1, ///< Height of top bevel border. + WD_BEVEL_BOTTOM = 1, ///< Height of bottom bevel border. + + /* FrameRect widgets, all text buttons, panel, editbox */ + WD_FRAMERECT_LEFT = 2, ///< Offset at left to draw the frame rectangular area + WD_FRAMERECT_RIGHT = 2, ///< Offset at right to draw the frame rectangular area + WD_FRAMERECT_TOP = 1, ///< Offset at top to draw the frame rectangular area + WD_FRAMERECT_BOTTOM = 1, ///< Offset at bottom to draw the frame rectangular area + + /* WWT_FRAME */ + WD_FRAMETEXT_LEFT = 6, ///< Left offset of the text of the frame. + WD_FRAMETEXT_RIGHT = 6, ///< Right offset of the text of the frame. + WD_FRAMETEXT_TOP = 6, ///< Top offset of the text of the frame + WD_FRAMETEXT_BOTTOM = 6, ///< Bottom offset of the text of the frame + + /* WWT_MATRIX */ + WD_MATRIX_LEFT = 2, ///< Offset at left of a matrix cell. + WD_MATRIX_RIGHT = 2, ///< Offset at right of a matrix cell. + WD_MATRIX_TOP = 3, ///< Offset at top of a matrix cell. + WD_MATRIX_BOTTOM = 1, ///< Offset at bottom of a matrix cell. + + /* WWT_SHADEBOX */ + WD_SHADEBOX_WIDTH = 12, ///< Width of a standard shade box widget. + WD_SHADEBOX_LEFT = 2, ///< Left offset of shade sprite. + WD_SHADEBOX_RIGHT = 2, ///< Right offset of shade sprite. + WD_SHADEBOX_TOP = 3, ///< Top offset of shade sprite. + WD_SHADEBOX_BOTTOM = 3, ///< Bottom offset of shade sprite. + + /* WWT_STICKYBOX */ + WD_STICKYBOX_WIDTH = 12, ///< Width of a standard sticky box widget. + WD_STICKYBOX_LEFT = 2, ///< Left offset of sticky sprite. + WD_STICKYBOX_RIGHT = 2, ///< Right offset of sticky sprite. + WD_STICKYBOX_TOP = 3, ///< Top offset of sticky sprite. + WD_STICKYBOX_BOTTOM = 3, ///< Bottom offset of sticky sprite. + + /* WWT_DEBUGBOX */ + WD_DEBUGBOX_WIDTH = 12, ///< Width of a standard debug box widget. + WD_DEBUGBOX_LEFT = 2, ///< Left offset of debug sprite. + WD_DEBUGBOX_RIGHT = 2, ///< Right offset of debug sprite. + WD_DEBUGBOX_TOP = 3, ///< Top offset of debug sprite. + WD_DEBUGBOX_BOTTOM = 3, ///< Bottom offset of debug sprite. + + /* WWT_DEFSIZEBOX */ + WD_DEFSIZEBOX_WIDTH = 12, ///< Width of a standard defsize box widget. + WD_DEFSIZEBOX_LEFT = 2, ///< Left offset of defsize sprite. + WD_DEFSIZEBOX_RIGHT = 2, ///< Right offset of defsize sprite. + WD_DEFSIZEBOX_TOP = 3, ///< Top offset of defsize sprite. + WD_DEFSIZEBOX_BOTTOM = 3, ///< Bottom offset of defsize sprite. + + /* WWT_RESIZEBOX */ + WD_RESIZEBOX_WIDTH = 12, ///< Width of a resize box widget. + WD_RESIZEBOX_LEFT = 2, ///< Left offset of resize sprite. + WD_RESIZEBOX_RIGHT = 2, ///< Right offset of resize sprite. + WD_RESIZEBOX_TOP = 2, ///< Top offset of resize sprite. + WD_RESIZEBOX_BOTTOM = 2, ///< Bottom offset of resize sprite. + + /* WWT_CLOSEBOX */ + WD_CLOSEBOX_WIDTH = 11, ///< Width of a close box widget. + WD_CLOSEBOX_LEFT = 2, ///< Left offset of closebox string. + WD_CLOSEBOX_RIGHT = 1, ///< Right offset of closebox string. + WD_CLOSEBOX_TOP = 2, ///< Top offset of closebox string. + WD_CLOSEBOX_BOTTOM = 2, ///< Bottom offset of closebox string. + + /* WWT_CAPTION */ + WD_CAPTION_HEIGHT = 14, ///< Height of a title bar. + WD_CAPTIONTEXT_LEFT = 2, ///< Offset of the caption text at the left. + WD_CAPTIONTEXT_RIGHT = 2, ///< Offset of the caption text at the right. + WD_CAPTIONTEXT_TOP = 2, ///< Offset of the caption text at the top. + WD_CAPTIONTEXT_BOTTOM = 2, ///< Offset of the caption text at the bottom. + + /* Dropdown widget. */ + WD_DROPDOWN_HEIGHT = 12, ///< Height of a drop down widget. + WD_DROPDOWNTEXT_LEFT = 2, ///< Left offset of the dropdown widget string. + WD_DROPDOWNTEXT_RIGHT = 2, ///< Right offset of the dropdown widget string. + WD_DROPDOWNTEXT_TOP = 1, ///< Top offset of the dropdown widget string. + WD_DROPDOWNTEXT_BOTTOM = 1, ///< Bottom offset of the dropdown widget string. + + WD_PAR_VSEP_NORMAL = 2, ///< Normal amount of vertical space between two paragraphs of text. + WD_PAR_VSEP_WIDE = 8, ///< Large amount of vertical space between two paragraphs of text. + }; + + friend NWidgetLeaf; +}; + +inline constexpr WidgetDimensions WidgetDimensions::unscaled = { + {WD_IMGBTN_LEFT, WD_IMGBTN_TOP, WD_IMGBTN_RIGHT, WD_IMGBTN_BOTTOM}, ///< imgbtn + {WD_INSET_LEFT, WD_INSET_TOP, WD_INSET_RIGHT, WD_BEVEL_BOTTOM}, ///< inset + {WD_VSCROLLBAR_LEFT, WD_VSCROLLBAR_TOP, WD_VSCROLLBAR_RIGHT, WD_VSCROLLBAR_BOTTOM}, ///< vscrollbar + {WD_HSCROLLBAR_LEFT, WD_HSCROLLBAR_TOP, WD_HSCROLLBAR_RIGHT, WD_HSCROLLBAR_BOTTOM}, ///< hscrollbar + {WD_BEVEL_LEFT, WD_BEVEL_TOP, WD_BEVEL_RIGHT, WD_BEVEL_BOTTOM}, ///< bevel + {WD_BEVEL_LEFT, WD_BEVEL_TOP, WD_BEVEL_RIGHT, WD_BEVEL_BOTTOM}, ///< fullbevel + {WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM}, ///< framerect + {WD_FRAMETEXT_LEFT, WD_FRAMETEXT_TOP, WD_FRAMETEXT_RIGHT, WD_FRAMETEXT_BOTTOM}, ///< frametext + {WD_MATRIX_LEFT, WD_MATRIX_TOP, WD_MATRIX_RIGHT, WD_MATRIX_BOTTOM}, ///< matrix + {WD_SHADEBOX_LEFT, WD_SHADEBOX_TOP, WD_SHADEBOX_RIGHT, WD_SHADEBOX_BOTTOM}, ///< shadebox + {WD_STICKYBOX_LEFT, WD_STICKYBOX_TOP, WD_STICKYBOX_RIGHT, WD_STICKYBOX_BOTTOM}, ///< stickybox + {WD_DEBUGBOX_LEFT, WD_DEBUGBOX_TOP, WD_DEBUGBOX_RIGHT, WD_DEBUGBOX_BOTTOM}, ///< debugbox + {WD_DEFSIZEBOX_LEFT, WD_DEFSIZEBOX_TOP, WD_DEFSIZEBOX_RIGHT, WD_DEFSIZEBOX_BOTTOM}, ///< defsizebox + {WD_RESIZEBOX_LEFT, WD_RESIZEBOX_TOP, WD_RESIZEBOX_RIGHT, WD_RESIZEBOX_BOTTOM}, ///< resizebox + {WD_CLOSEBOX_LEFT, WD_CLOSEBOX_TOP, WD_CLOSEBOX_RIGHT, WD_CLOSEBOX_BOTTOM}, ///< closebox + {WD_CAPTIONTEXT_LEFT, WD_CAPTIONTEXT_TOP, WD_CAPTIONTEXT_RIGHT, WD_CAPTIONTEXT_BOTTOM}, ///< captiontext + {WD_DROPDOWNTEXT_LEFT, WD_DROPDOWNTEXT_TOP, WD_DROPDOWNTEXT_RIGHT, WD_DROPDOWNTEXT_BOTTOM}, ///< dropdowntext + {WD_BEVEL_LEFT, WD_BEVEL_TOP * 2, WD_BEVEL_RIGHT, WD_BEVEL_BOTTOM * 2}, ///< dropdownmenu + {20, 10, 20, 10}, ///< modalpopup + {3, 3, 3, 3}, ///< picker + {10, 8, 10, 8}, ///< sparse window padding + {10, 8, 10, 1}, ///< resizable sparse window padding + 1, ///< vsep_picker + WD_PAR_VSEP_NORMAL, ///< vsep_normal + 4, ///< vsep_sparse + WD_PAR_VSEP_WIDE, ///< vsep_wide + 2, ///< hsep_normal + 6, ///< hsep_wide + 10, ///< hsep_indent }; /* widget.cpp */ From a5b6e17556da19fd45939d2842124e65da6772bb Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Mon, 15 Jan 2024 22:49:25 +0000 Subject: [PATCH 04/10] Codechange: Make geometry methods constexpr. --- src/core/geometry_type.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/geometry_type.hpp b/src/core/geometry_type.hpp index 2c1f91abe4..98995f4797 100644 --- a/src/core/geometry_type.hpp +++ b/src/core/geometry_type.hpp @@ -57,13 +57,13 @@ struct RectPadding { * Get total horizontal padding of RectPadding. * @return total horizontal padding. */ - inline uint Horizontal() const { return this->left + this->right; } + constexpr uint Horizontal() const { return this->left + this->right; } /** * Get total vertical padding of RectPadding. * @return total vertical padding. */ - inline uint Vertical() const { return this->top + this->bottom; } + constexpr uint Vertical() const { return this->top + this->bottom; } }; inline const RectPadding RectPadding::zero{}; From 71b7ba0daac8f64c8c4ffd87f1a9c0f9d80ae53d Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Mon, 15 Jan 2024 22:49:24 +0000 Subject: [PATCH 05/10] Codechange: Allow constexpr NWidgetPart construction. --- src/widget_type.h | 193 +++++++++++++++------------------------------- 1 file changed, 61 insertions(+), 132 deletions(-) diff --git a/src/widget_type.h b/src/widget_type.h index 0e058d33a0..4b46e8974f 100644 --- a/src/widget_type.h +++ b/src/widget_type.h @@ -1037,7 +1037,7 @@ typedef std::unique_ptr NWidgetFunctionType(); */ struct NWidgetPart { WidgetType type; ///< Type of the part. @see NWidgetPartType. - union { + union NWidgetPartUnion { Point xy; ///< Part with an x/y size. NWidgetPartDataTip data_tip; ///< Part with a data/tooltip. NWidgetPartWidget widget; ///< Part with a start of a widget. @@ -1048,7 +1048,33 @@ struct NWidgetPart { NWidgetPartAlignment align; ///< Part with internal alignment. NWidgetFunctionType *func_ptr; ///< Part with a function call. NWidContainerFlags cont_flags; ///< Part with container flags. + + /* Constructors for each NWidgetPartUnion data type. */ + constexpr NWidgetPartUnion() : xy() {} + constexpr NWidgetPartUnion(Point xy) : xy(xy) {} + constexpr NWidgetPartUnion(NWidgetPartDataTip data_tip) : data_tip(data_tip) {} + constexpr NWidgetPartUnion(NWidgetPartWidget widget) : widget(widget) {} + constexpr NWidgetPartUnion(NWidgetPartPaddings padding) : padding(padding) {} + constexpr NWidgetPartUnion(NWidgetPartPIP pip) : pip(pip) {} + constexpr NWidgetPartUnion(NWidgetPartTextLines text_lines) : text_lines(text_lines) {} + constexpr NWidgetPartUnion(NWidgetPartTextStyle text_style) : text_style(text_style) {} + constexpr NWidgetPartUnion(NWidgetPartAlignment align) : align(align) {} + constexpr NWidgetPartUnion(NWidgetFunctionType *func_ptr) : func_ptr(func_ptr) {} + constexpr NWidgetPartUnion(NWidContainerFlags cont_flags) : cont_flags(cont_flags) {} } u; + + /* Constructors for each NWidgetPart data type. */ + explicit constexpr NWidgetPart(WidgetType type) : type(type), u() {} + constexpr NWidgetPart(WidgetType type, Point xy) : type(type), u(xy) {} + constexpr NWidgetPart(WidgetType type, NWidgetPartDataTip data_tip) : type(type), u(data_tip) {} + constexpr NWidgetPart(WidgetType type, NWidgetPartWidget widget) : type(type), u(widget) {} + constexpr NWidgetPart(WidgetType type, NWidgetPartPaddings padding) : type(type), u(padding) {} + constexpr NWidgetPart(WidgetType type, NWidgetPartPIP pip) : type(type), u(pip) {} + constexpr NWidgetPart(WidgetType type, NWidgetPartTextLines text_lines) : type(type), u(text_lines) {} + constexpr NWidgetPart(WidgetType type, NWidgetPartTextStyle text_style) : type(type), u(text_style) {} + constexpr NWidgetPart(WidgetType type, NWidgetPartAlignment align) : type(type), u(align) {} + constexpr NWidgetPart(WidgetType type, NWidgetFunctionType *func_ptr) : type(type), u(func_ptr) {} + constexpr NWidgetPart(WidgetType type, NWidContainerFlags cont_flags) : type(type), u(cont_flags) {} }; /** @@ -1057,15 +1083,9 @@ struct NWidgetPart { * @param dy Vertical resize step. 0 means no vertical resizing. * @ingroup NestedWidgetParts */ -inline NWidgetPart SetResize(int16_t dx, int16_t dy) +constexpr NWidgetPart SetResize(int16_t dx, int16_t dy) { - NWidgetPart part; - - part.type = WPT_RESIZE; - part.u.xy.x = dx; - part.u.xy.y = dy; - - return part; + return NWidgetPart{WPT_RESIZE, Point{dx, dy}}; } /** @@ -1074,15 +1094,9 @@ inline NWidgetPart SetResize(int16_t dx, int16_t dy) * @param y Vertical minimal size. * @ingroup NestedWidgetParts */ -inline NWidgetPart SetMinimalSize(int16_t x, int16_t y) +constexpr NWidgetPart SetMinimalSize(int16_t x, int16_t y) { - NWidgetPart part; - - part.type = WPT_MINSIZE; - part.u.xy.x = x; - part.u.xy.y = y; - - return part; + return NWidgetPart{WPT_MINSIZE, Point{x, y}}; } /** @@ -1092,16 +1106,9 @@ inline NWidgetPart SetMinimalSize(int16_t x, int16_t y) * @param size Font size of text. * @ingroup NestedWidgetParts */ -inline NWidgetPart SetMinimalTextLines(uint8_t lines, uint8_t spacing, FontSize size = FS_NORMAL) +constexpr NWidgetPart SetMinimalTextLines(uint8_t lines, uint8_t spacing, FontSize size = FS_NORMAL) { - NWidgetPart part; - - part.type = WPT_MINTEXTLINES; - part.u.text_lines.lines = lines; - part.u.text_lines.spacing = spacing; - part.u.text_lines.size = size; - - return part; + return NWidgetPart{WPT_MINTEXTLINES, NWidgetPartTextLines{lines, spacing, size}}; } /** @@ -1110,15 +1117,9 @@ inline NWidgetPart SetMinimalTextLines(uint8_t lines, uint8_t spacing, FontSize * @param size Font size to draw string within widget. * @ingroup NestedWidgetParts */ -inline NWidgetPart SetTextStyle(TextColour colour, FontSize size = FS_NORMAL) +constexpr NWidgetPart SetTextStyle(TextColour colour, FontSize size = FS_NORMAL) { - NWidgetPart part; - - part.type = WPT_TEXTSTYLE; - part.u.text_style.colour = colour; - part.u.text_style.size = size; - - return part; + return NWidgetPart{WPT_TEXTSTYLE, NWidgetPartTextStyle{colour, size}}; } /** @@ -1126,14 +1127,9 @@ inline NWidgetPart SetTextStyle(TextColour colour, FontSize size = FS_NORMAL) * @param align Alignment of text/image within widget. * @ingroup NestedWidgetParts */ -inline NWidgetPart SetAlignment(StringAlignment align) +constexpr NWidgetPart SetAlignment(StringAlignment align) { - NWidgetPart part; - - part.type = WPT_ALIGNMENT; - part.u.align.align = align; - - return part; + return NWidgetPart{WPT_ALIGNMENT, NWidgetPartAlignment{align}}; } /** @@ -1142,15 +1138,9 @@ inline NWidgetPart SetAlignment(StringAlignment align) * @param fill_y Vertical filling step from minimal size. * @ingroup NestedWidgetParts */ -inline NWidgetPart SetFill(uint fill_x, uint fill_y) +constexpr NWidgetPart SetFill(uint16_t fill_x, uint16_t fill_y) { - NWidgetPart part; - - part.type = WPT_FILL; - part.u.xy.x = fill_x; - part.u.xy.y = fill_y; - - return part; + return NWidgetPart{WPT_FILL, Point{fill_x, fill_y}}; } /** @@ -1158,13 +1148,9 @@ inline NWidgetPart SetFill(uint fill_x, uint fill_y) * (horizontal, vertical, WWT_FRAME, WWT_INSET, or WWT_PANEL). * @ingroup NestedWidgetParts */ -inline NWidgetPart EndContainer() +constexpr NWidgetPart EndContainer() { - NWidgetPart part; - - part.type = WPT_ENDCONTAINER; - - return part; + return NWidgetPart{WPT_ENDCONTAINER}; } /** @@ -1173,15 +1159,9 @@ inline NWidgetPart EndContainer() * @param tip Tooltip of the widget. * @ingroup NestedWidgetParts */ -inline NWidgetPart SetDataTip(uint32_t data, StringID tip) +constexpr NWidgetPart SetDataTip(uint32_t data, StringID tip) { - NWidgetPart part; - - part.type = WPT_DATATIP; - part.u.data_tip.data = data; - part.u.data_tip.tooltip = tip; - - return part; + return NWidgetPart{WPT_DATATIP, NWidgetPartDataTip{data, tip}}; } /** @@ -1191,7 +1171,7 @@ inline NWidgetPart SetDataTip(uint32_t data, StringID tip) * @param tip Tooltip of the widget. * @ingroup NestedWidgetParts */ -inline NWidgetPart SetMatrixDataTip(uint8_t cols, uint8_t rows, StringID tip) +constexpr NWidgetPart SetMatrixDataTip(uint8_t cols, uint8_t rows, StringID tip) { return SetDataTip((rows << MAT_ROW_START) | (cols << MAT_COL_START), tip); } @@ -1205,17 +1185,9 @@ inline NWidgetPart SetMatrixDataTip(uint8_t cols, uint8_t rows, StringID tip) * @param left The padding left of the widget. * @ingroup NestedWidgetParts */ -inline NWidgetPart SetPadding(uint8_t top, uint8_t right, uint8_t bottom, uint8_t left) +constexpr NWidgetPart SetPadding(uint8_t top, uint8_t right, uint8_t bottom, uint8_t left) { - NWidgetPart part; - - part.type = WPT_PADDING; - part.u.padding.top = top; - part.u.padding.right = right; - part.u.padding.bottom = bottom; - part.u.padding.left = left; - - return part; + return NWidgetPart{WPT_PADDING, NWidgetPartPaddings{left, top, right, bottom}}; } /** @@ -1223,17 +1195,9 @@ inline NWidgetPart SetPadding(uint8_t top, uint8_t right, uint8_t bottom, uint8_ * @param r The padding around the widget. * @ingroup NestedWidgetParts */ -inline NWidgetPart SetPadding(const RectPadding &padding) +constexpr NWidgetPart SetPadding(const RectPadding &padding) { - NWidgetPart part; - - part.type = WPT_PADDING; - part.u.padding.left = padding.left; - part.u.padding.top = padding.top; - part.u.padding.right = padding.right; - part.u.padding.bottom = padding.bottom; - - return part; + return NWidgetPart{WPT_PADDING, NWidgetPartPaddings{padding}}; } /** @@ -1241,7 +1205,7 @@ inline NWidgetPart SetPadding(const RectPadding &padding) * @param padding The padding to use for all directions. * @ingroup NestedWidgetParts */ -inline NWidgetPart SetPadding(uint8_t padding) +constexpr NWidgetPart SetPadding(uint8_t padding) { return SetPadding(padding, padding, padding, padding); } @@ -1253,16 +1217,9 @@ inline NWidgetPart SetPadding(uint8_t padding) * @param post The amount of space after the last widget. * @ingroup NestedWidgetParts */ -inline NWidgetPart SetPIP(uint8_t pre, uint8_t inter, uint8_t post) +constexpr NWidgetPart SetPIP(uint8_t pre, uint8_t inter, uint8_t post) { - NWidgetPart part; - - part.type = WPT_PIPSPACE; - part.u.pip.pre = pre; - part.u.pip.inter = inter; - part.u.pip.post = post; - - return part; + return NWidgetPart{WPT_PIPSPACE, NWidgetPartPIP{pre, inter, post}}; } /** @@ -1272,16 +1229,9 @@ inline NWidgetPart SetPIP(uint8_t pre, uint8_t inter, uint8_t post) * @param post The ratio of space after the last widget. * @ingroup NestedWidgetParts */ -inline NWidgetPart SetPIPRatio(uint8_t ratio_pre, uint8_t ratio_inter, uint8_t ratio_post) +constexpr NWidgetPart SetPIPRatio(uint8_t ratio_pre, uint8_t ratio_inter, uint8_t ratio_post) { - NWidgetPart part; - - part.type = WPT_PIPRATIO; - part.u.pip.pre = ratio_pre; - part.u.pip.inter = ratio_inter; - part.u.pip.post = ratio_post; - - return part; + return NWidgetPart{WPT_PIPRATIO, NWidgetPartPIP{ratio_pre, ratio_inter, ratio_post}}; } /** @@ -1291,14 +1241,9 @@ inline NWidgetPart SetPIPRatio(uint8_t ratio_pre, uint8_t ratio_inter, uint8_t r * @param index Widget index of the scrollbar. * @ingroup NestedWidgetParts */ -inline NWidgetPart SetScrollbar(WidgetID index) +constexpr NWidgetPart SetScrollbar(WidgetID index) { - NWidgetPart part; - - part.type = WPT_SCROLLBAR; - part.u.widget.index = index; - - return part; + return NWidgetPart{WPT_SCROLLBAR, NWidgetPartWidget{INVALID_COLOUR, index}}; } /** @@ -1310,15 +1255,9 @@ inline NWidgetPart SetScrollbar(WidgetID index) * Child widgets must have a index bigger than the parent index. * @ingroup NestedWidgetParts */ -inline NWidgetPart NWidget(WidgetType tp, Colours col, int idx = -1) +constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx = -1) { - NWidgetPart part; - - part.type = tp; - part.u.widget.colour = col; - part.u.widget.index = idx; - - return part; + return NWidgetPart{tp, NWidgetPartWidget{col, idx}}; } /** @@ -1327,14 +1266,9 @@ inline NWidgetPart NWidget(WidgetType tp, Colours col, int idx = -1) * @param cont_flags Flags for the containers (#NWID_HORIZONTAL and #NWID_VERTICAL). * @ingroup NestedWidgetParts */ -inline NWidgetPart NWidget(WidgetType tp, NWidContainerFlags cont_flags = NC_NONE) +constexpr NWidgetPart NWidget(WidgetType tp, NWidContainerFlags cont_flags = NC_NONE) { - NWidgetPart part; - - part.type = tp; - part.u.cont_flags = cont_flags; - - return part; + return NWidgetPart{tp, NWidContainerFlags{cont_flags}}; } /** @@ -1342,14 +1276,9 @@ inline NWidgetPart NWidget(WidgetType tp, NWidContainerFlags cont_flags = NC_NON * @param func_ptr Pointer to function that returns the tree. * @ingroup NestedWidgetParts */ -inline NWidgetPart NWidgetFunction(NWidgetFunctionType *func_ptr) +constexpr NWidgetPart NWidgetFunction(NWidgetFunctionType *func_ptr) { - NWidgetPart part; - - part.type = WPT_FUNCTION; - part.u.func_ptr = func_ptr; - - return part; + return NWidgetPart{WPT_FUNCTION, func_ptr}; } bool IsContainerWidgetType(WidgetType tp); From 7737aa6640c29a61f27eed7d89757d897f9494f0 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Mon, 15 Jan 2024 22:49:24 +0000 Subject: [PATCH 06/10] Codechange: Make all NWidgetPart arrays constexpr. This ensures that the arrays are not created at runtime and prevents using non-constexpr values. --- src/ai/ai_gui.cpp | 2 +- src/airport_gui.cpp | 4 ++-- src/autoreplace_gui.cpp | 6 +++--- src/bootstrap_gui.cpp | 8 ++++---- src/bridge_gui.cpp | 2 +- src/build_vehicle_gui.cpp | 2 +- src/cheat_gui.cpp | 2 +- src/company_gui.cpp | 12 ++++++------ src/console_gui.cpp | 2 +- src/date_gui.cpp | 2 +- src/depot_gui.cpp | 2 +- src/dock_gui.cpp | 8 ++++---- src/engine_gui.cpp | 2 +- src/error_gui.cpp | 4 ++-- src/fios_gui.cpp | 6 +++--- src/framerate_gui.cpp | 4 ++-- src/game/game_gui.cpp | 2 +- src/genworld_gui.cpp | 8 ++++---- src/goal_gui.cpp | 10 +++++----- src/graph_gui.cpp | 16 ++++++++-------- src/group_gui.cpp | 2 +- src/help_gui.cpp | 2 +- src/highscore_gui.cpp | 2 +- src/industry_gui.cpp | 8 ++++---- src/intro_gui.cpp | 2 +- src/league_gui.cpp | 4 ++-- src/linkgraph/linkgraph_gui.cpp | 2 +- src/main_gui.cpp | 2 +- src/misc_gui.cpp | 10 +++++----- src/music_gui.cpp | 4 ++-- src/network/network_chat_gui.cpp | 2 +- src/network/network_content_gui.cpp | 4 ++-- src/network/network_gui.cpp | 14 +++++++------- src/newgrf_debug_gui.cpp | 6 +++--- src/newgrf_gui.cpp | 14 +++++++------- src/news_gui.cpp | 12 ++++++------ src/object_gui.cpp | 2 +- src/order_gui.cpp | 6 +++--- src/osk_gui.cpp | 2 +- src/rail_gui.cpp | 10 +++++----- src/road_gui.cpp | 14 +++++++------- src/screenshot_gui.cpp | 2 +- src/script/script_gui.cpp | 6 +++--- src/settings_gui.cpp | 6 +++--- src/signs_gui.cpp | 4 ++-- src/smallmap_gui.cpp | 6 +++--- src/station_gui.cpp | 6 +++--- src/statusbar_gui.cpp | 2 +- src/story_gui.cpp | 2 +- src/subsidy_gui.cpp | 2 +- src/terraform_gui.cpp | 4 ++-- src/textfile_gui.cpp | 2 +- src/timetable_gui.cpp | 2 +- src/toolbar_gui.cpp | 6 +++--- src/town_gui.cpp | 10 +++++----- src/transparency_gui.cpp | 2 +- src/tree_gui.cpp | 2 +- src/vehicle_gui.cpp | 10 +++++----- src/viewport_gui.cpp | 2 +- src/waypoint_gui.cpp | 2 +- src/widgets/dropdown.cpp | 2 +- 61 files changed, 154 insertions(+), 154 deletions(-) diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 2a78ce04bb..c51f0be993 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -27,7 +27,7 @@ /** Widgets for the configure AI window. */ -static const NWidgetPart _nested_ai_config_widgets[] = { +static constexpr NWidgetPart _nested_ai_config_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_MAUVE), NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_AI_CONFIG_CAPTION_AI, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index aa6b0f5e1e..b4f0180679 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -194,7 +194,7 @@ struct BuildAirToolbarWindow : Window { }, AirportToolbarGlobalHotkeys}; }; -static const NWidgetPart _nested_air_toolbar_widgets[] = { +static constexpr NWidgetPart _nested_air_toolbar_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_TOOLBAR_AIRCRAFT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -581,7 +581,7 @@ public: }}; }; -static const NWidgetPart _nested_build_airport_widgets[] = { +static constexpr NWidgetPart _nested_build_airport_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index 1c097fd9a9..64707259d3 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -732,7 +732,7 @@ public: } }; -static const NWidgetPart _nested_replace_rail_vehicle_widgets[] = { +static constexpr NWidgetPart _nested_replace_rail_vehicle_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_RV_CAPTION), SetDataTip(STR_REPLACE_VEHICLES_WHITE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -796,7 +796,7 @@ static WindowDesc _replace_rail_vehicle_desc(__FILE__, __LINE__, std::begin(_nested_replace_rail_vehicle_widgets), std::end(_nested_replace_rail_vehicle_widgets) ); -static const NWidgetPart _nested_replace_road_vehicle_widgets[] = { +static constexpr NWidgetPart _nested_replace_road_vehicle_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_RV_CAPTION), SetDataTip(STR_REPLACE_VEHICLES_WHITE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -854,7 +854,7 @@ static WindowDesc _replace_road_vehicle_desc(__FILE__, __LINE__, std::begin(_nested_replace_road_vehicle_widgets), std::end(_nested_replace_road_vehicle_widgets) ); -static const NWidgetPart _nested_replace_vehicle_widgets[] = { +static constexpr NWidgetPart _nested_replace_vehicle_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_RV_CAPTION), SetMinimalSize(433, 14), SetDataTip(STR_REPLACE_VEHICLES_WHITE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/bootstrap_gui.cpp b/src/bootstrap_gui.cpp index 3eb3609691..4a1b72d9c5 100644 --- a/src/bootstrap_gui.cpp +++ b/src/bootstrap_gui.cpp @@ -32,7 +32,7 @@ #include "safeguards.h" /** Widgets for the background window to prevent smearing. */ -static const NWidgetPart _background_widgets[] = { +static constexpr NWidgetPart _background_widgets[] = { NWidget(WWT_PANEL, COLOUR_DARK_BLUE, WID_BB_BACKGROUND), SetResize(1, 1), EndContainer(), }; @@ -65,7 +65,7 @@ public: }; /** Nested widgets for the error window. */ -static const NWidgetPart _nested_bootstrap_errmsg_widgets[] = { +static constexpr NWidgetPart _nested_bootstrap_errmsg_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CAPTION, COLOUR_GREY, WID_BEM_CAPTION), SetDataTip(STR_MISSING_GRAPHICS_ERROR_TITLE, STR_NULL), EndContainer(), @@ -122,7 +122,7 @@ public: }; /** Nested widgets for the download window. */ -static const NWidgetPart _nested_bootstrap_download_status_window_widgets[] = { +static constexpr NWidgetPart _nested_bootstrap_download_status_window_widgets[] = { NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_CONTENT_DOWNLOAD_TITLE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), NWidget(WWT_PANEL, COLOUR_GREY), NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0), SetPadding(WidgetDimensions::unscaled.modalpopup), @@ -173,7 +173,7 @@ public: }; /** The widgets for the query. It has no close box as that sprite does not exist yet. */ -static const NWidgetPart _bootstrap_query_widgets[] = { +static constexpr NWidgetPart _bootstrap_query_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_MISSING_GRAPHICS_SET_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), EndContainer(), diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index f671a8f4db..fec724bb4c 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -313,7 +313,7 @@ const StringID BuildBridgeWindow::sorter_names[] = { }; /** Widgets of the bridge gui. */ -static const NWidgetPart _nested_build_bridge_widgets[] = { +static constexpr NWidgetPart _nested_build_bridge_widgets[] = { /* Header */ NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index d71763ff00..63ce1709e5 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -54,7 +54,7 @@ uint GetEngineListHeight(VehicleType type) return std::max(GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.matrix.Vertical(), GetVehicleImageCellSize(type, EIT_PURCHASE).height); } -static const NWidgetPart _nested_build_vehicle_widgets[] = { +static constexpr NWidgetPart _nested_build_vehicle_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_BV_CAPTION), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), SetTextStyle(TC_WHITE), diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp index cd6be9d21d..5033faabfd 100644 --- a/src/cheat_gui.cpp +++ b/src/cheat_gui.cpp @@ -204,7 +204,7 @@ static const CheatEntry _cheats_ui[] = { static_assert(CHT_NUM_CHEATS == lengthof(_cheats_ui)); /** Widget definitions of the cheat GUI. */ -static const NWidgetPart _nested_cheat_widgets[] = { +static constexpr NWidgetPart _nested_cheat_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_CHEATS, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 17f6fdac97..8e271903ad 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -279,7 +279,7 @@ static void DrawYearColumn(const Rect &r, TimerGameCalendar::Year year, const Ex DrawPrice(sum, r.left, r.right, y, TC_WHITE); } -static const NWidgetPart _nested_company_finances_widgets[] = { +static constexpr NWidgetPart _nested_company_finances_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_CF_CAPTION), SetDataTip(STR_FINANCES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -1097,7 +1097,7 @@ public: } }; -static const NWidgetPart _nested_select_company_livery_widgets[] = { +static constexpr NWidgetPart _nested_select_company_livery_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_SCL_CAPTION), SetDataTip(STR_LIVERY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -1192,7 +1192,7 @@ void DrawCompanyManagerFace(CompanyManagerFace cmf, int colour, const Rect &r) } /** Nested widget description for the company manager face selection dialog */ -static const NWidgetPart _nested_select_company_manager_face_widgets[] = { +static constexpr NWidgetPart _nested_select_company_manager_face_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_SCMF_CAPTION), SetDataTip(STR_FACE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -1771,7 +1771,7 @@ static void DoSelectCompanyManagerFace(Window *parent) new SelectCompanyManagerFaceWindow(&_select_company_manager_face_desc, parent); } -static const NWidgetPart _nested_company_infrastructure_widgets[] = { +static constexpr NWidgetPart _nested_company_infrastructure_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_CI_CAPTION), SetDataTip(STR_COMPANY_INFRASTRUCTURE_VIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -2140,7 +2140,7 @@ static void ShowCompanyInfrastructure(CompanyID company) AllocateWindowDescFront(&_company_infrastructure_desc, company); } -static const NWidgetPart _nested_company_widgets[] = { +static constexpr NWidgetPart _nested_company_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_C_CAPTION), SetDataTip(STR_COMPANY_VIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -2726,7 +2726,7 @@ private: Money company_value; ///< The value of the company for which the user can buy it. }; -static const NWidgetPart _nested_buy_company_widgets[] = { +static constexpr NWidgetPart _nested_buy_company_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE), NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE, WID_BC_CAPTION), SetDataTip(STR_ERROR_MESSAGE_CAPTION_OTHER_COMPANY, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/console_gui.cpp b/src/console_gui.cpp index 225168e844..0e3ac41a16 100644 --- a/src/console_gui.cpp +++ b/src/console_gui.cpp @@ -98,7 +98,7 @@ static inline void IConsoleResetHistoryPos() static const char *IConsoleHistoryAdd(const char *cmd); static void IConsoleHistoryNavigate(int direction); -static const NWidgetPart _nested_console_window_widgets[] = { +static constexpr NWidgetPart _nested_console_window_widgets[] = { NWidget(WWT_EMPTY, INVALID_COLOUR, WID_C_BACKGROUND), SetResize(1, 1), }; diff --git a/src/date_gui.cpp b/src/date_gui.cpp index 6a43a73fbb..035b820ec6 100644 --- a/src/date_gui.cpp +++ b/src/date_gui.cpp @@ -173,7 +173,7 @@ struct SetDateWindow : Window { }; /** Widgets for the date setting window. */ -static const NWidgetPart _nested_set_date_widgets[] = { +static constexpr NWidgetPart _nested_set_date_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_DATE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 999cdd41bf..f523825b85 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -46,7 +46,7 @@ */ /** Nested widget definition for train depots. */ -static const NWidgetPart _nested_train_depot_widgets[] = { +static constexpr NWidgetPart _nested_train_depot_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(NWID_SELECTION, INVALID_COLOUR, WID_D_SHOW_RENAME), // rename button diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 518481c510..a0e18862e1 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -326,7 +326,7 @@ struct BuildDocksToolbarWindow : Window { * Nested widget parts of docks toolbar, game version. * Position of #WID_DT_RIVER widget has changed. */ -static const NWidgetPart _nested_build_docks_toolbar_widgets[] = { +static constexpr NWidgetPart _nested_build_docks_toolbar_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_WATERWAYS_TOOLBAR_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -371,7 +371,7 @@ Window *ShowBuildDocksToolbar() * Nested widget parts of docks toolbar, scenario editor version. * Positions of #WID_DT_DEPOT, #WID_DT_STATION, and #WID_DT_BUOY widgets have changed. */ -static const NWidgetPart _nested_build_docks_scen_toolbar_widgets[] = { +static constexpr NWidgetPart _nested_build_docks_scen_toolbar_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_WATERWAYS_TOOLBAR_CAPTION_SE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -479,7 +479,7 @@ public: }; /** Nested widget parts of a build dock station window. */ -static const NWidgetPart _nested_build_dock_station_widgets[] = { +static constexpr NWidgetPart _nested_build_dock_station_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_DOCK_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -580,7 +580,7 @@ public: } }; -static const NWidgetPart _nested_build_docks_depot_widgets[] = { +static constexpr NWidgetPart _nested_build_docks_depot_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_DEPOT_BUILD_SHIP_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp index 14866db3f7..72a47a907d 100644 --- a/src/engine_gui.cpp +++ b/src/engine_gui.cpp @@ -51,7 +51,7 @@ StringID GetEngineCategoryName(EngineID engine) } } -static const NWidgetPart _nested_engine_preview_widgets[] = { +static constexpr NWidgetPart _nested_engine_preview_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE), NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE), SetDataTip(STR_ENGINE_PREVIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/error_gui.cpp b/src/error_gui.cpp index b47d8f056e..6fed8398c7 100644 --- a/src/error_gui.cpp +++ b/src/error_gui.cpp @@ -33,7 +33,7 @@ #include "safeguards.h" -static const NWidgetPart _nested_errmsg_widgets[] = { +static constexpr NWidgetPart _nested_errmsg_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_RED), NWidget(WWT_CAPTION, COLOUR_RED, WID_EM_CAPTION), SetDataTip(STR_ERROR_MESSAGE_CAPTION, STR_NULL), @@ -50,7 +50,7 @@ static WindowDesc _errmsg_desc(__FILE__, __LINE__, std::begin(_nested_errmsg_widgets), std::end(_nested_errmsg_widgets) ); -static const NWidgetPart _nested_errmsg_face_widgets[] = { +static constexpr NWidgetPart _nested_errmsg_face_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_RED), NWidget(WWT_CAPTION, COLOUR_RED, WID_EM_CAPTION), SetDataTip(STR_ERROR_MESSAGE_CAPTION_OTHER_COMPANY, STR_NULL), diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp index e2fb4d3491..26b182184c 100644 --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -63,7 +63,7 @@ void LoadCheckData::Clear() } /** Load game/scenario with optional content download */ -static const NWidgetPart _nested_load_dialog_widgets[] = { +static constexpr NWidgetPart _nested_load_dialog_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_SL_CAPTION), @@ -124,7 +124,7 @@ static const NWidgetPart _nested_load_dialog_widgets[] = { }; /** Load heightmap with content download */ -static const NWidgetPart _nested_load_heightmap_dialog_widgets[] = { +static constexpr NWidgetPart _nested_load_heightmap_dialog_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_SL_CAPTION), @@ -169,7 +169,7 @@ static const NWidgetPart _nested_load_heightmap_dialog_widgets[] = { }; /** Save game/scenario */ -static const NWidgetPart _nested_save_dialog_widgets[] = { +static constexpr NWidgetPart _nested_save_dialog_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_SL_CAPTION), diff --git a/src/framerate_gui.cpp b/src/framerate_gui.cpp index c82e90f5a8..e058235058 100644 --- a/src/framerate_gui.cpp +++ b/src/framerate_gui.cpp @@ -372,7 +372,7 @@ static const char * GetAIName(int ai_index) } /** @hideinitializer */ -static const NWidgetPart _framerate_window_widgets[] = { +static constexpr NWidgetPart _framerate_window_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_FRW_CAPTION), SetDataTip(STR_FRAMERATE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -735,7 +735,7 @@ static WindowDesc _framerate_display_desc(__FILE__, __LINE__, /** @hideinitializer */ -static const NWidgetPart _frametime_graph_window_widgets[] = { +static constexpr NWidgetPart _frametime_graph_window_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_FGW_CAPTION), SetDataTip(STR_JUST_STRING2, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), SetTextStyle(TC_WHITE), diff --git a/src/game/game_gui.cpp b/src/game/game_gui.cpp index 08afc3a795..debc06af13 100644 --- a/src/game/game_gui.cpp +++ b/src/game/game_gui.cpp @@ -30,7 +30,7 @@ /** Widgets for the configure GS window. */ -static const NWidgetPart _nested_gs_config_widgets[] = { +static constexpr NWidgetPart _nested_gs_config_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_MAUVE), NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_AI_CONFIG_CAPTION_GAMESCRIPT, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 44c295784d..c895640756 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -69,7 +69,7 @@ void SetNewLandscapeType(byte landscape) } /** Widgets of GenerateLandscapeWindow when generating world */ -static const NWidgetPart _nested_generate_landscape_widgets[] = { +static constexpr NWidgetPart _nested_generate_landscape_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_MAPGEN_WORLD_GENERATION_CAPTION, STR_NULL), @@ -193,7 +193,7 @@ static const NWidgetPart _nested_generate_landscape_widgets[] = { }; /** Widgets of GenerateLandscapeWindow when loading heightmap */ -static const NWidgetPart _nested_heightmap_load_widgets[] = { +static constexpr NWidgetPart _nested_heightmap_load_widgets[] = { /* Window header. */ NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), @@ -1254,7 +1254,7 @@ struct CreateScenarioWindow : public Window } }; -static const NWidgetPart _nested_create_scenario_widgets[] = { +static constexpr NWidgetPart _nested_create_scenario_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_SE_MAPGEN_CAPTION, STR_NULL), @@ -1327,7 +1327,7 @@ void ShowCreateScenario() new CreateScenarioWindow(&_create_scenario_desc, GLWM_SCENARIO); } -static const NWidgetPart _nested_generate_progress_widgets[] = { +static constexpr NWidgetPart _nested_generate_progress_widgets[] = { NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GENERATION_WORLD, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), NWidget(WWT_PANEL, COLOUR_GREY), NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0), SetPadding(WidgetDimensions::unscaled.modalpopup), diff --git a/src/goal_gui.cpp b/src/goal_gui.cpp index db39c84f25..a19180c058 100644 --- a/src/goal_gui.cpp +++ b/src/goal_gui.cpp @@ -280,7 +280,7 @@ struct GoalListWindow : public Window { }; /** Widgets of the #GoalListWindow. */ -static const NWidgetPart _nested_goals_list_widgets[] = { +static constexpr NWidgetPart _nested_goals_list_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN, WID_GOAL_CAPTION), SetDataTip(STR_JUST_STRING1, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -406,7 +406,7 @@ struct GoalQuestionWindow : public Window { }; /** Widgets of the goal question window. */ -static const NWidgetPart _nested_goal_question_widgets_question[] = { +static constexpr NWidgetPart _nested_goal_question_widgets_question[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE), NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE, WID_GQ_CAPTION), SetDataTip(STR_GOAL_QUESTION_CAPTION_QUESTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -432,7 +432,7 @@ static const NWidgetPart _nested_goal_question_widgets_question[] = { EndContainer(), }; -static const NWidgetPart _nested_goal_question_widgets_info[] = { +static constexpr NWidgetPart _nested_goal_question_widgets_info[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE), NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE, WID_GQ_CAPTION), SetDataTip(STR_GOAL_QUESTION_CAPTION_INFORMATION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -458,7 +458,7 @@ static const NWidgetPart _nested_goal_question_widgets_info[] = { EndContainer(), }; -static const NWidgetPart _nested_goal_question_widgets_warning[] = { +static constexpr NWidgetPart _nested_goal_question_widgets_warning[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_YELLOW), NWidget(WWT_CAPTION, COLOUR_YELLOW, WID_GQ_CAPTION), SetDataTip(STR_GOAL_QUESTION_CAPTION_WARNING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -484,7 +484,7 @@ static const NWidgetPart _nested_goal_question_widgets_warning[] = { EndContainer(), }; -static const NWidgetPart _nested_goal_question_widgets_error[] = { +static constexpr NWidgetPart _nested_goal_question_widgets_error[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_RED), NWidget(WWT_CAPTION, COLOUR_RED, WID_GQ_CAPTION), SetDataTip(STR_GOAL_QUESTION_CAPTION_ERROR, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index 6952b8ec60..b95b725835 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -126,7 +126,7 @@ static std::unique_ptr MakeNWidgetCompanyLines() return vert; } -static const NWidgetPart _nested_graph_legend_widgets[] = { +static constexpr NWidgetPart _nested_graph_legend_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_GRAPH_KEY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -630,7 +630,7 @@ struct OperatingProfitGraphWindow : BaseGraphWindow { } }; -static const NWidgetPart _nested_operating_profit_widgets[] = { +static constexpr NWidgetPart _nested_operating_profit_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_GRAPH_OPERATING_PROFIT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -681,7 +681,7 @@ struct IncomeGraphWindow : BaseGraphWindow { } }; -static const NWidgetPart _nested_income_graph_widgets[] = { +static constexpr NWidgetPart _nested_income_graph_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_GRAPH_INCOME_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -730,7 +730,7 @@ struct DeliveredCargoGraphWindow : BaseGraphWindow { } }; -static const NWidgetPart _nested_delivered_cargo_graph_widgets[] = { +static constexpr NWidgetPart _nested_delivered_cargo_graph_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_GRAPH_CARGO_DELIVERED_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -785,7 +785,7 @@ struct PerformanceHistoryGraphWindow : BaseGraphWindow { } }; -static const NWidgetPart _nested_performance_history_widgets[] = { +static constexpr NWidgetPart _nested_performance_history_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_GRAPH_COMPANY_PERFORMANCE_RATINGS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -835,7 +835,7 @@ struct CompanyValueGraphWindow : BaseGraphWindow { } }; -static const NWidgetPart _nested_company_value_graph_widgets[] = { +static constexpr NWidgetPart _nested_company_value_graph_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_GRAPH_COMPANY_VALUES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -1053,7 +1053,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { } }; -static const NWidgetPart _nested_cargo_payment_rates_widgets[] = { +static constexpr NWidgetPart _nested_cargo_payment_rates_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_GRAPH_CARGO_PAYMENT_RATES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -1370,7 +1370,7 @@ std::unique_ptr MakeCompanyButtonRowsGraphGUI() return MakeCompanyButtonRows(WID_PRD_COMPANY_FIRST, WID_PRD_COMPANY_LAST, COLOUR_BROWN, 8, STR_PERFORMANCE_DETAIL_SELECT_COMPANY_TOOLTIP); } -static const NWidgetPart _nested_performance_rating_detail_widgets[] = { +static constexpr NWidgetPart _nested_performance_rating_detail_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_PERFORMANCE_DETAIL, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 7da213c0d7..79b04715c4 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -38,7 +38,7 @@ typedef GUIList GUIGroupList; -static const NWidgetPart _nested_group_widgets[] = { +static constexpr NWidgetPart _nested_group_widgets[] = { NWidget(NWID_HORIZONTAL), // Window header NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_GL_CAPTION), diff --git a/src/help_gui.cpp b/src/help_gui.cpp index 3c34b0fb0a..ab41674aaf 100644 --- a/src/help_gui.cpp +++ b/src/help_gui.cpp @@ -166,7 +166,7 @@ private: } }; -static const NWidgetPart _nested_helpwin_widgets[] = { +static constexpr NWidgetPart _nested_helpwin_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_HELP_WINDOW_CAPTION, STR_NULL), diff --git a/src/highscore_gui.cpp b/src/highscore_gui.cpp index c93e073f44..2198b191bc 100644 --- a/src/highscore_gui.cpp +++ b/src/highscore_gui.cpp @@ -210,7 +210,7 @@ struct HighScoreWindow : EndGameHighScoreBaseWindow { } }; -static const NWidgetPart _nested_highscore_widgets[] = { +static constexpr NWidgetPart _nested_highscore_widgets[] = { NWidget(WWT_PANEL, COLOUR_BROWN, WID_H_BACKGROUND), SetResize(1, 1), EndContainer(), }; diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 0c887ebf73..af1dac2fbb 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -261,7 +261,7 @@ void CcBuildIndustry(Commands, const CommandCost &result, TileIndex tile, Indust } } -static const NWidgetPart _nested_build_industry_widgets[] = { +static constexpr NWidgetPart _nested_build_industry_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_FUND_INDUSTRY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -1175,7 +1175,7 @@ static void UpdateIndustryProduction(Industry *i) } /** Widget definition of the view industry gui */ -static const NWidgetPart _nested_industry_view_widgets[] = { +static constexpr NWidgetPart _nested_industry_view_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_CREAM), NWidget(WWT_CAPTION, COLOUR_CREAM, WID_IV_CAPTION), SetDataTip(STR_INDUSTRY_VIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -1212,7 +1212,7 @@ void ShowIndustryViewWindow(int industry) } /** Widget definition of the industry directory gui */ -static const NWidgetPart _nested_industry_directory_widgets[] = { +static constexpr NWidgetPart _nested_industry_directory_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_INDUSTRY_DIRECTORY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -1918,7 +1918,7 @@ void ShowIndustryDirectory() } /** Widgets of the industry cargoes window. */ -static const NWidgetPart _nested_industry_cargoes_widgets[] = { +static constexpr NWidgetPart _nested_industry_cargoes_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN, WID_IC_CAPTION), SetDataTip(STR_INDUSTRY_CARGOES_INDUSTRY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp index 472f241453..ed06c0968c 100644 --- a/src/intro_gui.cpp +++ b/src/intro_gui.cpp @@ -377,7 +377,7 @@ struct SelectGameWindow : public Window { } }; -static const NWidgetPart _nested_select_game_widgets[] = { +static constexpr NWidgetPart _nested_select_game_widgets[] = { NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_INTRO_CAPTION, STR_NULL), NWidget(WWT_PANEL, COLOUR_BROWN), NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0), SetPadding(WidgetDimensions::unscaled.sparse), diff --git a/src/league_gui.cpp b/src/league_gui.cpp index 3faadad0c9..de02cfe8c2 100644 --- a/src/league_gui.cpp +++ b/src/league_gui.cpp @@ -186,7 +186,7 @@ public: } }; -static const NWidgetPart _nested_performance_league_widgets[] = { +static constexpr NWidgetPart _nested_performance_league_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_COMPANY_LEAGUE_TABLE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -419,7 +419,7 @@ public: } }; -static const NWidgetPart _nested_script_league_widgets[] = { +static constexpr NWidgetPart _nested_script_league_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN, WID_SLT_CAPTION), SetDataTip(STR_JUST_RAW_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/linkgraph/linkgraph_gui.cpp b/src/linkgraph/linkgraph_gui.cpp index 6f44f5c601..fa45679aac 100644 --- a/src/linkgraph/linkgraph_gui.cpp +++ b/src/linkgraph/linkgraph_gui.cpp @@ -506,7 +506,7 @@ std::unique_ptr MakeCargoesLegendLinkGraphGUI() } -static const NWidgetPart _nested_linkgraph_legend_widgets[] = { +static constexpr NWidgetPart _nested_linkgraph_legend_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_LGL_CAPTION), SetDataTip(STR_LINKGRAPH_LEGEND_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/main_gui.cpp b/src/main_gui.cpp index dcc4eb8015..d6ffa71ba2 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -176,7 +176,7 @@ void FixTitleGameZoom(int zoom_adjust) vp->virtual_height = ScaleByZoom(vp->height, vp->zoom); } -static const NWidgetPart _nested_main_window_widgets[] = { +static constexpr NWidgetPart _nested_main_window_widgets[] = { NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_M_VIEWPORT), SetResize(1, 1), }; diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index dbf191c95e..9abc483fa1 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -48,7 +48,7 @@ enum OskActivation { }; -static const NWidgetPart _nested_land_info_widgets[] = { +static constexpr NWidgetPart _nested_land_info_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_LAND_AREA_INFORMATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -377,7 +377,7 @@ void ShowLandInfo(TileIndex tile) new LandInfoWindow(tile); } -static const NWidgetPart _nested_about_widgets[] = { +static constexpr NWidgetPart _nested_about_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_ABOUT_OPENTTD, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -647,7 +647,7 @@ void HideFillingPercent(TextEffectID *te_id) *te_id = INVALID_TE_ID; } -static const NWidgetPart _nested_tooltips_widgets[] = { +static constexpr NWidgetPart _nested_tooltips_widgets[] = { NWidget(WWT_EMPTY, INVALID_COLOUR, WID_TT_BACKGROUND), }; @@ -1048,7 +1048,7 @@ struct QueryStringWindow : public Window } }; -static const NWidgetPart _nested_query_string_widgets[] = { +static constexpr NWidgetPart _nested_query_string_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_QS_CAPTION), SetDataTip(STR_JUST_STRING, STR_NULL), SetTextStyle(TC_WHITE), @@ -1195,7 +1195,7 @@ struct QueryWindow : public Window { } }; -static const NWidgetPart _nested_query_widgets[] = { +static constexpr NWidgetPart _nested_query_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_RED), NWidget(WWT_CAPTION, COLOUR_RED, WID_Q_CAPTION), // The caption's string is set in the constructor diff --git a/src/music_gui.cpp b/src/music_gui.cpp index ffe15319a6..728ba73c5c 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -630,7 +630,7 @@ struct MusicTrackSelectionWindow : public Window { } }; -static const NWidgetPart _nested_music_track_selection_widgets[] = { +static constexpr NWidgetPart _nested_music_track_selection_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_MTS_CAPTION), SetDataTip(STR_PLAYLIST_MUSIC_SELECTION_SETNAME, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -862,7 +862,7 @@ struct MusicWindow : public Window { } }; -static const NWidgetPart _nested_music_window_widgets[] = { +static constexpr NWidgetPart _nested_music_window_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_MUSIC_JAZZ_JUKEBOX_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp index 8b4bfd7b04..321cc4f9ec 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -491,7 +491,7 @@ struct NetworkChatWindow : public Window { }; /** The widgets of the chat window. */ -static const NWidgetPart _nested_chat_window_widgets[] = { +static constexpr NWidgetPart _nested_chat_window_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY, WID_NC_CLOSE), NWidget(WWT_PANEL, COLOUR_GREY, WID_NC_BACKGROUND), diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index e90d0daeb7..e937bfb0ea 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -80,7 +80,7 @@ void ShowContentTextfileWindow(TextfileType file_type, const ContentInfo *ci) } /** Nested widgets for the download window. */ -static const NWidgetPart _nested_network_content_download_status_window_widgets[] = { +static constexpr NWidgetPart _nested_network_content_download_status_window_widgets[] = { NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_CONTENT_DOWNLOAD_TITLE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), NWidget(WWT_PANEL, COLOUR_GREY), NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0), SetPadding(WidgetDimensions::unscaled.modalpopup), @@ -1032,7 +1032,7 @@ void BuildContentTypeStringList() } /** The widgets for the content list. */ -static const NWidgetPart _nested_network_content_list_widgets[] = { +static constexpr NWidgetPart _nested_network_content_list_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE), NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE), SetDataTip(STR_CONTENT_TITLE, STR_NULL), diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 3e58ca964b..40e2e966ae 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -871,7 +871,7 @@ static std::unique_ptr MakeResizableHeader() return std::make_unique(); } -static const NWidgetPart _nested_network_game_widgets[] = { +static constexpr NWidgetPart _nested_network_game_widgets[] = { /* TOP */ NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE), @@ -1149,7 +1149,7 @@ struct NetworkStartServerWindow : public Window { } }; -static const NWidgetPart _nested_network_start_server_window_widgets[] = { +static constexpr NWidgetPart _nested_network_start_server_window_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE), NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE), SetDataTip(STR_NETWORK_START_SERVER_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -1237,7 +1237,7 @@ static void ShowNetworkStartServerWindow() extern void DrawCompanyIcon(CompanyID cid, int x, int y); -static const NWidgetPart _nested_client_list_widgets[] = { +static constexpr NWidgetPart _nested_client_list_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_NETWORK_CLIENT_LIST_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -2194,7 +2194,7 @@ struct NetworkJoinStatusWindow : Window { } }; -static const NWidgetPart _nested_network_join_status_window_widgets[] = { +static constexpr NWidgetPart _nested_network_join_status_window_widgets[] = { NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_NETWORK_CONNECTING_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), NWidget(WWT_PANEL, COLOUR_GREY), NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0), SetPadding(WidgetDimensions::unscaled.modalpopup), @@ -2302,7 +2302,7 @@ struct NetworkCompanyPasswordWindow : public Window { } }; -static const NWidgetPart _nested_network_company_password_window_widgets[] = { +static constexpr NWidgetPart _nested_network_company_password_window_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_COMPANY_PASSWORD_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -2419,7 +2419,7 @@ struct NetworkAskRelayWindow : public Window { } }; -static const NWidgetPart _nested_network_ask_relay_widgets[] = { +static constexpr NWidgetPart _nested_network_ask_relay_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_RED), NWidget(WWT_CAPTION, COLOUR_RED, WID_NAR_CAPTION), SetDataTip(STR_NETWORK_ASK_RELAY_CAPTION, STR_NULL), @@ -2514,7 +2514,7 @@ struct NetworkAskSurveyWindow : public Window { } }; -static const NWidgetPart _nested_network_ask_survey_widgets[] = { +static constexpr NWidgetPart _nested_network_ask_survey_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_NAS_CAPTION), SetDataTip(STR_NETWORK_ASK_SURVEY_CAPTION, STR_NULL), diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index 83f857e657..6bb16255bb 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -637,7 +637,7 @@ struct NewGRFInspectWindow : Window { /* static */ uint32_t NewGRFInspectWindow::var60params[GSF_FAKE_END][0x20] = { {0} }; // Use spec to have 0s in whole array -static const NWidgetPart _nested_newgrf_inspect_chain_widgets[] = { +static constexpr NWidgetPart _nested_newgrf_inspect_chain_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_NGRFI_CAPTION), SetDataTip(STR_NEWGRF_INSPECT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -661,7 +661,7 @@ static const NWidgetPart _nested_newgrf_inspect_chain_widgets[] = { EndContainer(), }; -static const NWidgetPart _nested_newgrf_inspect_widgets[] = { +static constexpr NWidgetPart _nested_newgrf_inspect_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_NGRFI_CAPTION), SetDataTip(STR_NEWGRF_INSPECT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -1090,7 +1090,7 @@ struct SpriteAlignerWindow : Window { bool SpriteAlignerWindow::centre = true; bool SpriteAlignerWindow::crosshair = true; -static const NWidgetPart _nested_sprite_aligner_widgets[] = { +static constexpr NWidgetPart _nested_sprite_aligner_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_SA_CAPTION), SetDataTip(STR_SPRITE_ALIGNER_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 57071d28d3..769ee5d6f9 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -508,7 +508,7 @@ struct NewGRFParametersWindow : public Window { GRFParameterInfo NewGRFParametersWindow::dummy_parameter_info(0); -static const NWidgetPart _nested_newgrf_parameter_widgets[] = { +static constexpr NWidgetPart _nested_newgrf_parameter_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_MAUVE), NWidget(WWT_CAPTION, COLOUR_MAUVE, WID_NP_CAPTION), @@ -1808,7 +1808,7 @@ public: const uint NWidgetNewGRFDisplay::MAX_EXTRA_INFO_WIDTH = 150; const uint NWidgetNewGRFDisplay::MIN_EXTRA_FOR_3_COLUMNS = 50; -static const NWidgetPart _nested_newgrf_actives_widgets[] = { +static constexpr NWidgetPart _nested_newgrf_actives_widgets[] = { NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0), /* Left side, presets. */ NWidget(NWID_VERTICAL), @@ -1863,7 +1863,7 @@ static const NWidgetPart _nested_newgrf_actives_widgets[] = { EndContainer(), }; -static const NWidgetPart _nested_newgrf_availables_widgets[] = { +static constexpr NWidgetPart _nested_newgrf_availables_widgets[] = { NWidget(WWT_FRAME, COLOUR_MAUVE), SetDataTip(STR_NEWGRF_SETTINGS_INACTIVE_LIST, STR_NULL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0), /* Left side, available grfs, filter edit box. */ NWidget(NWID_HORIZONTAL), SetPIP(0, WidgetDimensions::unscaled.hsep_wide, 0), @@ -1896,7 +1896,7 @@ static const NWidgetPart _nested_newgrf_availables_widgets[] = { EndContainer(), }; -static const NWidgetPart _nested_newgrf_infopanel_widgets[] = { +static constexpr NWidgetPart _nested_newgrf_infopanel_widgets[] = { NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0), /* Right side, info panel. */ NWidget(WWT_PANEL, COLOUR_MAUVE), @@ -1949,7 +1949,7 @@ std::unique_ptr NewGRFDisplay() } /* Widget definition of the manage newgrfs window */ -static const NWidgetPart _nested_newgrf_widgets[] = { +static constexpr NWidgetPart _nested_newgrf_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_MAUVE), NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_NEWGRF_SETTINGS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -2025,7 +2025,7 @@ void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFC } /** Widget parts of the save preset window. */ -static const NWidgetPart _nested_save_preset_widgets[] = { +static constexpr NWidgetPart _nested_save_preset_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_SAVE_PRESET_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -2183,7 +2183,7 @@ static void ShowSavePresetWindow(const char *initial_text) } /** Widgets for the progress window. */ -static const NWidgetPart _nested_scan_progress_widgets[] = { +static constexpr NWidgetPart _nested_scan_progress_widgets[] = { NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_NEWGRF_SCAN_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), NWidget(WWT_PANEL, COLOUR_GREY), NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0), SetPadding(WidgetDimensions::unscaled.modalpopup), diff --git a/src/news_gui.cpp b/src/news_gui.cpp index e5b73de2e4..a6952600d2 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -82,7 +82,7 @@ static TileIndex GetReferenceTile(NewsReferenceType reftype, uint32_t ref) } /* Normal news items. */ -static const NWidgetPart _nested_normal_news_widgets[] = { +static constexpr NWidgetPart _nested_normal_news_widgets[] = { NWidget(WWT_PANEL, COLOUR_WHITE, WID_N_PANEL), NWidget(NWID_HORIZONTAL), SetPadding(1, 1, 0, 1), NWidget(WWT_CLOSEBOX, COLOUR_WHITE, WID_N_CLOSEBOX), SetPadding(0, 0, 0, 1), @@ -104,7 +104,7 @@ static WindowDesc _normal_news_desc(__FILE__, __LINE__, ); /* New vehicles news items. */ -static const NWidgetPart _nested_vehicle_news_widgets[] = { +static constexpr NWidgetPart _nested_vehicle_news_widgets[] = { NWidget(WWT_PANEL, COLOUR_WHITE, WID_N_PANEL), NWidget(NWID_HORIZONTAL), SetPadding(1, 1, 0, 1), NWidget(NWID_VERTICAL), @@ -131,7 +131,7 @@ static WindowDesc _vehicle_news_desc(__FILE__, __LINE__, ); /* Company news items. */ -static const NWidgetPart _nested_company_news_widgets[] = { +static constexpr NWidgetPart _nested_company_news_widgets[] = { NWidget(WWT_PANEL, COLOUR_WHITE, WID_N_PANEL), NWidget(NWID_HORIZONTAL), SetPadding(1, 1, 0, 1), NWidget(NWID_VERTICAL), @@ -159,7 +159,7 @@ static WindowDesc _company_news_desc(__FILE__, __LINE__, ); /* Thin news items. */ -static const NWidgetPart _nested_thin_news_widgets[] = { +static constexpr NWidgetPart _nested_thin_news_widgets[] = { NWidget(WWT_PANEL, COLOUR_WHITE, WID_N_PANEL), NWidget(NWID_HORIZONTAL), SetPadding(1, 1, 0, 1), NWidget(WWT_CLOSEBOX, COLOUR_WHITE, WID_N_CLOSEBOX), SetPadding(0, 0, 0, 1), @@ -182,7 +182,7 @@ static WindowDesc _thin_news_desc(__FILE__, __LINE__, ); /* Small news items. */ -static const NWidgetPart _nested_small_news_widgets[] = { +static constexpr NWidgetPart _nested_small_news_widgets[] = { /* Caption + close box. The caption is no WWT_CAPTION as the window shall not be moveable and so on. */ NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE, WID_N_CLOSEBOX), @@ -1209,7 +1209,7 @@ struct MessageHistoryWindow : Window { } }; -static const NWidgetPart _nested_message_history[] = { +static constexpr NWidgetPart _nested_message_history[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_MESSAGE_HISTORY, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/object_gui.cpp b/src/object_gui.cpp index 8a198c8f89..a72edbe4ff 100644 --- a/src/object_gui.cpp +++ b/src/object_gui.cpp @@ -662,7 +662,7 @@ BuildObjectWindow::GUIObjectClassList::FilterFunction * const BuildObjectWindow: &TagNameFilter, }; -static const NWidgetPart _nested_build_object_widgets[] = { +static constexpr NWidgetPart _nested_build_object_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_OBJECT_BUILD_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/order_gui.cpp b/src/order_gui.cpp index ac481afd2d..ec9b7960bb 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -1567,7 +1567,7 @@ public: }; /** Nested widget definition for "your" train orders. */ -static const NWidgetPart _nested_orders_train_widgets[] = { +static constexpr NWidgetPart _nested_orders_train_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_O_CAPTION), SetDataTip(STR_ORDERS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -1645,7 +1645,7 @@ static WindowDesc _orders_train_desc(__FILE__, __LINE__, ); /** Nested widget definition for "your" orders (non-train). */ -static const NWidgetPart _nested_orders_widgets[] = { +static constexpr NWidgetPart _nested_orders_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_O_CAPTION), SetDataTip(STR_ORDERS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -1718,7 +1718,7 @@ static WindowDesc _orders_desc(__FILE__, __LINE__, ); /** Nested widget definition for competitor orders. */ -static const NWidgetPart _nested_other_orders_widgets[] = { +static constexpr NWidgetPart _nested_other_orders_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_O_CAPTION), SetDataTip(STR_ORDERS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp index bb3d49bf6a..00d311ff24 100644 --- a/src/osk_gui.cpp +++ b/src/osk_gui.cpp @@ -318,7 +318,7 @@ static std::unique_ptr MakeSpacebarKeys() } -static const NWidgetPart _nested_osk_widgets[] = { +static constexpr NWidgetPart _nested_osk_widgets[] = { NWidget(WWT_CAPTION, COLOUR_GREY, WID_OSK_CAPTION), SetDataTip(STR_JUST_STRING, STR_NULL), SetTextStyle(TC_WHITE), NWidget(WWT_PANEL, COLOUR_GREY), NWidget(WWT_EDITBOX, COLOUR_GREY, WID_OSK_TEXT), SetMinimalSize(252, 12), SetPadding(2, 2, 2, 2), diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 7ed5e2159c..1e94cc9032 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -796,7 +796,7 @@ struct BuildRailToolbarWindow : Window { }, RailToolbarGlobalHotkeys}; }; -static const NWidgetPart _nested_build_rail_widgets[] = { +static constexpr NWidgetPart _nested_build_rail_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_RAT_CAPTION), SetDataTip(STR_JUST_STRING2, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), SetTextStyle(TC_WHITE), @@ -1528,7 +1528,7 @@ BuildRailStationWindow::GUIStationClassList::FilterFunction * const BuildRailSta &TagNameFilter, }; -static const NWidgetPart _nested_station_builder_widgets[] = { +static constexpr NWidgetPart _nested_station_builder_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_RAIL_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -1821,7 +1821,7 @@ public: }; /** Nested widget definition of the build signal window */ -static const NWidgetPart _nested_signal_builder_widgets[] = { +static constexpr NWidgetPart _nested_signal_builder_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_BS_CAPTION), SetDataTip(STR_BUILD_SIGNAL_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -1937,7 +1937,7 @@ struct BuildRailDepotWindow : public PickerWindowBase { }; /** Nested widget definition of the build rail depot window */ -static const NWidgetPart _nested_build_depot_widgets[] = { +static constexpr NWidgetPart _nested_build_depot_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_BUILD_DEPOT_TRAIN_ORIENTATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -2160,7 +2160,7 @@ struct BuildRailWaypointWindow : PickerWindowBase { /* static */ QueryString BuildRailWaypointWindow::editbox(BuildRailWaypointWindow::FILTER_LENGTH * MAX_CHAR_LENGTH, BuildRailWaypointWindow::FILTER_LENGTH); /** Nested widget definition for the build NewGRF rail waypoint window */ -static const NWidgetPart _nested_build_waypoint_widgets[] = { +static constexpr NWidgetPart _nested_build_waypoint_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_WAYPOINT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 1d513d49d4..f9ce3039b2 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -816,7 +816,7 @@ struct BuildRoadToolbarWindow : Window { }, TramToolbarGlobalHotkeys}; }; -static const NWidgetPart _nested_build_road_widgets[] = { +static constexpr NWidgetPart _nested_build_road_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_ROT_CAPTION), SetDataTip(STR_JUST_STRING2, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), SetTextStyle(TC_WHITE), @@ -859,7 +859,7 @@ static WindowDesc _build_road_desc(__FILE__, __LINE__, &BuildRoadToolbarWindow::road_hotkeys ); -static const NWidgetPart _nested_build_tramway_widgets[] = { +static constexpr NWidgetPart _nested_build_tramway_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_ROT_CAPTION), SetDataTip(STR_JUST_STRING2, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), SetTextStyle(TC_WHITE), @@ -918,7 +918,7 @@ Window *ShowBuildRoadToolbar(RoadType roadtype) return AllocateWindowDescFront(RoadTypeIsRoad(_cur_roadtype) ? &_build_road_desc : &_build_tramway_desc, TRANSPORT_ROAD); } -static const NWidgetPart _nested_build_road_scen_widgets[] = { +static constexpr NWidgetPart _nested_build_road_scen_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_ROT_CAPTION), SetDataTip(STR_JUST_STRING2, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), SetTextStyle(TC_WHITE), @@ -955,7 +955,7 @@ static WindowDesc _build_road_scen_desc(__FILE__, __LINE__, &BuildRoadToolbarWindow::road_hotkeys ); -static const NWidgetPart _nested_build_tramway_scen_widgets[] = { +static constexpr NWidgetPart _nested_build_tramway_scen_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_ROT_CAPTION), SetDataTip(STR_JUST_STRING2, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), SetTextStyle(TC_WHITE), @@ -1060,7 +1060,7 @@ struct BuildRoadDepotWindow : public PickerWindowBase { } }; -static const NWidgetPart _nested_build_road_depot_widgets[] = { +static constexpr NWidgetPart _nested_build_road_depot_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_BROD_CAPTION), SetDataTip(STR_BUILD_DEPOT_ROAD_ORIENTATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -1599,7 +1599,7 @@ BuildRoadStationWindow::GUIRoadStopClassList::FilterFunction * const BuildRoadSt }; /** Widget definition of the build road station window */ -static const NWidgetPart _nested_road_station_picker_widgets[] = { +static constexpr NWidgetPart _nested_road_station_picker_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_BROS_CAPTION), @@ -1688,7 +1688,7 @@ static WindowDesc _road_station_picker_desc(__FILE__, __LINE__, ); /** Widget definition of the build tram station window */ -static const NWidgetPart _nested_tram_station_picker_widgets[] = { +static constexpr NWidgetPart _nested_tram_station_picker_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_BROS_CAPTION), diff --git a/src/screenshot_gui.cpp b/src/screenshot_gui.cpp index 2d92c6ca4d..268f4dec0c 100644 --- a/src/screenshot_gui.cpp +++ b/src/screenshot_gui.cpp @@ -43,7 +43,7 @@ struct ScreenshotWindow : Window { } }; -static const NWidgetPart _nested_screenshot[] = { +static constexpr NWidgetPart _nested_screenshot[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_SCREENSHOT_CAPTION, 0), diff --git a/src/script/script_gui.cpp b/src/script/script_gui.cpp index 1674327d77..3f3bd0e232 100644 --- a/src/script/script_gui.cpp +++ b/src/script/script_gui.cpp @@ -239,7 +239,7 @@ struct ScriptListWindow : public Window { }; /** Widgets for the AI list window. */ -static const NWidgetPart _nested_script_list_widgets[] = { +static constexpr NWidgetPart _nested_script_list_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_MAUVE), NWidget(WWT_CAPTION, COLOUR_MAUVE, WID_SCRL_CAPTION), SetDataTip(STR_AI_LIST_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -586,7 +586,7 @@ private: }; /** Widgets for the Script settings window. */ -static const NWidgetPart _nested_script_settings_widgets[] = { +static constexpr NWidgetPart _nested_script_settings_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_MAUVE), NWidget(WWT_CAPTION, COLOUR_MAUVE, WID_SCRS_CAPTION), SetDataTip(STR_AI_SETTINGS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -1237,7 +1237,7 @@ std::unique_ptr MakeCompanyButtonRowsScriptDebug() } /** Widgets for the Script debug window. */ -static const NWidgetPart _nested_script_debug_widgets[] = { +static constexpr NWidgetPart _nested_script_debug_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_AI_DEBUG, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 944b3273ff..d34368560a 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -803,7 +803,7 @@ struct GameOptionsWindow : Window { } }; -static const NWidgetPart _nested_game_options_widgets[] = { +static constexpr NWidgetPart _nested_game_options_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GAME_OPTIONS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -2670,7 +2670,7 @@ struct GameSettingsWindow : Window { GameSettings *GameSettingsWindow::settings_ptr = nullptr; -static const NWidgetPart _nested_settings_selection_widgets[] = { +static constexpr NWidgetPart _nested_settings_selection_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_MAUVE), NWidget(WWT_CAPTION, COLOUR_MAUVE), SetDataTip(STR_CONFIG_SETTING_TREE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -2977,7 +2977,7 @@ struct CustomCurrencyWindow : Window { } }; -static const NWidgetPart _nested_cust_currency_widgets[] = { +static constexpr NWidgetPart _nested_cust_currency_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_CURRENCY_WINDOW, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index a22da119c7..848cb8e529 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -356,7 +356,7 @@ struct SignListWindow : Window, SignList { }, SignListGlobalHotkeys}; }; -static const NWidgetPart _nested_sign_list_widgets[] = { +static constexpr NWidgetPart _nested_sign_list_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN, WID_SIL_CAPTION), SetDataTip(STR_SIGN_LIST_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -530,7 +530,7 @@ struct SignWindow : Window, SignList { } }; -static const NWidgetPart _nested_query_sign_edit_widgets[] = { +static constexpr NWidgetPart _nested_query_sign_edit_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_QES_CAPTION), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), SetTextStyle(TC_WHITE), diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index 51acb14a26..0e39aee41f 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -1896,14 +1896,14 @@ public: }; /** Widget parts of the smallmap display. */ -static const NWidgetPart _nested_smallmap_display[] = { +static constexpr NWidgetPart _nested_smallmap_display[] = { NWidget(WWT_PANEL, COLOUR_BROWN, WID_SM_MAP_BORDER), NWidget(WWT_INSET, COLOUR_BROWN, WID_SM_MAP), SetMinimalSize(346, 140), SetResize(1, 1), SetPadding(2, 2, 2, 2), EndContainer(), EndContainer(), }; /** Widget parts of the smallmap legend bar + image buttons. */ -static const NWidgetPart _nested_smallmap_bar[] = { +static constexpr NWidgetPart _nested_smallmap_bar[] = { NWidget(WWT_PANEL, COLOUR_BROWN), NWidget(NWID_HORIZONTAL), NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SM_LEGEND), SetResize(1, 1), @@ -1954,7 +1954,7 @@ static std::unique_ptr SmallMapDisplay() } -static const NWidgetPart _nested_smallmap_widgets[] = { +static constexpr NWidgetPart _nested_smallmap_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN, WID_SM_CAPTION), SetDataTip(STR_SMALLMAP_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/station_gui.cpp b/src/station_gui.cpp index ce1f877871..2726cc97cd 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -732,7 +732,7 @@ static std::unique_ptr CargoWidgets() return container; } -static const NWidgetPart _nested_company_stations_widgets[] = { +static constexpr NWidgetPart _nested_company_stations_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_STL_CAPTION), SetDataTip(STR_STATION_LIST_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -786,7 +786,7 @@ void ShowCompanyStations(CompanyID company) AllocateWindowDescFront(&_company_stations_desc, company); } -static const NWidgetPart _nested_station_view_widgets[] = { +static constexpr NWidgetPart _nested_station_view_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_SV_RENAME), SetMinimalSize(12, 14), SetDataTip(SPR_RENAME, STR_STATION_VIEW_RENAME_TOOLTIP), @@ -2252,7 +2252,7 @@ static const T *FindStationsNearby(TileArea ta, bool distant_join) return nullptr; } -static const NWidgetPart _nested_select_station_widgets[] = { +static constexpr NWidgetPart _nested_select_station_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_JS_CAPTION), SetDataTip(STR_JOIN_STATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp index f892080454..856b4cf077 100644 --- a/src/statusbar_gui.cpp +++ b/src/statusbar_gui.cpp @@ -218,7 +218,7 @@ struct StatusBarWindow : Window { }}; }; -static const NWidgetPart _nested_main_status_widgets[] = { +static constexpr NWidgetPart _nested_main_status_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_PANEL, COLOUR_GREY, WID_S_LEFT), SetMinimalSize(140, 12), EndContainer(), NWidget(WWT_PUSHBTN, COLOUR_GREY, WID_S_MIDDLE), SetMinimalSize(40, 12), SetDataTip(0x0, STR_STATUSBAR_TOOLTIP_SHOW_LAST_NEWS), SetResize(1, 0), diff --git a/src/story_gui.cpp b/src/story_gui.cpp index b3f4647337..c986042cb7 100644 --- a/src/story_gui.cpp +++ b/src/story_gui.cpp @@ -947,7 +947,7 @@ GUIStoryPageElementList::SortFunction * const StoryBookWindow::page_element_sort &PageElementOrderSorter, }; -static const NWidgetPart _nested_story_book_widgets[] = { +static constexpr NWidgetPart _nested_story_book_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN, WID_SB_CAPTION), SetDataTip(STR_JUST_STRING1, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp index 8cf07ef253..bd31e0f611 100644 --- a/src/subsidy_gui.cpp +++ b/src/subsidy_gui.cpp @@ -216,7 +216,7 @@ struct SubsidyListWindow : Window { } }; -static const NWidgetPart _nested_subsidies_list_widgets[] = { +static constexpr NWidgetPart _nested_subsidies_list_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_SUBSIDIES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index ed395d0491..e589c4f20e 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -320,7 +320,7 @@ struct TerraformToolbarWindow : Window { }, TerraformToolbarGlobalHotkeys}; }; -static const NWidgetPart _nested_terraform_widgets[] = { +static constexpr NWidgetPart _nested_terraform_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_LANDSCAPING_TOOLBAR, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -449,7 +449,7 @@ static const int8_t _multi_terraform_coords[][2] = { {-28, 0}, {-24, -2}, {-20, -4}, {-16, -6}, {-12, -8}, { -8,-10}, { -4,-12}, { 0,-14}, { 4,-12}, { 8,-10}, { 12, -8}, { 16, -6}, { 20, -4}, { 24, -2}, { 28, 0}, }; -static const NWidgetPart _nested_scen_edit_land_gen_widgets[] = { +static constexpr NWidgetPart _nested_scen_edit_land_gen_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_TERRAFORM_TOOLBAR_LAND_GENERATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/textfile_gui.cpp b/src/textfile_gui.cpp index a8db38b0b5..029cd40ff8 100644 --- a/src/textfile_gui.cpp +++ b/src/textfile_gui.cpp @@ -38,7 +38,7 @@ #include "safeguards.h" /** Widgets for the textfile window. */ -static const NWidgetPart _nested_textfile_widgets[] = { +static constexpr NWidgetPart _nested_textfile_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_MAUVE), NWidget(WWT_PUSHARROWBTN, COLOUR_MAUVE, WID_TF_NAVBACK), SetFill(0, 1), SetMinimalSize(15, 1), SetDataTip(AWV_DECREASE, STR_TEXTFILE_NAVBACK_TOOLTIP), diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index c01689e242..80a523e035 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -800,7 +800,7 @@ struct TimetableWindow : Window { }}; }; -static const NWidgetPart _nested_timetable_widgets[] = { +static constexpr NWidgetPart _nested_timetable_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_VT_CAPTION), SetDataTip(STR_TIMETABLE_TITLE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index 2931774962..dab9ff0dc8 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -2179,7 +2179,7 @@ static std::unique_ptr MakeMainToolbar() return hor; } -static const NWidgetPart _nested_toolbar_normal_widgets[] = { +static constexpr NWidgetPart _nested_toolbar_normal_widgets[] = { NWidgetFunction(MakeMainToolbar), }; @@ -2479,7 +2479,7 @@ struct ScenarioEditorToolbarWindow : Window { }}; }; -static const NWidgetPart _nested_toolb_scen_inner_widgets[] = { +static constexpr NWidgetPart _nested_toolb_scen_inner_widgets[] = { NWidget(WWT_IMGBTN, COLOUR_GREY, WID_TE_PAUSE), SetDataTip(SPR_IMG_PAUSE, STR_TOOLBAR_TOOLTIP_PAUSE_GAME), NWidget(WWT_IMGBTN, COLOUR_GREY, WID_TE_FAST_FORWARD), SetDataTip(SPR_IMG_FASTFORWARD, STR_TOOLBAR_TOOLTIP_FORWARD), NWidget(WWT_IMGBTN, COLOUR_GREY, WID_TE_SETTINGS), SetDataTip(SPR_IMG_SETTINGS, STR_TOOLBAR_TOOLTIP_OPTIONS), @@ -2519,7 +2519,7 @@ static std::unique_ptr MakeScenarioToolbar() return MakeNWidgets(std::begin(_nested_toolb_scen_inner_widgets), std::end(_nested_toolb_scen_inner_widgets), std::make_unique()); } -static const NWidgetPart _nested_toolb_scen_widgets[] = { +static constexpr NWidgetPart _nested_toolb_scen_widgets[] = { NWidgetFunction(MakeScenarioToolbar), }; diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 1455d95e21..8a9fb46433 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -50,7 +50,7 @@ TownKdtree _town_local_authority_kdtree(&Kdtree_TownXYFunc); typedef GUIList GUITownList; -static const NWidgetPart _nested_town_authority_widgets[] = { +static constexpr NWidgetPart _nested_town_authority_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN, WID_TA_CAPTION), SetDataTip(STR_LOCAL_AUTHORITY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -597,7 +597,7 @@ public: }}; }; -static const NWidgetPart _nested_town_game_view_widgets[] = { +static constexpr NWidgetPart _nested_town_game_view_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, WID_TV_CHANGE_NAME), SetMinimalSize(12, 14), SetDataTip(SPR_RENAME, STR_TOWN_VIEW_RENAME_TOOLTIP), @@ -627,7 +627,7 @@ static WindowDesc _town_game_view_desc(__FILE__, __LINE__, std::begin(_nested_town_game_view_widgets), std::end(_nested_town_game_view_widgets) ); -static const NWidgetPart _nested_town_editor_view_widgets[] = { +static constexpr NWidgetPart _nested_town_editor_view_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, WID_TV_CHANGE_NAME), SetMinimalSize(12, 14), SetDataTip(SPR_RENAME, STR_TOWN_VIEW_RENAME_TOOLTIP), @@ -667,7 +667,7 @@ void ShowTownViewWindow(TownID town) } } -static const NWidgetPart _nested_town_directory_widgets[] = { +static constexpr NWidgetPart _nested_town_directory_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_BROWN), NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_TOWN_DIRECTORY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -1075,7 +1075,7 @@ void CcFoundRandomTown(Commands, const CommandCost &result, Money, TownID town_i if (result.Succeeded()) ScrollMainWindowToTile(Town::Get(town_id)->xy); } -static const NWidgetPart _nested_found_town_widgets[] = { +static constexpr NWidgetPart _nested_found_town_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_FOUND_TOWN_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp index 4029125d38..d0379ad801 100644 --- a/src/transparency_gui.cpp +++ b/src/transparency_gui.cpp @@ -125,7 +125,7 @@ public: } }; -static const NWidgetPart _nested_transparency_widgets[] = { +static constexpr NWidgetPart _nested_transparency_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_TRANSPARENCY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp index 9a08cfef99..4a91853289 100644 --- a/src/tree_gui.cpp +++ b/src/tree_gui.cpp @@ -285,7 +285,7 @@ static std::unique_ptr MakeTreeTypeButtons() return vstack; } -static const NWidgetPart _nested_build_trees_widgets[] = { +static constexpr NWidgetPart _nested_build_trees_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN), NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_PLANT_TREE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index f8711f474f..8ca17bd423 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1207,7 +1207,7 @@ struct RefitWindow : public Window { } }; -static const NWidgetPart _nested_vehicle_refit_widgets[] = { +static constexpr NWidgetPart _nested_vehicle_refit_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_VR_CAPTION), SetDataTip(STR_REFIT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -1495,7 +1495,7 @@ void ChangeVehicleViewWindow(VehicleID from_index, VehicleID to_index) ChangeVehicleWindow(WC_VEHICLE_TIMETABLE, from_index, to_index); } -static const NWidgetPart _nested_vehicle_list[] = { +static constexpr NWidgetPart _nested_vehicle_list[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(NWID_SELECTION, INVALID_COLOUR, WID_VL_CAPTION_SELECTION), @@ -2232,7 +2232,7 @@ static_assert(WID_VD_DETAILS_CAPACITY_OF_EACH == WID_VD_DETAILS_CARGO_CARRIED + static_assert(WID_VD_DETAILS_TOTAL_CARGO == WID_VD_DETAILS_CARGO_CARRIED + TDW_TAB_TOTALS ); /** Vehicle details widgets (other than train). */ -static const NWidgetPart _nested_nontrain_vehicle_details_widgets[] = { +static constexpr NWidgetPart _nested_nontrain_vehicle_details_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_VD_CAPTION), SetDataTip(STR_VEHICLE_DETAILS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -2255,7 +2255,7 @@ static const NWidgetPart _nested_nontrain_vehicle_details_widgets[] = { }; /** Train details widgets. */ -static const NWidgetPart _nested_train_vehicle_details_widgets[] = { +static constexpr NWidgetPart _nested_train_vehicle_details_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_VD_CAPTION), SetDataTip(STR_VEHICLE_DETAILS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), @@ -2693,7 +2693,7 @@ static void ShowVehicleDetailsWindow(const Vehicle *v) /* Unified vehicle GUI - Vehicle View Window */ /** Vehicle view widgets. */ -static const NWidgetPart _nested_vehicle_view_widgets[] = { +static constexpr NWidgetPart _nested_vehicle_view_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VV_RENAME), SetMinimalSize(12, 14), SetDataTip(SPR_RENAME, STR_NULL /* filled in later */), diff --git a/src/viewport_gui.cpp b/src/viewport_gui.cpp index 19a4e34888..c2c55240ee 100644 --- a/src/viewport_gui.cpp +++ b/src/viewport_gui.cpp @@ -23,7 +23,7 @@ #include "safeguards.h" /* Extra Viewport Window Stuff */ -static const NWidgetPart _nested_extra_viewport_widgets[] = { +static constexpr NWidgetPart _nested_extra_viewport_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_CAPTION, COLOUR_GREY, WID_EV_CAPTION), SetDataTip(STR_EXTRA_VIEWPORT_TITLE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp index ba930c2606..725f8f91d8 100644 --- a/src/waypoint_gui.cpp +++ b/src/waypoint_gui.cpp @@ -160,7 +160,7 @@ public: }; /** The widgets of the waypoint view. */ -static const NWidgetPart _nested_waypoint_view_widgets[] = { +static constexpr NWidgetPart _nested_waypoint_view_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_CLOSEBOX, COLOUR_GREY), NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_W_RENAME), SetMinimalSize(12, 14), SetDataTip(SPR_RENAME, STR_BUOY_VIEW_CHANGE_BUOY_NAME), diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index 93266c40b8..071a3d41cb 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -22,7 +22,7 @@ #include "../safeguards.h" -static const NWidgetPart _nested_dropdown_menu_widgets[] = { +static constexpr NWidgetPart _nested_dropdown_menu_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(WWT_PANEL, COLOUR_END, WID_DM_ITEMS), SetScrollbar(WID_DM_SCROLL), EndContainer(), NWidget(NWID_SELECTION, INVALID_COLOUR, WID_DM_SHOW_SCROLL), From aa5ba5bd7fe1ecd353fb67841478b88805e293b2 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Tue, 16 Jan 2024 22:01:28 +0100 Subject: [PATCH 07/10] Codechange: allow certain enumeration to be added Otherwise C++20 doesn't like it. --- src/company_gui.cpp | 8 ++++---- src/company_type.h | 1 + src/core/enum_type.hpp | 6 ++++++ src/direction_type.h | 4 ++-- src/dock_gui.cpp | 6 +++--- src/gfx_type.h | 1 + src/graph_gui.cpp | 16 ++++++++-------- src/linkgraph/linkgraph_gui.cpp | 16 ++++++++-------- src/livery.h | 3 ++- src/network/network_type.h | 5 ++++- src/rail_gui.cpp | 18 +++++++++--------- src/road_gui.cpp | 18 +++++++++--------- src/script/script_gui.cpp | 2 +- src/signal_type.h | 1 + src/smallmap_gui.cpp | 31 ++++++++++++++++--------------- src/textfile_type.h | 1 + src/town_type.h | 2 ++ src/vehicle_gui.cpp | 2 +- src/vehicle_gui.h | 3 ++- src/vehicle_type.h | 1 + src/zoom_type.h | 1 + 21 files changed, 83 insertions(+), 63 deletions(-) diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 8e271903ad..272dbda3b5 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -747,7 +747,7 @@ public: void SetSelectedGroup(CompanyID company, GroupID group) { - this->RaiseWidget(this->livery_class + WID_SCL_CLASS_GENERAL); + this->RaiseWidget(WID_SCL_CLASS_GENERAL + this->livery_class); const Group *g = Group::Get(group); switch (g->vehicle_type) { case VEH_TRAIN: this->livery_class = LC_GROUP_RAIL; break; @@ -757,7 +757,7 @@ public: default: NOT_REACHED(); } this->sel = group; - this->LowerWidget(this->livery_class + WID_SCL_CLASS_GENERAL); + this->LowerWidget(WID_SCL_CLASS_GENERAL + this->livery_class); this->groups.ForceRebuild(); this->BuildGroupList(company); @@ -963,9 +963,9 @@ public: case WID_SCL_GROUPS_ROAD: case WID_SCL_GROUPS_SHIP: case WID_SCL_GROUPS_AIRCRAFT: - this->RaiseWidget(this->livery_class + WID_SCL_CLASS_GENERAL); + this->RaiseWidget(WID_SCL_CLASS_GENERAL + this->livery_class); this->livery_class = (LiveryClass)(widget - WID_SCL_CLASS_GENERAL); - this->LowerWidget(this->livery_class + WID_SCL_CLASS_GENERAL); + this->LowerWidget(WID_SCL_CLASS_GENERAL + this->livery_class); /* Select the first item in the list */ if (this->livery_class < LC_GROUP_RAIL) { diff --git a/src/company_type.h b/src/company_type.h index d87e778cce..ff22a4d0dc 100644 --- a/src/company_type.h +++ b/src/company_type.h @@ -35,6 +35,7 @@ enum Owner : byte { COMPANY_SPECTATOR = 255, ///< The client is spectating }; DECLARE_POSTFIX_INCREMENT(Owner) +DECLARE_ENUM_AS_ADDABLE(Owner) static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS = 32; ///< The maximum length of a president name in characters including '\0' static const uint MAX_LENGTH_COMPANY_NAME_CHARS = 32; ///< The maximum length of a company name in characters including '\0' diff --git a/src/core/enum_type.hpp b/src/core/enum_type.hpp index c5e2945802..e8a9d0d76e 100644 --- a/src/core/enum_type.hpp +++ b/src/core/enum_type.hpp @@ -37,5 +37,11 @@ inline constexpr enum_type& operator ^= (enum_type& m1, enum_type m2) {m1 = m1 ^ m2; return m1;} \ inline constexpr enum_type operator ~(enum_type m) {return (enum_type)(~(std::underlying_type::type)m);} +/** Operator that allows this enumeration to be added to any other enumeration. */ +#define DECLARE_ENUM_AS_ADDABLE(EnumType) \ + template , OtherEnumType>::type> \ + constexpr OtherEnumType operator + (OtherEnumType m1, EnumType m2) { \ + return static_cast(static_cast::type>(m1) + static_cast::type>(m2)); \ + } #endif /* ENUM_TYPE_HPP */ diff --git a/src/direction_type.h b/src/direction_type.h index a7983a5c3d..fb08c224af 100644 --- a/src/direction_type.h +++ b/src/direction_type.h @@ -79,9 +79,8 @@ enum DiagDirection : byte { DIAGDIR_END, ///< Used for iterations INVALID_DIAGDIR = 0xFF, ///< Flag for an invalid DiagDirection }; - -/** Allow incrementing of DiagDirection variables */ DECLARE_POSTFIX_INCREMENT(DiagDirection) +DECLARE_ENUM_AS_ADDABLE(DiagDirection) /** * Enumeration for the difference between to DiagDirection. @@ -120,5 +119,6 @@ enum Axis : byte { AXIS_END, ///< Used for iterations INVALID_AXIS = 0xFF, ///< Flag for an invalid Axis }; +DECLARE_ENUM_AS_ADDABLE(Axis) #endif /* DIRECTION_TYPE_H */ diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index a0e18862e1..76a778622a 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -525,7 +525,7 @@ public: BuildDocksDepotWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent) { this->InitNested(TRANSPORT_WATER); - this->LowerWidget(_ship_depot_direction + WID_BDD_X); + this->LowerWidget(WID_BDD_X + _ship_depot_direction); UpdateDocksDirection(); } @@ -569,9 +569,9 @@ public: switch (widget) { case WID_BDD_X: case WID_BDD_Y: - this->RaiseWidget(_ship_depot_direction + WID_BDD_X); + this->RaiseWidget(WID_BDD_X + _ship_depot_direction); _ship_depot_direction = (widget == WID_BDD_X ? AXIS_X : AXIS_Y); - this->LowerWidget(_ship_depot_direction + WID_BDD_X); + this->LowerWidget(WID_BDD_X + _ship_depot_direction); if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); UpdateDocksDirection(); this->SetDirty(); diff --git a/src/gfx_type.h b/src/gfx_type.h index c14316001b..fbedceb87c 100644 --- a/src/gfx_type.h +++ b/src/gfx_type.h @@ -247,6 +247,7 @@ enum Colours : byte { COLOUR_END, INVALID_COLOUR = 0xFF, }; +DECLARE_ENUM_AS_ADDABLE(Colours) /** Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palette.png */ enum TextColour { diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index b95b725835..934522208e 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -50,7 +50,7 @@ struct GraphLegendWindow : Window { this->InitNested(window_number); for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) { - if (!HasBit(_legend_excluded_companies, c)) this->LowerWidget(c + WID_GL_FIRST_COMPANY); + if (!HasBit(_legend_excluded_companies, c)) this->LowerWidget(WID_GL_FIRST_COMPANY + c); this->OnInvalidateData(c); } @@ -58,7 +58,7 @@ struct GraphLegendWindow : Window { void DrawWidget(const Rect &r, WidgetID widget) const override { - if (!IsInsideMM(widget, WID_GL_FIRST_COMPANY, MAX_COMPANIES + WID_GL_FIRST_COMPANY)) return; + if (!IsInsideMM(widget, WID_GL_FIRST_COMPANY, WID_GL_FIRST_COMPANY + MAX_COMPANIES)) return; CompanyID cid = (CompanyID)(widget - WID_GL_FIRST_COMPANY); @@ -78,7 +78,7 @@ struct GraphLegendWindow : Window { void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override { - if (!IsInsideMM(widget, WID_GL_FIRST_COMPANY, MAX_COMPANIES + WID_GL_FIRST_COMPANY)) return; + if (!IsInsideMM(widget, WID_GL_FIRST_COMPANY, WID_GL_FIRST_COMPANY + MAX_COMPANIES)) return; ToggleBit(_legend_excluded_companies, widget - WID_GL_FIRST_COMPANY); this->ToggleWidgetLoweredState(widget); @@ -1282,9 +1282,9 @@ struct PerformanceRatingDetailWindow : Window { if (IsInsideMM(widget, WID_PRD_COMPANY_FIRST, WID_PRD_COMPANY_LAST + 1)) { /* Is it no on disable? */ if (!this->IsWidgetDisabled(widget)) { - this->RaiseWidget(this->company + WID_PRD_COMPANY_FIRST); + this->RaiseWidget(WID_PRD_COMPANY_FIRST + this->company); this->company = (CompanyID)(widget - WID_PRD_COMPANY_FIRST); - this->LowerWidget(this->company + WID_PRD_COMPANY_FIRST); + this->LowerWidget(WID_PRD_COMPANY_FIRST + this->company); this->SetDirty(); } } @@ -1309,13 +1309,13 @@ struct PerformanceRatingDetailWindow : Window { if (!gui_scope) return; /* Disable the companies who are not active */ for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) { - this->SetWidgetDisabledState(i + WID_PRD_COMPANY_FIRST, !Company::IsValidID(i)); + this->SetWidgetDisabledState(WID_PRD_COMPANY_FIRST + i, !Company::IsValidID(i)); } /* Check if the currently selected company is still active. */ if (this->company != INVALID_COMPANY && !Company::IsValidID(this->company)) { /* Raise the widget for the previous selection. */ - this->RaiseWidget(this->company + WID_PRD_COMPANY_FIRST); + this->RaiseWidget(WID_PRD_COMPANY_FIRST + this->company); this->company = INVALID_COMPANY; } @@ -1327,7 +1327,7 @@ struct PerformanceRatingDetailWindow : Window { } /* Make sure the widget is lowered */ - this->LowerWidget(this->company + WID_PRD_COMPANY_FIRST); + this->LowerWidget(WID_PRD_COMPANY_FIRST + this->company); } }; diff --git a/src/linkgraph/linkgraph_gui.cpp b/src/linkgraph/linkgraph_gui.cpp index fa45679aac..b00f78ac9c 100644 --- a/src/linkgraph/linkgraph_gui.cpp +++ b/src/linkgraph/linkgraph_gui.cpp @@ -666,9 +666,9 @@ bool LinkGraphLegendWindow::OnTooltip([[maybe_unused]] Point, WidgetID widget, T void LinkGraphLegendWindow::UpdateOverlayCompanies() { uint32_t mask = 0; - for (uint c = 0; c < MAX_COMPANIES; c++) { - if (this->IsWidgetDisabled(c + WID_LGL_COMPANY_FIRST)) continue; - if (!this->IsWidgetLowered(c + WID_LGL_COMPANY_FIRST)) continue; + for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) { + if (this->IsWidgetDisabled(WID_LGL_COMPANY_FIRST + c)) continue; + if (!this->IsWidgetLowered(WID_LGL_COMPANY_FIRST + c)) continue; SetBit(mask, c); } this->overlay->SetCompanyMask(mask); @@ -680,8 +680,8 @@ void LinkGraphLegendWindow::UpdateOverlayCompanies() void LinkGraphLegendWindow::UpdateOverlayCargoes() { CargoTypes mask = 0; - for (uint c = 0; c < num_cargo; c++) { - if (!this->IsWidgetLowered(c + WID_LGL_CARGO_FIRST)) continue; + for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) { + if (!this->IsWidgetLowered(WID_LGL_CARGO_FIRST + c)) continue; SetBit(mask, _sorted_cargo_specs[c]->Index()); } this->overlay->SetCargoMask(mask); @@ -696,8 +696,8 @@ void LinkGraphLegendWindow::OnClick([[maybe_unused]] Point pt, WidgetID widget, this->UpdateOverlayCompanies(); } } else if (widget == WID_LGL_COMPANIES_ALL || widget == WID_LGL_COMPANIES_NONE) { - for (uint c = 0; c < MAX_COMPANIES; c++) { - if (this->IsWidgetDisabled(c + WID_LGL_COMPANY_FIRST)) continue; + for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) { + if (this->IsWidgetDisabled(WID_LGL_COMPANY_FIRST + c)) continue; this->SetWidgetLoweredState(WID_LGL_COMPANY_FIRST + c, widget == WID_LGL_COMPANIES_ALL); } this->UpdateOverlayCompanies(); @@ -728,6 +728,6 @@ void LinkGraphLegendWindow::OnInvalidateData([[maybe_unused]] int data, [[maybe_ /* Disable the companies who are not active */ for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) { - this->SetWidgetDisabledState(i + WID_LGL_COMPANY_FIRST, !Company::IsValidID(i)); + this->SetWidgetDisabledState(WID_LGL_COMPANY_FIRST + i, !Company::IsValidID(i)); } } diff --git a/src/livery.h b/src/livery.h index 730c29da33..cfb54aa182 100644 --- a/src/livery.h +++ b/src/livery.h @@ -59,7 +59,7 @@ enum LiveryScheme : byte { DECLARE_POSTFIX_INCREMENT(LiveryScheme) /** List of different livery classes, used only by the livery GUI. */ -enum LiveryClass { +enum LiveryClass : byte { LC_OTHER, LC_RAIL, LC_ROAD, @@ -71,6 +71,7 @@ enum LiveryClass { LC_GROUP_AIRCRAFT, LC_END }; +DECLARE_ENUM_AS_ADDABLE(LiveryClass) /** Information about a particular livery. */ struct Livery { diff --git a/src/network/network_type.h b/src/network/network_type.h index 86cb877bbb..5244fe18d6 100644 --- a/src/network/network_type.h +++ b/src/network/network_type.h @@ -10,6 +10,8 @@ #ifndef NETWORK_TYPE_H #define NETWORK_TYPE_H +#include "../core/enum_type.hpp" + /** How many clients can we have */ static const uint MAX_CLIENTS = 255; @@ -86,11 +88,12 @@ enum NetworkPasswordType { * Destination of our chat messages. * @warning The values of the enum items are part of the admin network API. Only append at the end. */ -enum DestType { +enum DestType : byte { DESTTYPE_BROADCAST, ///< Send message/notice to all clients (All) DESTTYPE_TEAM, ///< Send message/notice to everyone playing the same company (Team) DESTTYPE_CLIENT, ///< Send message/notice to only a certain client (Private) }; +DECLARE_ENUM_AS_ADDABLE(DestType) /** * Actions that can be used for NetworkTextMessage. diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 1e94cc9032..0b7e84ea0a 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -998,12 +998,12 @@ public: this->FinishInitNested(TRANSPORT_RAIL); - this->LowerWidget(_railstation.orientation + WID_BRAS_PLATFORM_DIR_X); + this->LowerWidget(WID_BRAS_PLATFORM_DIR_X + _railstation.orientation); if (_settings_client.gui.station_dragdrop) { this->LowerWidget(WID_BRAS_PLATFORM_DRAG_N_DROP); } else { - this->LowerWidget(_settings_client.gui.station_numtracks + WID_BRAS_PLATFORM_NUM_BEGIN); - this->LowerWidget(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN); + this->LowerWidget(WID_BRAS_PLATFORM_NUM_BEGIN + _settings_client.gui.station_numtracks); + this->LowerWidget(WID_BRAS_PLATFORM_LEN_BEGIN + _settings_client.gui.station_platlength); } this->SetWidgetLoweredState(WID_BRAS_HIGHLIGHT_OFF, !_settings_client.gui.station_show_coverage); this->SetWidgetLoweredState(WID_BRAS_HIGHLIGHT_ON, _settings_client.gui.station_show_coverage); @@ -1328,9 +1328,9 @@ public: switch (widget) { case WID_BRAS_PLATFORM_DIR_X: case WID_BRAS_PLATFORM_DIR_Y: - this->RaiseWidget(_railstation.orientation + WID_BRAS_PLATFORM_DIR_X); + this->RaiseWidget(WID_BRAS_PLATFORM_DIR_X + _railstation.orientation); _railstation.orientation = (Axis)(widget - WID_BRAS_PLATFORM_DIR_X); - this->LowerWidget(_railstation.orientation + WID_BRAS_PLATFORM_DIR_X); + this->LowerWidget(WID_BRAS_PLATFORM_DIR_X + _railstation.orientation); if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); this->SetDirty(); CloseWindowById(WC_SELECT_STATION, 0); @@ -1343,7 +1343,7 @@ public: case WID_BRAS_PLATFORM_NUM_5: case WID_BRAS_PLATFORM_NUM_6: case WID_BRAS_PLATFORM_NUM_7: { - this->RaiseWidget(_settings_client.gui.station_numtracks + WID_BRAS_PLATFORM_NUM_BEGIN); + this->RaiseWidget(WID_BRAS_PLATFORM_NUM_BEGIN + _settings_client.gui.station_numtracks); this->RaiseWidget(WID_BRAS_PLATFORM_DRAG_N_DROP); _settings_client.gui.station_numtracks = widget - WID_BRAS_PLATFORM_NUM_BEGIN; @@ -1894,7 +1894,7 @@ struct BuildRailDepotWindow : public PickerWindowBase { BuildRailDepotWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent) { this->InitNested(TRANSPORT_RAIL); - this->LowerWidget(_build_depot_direction + WID_BRAD_DEPOT_NE); + this->LowerWidget(WID_BRAD_DEPOT_NE + _build_depot_direction); } void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override @@ -1926,9 +1926,9 @@ struct BuildRailDepotWindow : public PickerWindowBase { case WID_BRAD_DEPOT_SE: case WID_BRAD_DEPOT_SW: case WID_BRAD_DEPOT_NW: - this->RaiseWidget(_build_depot_direction + WID_BRAD_DEPOT_NE); + this->RaiseWidget(WID_BRAD_DEPOT_NE + _build_depot_direction); _build_depot_direction = (DiagDirection)(widget - WID_BRAD_DEPOT_NE); - this->LowerWidget(_build_depot_direction + WID_BRAD_DEPOT_NE); + this->LowerWidget(WID_BRAD_DEPOT_NE + _build_depot_direction); if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); this->SetDirty(); break; diff --git a/src/road_gui.cpp b/src/road_gui.cpp index f9ce3039b2..adb88f33e6 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -1007,7 +1007,7 @@ struct BuildRoadDepotWindow : public PickerWindowBase { { this->CreateNestedTree(); - this->LowerWidget(_road_depot_orientation + WID_BROD_DEPOT_NE); + this->LowerWidget(WID_BROD_DEPOT_NE + _road_depot_orientation); if (RoadTypeIsTram(_cur_roadtype)) { this->GetWidget(WID_BROD_CAPTION)->widget_data = STR_BUILD_DEPOT_TRAM_ORIENTATION_CAPTION; for (WidgetID i = WID_BROD_DEPOT_NE; i <= WID_BROD_DEPOT_NW; i++) { @@ -1047,9 +1047,9 @@ struct BuildRoadDepotWindow : public PickerWindowBase { case WID_BROD_DEPOT_NE: case WID_BROD_DEPOT_SW: case WID_BROD_DEPOT_SE: - this->RaiseWidget(_road_depot_orientation + WID_BROD_DEPOT_NE); + this->RaiseWidget(WID_BROD_DEPOT_NE + _road_depot_orientation); _road_depot_orientation = (DiagDirection)(widget - WID_BROD_DEPOT_NE); - this->LowerWidget(_road_depot_orientation + WID_BROD_DEPOT_NE); + this->LowerWidget(WID_BROD_DEPOT_NE + _road_depot_orientation); if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); this->SetDirty(); break; @@ -1132,9 +1132,9 @@ private: if (_roadstop_gui_settings.orientation >= DIAGDIR_END) return; const RoadStopSpec *spec = RoadStopClass::Get(_roadstop_gui_settings.roadstop_class)->GetSpec(_roadstop_gui_settings.roadstop_type); if (spec != nullptr && HasBit(spec->flags, RSF_DRIVE_THROUGH_ONLY)) { - this->RaiseWidget(_roadstop_gui_settings.orientation + WID_BROS_STATION_NE); + this->RaiseWidget(WID_BROS_STATION_NE + _roadstop_gui_settings.orientation); _roadstop_gui_settings.orientation = DIAGDIR_END; - this->LowerWidget(_roadstop_gui_settings.orientation + WID_BROS_STATION_NE); + this->LowerWidget(WID_BROS_STATION_NE + _roadstop_gui_settings.orientation); this->SetDirty(); CloseWindowById(WC_SELECT_STATION, 0); } @@ -1184,8 +1184,8 @@ public: this->GetWidget(i)->tool_tip = rti->strings.picker_tooltip[rs]; } - this->LowerWidget(_roadstop_gui_settings.orientation + WID_BROS_STATION_NE); - this->LowerWidget(_settings_client.gui.station_show_coverage + WID_BROS_LT_OFF); + this->LowerWidget(WID_BROS_STATION_NE + _roadstop_gui_settings.orientation); + this->LowerWidget(WID_BROS_LT_OFF + _settings_client.gui.station_show_coverage); this->FinishInitNested(TRANSPORT_ROAD); @@ -1508,9 +1508,9 @@ public: const RoadStopSpec *spec = RoadStopClass::Get(_roadstop_gui_settings.roadstop_class)->GetSpec(_roadstop_gui_settings.roadstop_type); if (spec != nullptr && HasBit(spec->flags, RSF_DRIVE_THROUGH_ONLY)) return; } - this->RaiseWidget(_roadstop_gui_settings.orientation + WID_BROS_STATION_NE); + this->RaiseWidget(WID_BROS_STATION_NE + _roadstop_gui_settings.orientation); _roadstop_gui_settings.orientation = (DiagDirection)(widget - WID_BROS_STATION_NE); - this->LowerWidget(_roadstop_gui_settings.orientation + WID_BROS_STATION_NE); + this->LowerWidget(WID_BROS_STATION_NE + _roadstop_gui_settings.orientation); if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); this->SetDirty(); CloseWindowById(WC_SELECT_STATION, 0); diff --git a/src/script/script_gui.cpp b/src/script/script_gui.cpp index 3f3bd0e232..6808d443c6 100644 --- a/src/script/script_gui.cpp +++ b/src/script/script_gui.cpp @@ -983,7 +983,7 @@ struct ScriptDebugWindow : public Window { bool dead = valid && Company::Get(i)->ai_instance->IsDead(); bool paused = valid && Company::Get(i)->ai_instance->IsPaused(); - NWidgetCore *button = this->GetWidget(i + WID_SCRD_COMPANY_BUTTON_START); + NWidgetCore *button = this->GetWidget(WID_SCRD_COMPANY_BUTTON_START + i); button->SetDisabled(!valid); button->SetLowered(this->filter.script_debug_company == i); SetScriptButtonColour(*button, dead, paused); diff --git a/src/signal_type.h b/src/signal_type.h index e29d2d65b6..294790fae7 100644 --- a/src/signal_type.h +++ b/src/signal_type.h @@ -32,6 +32,7 @@ enum SignalType : byte { SIGTYPE_LAST = SIGTYPE_PBS_ONEWAY, SIGTYPE_LAST_NOPBS = SIGTYPE_COMBO, }; +DECLARE_ENUM_AS_ADDABLE(SignalType) /** * These are states in which a signal can be. Currently these are only two, so diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index 0e39aee41f..3df7ab6e14 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -611,20 +611,21 @@ static const byte _vehicle_type_colours[6] = { PC_RED, PC_YELLOW, PC_LIGHT_BLUE, PC_WHITE, PC_BLACK, PC_RED }; +/** Types of legends in the #WID_SM_LEGEND widget. */ +enum SmallMapType : byte { + SMT_CONTOUR, + SMT_VEHICLES, + SMT_INDUSTRY, + SMT_LINKSTATS, + SMT_ROUTES, + SMT_VEGETATION, + SMT_OWNER, +}; +DECLARE_ENUM_AS_ADDABLE(SmallMapType) + /** Class managing the smallmap window. */ class SmallMapWindow : public Window { protected: - /** Types of legends in the #WID_SM_LEGEND widget. */ - enum SmallMapType { - SMT_CONTOUR, - SMT_VEHICLES, - SMT_INDUSTRY, - SMT_LINKSTATS, - SMT_ROUTES, - SMT_VEGETATION, - SMT_OWNER, - }; - /** Available kinds of zoomlevel changes. */ enum ZoomLevelChange { ZLC_INITIALIZE, ///< Initialize zoom level. @@ -820,9 +821,9 @@ protected: */ void SwitchMapType(SmallMapType map_type) { - this->RaiseWidget(this->map_type + WID_SM_CONTOUR); + this->RaiseWidget(WID_SM_CONTOUR + this->map_type); this->map_type = map_type; - this->LowerWidget(this->map_type + WID_SM_CONTOUR); + this->LowerWidget(WID_SM_CONTOUR + this->map_type); this->SetupWidgetData(); @@ -1404,7 +1405,7 @@ public: _smallmap_industry_highlight = INVALID_INDUSTRYTYPE; this->overlay = std::make_unique(this, WID_SM_MAP, 0, this->GetOverlayCompanyMask(), 1); this->InitNested(window_number); - this->LowerWidget(this->map_type + WID_SM_CONTOUR); + this->LowerWidget(WID_SM_CONTOUR + this->map_type); this->RebuildColourIndexIfNecessary(); @@ -1830,7 +1831,7 @@ public: }; -SmallMapWindow::SmallMapType SmallMapWindow::map_type = SMT_CONTOUR; +SmallMapType SmallMapWindow::map_type = SMT_CONTOUR; bool SmallMapWindow::show_towns = true; int SmallMapWindow::map_height_limit = -1; diff --git a/src/textfile_type.h b/src/textfile_type.h index a1c0c6569b..8482106f12 100644 --- a/src/textfile_type.h +++ b/src/textfile_type.h @@ -26,5 +26,6 @@ enum TextfileType { TFT_END, }; DECLARE_POSTFIX_INCREMENT(TextfileType) +DECLARE_ENUM_AS_ADDABLE(TextfileType) #endif /* TEXTFILE_TYPE_H */ diff --git a/src/town_type.h b/src/town_type.h index 53fd0d7b82..db2f9a2256 100644 --- a/src/town_type.h +++ b/src/town_type.h @@ -24,6 +24,7 @@ enum TownSize : byte { TSZ_END, ///< Number of available town sizes. }; +DECLARE_ENUM_AS_ADDABLE(TownSize) enum Ratings { /* These refer to the maximums, so Appalling is -1000 to -400 @@ -87,6 +88,7 @@ enum TownLayout : byte { NUM_TLS, ///< Number of town layouts }; +DECLARE_ENUM_AS_ADDABLE(TownLayout) /** Town founding setting values. It needs to be 8bits, because we save and load it as such */ enum TownFounding : byte { diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 8ca17bd423..eb6484651a 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -2587,7 +2587,7 @@ struct VehicleDetailsWindow : Window { const Vehicle *v = Vehicle::Get(this->window_number); if (v->type == VEH_TRAIN) { - this->LowerWidget(this->tab + WID_VD_DETAILS_CARGO_CARRIED); + this->LowerWidget(WID_VD_DETAILS_CARGO_CARRIED + this->tab); this->vscroll->SetCount(GetTrainDetailsWndVScroll(v->index, this->tab)); } diff --git a/src/vehicle_gui.h b/src/vehicle_gui.h index f782580780..52eb17e35c 100644 --- a/src/vehicle_gui.h +++ b/src/vehicle_gui.h @@ -22,12 +22,13 @@ void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent, bool auto_refit = false); /** The tabs in the train details window */ -enum TrainDetailsWindowTabs { +enum TrainDetailsWindowTabs : byte { TDW_TAB_CARGO = 0, ///< Tab with cargo carried by the vehicles TDW_TAB_INFO, ///< Tab with name and value of the vehicles TDW_TAB_CAPACITY, ///< Tab with cargo capacity of the vehicles TDW_TAB_TOTALS, ///< Tab with sum of total cargo transported }; +DECLARE_ENUM_AS_ADDABLE(TrainDetailsWindowTabs) /** Special values for vehicle-related windows for the data parameter of #InvalidateWindowData. */ enum VehicleInvalidateWindowData { diff --git a/src/vehicle_type.h b/src/vehicle_type.h index 625d032b3e..e61223ba3a 100644 --- a/src/vehicle_type.h +++ b/src/vehicle_type.h @@ -35,6 +35,7 @@ enum VehicleType : byte { VEH_INVALID = 0xFF, ///< Non-existing type of vehicle. }; DECLARE_POSTFIX_INCREMENT(VehicleType) +DECLARE_ENUM_AS_ADDABLE(VehicleType) struct Vehicle; struct Train; diff --git a/src/zoom_type.h b/src/zoom_type.h index cbf669c89b..38fd8bc112 100644 --- a/src/zoom_type.h +++ b/src/zoom_type.h @@ -45,6 +45,7 @@ enum ZoomLevel : byte { }; DECLARE_POSTFIX_INCREMENT(ZoomLevel) +DECLARE_ENUM_AS_ADDABLE(ZoomLevel) extern int _gui_scale; extern int _gui_scale_cfg; From e7ba42ad4b2a54ec9185c24a98c43ae4378e5b9b Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Tue, 16 Jan 2024 23:37:05 +0100 Subject: [PATCH 08/10] Fix bde05ce7: also update the version in the OpenTTD docs to v0.4 (#11810) --- media/baseset/OpenTTD-font.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media/baseset/OpenTTD-font.md b/media/baseset/OpenTTD-font.md index 04cc878cf3..44fcb262f9 100644 --- a/media/baseset/OpenTTD-font.md +++ b/media/baseset/OpenTTD-font.md @@ -3,4 +3,4 @@ The OpenTTD TrueType font was created by Zephyris and is maintained on [Github](https://github.com/zephyris/openttd-ttf). It is licensed under GPL-2.0. -The currently included files correspond to release v0.3. +The currently included files correspond to release v0.4. From fd59393899867500032237a304e32132879bb919 Mon Sep 17 00:00:00 2001 From: Michael Lutz Date: Wed, 17 Jan 2024 00:00:26 +0100 Subject: [PATCH 09/10] Fix #11791, e1f5be62: Run missing-glyph detection after toggling sprite font. (#11812) --- src/settings_gui.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index d34368560a..07cdb6b808 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -574,6 +574,7 @@ struct GameOptionsWindow : Window { InitFontCache(false); InitFontCache(true); ClearFontCache(); + CheckForMissingGlyphs(); SetupWidgetDimensions(); UpdateAllVirtCoords(); ReInitAllWindows(true); From bb491127847ddf0a164a523779484d2269fdab83 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Tue, 16 Jan 2024 20:38:42 +0100 Subject: [PATCH 10/10] Codechange: switch our codebase to C++20 --- .github/workflows/ci-build.yml | 8 ++++---- CMakeLists.txt | 2 +- src/blitter/32bpp_anim_sse4.cpp | 2 +- src/direction_func.h | 8 ++++---- src/fileio_type.h | 2 +- src/script/api/script_rail.cpp | 2 +- src/script/api/script_station.cpp | 2 +- src/script/api/script_stationlist.cpp | 2 +- src/script/api/script_waypoint.cpp | 2 +- src/script/api/script_waypointlist.cpp | 2 +- src/slope_func.h | 4 ++-- 11 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index e5e6e6e5a4..df771b6012 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -74,12 +74,12 @@ jobs: matrix: include: - name: Clang - Debug - compiler: clang - cxxcompiler: clang++ + compiler: clang-15 + cxxcompiler: clang++-15 libraries: libsdl2-dev - name: Clang - Release - compiler: clang - cxxcompiler: clang++ + compiler: clang-15 + cxxcompiler: clang++-15 libraries: libsdl2-dev extra-cmake-parameters: -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPTION_USE_ASSERTS=OFF - name: GCC - SDL2 diff --git a/CMakeLists.txt b/CMakeLists.txt index d1da5bad10..6cc0880f5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,7 @@ set_directory_options() include(Static) set_static_if_needed() -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/src/blitter/32bpp_anim_sse4.cpp b/src/blitter/32bpp_anim_sse4.cpp index 5154a3f082..031f0cc985 100644 --- a/src/blitter/32bpp_anim_sse4.cpp +++ b/src/blitter/32bpp_anim_sse4.cpp @@ -31,7 +31,7 @@ static FBlitter_32bppSSE4_Anim iFBlitter_32bppSSE4_Anim; IGNORE_UNINITIALIZED_WARNING_START template GNU_TARGET("sse4.1") -inline void Blitter_32bppSSE4_Anim::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom) +inline void Blitter_32bppSSE4_Anim::Draw(const BlitterParams *bp, ZoomLevel zoom) { const byte * const remap = bp->remap; Colour *dst_line = (Colour *) bp->dst + bp->top * bp->pitch + bp->left; diff --git a/src/direction_func.h b/src/direction_func.h index b35133530a..396943b024 100644 --- a/src/direction_func.h +++ b/src/direction_func.h @@ -71,7 +71,7 @@ inline DirDiff DirDifference(Direction d0, Direction d1) assert(IsValidDirection(d1)); /* Cast to uint so compiler can use bitmask. If the difference is negative * and we used int instead of uint, further "+ 8" would have to be added. */ - return (DirDiff)((uint)(d0 - d1) % 8); + return static_cast(static_cast(d0) - static_cast(d1) % 8); } /** @@ -88,7 +88,7 @@ inline DirDiff DirDifference(Direction d0, Direction d1) inline DirDiff ChangeDirDiff(DirDiff d, DirDiff delta) { /* Cast to uint so compiler can use bitmask. Result can never be negative. */ - return (DirDiff)((uint)(d + delta) % 8); + return static_cast((static_cast(d) + static_cast(delta)) % 8); } /** @@ -105,7 +105,7 @@ inline Direction ChangeDir(Direction d, DirDiff delta) { assert(IsValidDirection(d)); /* Cast to uint so compiler can use bitmask. Result can never be negative. */ - return (Direction)((uint)(d + delta) % 8); + return static_cast((static_cast(d) + static_cast(delta)) % 8); } @@ -150,7 +150,7 @@ inline DiagDirection ChangeDiagDir(DiagDirection d, DiagDirDiff delta) { assert(IsValidDiagDirection(d)); /* Cast to uint so compiler can use bitmask. Result can never be negative. */ - return (DiagDirection)((uint)(d + delta) % 4); + return static_cast((static_cast(d) + static_cast(delta)) % 4); } /** diff --git a/src/fileio_type.h b/src/fileio_type.h index 14acf07971..66d502d88a 100644 --- a/src/fileio_type.h +++ b/src/fileio_type.h @@ -89,7 +89,7 @@ enum FiosType { */ inline AbstractFileType GetAbstractFileType(FiosType fios_type) { - return static_cast(fios_type & FT_MASK); + return static_cast(static_cast(fios_type) & FT_MASK); } /** diff --git a/src/script/api/script_rail.cpp b/src/script/api/script_rail.cpp index 88f88e6048..001d7952d8 100644 --- a/src/script/api/script_rail.cpp +++ b/src/script/api/script_rail.cpp @@ -250,7 +250,7 @@ EnforceCompanyModeValid(false); EnforcePrecondition(false, ::IsValidTile(tile)); EnforcePrecondition(false, rail_track != 0); - EnforcePrecondition(false, (rail_track & ~::TRACK_BIT_ALL) == 0); + EnforcePrecondition(false, (static_cast(rail_track) & ~static_cast(::TRACK_BIT_ALL)) == 0); EnforcePrecondition(false, KillFirstBit((uint)rail_track) == 0); EnforcePrecondition(false, IsRailTypeAvailable(GetCurrentRailType())); diff --git a/src/script/api/script_station.cpp b/src/script/api/script_station.cpp index 83bfde2958..ee3ff0d5d6 100644 --- a/src/script/api/script_station.cpp +++ b/src/script/api/script_station.cpp @@ -203,7 +203,7 @@ template if (!IsValidStation(station_id)) return false; if (!HasExactlyOneBit(station_type)) return false; - return (::Station::Get(station_id)->facilities & station_type) != 0; + return (::Station::Get(station_id)->facilities & static_cast(station_type)) != 0; } /* static */ bool ScriptStation::HasRoadType(StationID station_id, ScriptRoad::RoadType road_type) diff --git a/src/script/api/script_stationlist.cpp b/src/script/api/script_stationlist.cpp index 2051679eca..d2c1d532b1 100644 --- a/src/script/api/script_stationlist.cpp +++ b/src/script/api/script_stationlist.cpp @@ -23,7 +23,7 @@ ScriptStationList::ScriptStationList(ScriptStation::StationType station_type) CompanyID owner = ScriptObject::GetCompany(); ScriptList::FillList(this, [is_deity, owner, station_type](const Station *st) { - return (is_deity || st->owner == owner) && (st->facilities & station_type) != 0; + return (is_deity || st->owner == owner) && (st->facilities & static_cast(station_type)) != 0; } ); } diff --git a/src/script/api/script_waypoint.cpp b/src/script/api/script_waypoint.cpp index 5f7bceaa61..84c2a4aeb6 100644 --- a/src/script/api/script_waypoint.cpp +++ b/src/script/api/script_waypoint.cpp @@ -34,5 +34,5 @@ if (!IsValidWaypoint(waypoint_id)) return false; if (!HasExactlyOneBit(waypoint_type)) return false; - return (::Waypoint::Get(waypoint_id)->facilities & waypoint_type) != 0; + return (::Waypoint::Get(waypoint_id)->facilities & static_cast(waypoint_type)) != 0; } diff --git a/src/script/api/script_waypointlist.cpp b/src/script/api/script_waypointlist.cpp index f137bea190..2332655c2e 100644 --- a/src/script/api/script_waypointlist.cpp +++ b/src/script/api/script_waypointlist.cpp @@ -23,7 +23,7 @@ ScriptWaypointList::ScriptWaypointList(ScriptWaypoint::WaypointType waypoint_typ CompanyID owner = ScriptObject::GetCompany(); ScriptList::FillList(this, [is_deity, owner, waypoint_type](const Waypoint *wp) { - return (is_deity || wp->owner == owner || wp->owner == OWNER_NONE) && (wp->facilities & waypoint_type) != 0; + return (is_deity || wp->owner == owner || wp->owner == OWNER_NONE) && (wp->facilities & static_cast(waypoint_type)) != 0; } ); } diff --git a/src/slope_func.h b/src/slope_func.h index b6217ae035..2d78faea3b 100644 --- a/src/slope_func.h +++ b/src/slope_func.h @@ -391,7 +391,7 @@ inline Foundation InclinedFoundation(Axis axis) inline Foundation HalftileFoundation(Corner corner) { assert(IsValidCorner(corner)); - return (Foundation)(FOUNDATION_HALFTILE_W + corner); + return static_cast(static_cast(FOUNDATION_HALFTILE_W) + static_cast(corner)); } /** @@ -403,7 +403,7 @@ inline Foundation HalftileFoundation(Corner corner) inline Foundation SpecialRailFoundation(Corner corner) { assert(IsValidCorner(corner)); - return (Foundation)(FOUNDATION_RAIL_W + corner); + return static_cast(static_cast(FOUNDATION_RAIL_W) + static_cast(corner)); } /**