diff --git a/src/lang/latvian.txt b/src/lang/latvian.txt index 14be5c60bc..af11240a97 100644 --- a/src/lang/latvian.txt +++ b/src/lang/latvian.txt @@ -2022,7 +2022,7 @@ STR_CONFIG_SETTING_SOFT_LIMIT :Maksimālais lo STR_CONFIG_SETTING_SOFT_LIMIT_HELPTEXT :Atvērtu nepielipušo logu skaits, pirms tie tiek automātiski aizvērti lai atbrīvotu vietu jauniem logiem STR_CONFIG_SETTING_SOFT_LIMIT_VALUE :{COMMA} ###setting-zero-is-special -STR_CONFIG_SETTING_SOFT_LIMIT_DISABLED :izslēgts +STR_CONFIG_SETTING_SOFT_LIMIT_DISABLED :Izslēgts STR_CONFIG_SETTING_ZOOM_MIN :Maksimālais pietuvinājuma līmenis: {STRING} STR_CONFIG_SETTING_ZOOM_MIN_HELPTEXT :Maksimālais pietuvinājuma līmenis skatvietām. Ir jāievēro ka paaugstinot pietuvinājuma līmeni, pieaug operatīvās atmiņas izlietojums diff --git a/src/lang/luxembourgish.txt b/src/lang/luxembourgish.txt index 2941add4f2..7e070b41a3 100644 --- a/src/lang/luxembourgish.txt +++ b/src/lang/luxembourgish.txt @@ -452,6 +452,12 @@ STR_SETTINGS_MENU_SANDBOX_OPTIONS :Sandbox Optioun STR_SETTINGS_MENU_TRANSPARENCY_OPTIONS :Transparenz Optiounen STR_SETTINGS_MENU_TOWN_NAMES_DISPLAYED :Stiednimm uweisen STR_SETTINGS_MENU_STATION_NAMES_DISPLAYED :Statiounsnimm uweisen +STR_SETTINGS_MENU_STATION_NAMES_TRAIN :Garen +STR_SETTINGS_MENU_STATION_NAMES_LORRY :Camionsgaren +STR_SETTINGS_MENU_STATION_NAMES_BUS :Busarrêten +STR_SETTINGS_MENU_STATION_NAMES_SHIP :Hafen +STR_SETTINGS_MENU_STATION_NAMES_PLANE :Fluchhäfen +STR_SETTINGS_MENU_STATION_NAMES_GHOST :Geescht STR_SETTINGS_MENU_WAYPOINTS_DISPLAYED :Weepunktnimm uweisen STR_SETTINGS_MENU_SIGNS_DISPLAYED :Schëlder uweisen STR_SETTINGS_MENU_SHOW_COMPETITOR_SIGNS :Géignerschëlder an Nimm uweisen @@ -1017,6 +1023,7 @@ STR_GAME_OPTIONS_CURRENCY_IDR :Indonesesch Rup STR_GAME_OPTIONS_CURRENCY_MYR :Malaysesche Ringgit STR_GAME_OPTIONS_CURRENCY_LVL :Lettesch Lat STR_GAME_OPTIONS_CURRENCY_PTE :Portugieseschen Escudo +STR_GAME_OPTIONS_CURRENCY_UAH :Ukrainesch Hryvnia STR_GAME_OPTIONS_AUTOSAVE_FRAME :{BLACK}Autospäicheren STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_TOOLTIP :{BLACK}Wiel den Intervall aus fir d'Autospäicherung @@ -1210,7 +1217,7 @@ STR_CITY_APPROVAL_TOLERANT :Tolerant STR_CITY_APPROVAL_HOSTILE :Feindlech STR_CITY_APPROVAL_PERMISSIVE :Fräizügeg (keng Auswierkung op Firmenactiounen) -STR_WARNING_NO_SUITABLE_AI :{WHITE}Keng KI fonnt...{}KI kënnen iwwert den 'Online Content' system downgeload ginn +STR_WARNING_NO_SUITABLE_AI :{WHITE}Keng KI fonnt...{}{}KI kënnen iwwert den 'Online Content' system downgeload ginn # Settings tree window STR_CONFIG_SETTING_TREE_CAPTION :{WHITE}Astellungen @@ -1923,7 +1930,8 @@ STR_CONFIG_SETTING_ENDING_YEAR_ZERO :Nie STR_CONFIG_SETTING_ECONOMY_TYPE :Wiertschaftstyp: {STRING} ###length 2 -STR_CONFIG_SETTING_ECONOMY_TYPE_HELPTEXT :"Glaat" suergt fir méi oft a kleng Produktiounsännerungen. "Agefruer" stoppt jeglech Ännerungen an der Wiertschaft an Industrieschléissungen. Dës Astellunge kinnten keen Afloss hunn, wann en NewGRF benotzt gëtt +STR_CONFIG_SETTING_ECONOMY_TYPE_HELPTEXT :"Glaat" suergt fir méi oft a kleng Produktiounsännerungen. "Agefruer" stoppt jeglech Ännerungen an der Wiertschaft an Industrieschléissungen. Dës Astellunge kinnten keen Afloss hunn, wann en NewGRF benotzt gëtt.{}{}Industrieproduktioun pro Mount kinnt nach emmer variabel ausgesinn wann d'Ekonomie agefruer ass, wëll d'Produktioun a fixen Intervalle ugefrot gëtt an dat net exakt de equivalent zu de Méint ass +STR_CONFIG_SETTING_ECONOMY_TYPE_HELPTEXT_PERIOD :"Glaat" suergt fir méi oft a kleng Produktiounsännerungen. "Agefruer" stoppt jeglech Ännerungen an der Wiertschaft an Industrieschléissungen. Dës Astellunge kinnten keen Afloss hunn, wann en NewGRF benotzt gëtt.{}{}Industrieproduktioun pro Minut kinnt nach emmer variabel ausgesinn wann d'Ekonomie agefruer ass, wëll d'Produktioun a fixen Intervalle ugefrot gëtt an dat net exakt de equivalent zu Minuten ass ###length 3 STR_CONFIG_SETTING_ECONOMY_TYPE_ORIGINAL :Original @@ -1966,19 +1974,24 @@ STR_CONFIG_SETTING_TOWN_LAYOUT_RANDOM :Zoufälleg STR_CONFIG_SETTING_ALLOW_TOWN_ROADS :Stied däerfen Stroossen bauen: {STRING} STR_CONFIG_SETTING_ALLOW_TOWN_ROADS_HELPTEXT :Erlaabt Stied Stroossen ze bauen fir ze wuessen. Ausschalten fir d'Stiedréid dorun ze hënneren fir Stroossen selwer ze bauen STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS :Stied dierfe Barrière bauen: {STRING} -STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS_HELPTEXT :Wann dës Astellung ugeschalt ass, kënnen Stied Stroossen iwwert Schinne bauen +STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS_HELPTEXT :Wann dës Astellung ugeschalt ass, kënne Stied Stroossen iwwert Schinne bauen STR_CONFIG_SETTING_NOISE_LEVEL :Limitéier de Bau vu Fluchhäfen geméiss dem Kaméidisniveau: {STRING} STR_CONFIG_SETTING_NOISE_LEVEL_HELPTEXT :Erlaabt de Stied de Bau vu Fluchhäfen opgront vum Kaméidisniveau ze blockéiren, wat sech op d'Gréisst vun der Stad an d'Gréisst an Distanz vum Fluchhafe baséiert. Wann dat ausgeschalt ass, erlaabt d'Stad zwee Fluchhäfen ausser d'Gemengenastellung ass "Fräizügeg" STR_CONFIG_SETTING_TOWN_FOUNDING :Stiedgrënnung am Spill: {STRING} -STR_CONFIG_SETTING_TOWN_FOUNDING_HELPTEXT :Wann dës Astellung ugeschalt ass, kënnen Spiller nei Stied am Spill grënnen +STR_CONFIG_SETTING_TOWN_FOUNDING_HELPTEXT :Wann dës Astellung ugeschalt ass, kënne Spiller nei Stied am Spill grënnen ###length 3 STR_CONFIG_SETTING_TOWN_FOUNDING_FORBIDDEN :Verbueden STR_CONFIG_SETTING_TOWN_FOUNDING_ALLOWED :Erlaabt STR_CONFIG_SETTING_TOWN_FOUNDING_ALLOWED_CUSTOM_LAYOUT :Erlaabt, eegene Stad-Layout +STR_CONFIG_SETTING_HOUSE_PLACER :Individuell Haiser plazéiren: {STRING} +STR_CONFIG_SETTING_HOUSE_PLACER_HELPTEXT :Wann des Astellung ugeschalt ass, kënne Spiller Haiser manuell plazéiren ###length 3 +STR_CONFIG_SETTING_HOUSE_PLACER_FORBIDDEN :Verbueden +STR_CONFIG_SETTING_HOUSE_PLACER_ALLOWED :Erlabt +STR_CONFIG_SETTING_HOUSE_PLACER_FULLY_CONSTRUCTED :Erlabt, fäerdeg gebaut STR_CONFIG_SETTING_TOWN_CARGOGENMODE :Duerfwuerengeneratioun: {STRING} STR_CONFIG_SETTING_TOWN_CARGOGENMODE_HELPTEXT :Wéivill Wuere produzéiert ginn, relativ zur Bevölkerung vum Duerf.{}Quadratesche Wuesstum: En duebel sou grousst Duerf, generéiert véier mol souvill Passagéier.{}Lineare Wuesstum: En duebel sou grousst Duerf, generéiert duebel souvill Passagéier @@ -2007,7 +2020,7 @@ STR_CONFIG_SETTING_SOFT_LIMIT :Maximal Unzuel STR_CONFIG_SETTING_SOFT_LIMIT_HELPTEXT :Unzuel un net-gepinnten openen Fënster befier al Fënsteren automatesch zougemaach ginn fir nei Plaz ze man fir nei Fënsteren STR_CONFIG_SETTING_SOFT_LIMIT_VALUE :{COMMA} ###setting-zero-is-special -STR_CONFIG_SETTING_SOFT_LIMIT_DISABLED :ausgeschalt +STR_CONFIG_SETTING_SOFT_LIMIT_DISABLED :Ausgeschalt STR_CONFIG_SETTING_ZOOM_MIN :Maximale Razoom Level: {STRING} STR_CONFIG_SETTING_ZOOM_MIN_HELPTEXT :Maximal Razoomstuf fir Usiichtsfënsteren. Et gëtt méi Späicher gebraucht wann d'Stufen ze grouss ginn @@ -2192,7 +2205,7 @@ STR_INTRO_HIGHSCORE :{BLACK}Beschtel STR_INTRO_HELP :{BLACK}Hëllef & Handbuch STR_INTRO_CONFIG_SETTINGS_TREE :{BLACK}Astellungen STR_INTRO_NEWGRF_SETTINGS :{BLACK}NewGRF Astellungen -STR_INTRO_ONLINE_CONTENT :{BLACK}Check Online Inhalt +STR_INTRO_ONLINE_CONTENT :{BLACK}Online Content STR_INTRO_AI_SETTINGS :{BLACK}KI Astellungen STR_INTRO_GAMESCRIPT_SETTINGS :{BLACK}Spillscriptastellungen STR_INTRO_QUIT :{BLACK}Eraus @@ -2241,6 +2254,7 @@ STR_HELP_WINDOW_README :{BLACK}Readme STR_HELP_WINDOW_CHANGELOG :{BLACK}Changelog STR_HELP_WINDOW_KNOWN_BUGS :{BLACK}Bekannte Bugs STR_HELP_WINDOW_LICENSE :{BLACK}Lizenz +STR_HELP_WINDOW_FONTS :{BLACK}Schrëften STR_HELP_WINDOW_MAIN_WEBSITE :{BLACK}OpenTTD STR_HELP_WINDOW_MANUAL_WIKI :{BLACK}Handbuch / Wiki STR_HELP_WINDOW_BUGTRACKER :{BLACK}E Bug melden @@ -2629,13 +2643,14 @@ STR_NETWORK_SERVER_MESSAGE_GAME_REASON_LINK_GRAPH :warden op d'Akt STR_NETWORK_MESSAGE_CLIENT_LEAVING :verloossen STR_NETWORK_MESSAGE_CLIENT_JOINED :*** {STRING} ass dem Spill bäigetrueden STR_NETWORK_MESSAGE_CLIENT_JOINED_ID :*** {STRING} ass an d'Spill komm (Client #{NUM}) +STR_NETWORK_MESSAGE_CLIENT_COMPANY_JOIN :*** {STRING} ass bei d'Firma {STRING} gaang STR_NETWORK_MESSAGE_CLIENT_COMPANY_SPECTATE :*** {STRING} ass als Zuschauer do STR_NETWORK_MESSAGE_CLIENT_COMPANY_NEW :*** {STRING} huet eng nei Firma gegrënnt (#{NUM}) STR_NETWORK_MESSAGE_CLIENT_LEFT :*** {STRING} huet d'Spill verlooss ({STRING}) STR_NETWORK_MESSAGE_NAME_CHANGE :*** {STRING} huet säin Numm op {STRING} gewiesselt STR_NETWORK_MESSAGE_GIVE_MONEY :*** {STRING} huet {CURRENCY_LONG} der Firma {STRING} ginn STR_NETWORK_MESSAGE_SERVER_SHUTDOWN :{WHITE}De Server huet d'Sessioun zougemaach -STR_NETWORK_MESSAGE_SERVER_REBOOT :{WHITE}De Server gëtt nei gestart...{}W.e.g. waarden... +STR_NETWORK_MESSAGE_SERVER_REBOOT :{WHITE}De Server gëtt nei gestart...{}{}W.e.g. waarden... STR_NETWORK_MESSAGE_KICKED :*** {STRING} gouf gekickt. Grond: ({STRING}) STR_NETWORK_ERROR_COORDINATOR_REGISTRATION_FAILED :{WHITE}Server Registration huet net geklappt @@ -2644,7 +2659,7 @@ STR_NETWORK_ERROR_COORDINATOR_ISOLATED :{WHITE}De Serve STR_NETWORK_ERROR_COORDINATOR_ISOLATED_DETAIL :{WHITE}Aner Spiller wäerte sech net op de Server verbanne kënnen # Content downloading window -STR_CONTENT_TITLE :{WHITE}Lueden Inhalt erof +STR_CONTENT_TITLE :{WHITE}Online Content STR_CONTENT_TYPE_CAPTION :{BLACK}Typ STR_CONTENT_TYPE_CAPTION_TOOLTIP :{BLACK}Typ vum Inhalt STR_CONTENT_NAME_CAPTION :{BLACK}Numm @@ -2843,6 +2858,7 @@ STR_HOUSE_PICKER_YEARS_FROM :{BLACK}Joer: {O STR_HOUSE_PICKER_YEARS_UNTIL :{BLACK}Joer: {ORANGE}Bis {NUM} STR_HOUSE_PICKER_SIZE :{BLACK}Gréisst: {ORANGE}{NUM}x{NUM} Felder STR_HOUSE_PICKER_CARGO_ACCEPTED :{BLACK}Akzeptéiert Wuer: {ORANGE} +STR_HOUSE_PICKER_CARGO_PRODUCED :{BLACK}Produzéiert Wuer: {ORANGE}{CARGO_LIST} STR_HOUSE_PICKER_CLASS_ZONE1 :Rand STR_HOUSE_PICKER_CLASS_ZONE2 :Ausseberäich @@ -2850,6 +2866,10 @@ STR_HOUSE_PICKER_CLASS_ZONE3 :Aner Viruerter STR_HOUSE_PICKER_CLASS_ZONE4 :Bannescht Viruerter STR_HOUSE_PICKER_CLASS_ZONE5 :Stadzentrum +STR_HOUSE_PICKER_PROTECT_TITLE :Upgrades verhënneren +STR_HOUSE_PICKER_PROTECT_TOOLTIP :Wiel aus ob dëst Haus firun engem Ersetze geschützt gëtt wann d'Stad wiisst +STR_HOUSE_PICKER_PROTECT_OFF :Aus +STR_HOUSE_PICKER_PROTECT_ON :Un STR_STATION_CLASS_DFLT :Standard STR_STATION_CLASS_DFLT_STATION :Standardstatioun @@ -2883,6 +2903,7 @@ STR_SELECT_ROAD_BRIDGE_CAPTION :{WHITE}Stroosse STR_SELECT_BRIDGE_SELECTION_TOOLTIP :{BLACK}Bréckenauswiel - Wiel deng Bréck aus STR_SELECT_BRIDGE_INFO_NAME :{GOLD}{STRING} STR_SELECT_BRIDGE_INFO_NAME_MAX_SPEED :{GOLD}{STRING},{} {VELOCITY} +STR_SELECT_BRIDGE_INFO_NAME_COST :{GOLD}{STRING},{} {WHITE}{CURRENCY_LONG} STR_SELECT_BRIDGE_INFO_NAME_MAX_SPEED_COST :{GOLD}{STRING},{} {VELOCITY} {WHITE}{CURRENCY_LONG} STR_BRIDGE_NAME_SUSPENSION_STEEL :Stolen Hängebréck STR_BRIDGE_NAME_GIRDER_STEEL :Stoldréier Bréck @@ -2941,7 +2962,7 @@ STR_STATION_BUILD_CARGO_TRAM_ORIENTATION_TOOLTIP :{BLACK}Wueren-T # Waterways toolbar (last two for SE only) STR_WATERWAYS_TOOLBAR_CAPTION :{WHITE}Waasserstroosse bauen STR_WATERWAYS_TOOLBAR_CAPTION_SE :{WHITE}Waasserstroossen -STR_WATERWAYS_TOOLBAR_BUILD_CANALS_TOOLTIP :{BLACK}Kanäl bauen. Dréck Shift fir nëmmen déi ongeféier Käschten unzeweisen +STR_WATERWAYS_TOOLBAR_BUILD_CANALS_TOOLTIP :{BLACK}Kanäl bauen. Ctrl+Klick+Zéien fir wielt d'Areal diagonal aus. Dréck Shift fir nëmmen déi ongeféier Käschten unzeweisen STR_WATERWAYS_TOOLBAR_BUILD_LOCKS_TOOLTIP :{BLACK}Schleise bauen. Dréck Shift fir nëmmen déi ongeféier Käschten unzeweisen STR_WATERWAYS_TOOLBAR_BUILD_DEPOT_TOOLTIP :{BLACK}Schëffsschapp bauen (fir Schëffer ze bauen an ze reparéiren). Dréck Shift fir nëmmen déi ongeféier Käschten unzeweisen STR_WATERWAYS_TOOLBAR_BUILD_DOCK_TOOLTIP :{BLACK}Schëffsdock bauen. Ctrl aktivéiert ubaue vu Statiounen. Shift wiesselt tëscht bauen/ongeféier Käschten uweisen @@ -3126,6 +3147,8 @@ STR_LANG_AREA_INFORMATION_TRAM_TYPE :{BLACK}Tramtyp: STR_LANG_AREA_INFORMATION_RAIL_SPEED_LIMIT :{BLACK}Schinne-Geschw.-Limit: {LTBLUE}{VELOCITY} STR_LANG_AREA_INFORMATION_ROAD_SPEED_LIMIT :{BLACK}Stroosse-Geschw.-Limit: {LTBLUE}{VELOCITY} STR_LANG_AREA_INFORMATION_TRAM_SPEED_LIMIT :{BLACK}Tram-Geschw.-Limit: {LTBLUE}{VELOCITY} +STR_LAND_AREA_INFORMATION_TOWN_CAN_UPGRADE :{BLACK}Stad kann upgraden: {LTBLUE}Jo +STR_LAND_AREA_INFORMATION_TOWN_CANNOT_UPGRADE :{BLACK}Stad kann upgraden: {LTBLUE}Nee # Description of land area of different tiles STR_LAI_CLEAR_DESCRIPTION_ROCKS :Fielsen @@ -3134,6 +3157,9 @@ STR_LAI_CLEAR_DESCRIPTION_BARE_LAND :Eidelt Land STR_LAI_CLEAR_DESCRIPTION_GRASS :Gras STR_LAI_CLEAR_DESCRIPTION_FIELDS :Felder STR_LAI_CLEAR_DESCRIPTION_DESERT :Wüst +STR_LAI_CLEAR_DESCRIPTION_SNOWY_ROCKS :Schnéibedeckt Fielsen +STR_LAI_CLEAR_DESCRIPTION_SNOWY_ROUGH_LAND :Schnéibedeckt knubbelegt Land +STR_LAI_CLEAR_DESCRIPTION_SNOWY_GRASS :Schnéibedeckt Gras STR_LAI_RAIL_DESCRIPTION_TRACK :Schinn STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_SIGNALS :Schinn mat Blocksignaler @@ -3605,17 +3631,17 @@ STR_NEWGRF_LIST_COMPATIBLE :{YELLOW}Kompati STR_NEWGRF_LIST_MISSING :{RED}Dateien feelen # NewGRF 'it's broken' warnings -STR_NEWGRF_BROKEN :{WHITE}Verhalen vun der NewGRF '{0:STRING}' kann Desyncs oder Crashen verursachen -STR_NEWGRF_BROKEN_POWERED_WAGON :{WHITE}Ännert den Zoustand fir '{1:ENGINE}' wann net an engem Schapp -STR_NEWGRF_BROKEN_VEHICLE_LENGTH :{WHITE}Ännert d'Gefierlängt fir '{1:ENGINE}' wann net an engem Schapp -STR_NEWGRF_BROKEN_CAPACITY :{WHITE}Geännerte Gefierkapazitéit vun '{1:ENGINE}' wann net an engem Schapp oder amgaang emgebaut ze ginn +STR_NEWGRF_BROKEN :{WHITE}Verhalen vun der NewGRF '{PUSH_COLOUR}{0:STRING}{POP_COLOUR}' kann Desyncs oder Crashen verursachen +STR_NEWGRF_BROKEN_POWERED_WAGON :{WHITE}Ännert den Zoustand fir '{PUSH_COLOUR}{1:ENGINE}{POP_COLOUR}' wann net an engem Schapp +STR_NEWGRF_BROKEN_VEHICLE_LENGTH :{WHITE}Ännert d'Gefierlängt fir '{PUSH_COLOUR}{1:ENGINE}{POP_COLOUR}' wann net an engem Schapp +STR_NEWGRF_BROKEN_CAPACITY :{WHITE}Geännerte Gefierkapazitéit vun '{PUSH_COLOUR}{1:ENGINE}{POP_COLOUR}' wann net an engem Schapp oder amgaang emgebaut ze ginn STR_BROKEN_VEHICLE_LENGTH :{WHITE}Zuch'{VEHICLE}' vun der Firma '{COMPANY}' huet eng falsch Längt. Et kënnt wahrscheinlech wéinst den NewGRFs. Spill kann desyncroniséiren oder ofstierzen -STR_NEWGRF_BUGGY :{WHITE}NewGRF '{0:STRING}' huet Fehlinformatiounen -STR_NEWGRF_BUGGY_ARTICULATED_CARGO :{WHITE}Cargo/refit Informatioun fir '{1:ENGINE}' ass anescht wéi an der Kaflëscht no der Constructioun. Dëst kann en Autoerneirung/-ersetzen Feeler oprufen -STR_NEWGRF_BUGGY_ENDLESS_PRODUCTION_CALLBACK :{WHITE}'{1:STRING}' huet eng Endlosschläif am Production callback verursaacht +STR_NEWGRF_BUGGY :{WHITE}NewGRF '{PUSH_COLOUR}{0:STRING}{POP_COLOUR}' huet Fehlinformatiounen +STR_NEWGRF_BUGGY_ARTICULATED_CARGO :{WHITE}Cargo/refit Informatioun fir '{PUSH_COLOUR}{1:ENGINE}{POP_COLOUR}' ass anescht wéi an der Kaflëscht no der Constructioun. Dëst kann en Autoerneirung/-ersetzen Feeler oprufen +STR_NEWGRF_BUGGY_ENDLESS_PRODUCTION_CALLBACK :{WHITE}'{PUSH_COLOUR}{1:STRING}{POP_COLOUR}' huet eng Endlosschläif am Production callback verursaacht STR_NEWGRF_BUGGY_UNKNOWN_CALLBACK_RESULT :{WHITE}Callback {1:HEX} huet en onbekannten/invalid Resultat {2:HEX} -STR_NEWGRF_BUGGY_INVALID_CARGO_PRODUCTION_CALLBACK :{WHITE}'{1:STRING}' huet en ongültegen Wuerentyp am Production-callback bei {2:HEX} +STR_NEWGRF_BUGGY_INVALID_CARGO_PRODUCTION_CALLBACK :{WHITE}'{PUSH_COLOUR}{1:STRING}{POP_COLOUR}' huet en ongültegen Wuerentyp am Production-callback bei {2:HEX} # 'User removed essential NewGRFs'-placeholders for stuff without specs STR_NEWGRF_INVALID_CARGO : @@ -4011,6 +4037,10 @@ STR_INDUSTRY_VIEW_PRODUCES_N_CARGO :{BLACK}Produzé STR_INDUSTRY_VIEW_CARGO_LIST_EXTENSION :, {STRING}{STRING} STR_INDUSTRY_VIEW_REQUIRES :{BLACK}Brauch: +STR_INDUSTRY_VIEW_ACCEPT_CARGO_SUFFIX :{YELLOW}{0:STRING}{BLACK}{3:STRING} +STR_INDUSTRY_VIEW_ACCEPT_CARGO_AMOUNT_SUFFIX :{YELLOW}{0:STRING}{BLACK}: {1:CARGO_SHORT} warden{3:STRING} +STR_INDUSTRY_VIEW_ACCEPT_CARGO_NOSUFFIX :{YELLOW}{0:STRING} +STR_INDUSTRY_VIEW_ACCEPT_CARGO_AMOUNT_NOSUFFIX :{YELLOW}{0:STRING}{BLACK}: {1:CARGO_SHORT} warden STR_CONFIG_GAME_PRODUCTION :{WHITE}D'Produktioun änneren (Multipel vun 8, bis op 2040) STR_CONFIG_GAME_PRODUCTION_LEVEL :{WHITE}Änner de Produktiounslevel (Prozenter, bis zu 800%) @@ -4668,54 +4698,56 @@ STR_ORDER_ROAD_VEHICLE_DEPOT :Stroossegefier- STR_ORDER_SHIP_DEPOT :Schëffswerft ###next-name-looks-similar +STR_ORDER_GO_TO_NEAREST_HANGAR_FORMAT :{STRING} den noosten Hangar +STR_ORDER_GO_TO_NEAREST_DEPOT_FORMAT :{STRING} den noosten {STRING} STR_ORDER_GO_TO_DEPOT_FORMAT :{STRING} {DEPOT} -STR_ORDER_REFIT_ORDER :(Ëmbau op {STRING}) -STR_ORDER_REFIT_STOP_ORDER :(Ëmbau op {STRING} an stoppen) -STR_ORDER_STOP_ORDER :(Stop) +STR_ORDER_REFIT_ORDER :{SPACE}(Ëmbau op {STRING}) +STR_ORDER_REFIT_STOP_ORDER :{SPACE}(Ëmbau op {STRING} an stoppen) +STR_ORDER_STOP_ORDER :{SPACE}(Stop) -STR_ORDER_WAIT_TO_UNBUNCH :(Warden fir ze verspreeën) +STR_ORDER_WAIT_TO_UNBUNCH :{SPACE}(Warden fir ze verspreeën) STR_ORDER_GO_TO_STATION :{STRING} {STATION} STR_ORDER_GO_TO_STATION_CAN_T_USE_STATION :{PUSH_COLOUR}{RED}(Statioun kann net benotzt ginn){POP_COLOUR} {STRING} {STATION} -STR_ORDER_IMPLICIT :(Implizit) +STR_ORDER_IMPLICIT :{SPACE}(Implizit) -STR_ORDER_FULL_LOAD :(Voll lueden) -STR_ORDER_FULL_LOAD_ANY :(Voll lueden mat all Wuer) -STR_ORDER_NO_LOAD :(Net lueden) -STR_ORDER_UNLOAD :(Entlueden an Luedung huelen) -STR_ORDER_UNLOAD_FULL_LOAD :(Entlueden an erem voll lueden) -STR_ORDER_UNLOAD_FULL_LOAD_ANY :(Entlueden an mat all Wuer voll lueden) -STR_ORDER_UNLOAD_NO_LOAD :(Entlueden an eidel loosen) -STR_ORDER_TRANSFER :(Transferéieren an Lueden) -STR_ORDER_TRANSFER_FULL_LOAD :(Transferéieren an voll lueden) -STR_ORDER_TRANSFER_FULL_LOAD_ANY :(Transferéieren an mat all Wuer voll lueden) -STR_ORDER_TRANSFER_NO_LOAD :(Transferéieren an eidel loosen) -STR_ORDER_NO_UNLOAD :(Net entlueden an Wueren lueden) -STR_ORDER_NO_UNLOAD_FULL_LOAD :(Net entlueden an op voll Beluedung waarden) -STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY :(Net entlueden an op iergendeng voll Beluedung waarden) -STR_ORDER_NO_UNLOAD_NO_LOAD :(Keen Ent- an Belueden) +STR_ORDER_FULL_LOAD :{SPACE}(Voll lueden) +STR_ORDER_FULL_LOAD_ANY :{SPACE}(Voll lueden mat all Wuer) +STR_ORDER_NO_LOAD :{SPACE}(Net lueden) +STR_ORDER_UNLOAD :{SPACE}(Entlueden an Luedung huelen) +STR_ORDER_UNLOAD_FULL_LOAD :{SPACE}(Entlueden an erem voll lueden) +STR_ORDER_UNLOAD_FULL_LOAD_ANY :{SPACE}(Entlueden an mat all Wuer voll lueden) +STR_ORDER_UNLOAD_NO_LOAD :{SPACE}(Entlueden an eidel loosen) +STR_ORDER_TRANSFER :{SPACE}(Transferéieren an Lueden) +STR_ORDER_TRANSFER_FULL_LOAD :{SPACE}(Transferéieren an voll lueden) +STR_ORDER_TRANSFER_FULL_LOAD_ANY :{SPACE}(Transferéieren an mat all Wuer voll lueden) +STR_ORDER_TRANSFER_NO_LOAD :{SPACE}(Transferéieren an eidel loosen) +STR_ORDER_NO_UNLOAD :{SPACE}(Net entlueden an Wueren lueden) +STR_ORDER_NO_UNLOAD_FULL_LOAD :{SPACE}(Net entlueden an op voll Beluedung waarden) +STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY :{SPACE}(Net entlueden an op iergendeng voll Beluedung waarden) +STR_ORDER_NO_UNLOAD_NO_LOAD :{SPACE}(Keen Ent- an Belueden) -STR_ORDER_AUTO_REFIT :(Embauen op {STRING}) -STR_ORDER_FULL_LOAD_REFIT :(Voll lueden mat ëmbauen op {STRING}) -STR_ORDER_FULL_LOAD_ANY_REFIT :(Voll lueden mat all Wueren mat ëmbauen op {STRING}) -STR_ORDER_UNLOAD_REFIT :(Entlueden an Wueren lueden mat Embauen op {STRING}) -STR_ORDER_UNLOAD_FULL_LOAD_REFIT :(Entlueden an op voll Luedung waarden mat Embauen op {STRING}) -STR_ORDER_UNLOAD_FULL_LOAD_ANY_REFIT :(Entlueden an waard op iergendeng Volluedung mat Embauen op {STRING}) -STR_ORDER_TRANSFER_REFIT :(Transfer an lued Wueren mat Auto-Embauen zu {STRING}) -STR_ORDER_TRANSFER_FULL_LOAD_REFIT :(Transfer an waard op Vollueden mat Auto-Embauen op {STRING}) -STR_ORDER_TRANSFER_FULL_LOAD_ANY_REFIT :(Transfer an waard op iergendeng Volluedung mat Auto-Embauen op {STRING}) -STR_ORDER_NO_UNLOAD_REFIT :(Keen Entlueden an huel Wueren mat Auto-Embauen op {STRING}) -STR_ORDER_NO_UNLOAD_FULL_LOAD_REFIT :(Keen Entlueden an waard op Vollueden mat Auto-Embauen op {STRING}) -STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY_REFIT :(Keen Entlueden an waard op iergendend Volluedung mat Auto-Embauen op {STRING}) +STR_ORDER_AUTO_REFIT :{SPACE}(Embauen op {STRING}) +STR_ORDER_FULL_LOAD_REFIT :{SPACE}(Voll lueden mat ëmbauen op {STRING}) +STR_ORDER_FULL_LOAD_ANY_REFIT :{SPACE}(Voll lueden mat all Wueren mat ëmbauen op {STRING}) +STR_ORDER_UNLOAD_REFIT :{SPACE}(Entlueden an Wueren lueden mat Embauen op {STRING}) +STR_ORDER_UNLOAD_FULL_LOAD_REFIT :{SPACE}(Entlueden an op voll Luedung waarden mat Embauen op {STRING}) +STR_ORDER_UNLOAD_FULL_LOAD_ANY_REFIT :{SPACE}(Entlueden an waard op iergendeng Volluedung mat Embauen op {STRING}) +STR_ORDER_TRANSFER_REFIT :{SPACE}(Transfer an lued Wueren mat Auto-Embauen zu {STRING}) +STR_ORDER_TRANSFER_FULL_LOAD_REFIT :{SPACE}(Transfer an waard op Vollueden mat Auto-Embauen op {STRING}) +STR_ORDER_TRANSFER_FULL_LOAD_ANY_REFIT :{SPACE}(Transfer an waard op iergendeng Volluedung mat Auto-Embauen op {STRING}) +STR_ORDER_NO_UNLOAD_REFIT :{SPACE}(Keen Entlueden an huel Wueren mat Auto-Embauen op {STRING}) +STR_ORDER_NO_UNLOAD_FULL_LOAD_REFIT :{SPACE}(Keen Entlueden an waard op Vollueden mat Auto-Embauen op {STRING}) +STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY_REFIT :{SPACE}(Keen Entlueden an waard op iergendend Volluedung mat Auto-Embauen op {STRING}) STR_ORDER_AUTO_REFIT_ANY :verfügbar Wueren ###length 3 -STR_ORDER_STOP_LOCATION_NEAR_END :[noosten Enn] -STR_ORDER_STOP_LOCATION_MIDDLE :[Mëtt] -STR_ORDER_STOP_LOCATION_FAR_END :[wäit Enn] +STR_ORDER_STOP_LOCATION_NEAR_END :{SPACE}[no um Enn] +STR_ORDER_STOP_LOCATION_MIDDLE :{SPACE}[Mëtt] +STR_ORDER_STOP_LOCATION_FAR_END :{SPACE}[wäit Enn] STR_ORDER_OUT_OF_RANGE :{RED} (Nächst Destinatioun ass ze wäit fort) @@ -4740,8 +4772,8 @@ STR_TIMETABLE_TRAVEL_FOR :Ënnerwee währ STR_TIMETABLE_TRAVEL_FOR_SPEED :Fiert während {STRING} mat maximal {VELOCITY} STR_TIMETABLE_TRAVEL_FOR_ESTIMATED :Fuer (während {STRING}, ouni Zäitplang) STR_TIMETABLE_TRAVEL_FOR_SPEED_ESTIMATED :Fuer (während {STRING}, ouni Zäitplang) mat maximal {VELOCITY} -STR_TIMETABLE_STAY_FOR_ESTIMATED :(bleif während {STRING}, ouni Zäitplang) -STR_TIMETABLE_AND_TRAVEL_FOR_ESTIMATED :(fuer während {STRING}, ouni Zäitplang) +STR_TIMETABLE_STAY_FOR_ESTIMATED :{SPACE}(waard {STRING}, ouni Zäitplang) +STR_TIMETABLE_AND_TRAVEL_FOR_ESTIMATED :{SPACE}(fuer während {STRING}, ouni Zäitplang) STR_TIMETABLE_STAY_FOR :an bleif fir {STRING} STR_TIMETABLE_AND_TRAVEL_FOR :an ënnerwee während {STRING} @@ -4762,12 +4794,14 @@ STR_TIMETABLE_START_SECONDS_QUERY :Sekonne bis den STR_TIMETABLE_CHANGE_TIME :{BLACK}Zäit wiesselen STR_TIMETABLE_WAIT_TIME_TOOLTIP :{BLACK}Änner Zäit déi den ugewielten Optrag brauche soll. Ctrl+Klick ännert d'Zäit fir all Opträg +STR_TIMETABLE_CHANGE_TIME_QUERY :Zäit änneren STR_TIMETABLE_CLEAR_TIME :{BLACK}Zäit läschen STR_TIMETABLE_CLEAR_TIME_TOOLTIP :{BLACK}Läsch Zäit fir de gewielten Optrag. Ctrl+Klick läscht d'Zäite fir all opträg STR_TIMETABLE_CHANGE_SPEED :{BLACK}Änner de Geschwindegkeetslimit STR_TIMETABLE_CHANGE_SPEED_TOOLTIP :{BLACK}Änner d'maximal Reesgeschwindëgkeet fir de gewielten Optrag. Ctrl+Klick ännert d'Geschwindegkeet fir all Opträg +STR_TIMETABLE_CHANGE_SPEED_QUERY :Geschwindegkeetslimit änneren STR_TIMETABLE_CLEAR_SPEED :{BLACK}Geschwindegkeetslimit läschen STR_TIMETABLE_CLEAR_SPEED_TOOLTIP :{BLACK}Maximal Reesgeschwindegkeet vum gewielten Optrag läschen. Ctrl+Klick läscht d'Geschwindegkeet fir all Opträg @@ -4873,7 +4907,7 @@ STR_SCREENSHOT_MINIMAP_SCREENSHOT :{BLACK}Minimap- # Script Parameters STR_AI_SETTINGS_CAPTION_AI :KI -STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Spill-Script +STR_AI_SETTINGS_CAPTION_GAMESCRIPT :{WHITE}Spill-Script-Parameter STR_AI_SETTINGS_CLOSE :{BLACK}Zoumaachen STR_AI_SETTINGS_RESET :{BLACK}Reset STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} @@ -4934,7 +4968,7 @@ STR_GAME_SAVELOAD_NOT_AVAILABLE : STR_WARNING_LOADGAME_REMOVED_TRAMS :{WHITE}Spill gouf an enger Versioun ouni Tram support gesaved. All Tram gouf wechgeholl # Map generation messages -STR_ERROR_COULD_NOT_CREATE_TOWN :{WHITE}Kaartenerstellung ofgebrach...{}... keng passend Stadplazen +STR_ERROR_COULD_NOT_CREATE_TOWN :{WHITE}Kaartenerstellung ofgebrach...{}{}... keng passend Stadplazen STR_ERROR_NO_TOWN_IN_SCENARIO :{WHITE}... et ass keng Stad an dësem Szenario STR_ERROR_PNGMAP :{WHITE}Kann d'Landschaft net vum PNG lueden... @@ -4963,6 +4997,7 @@ STR_ERROR_SCREENSHOT_FAILED :{WHITE}Screensh # Error message titles STR_ERROR_MESSAGE_CAPTION :{YELLOW}Meldung +STR_ERROR_MESSAGE_CAPTION_OTHER_COMPANY :{YELLOW}Matdeelung vun {COMPANY} # Generic construction errors STR_ERROR_OFF_EDGE_OF_MAP :{WHITE}Ausserhalb vun der Kaart @@ -4981,6 +5016,7 @@ STR_ERROR_TERRAFORM_LIMIT_REACHED :{WHITE}... Limi STR_ERROR_CLEARING_LIMIT_REACHED :{WHITE}... Limit fir d'Raume vu Felder erreecht STR_ERROR_TREE_PLANT_LIMIT_REACHED :{WHITE}... Limit fir Beem ze planzen erreecht STR_ERROR_NAME_MUST_BE_UNIQUE :{WHITE}Numm muss eenzegarteg sinn +STR_ERROR_GENERIC_OBJECT_IN_THE_WAY :{WHITE}{STRING} am Wee STR_ERROR_NOT_ALLOWED_WHILE_PAUSED :{WHITE}Net erlaabt an der Paus # Local authority errors @@ -5023,7 +5059,7 @@ STR_ERROR_TOO_CLOSE_TO_ANOTHER_TOWN :{WHITE}... ze n STR_ERROR_TOO_MANY_TOWNS :{WHITE}... ze vill Stied STR_ERROR_NO_SPACE_FOR_TOWN :{WHITE}... et ass keng Plaz méi op der Kaart STR_ERROR_ROAD_WORKS_IN_PROGRESS :{WHITE}Stroossenarbeschten amgaangen -STR_ERROR_TOWN_CAN_T_DELETE :{WHITE}Kann des Stad net läschen...{}Eng Statioun oder Schapp huet den Numm vun dëser Stad oder en Stéck dat der Stad gehéiert kann net ewechgeholl ginn +STR_ERROR_TOWN_CAN_T_DELETE :{WHITE}Kann des Stad net läschen...{}{}Eng Statioun oder Schapp huet den Numm vun dëser Stad oder en Stéck dat der Stad gehéiert kann net ewechgeholl ginn STR_ERROR_STATUE_NO_SUITABLE_PLACE :{WHITE}... et gëtt keng gëeegent Plaz fir eng Statu am Stadzentrum STR_ERROR_CAN_T_BUILD_HOUSE :{WHITE}Kann d'Haus net bauen... @@ -5297,8 +5333,16 @@ STR_ERROR_CAN_T_SELL_SHIP :{WHITE}Kann Sch STR_ERROR_CAN_T_SELL_AIRCRAFT :{WHITE}Kann de Fliger net verkafen... ###length VEHICLE_TYPES +STR_ERROR_CAN_T_SELL_ALL_TRAIN :{WHITE}Kann net all Zich verkafen... +STR_ERROR_CAN_T_SELL_ALL_ROAD_VEHICLE :{WHITE}Kann net all Gefierer verkafen... +STR_ERROR_CAN_T_SELL_ALL_SHIP :{WHITE}Kann net all Schëffer verkafen... +STR_ERROR_CAN_T_SELL_ALL_AIRCRAFT :{WHITE}Kann all Fligeren net verkafen... ###length VEHICLE_TYPES +STR_ERROR_CAN_T_AUTOREPLACE_TRAIN :{WHITE}Kann Zich net automatesch ersetzen... +STR_ERROR_CAN_T_AUTOREPLACE_ROAD_VEHICLE :{WHITE}Ka Gefierer net automatesch ersetzen... +STR_ERROR_CAN_T_AUTOREPLACE_SHIP :{WHITE}Ka Schëffer net automatesch ersetzen... +STR_ERROR_CAN_T_AUTOREPLACE_AIRCRAFT :{WHITE}Ka Fliger net automatesch ersetzen... STR_ERROR_TOO_MANY_VEHICLES_IN_GAME :{WHITE}Ze vill Gefierer am Spill STR_ERROR_CAN_T_CHANGE_SERVICING :{WHITE}De Service-Intervall kann net geännert ginn... @@ -5818,7 +5862,7 @@ STR_SAVEGAME_NAME_DEFAULT :{COMPANY}, {STR STR_SAVEGAME_NAME_SPECTATOR :Zuschauer, {1:STRING} # Viewport strings -STR_VIEWPORT_TOWN_POP :{WHITE}{TOWN} ({COMMA}) +STR_VIEWPORT_TOWN_POP :{TOWN} ({COMMA}) STR_VIEWPORT_STATION :{STATION} {STATION_FEATURES} # Simple strings to get specific types of data @@ -5880,3 +5924,4 @@ STR_SHIP :{BLACK}{SHIP} STR_TOOLBAR_RAILTYPE_VELOCITY :{STRING} ({VELOCITY}) +STR_BADGE_NAME_LIST :{STRING}: {GOLD}{STRING} diff --git a/src/newgrf.cpp b/src/newgrf.cpp index ee440aa464..224e6ca6fc 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -945,40 +945,40 @@ void FinaliseCargoArray() * @param filename The filename of the newgrf this house was defined in. * @return Whether the given housespec is valid. */ -static bool IsHouseSpecValid(HouseSpec *hs, const HouseSpec *next1, const HouseSpec *next2, const HouseSpec *next3, const std::string &filename) +static bool IsHouseSpecValid(HouseSpec &hs, const HouseSpec *next1, const HouseSpec *next2, const HouseSpec *next3, const std::string &filename) { - if ((hs->building_flags.Any(BUILDING_HAS_2_TILES) && + if ((hs.building_flags.Any(BUILDING_HAS_2_TILES) && (next1 == nullptr || !next1->enabled || next1->building_flags.Any(BUILDING_HAS_1_TILE))) || - (hs->building_flags.Any(BUILDING_HAS_4_TILES) && + (hs.building_flags.Any(BUILDING_HAS_4_TILES) && (next2 == nullptr || !next2->enabled || next2->building_flags.Any(BUILDING_HAS_1_TILE) || next3 == nullptr || !next3->enabled || next3->building_flags.Any(BUILDING_HAS_1_TILE)))) { - hs->enabled = false; - if (!filename.empty()) Debug(grf, 1, "FinaliseHouseArray: {} defines house {} as multitile, but no suitable tiles follow. Disabling house.", filename, hs->grf_prop.local_id); + hs.enabled = false; + if (!filename.empty()) Debug(grf, 1, "FinaliseHouseArray: {} defines house {} as multitile, but no suitable tiles follow. Disabling house.", filename, hs.grf_prop.local_id); return false; } /* Some places sum population by only counting north tiles. Other places use all tiles causing desyncs. * As the newgrf specs define population to be zero for non-north tiles, we just disable the offending house. * If you want to allow non-zero populations somewhen, make sure to sum the population of all tiles in all places. */ - if ((hs->building_flags.Any(BUILDING_HAS_2_TILES) && next1->population != 0) || - (hs->building_flags.Any(BUILDING_HAS_4_TILES) && (next2->population != 0 || next3->population != 0))) { - hs->enabled = false; - if (!filename.empty()) Debug(grf, 1, "FinaliseHouseArray: {} defines multitile house {} with non-zero population on additional tiles. Disabling house.", filename, hs->grf_prop.local_id); + if ((hs.building_flags.Any(BUILDING_HAS_2_TILES) && next1->population != 0) || + (hs.building_flags.Any(BUILDING_HAS_4_TILES) && (next2->population != 0 || next3->population != 0))) { + hs.enabled = false; + if (!filename.empty()) Debug(grf, 1, "FinaliseHouseArray: {} defines multitile house {} with non-zero population on additional tiles. Disabling house.", filename, hs.grf_prop.local_id); return false; } /* Substitute type is also used for override, and having an override with a different size causes crashes. * This check should only be done for NewGRF houses because grf_prop.subst_id is not set for original houses.*/ - if (!filename.empty() && (hs->building_flags & BUILDING_HAS_1_TILE) != (HouseSpec::Get(hs->grf_prop.subst_id)->building_flags & BUILDING_HAS_1_TILE)) { - hs->enabled = false; - Debug(grf, 1, "FinaliseHouseArray: {} defines house {} with different house size then it's substitute type. Disabling house.", filename, hs->grf_prop.local_id); + if (!filename.empty() && (hs.building_flags & BUILDING_HAS_1_TILE) != (HouseSpec::Get(hs.grf_prop.subst_id)->building_flags & BUILDING_HAS_1_TILE)) { + hs.enabled = false; + Debug(grf, 1, "FinaliseHouseArray: {} defines house {} with different house size then it's substitute type. Disabling house.", filename, hs.grf_prop.local_id); return false; } /* Make sure that additional parts of multitile houses are not available. */ - if (!hs->building_flags.Any(BUILDING_HAS_1_TILE) && (hs->building_availability & HZ_ZONALL) != 0 && (hs->building_availability & HZ_CLIMALL) != 0) { - hs->enabled = false; - if (!filename.empty()) Debug(grf, 1, "FinaliseHouseArray: {} defines house {} without a size but marked it as available. Disabling house.", filename, hs->grf_prop.local_id); + if (!hs.building_flags.Any(BUILDING_HAS_1_TILE) && (hs.building_availability & HZ_ZONALL) != 0 && (hs.building_availability & HZ_CLIMALL) != 0) { + hs.enabled = false; + if (!filename.empty()) Debug(grf, 1, "FinaliseHouseArray: {} defines house {} without a size but marked it as available. Disabling house.", filename, hs.grf_prop.local_id); return false; } @@ -1027,12 +1027,12 @@ static void FinaliseHouseArray() * On the other hand, why 1930? Just 'fix' the houses with the lowest * minimum introduction date to 0. */ - for (const auto &file : _grf_files) { + for (auto &file : _grf_files) { if (file.housespec.empty()) continue; size_t num_houses = file.housespec.size(); for (size_t i = 0; i < num_houses; i++) { - HouseSpec *hs = file.housespec[i].get(); + auto &hs = file.housespec[i]; if (hs == nullptr) continue; @@ -1040,10 +1040,14 @@ static void FinaliseHouseArray() const HouseSpec *next2 = (i + 2 < num_houses ? file.housespec[i + 2].get() : nullptr); const HouseSpec *next3 = (i + 3 < num_houses ? file.housespec[i + 3].get() : nullptr); - if (!IsHouseSpecValid(hs, next1, next2, next3, file.filename)) continue; + if (!IsHouseSpecValid(*hs, next1, next2, next3, file.filename)) continue; - _house_mngr.SetEntitySpec(hs); + _house_mngr.SetEntitySpec(std::move(*hs)); } + + /* Won't be used again */ + file.housespec.clear(); + file.housespec.shrink_to_fit(); } for (size_t i = 0; i < HouseSpec::Specs().size(); i++) { @@ -1054,7 +1058,7 @@ static void FinaliseHouseArray() /* We need to check all houses again to we are sure that multitile houses * did get consecutive IDs and none of the parts are missing. */ - if (!IsHouseSpecValid(hs, next1, next2, next3, std::string{})) { + if (!IsHouseSpecValid(*hs, next1, next2, next3, std::string{})) { /* GetHouseNorthPart checks 3 houses that are directly before * it in the house pool. If any of those houses have multi-tile * flags set it assumes it's part of a multitile house. Since @@ -1096,18 +1100,24 @@ static void FinaliseHouseArray() */ static void FinaliseIndustriesArray() { - for (const auto &file : _grf_files) { - for (const auto &indsp : file.industryspec) { + for (auto &file : _grf_files) { + for (auto &indsp : file.industryspec) { if (indsp == nullptr || !indsp->enabled) continue; - _industry_mngr.SetEntitySpec(indsp.get()); + _industry_mngr.SetEntitySpec(std::move(*indsp)); } - for (const auto &indtsp : file.indtspec) { + for (auto &indtsp : file.indtspec) { if (indtsp != nullptr) { - _industile_mngr.SetEntitySpec(indtsp.get()); + _industile_mngr.SetEntitySpec(std::move(*indtsp)); } } + + /* Won't be used again */ + file.industryspec.clear(); + file.industryspec.shrink_to_fit(); + file.indtspec.clear(); + file.indtspec.shrink_to_fit(); } for (auto &indsp : _industry_specs) { @@ -1144,12 +1154,16 @@ static void FinaliseIndustriesArray() */ static void FinaliseObjectsArray() { - for (const auto &file : _grf_files) { + for (auto &file : _grf_files) { for (auto &objectspec : file.objectspec) { if (objectspec != nullptr && objectspec->grf_prop.HasGrfFile() && objectspec->IsEnabled()) { - _object_mngr.SetEntitySpec(objectspec.get()); + _object_mngr.SetEntitySpec(std::move(*objectspec)); } } + + /* Won't be used again */ + file.objectspec.clear(); + file.objectspec.shrink_to_fit(); } ObjectSpec::BindToClasses(); @@ -1162,18 +1176,24 @@ static void FinaliseObjectsArray() */ static void FinaliseAirportsArray() { - for (const auto &file : _grf_files) { + for (auto &file : _grf_files) { for (auto &as : file.airportspec) { if (as != nullptr && as->enabled) { - _airport_mngr.SetEntitySpec(as.get()); + _airport_mngr.SetEntitySpec(std::move(*as)); } } for (auto &ats : file.airtspec) { if (ats != nullptr && ats->enabled) { - _airporttile_mngr.SetEntitySpec(ats.get()); + _airporttile_mngr.SetEntitySpec(std::move(*ats)); } } + + /* Won't be used again */ + file.airportspec.clear(); + file.airportspec.shrink_to_fit(); + file.airtspec.clear(); + file.airtspec.shrink_to_fit(); } } diff --git a/src/newgrf_airport.cpp b/src/newgrf_airport.cpp index fdd5fc3739..a22e87bb9d 100644 --- a/src/newgrf_airport.cpp +++ b/src/newgrf_airport.cpp @@ -134,22 +134,22 @@ void BindAirportSpecs() } -void AirportOverrideManager::SetEntitySpec(AirportSpec *as) +void AirportOverrideManager::SetEntitySpec(AirportSpec &&as) { - uint8_t airport_id = this->AddEntityID(as->grf_prop.local_id, as->grf_prop.grfid, as->grf_prop.subst_id); + uint8_t airport_id = this->AddEntityID(as.grf_prop.local_id, as.grf_prop.grfid, as.grf_prop.subst_id); if (airport_id == this->invalid_id) { GrfMsg(1, "Airport.SetEntitySpec: Too many airports allocated. Ignoring."); return; } - *AirportSpec::GetWithoutOverride(airport_id) = *as; + AirportSpec::specs[airport_id] = std::move(as); /* Now add the overrides. */ for (int i = 0; i < this->max_offset; i++) { AirportSpec *overridden_as = AirportSpec::GetWithoutOverride(i); - if (this->entity_overrides[i] != as->grf_prop.local_id || this->grfid_overrides[i] != as->grf_prop.grfid) continue; + if (this->entity_overrides[i] != AirportSpec::specs[airport_id].grf_prop.local_id || this->grfid_overrides[i] != AirportSpec::specs[airport_id].grf_prop.grfid) continue; overridden_as->grf_prop.override_id = airport_id; overridden_as->enabled = false; diff --git a/src/newgrf_airport.h b/src/newgrf_airport.h index f9faa33921..59e811b80e 100644 --- a/src/newgrf_airport.h +++ b/src/newgrf_airport.h @@ -141,6 +141,8 @@ struct AirportSpec : NewGRFSpecBase { private: static AirportSpec specs[NUM_AIRPORTS]; ///< Specs of the airports. + + friend void AirportOverrideManager::SetEntitySpec(AirportSpec &&as); }; /** Information related to airport classes. */ diff --git a/src/newgrf_airporttiles.cpp b/src/newgrf_airporttiles.cpp index f47e9e4af6..eea0f118c3 100644 --- a/src/newgrf_airporttiles.cpp +++ b/src/newgrf_airporttiles.cpp @@ -66,22 +66,22 @@ void AirportTileSpec::ResetAirportTiles() _airporttile_mngr.ResetOverride(); } -void AirportTileOverrideManager::SetEntitySpec(const AirportTileSpec *airpts) +void AirportTileOverrideManager::SetEntitySpec(AirportTileSpec &&airpts) { - StationGfx airpt_id = this->AddEntityID(airpts->grf_prop.local_id, airpts->grf_prop.grfid, airpts->grf_prop.subst_id); + StationGfx airpt_id = this->AddEntityID(airpts.grf_prop.local_id, airpts.grf_prop.grfid, airpts.grf_prop.subst_id); if (airpt_id == this->invalid_id) { GrfMsg(1, "AirportTile.SetEntitySpec: Too many airport tiles allocated. Ignoring."); return; } - AirportTileSpec::tiles[airpt_id] = *airpts; + AirportTileSpec::tiles[airpt_id] = std::move(airpts); /* Now add the overrides. */ for (int i = 0; i < this->max_offset; i++) { AirportTileSpec *overridden_airpts = &AirportTileSpec::tiles[i]; - if (this->entity_overrides[i] != airpts->grf_prop.local_id || this->grfid_overrides[i] != airpts->grf_prop.grfid) continue; + if (this->entity_overrides[i] != AirportTileSpec::tiles[airpt_id].grf_prop.local_id || this->grfid_overrides[i] != AirportTileSpec::tiles[airpt_id].grf_prop.grfid) continue; overridden_airpts->grf_prop.override_id = airpt_id; overridden_airpts->enabled = false; diff --git a/src/newgrf_airporttiles.h b/src/newgrf_airporttiles.h index 1f2d989c33..68a62d1b07 100644 --- a/src/newgrf_airporttiles.h +++ b/src/newgrf_airporttiles.h @@ -84,7 +84,7 @@ struct AirportTileSpec { private: static AirportTileSpec tiles[NUM_AIRPORTTILES]; - friend void AirportTileOverrideManager::SetEntitySpec(const AirportTileSpec *airpts); + friend void AirportTileOverrideManager::SetEntitySpec(AirportTileSpec &&airpts); }; void AnimateAirportTile(TileIndex tile); diff --git a/src/newgrf_commons.cpp b/src/newgrf_commons.cpp index 6ed612ca81..3d28b360ad 100644 --- a/src/newgrf_commons.cpp +++ b/src/newgrf_commons.cpp @@ -157,9 +157,9 @@ uint16_t OverrideManagerBase::GetSubstituteID(uint16_t entity_id) const * It will find itself the proper slot on which it will go * @param hs HouseSpec read from the grf file, ready for inclusion */ -void HouseOverrideManager::SetEntitySpec(const HouseSpec *hs) +void HouseOverrideManager::SetEntitySpec(HouseSpec &&hs) { - HouseID house_id = this->AddEntityID(hs->grf_prop.local_id, hs->grf_prop.grfid, hs->grf_prop.subst_id); + HouseID house_id = this->AddEntityID(hs.grf_prop.local_id, hs.grf_prop.grfid, hs.grf_prop.subst_id); if (house_id == this->invalid_id) { GrfMsg(1, "House.SetEntitySpec: Too many houses allocated. Ignoring."); @@ -170,13 +170,13 @@ void HouseOverrideManager::SetEntitySpec(const HouseSpec *hs) /* Now that we know we can use the given id, copy the spec to its final destination. */ if (house_id >= house_specs.size()) house_specs.resize(house_id + 1); - house_specs[house_id] = *hs; + house_specs[house_id] = std::move(hs); /* Now add the overrides. */ for (int i = 0; i < this->max_offset; i++) { HouseSpec *overridden_hs = HouseSpec::Get(i); - if (this->entity_overrides[i] != hs->grf_prop.local_id || this->grfid_overrides[i] != hs->grf_prop.grfid) continue; + if (this->entity_overrides[i] != house_specs[house_id].grf_prop.local_id || this->grfid_overrides[i] != house_specs[house_id].grf_prop.grfid) continue; overridden_hs->grf_prop.override_id = house_id; this->entity_overrides[i] = this->invalid_id; @@ -245,18 +245,18 @@ uint16_t IndustryOverrideManager::AddEntityID(uint16_t grf_local_id, uint32_t gr * checking what is available * @param inds Industryspec that comes from the grf decoding process */ -void IndustryOverrideManager::SetEntitySpec(IndustrySpec *inds) +void IndustryOverrideManager::SetEntitySpec(IndustrySpec &&inds) { /* First step : We need to find if this industry is already specified in the savegame data. */ - IndustryType ind_id = this->GetID(inds->grf_prop.local_id, inds->grf_prop.grfid); + IndustryType ind_id = this->GetID(inds.grf_prop.local_id, inds.grf_prop.grfid); if (ind_id == this->invalid_id) { /* Not found. * Or it has already been overridden, so you've lost your place. * Or it is a simple substitute. * We need to find a free available slot */ - ind_id = this->AddEntityID(inds->grf_prop.local_id, inds->grf_prop.grfid, inds->grf_prop.subst_id); - inds->grf_prop.override_id = this->invalid_id; // make sure it will not be detected as overridden + ind_id = this->AddEntityID(inds.grf_prop.local_id, inds.grf_prop.grfid, inds.grf_prop.subst_id); + inds.grf_prop.override_id = this->invalid_id; // make sure it will not be detected as overridden } if (ind_id == this->invalid_id) { @@ -265,27 +265,27 @@ void IndustryOverrideManager::SetEntitySpec(IndustrySpec *inds) } /* Now that we know we can use the given id, copy the spec to its final destination... */ - _industry_specs[ind_id] = *inds; + _industry_specs[ind_id] = std::move(inds); /* ... and mark it as usable*/ _industry_specs[ind_id].enabled = true; } -void IndustryTileOverrideManager::SetEntitySpec(const IndustryTileSpec *its) +void IndustryTileOverrideManager::SetEntitySpec(IndustryTileSpec &&its) { - IndustryGfx indt_id = this->AddEntityID(its->grf_prop.local_id, its->grf_prop.grfid, its->grf_prop.subst_id); + IndustryGfx indt_id = this->AddEntityID(its.grf_prop.local_id, its.grf_prop.grfid, its.grf_prop.subst_id); if (indt_id == this->invalid_id) { GrfMsg(1, "IndustryTile.SetEntitySpec: Too many industry tiles allocated. Ignoring."); return; } - _industry_tile_specs[indt_id] = *its; + _industry_tile_specs[indt_id] = std::move(its); /* Now add the overrides. */ for (int i = 0; i < this->max_offset; i++) { IndustryTileSpec *overridden_its = &_industry_tile_specs[i]; - if (this->entity_overrides[i] != its->grf_prop.local_id || this->grfid_overrides[i] != its->grf_prop.grfid) continue; + if (this->entity_overrides[i] != _industry_tile_specs[indt_id].grf_prop.local_id || this->grfid_overrides[i] != _industry_tile_specs[indt_id].grf_prop.grfid) continue; overridden_its->grf_prop.override_id = indt_id; overridden_its->enabled = false; @@ -300,17 +300,17 @@ void IndustryTileOverrideManager::SetEntitySpec(const IndustryTileSpec *its) * checking what is available * @param spec ObjectSpec that comes from the grf decoding process */ -void ObjectOverrideManager::SetEntitySpec(ObjectSpec *spec) +void ObjectOverrideManager::SetEntitySpec(ObjectSpec &&spec) { /* First step : We need to find if this object is already specified in the savegame data. */ - ObjectType type = this->GetID(spec->grf_prop.local_id, spec->grf_prop.grfid); + ObjectType type = this->GetID(spec.grf_prop.local_id, spec.grf_prop.grfid); if (type == this->invalid_id) { /* Not found. * Or it has already been overridden, so you've lost your place. * Or it is a simple substitute. * We need to find a free available slot */ - type = this->AddEntityID(spec->grf_prop.local_id, spec->grf_prop.grfid, OBJECT_TRANSMITTER); + type = this->AddEntityID(spec.grf_prop.local_id, spec.grf_prop.grfid, OBJECT_TRANSMITTER); } if (type == this->invalid_id) { @@ -322,7 +322,7 @@ void ObjectOverrideManager::SetEntitySpec(ObjectSpec *spec) /* Now that we know we can use the given id, copy the spec to its final destination. */ if (type >= _object_specs.size()) _object_specs.resize(type + 1); - _object_specs[type] = *spec; + _object_specs[type] = std::move(spec); } /** @@ -617,7 +617,7 @@ uint32_t NewGRFSpriteLayout::PrepareLayout(uint32_t orig_offset, uint32_t newgrf * and apply the default sprite offsets (unless disabled). */ const TileLayoutRegisters *regs = this->registers.empty() ? nullptr : this->registers.data(); bool ground = true; - for (DrawTileSeqStruct result : result_seq) { + for (DrawTileSeqStruct &result : result_seq) { TileLayoutFlags flags = TLF_NOTHING; if (regs != nullptr) flags = regs->flags; diff --git a/src/newgrf_commons.h b/src/newgrf_commons.h index 37ecc134e7..d553bd6e49 100644 --- a/src/newgrf_commons.h +++ b/src/newgrf_commons.h @@ -210,7 +210,7 @@ public: HouseOverrideManager(uint16_t offset, uint16_t maximum, uint16_t invalid) : OverrideManagerBase(offset, maximum, invalid) {} - void SetEntitySpec(const HouseSpec *hs); + void SetEntitySpec(HouseSpec &&hs); }; @@ -223,7 +223,7 @@ public: uint16_t AddEntityID(uint16_t grf_local_id, uint32_t grfid, uint16_t substitute_id) override; uint16_t GetID(uint16_t grf_local_id, uint32_t grfid) const override; - void SetEntitySpec(IndustrySpec *inds); + void SetEntitySpec(IndustrySpec &&inds); }; @@ -235,7 +235,7 @@ public: IndustryTileOverrideManager(uint16_t offset, uint16_t maximum, uint16_t invalid) : OverrideManagerBase(offset, maximum, invalid) {} - void SetEntitySpec(const IndustryTileSpec *indts); + void SetEntitySpec(IndustryTileSpec &&indts); }; struct AirportSpec; @@ -244,7 +244,7 @@ public: AirportOverrideManager(uint16_t offset, uint16_t maximum, uint16_t invalid) : OverrideManagerBase(offset, maximum, invalid) {} - void SetEntitySpec(AirportSpec *inds); + void SetEntitySpec(AirportSpec &&inds); }; struct AirportTileSpec; @@ -255,7 +255,7 @@ public: AirportTileOverrideManager(uint16_t offset, uint16_t maximum, uint16_t invalid) : OverrideManagerBase(offset, maximum, invalid) {} - void SetEntitySpec(const AirportTileSpec *ats); + void SetEntitySpec(AirportTileSpec &&ats); }; struct ObjectSpec; @@ -266,7 +266,7 @@ public: ObjectOverrideManager(uint16_t offset, uint16_t maximum, uint16_t invalid) : OverrideManagerBase(offset, maximum, invalid) {} - void SetEntitySpec(ObjectSpec *spec); + void SetEntitySpec(ObjectSpec &&spec); }; extern HouseOverrideManager _house_mngr; diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp index 3203688e43..99cbf7b0e1 100644 --- a/src/newgrf_house.cpp +++ b/src/newgrf_house.cpp @@ -628,12 +628,20 @@ bool CanDeleteHouse(TileIndex tile) } } -static void AnimationControl(TileIndex tile, uint16_t random_bits) +/** + * Call the tile loop animation trigger for houses, if enabled. + * @param tile House tile + * @param sync Whether to call the synchronized or the unsynchronized trigger. + * @param random_bits Shared random bits for the synchronized trigger. + */ +static void AnimationControl(TileIndex tile, bool sync, uint16_t random_bits) { const HouseSpec *hs = HouseSpec::Get(GetHouseType(tile)); - if (hs->callback_mask.Test(HouseCallbackMask::AnimationStartStop)) { - uint32_t param = hs->extra_flags.Test(HouseExtraFlag::SynchronisedCallback1B) ? (GB(Random(), 0, 16) | random_bits << 16) : Random(); + /* Check whether the matching trigger is enabled */ + if (hs->callback_mask.Test(HouseCallbackMask::AnimationStartStop) && + hs->extra_flags.Test(HouseExtraFlag::SynchronisedCallback1B) == sync) { + uint32_t param = sync ? (GB(Random(), 0, 16) | random_bits << 16) : Random(); HouseAnimationBase::ChangeAnimationFrame(CBID_HOUSE_ANIMATION_START_STOP, hs, Town::GetByTile(tile), tile, param, 0); } } @@ -650,21 +658,16 @@ bool NewHouseTileLoop(TileIndex tile) TriggerHouse(tile, HOUSE_TRIGGER_TILE_LOOP); if (hs->building_flags.Any(BUILDING_HAS_1_TILE)) TriggerHouse(tile, HOUSE_TRIGGER_TILE_LOOP_TOP); - if (hs->callback_mask.Test(HouseCallbackMask::AnimationStartStop)) { - /* If this house is marked as having a synchronised callback, all the - * tiles will have the callback called at once, rather than when the - * tile loop reaches them. This should only be enabled for the northern - * tile, or strange things will happen (here, and in TTDPatch). */ - if (hs->extra_flags.Test(HouseExtraFlag::SynchronisedCallback1B)) { - uint16_t random = GB(Random(), 0, 16); + /* Call the unsynchronized tile loop trigger */ + AnimationControl(tile, false, 0); - if (hs->building_flags.Any(BUILDING_HAS_1_TILE)) AnimationControl(tile, random); - if (hs->building_flags.Any(BUILDING_2_TILES_Y)) AnimationControl(TileAddXY(tile, 0, 1), random); - if (hs->building_flags.Any(BUILDING_2_TILES_X)) AnimationControl(TileAddXY(tile, 1, 0), random); - if (hs->building_flags.Any(BUILDING_HAS_4_TILES)) AnimationControl(TileAddXY(tile, 1, 1), random); - } else { - AnimationControl(tile, 0); - } + /* Call the synchronized tile loop trigger, if this is the north tile */ + if (hs->building_flags.Any(BUILDING_HAS_1_TILE)) { + uint16_t random = GB(Random(), 0, 16); + AnimationControl(tile, true, random); + if (hs->building_flags.Any(BUILDING_2_TILES_Y)) AnimationControl(TileAddXY(tile, 0, 1), true, random); + if (hs->building_flags.Any(BUILDING_2_TILES_X)) AnimationControl(TileAddXY(tile, 1, 0), true, random); + if (hs->building_flags.Any(BUILDING_HAS_4_TILES)) AnimationControl(TileAddXY(tile, 1, 1), true, random); } /* Check callback 21, which determines if a house should be destroyed. */ diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 160f1d1eb1..fa35efccb5 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -889,9 +889,13 @@ enum class CargoSortType : uint8_t { class CargoSorter { public: + using is_transparent = void; CargoSorter(CargoSortType t = CargoSortType::StationID, SortOrder o = SO_ASCENDING) : type(t), order(o) {} CargoSortType GetSortType() {return this->type;} - bool operator()(const CargoDataEntry *cd1, const CargoDataEntry *cd2) const; + bool operator()(const CargoDataEntry &cd1, const CargoDataEntry &cd2) const; + bool operator()(const CargoDataEntry &cd1, const std::unique_ptr &cd2) const { return this->operator()(cd1, *cd2); } + bool operator()(const std::unique_ptr &cd1, const CargoDataEntry &cd2) const { return this->operator()(*cd1, cd2); } + bool operator()(const std::unique_ptr &cd1, const std::unique_ptr &cd2) const { return this->operator()(*cd1, *cd2); } private: CargoSortType type; @@ -899,11 +903,11 @@ private: template bool SortId(Tid st1, Tid st2) const; - bool SortCount(const CargoDataEntry *cd1, const CargoDataEntry *cd2) const; - bool SortStation (StationID st1, StationID st2) const; + bool SortCount(const CargoDataEntry &cd1, const CargoDataEntry &cd2) const; + bool SortStation(StationID st1, StationID st2) const; }; -typedef std::set CargoDataSet; +typedef std::set, CargoSorter> CargoDataSet; /** * A cargo data entry representing one possible row in the station view window's @@ -920,7 +924,7 @@ public: * @param station ID of the station for which an entry shall be created or retrieved * @return a child entry associated with the given station. */ - CargoDataEntry *InsertOrRetrieve(StationID station) + CargoDataEntry &InsertOrRetrieve(StationID station) { return this->InsertOrRetrieve(station); } @@ -930,7 +934,7 @@ public: * @param cargo type of the cargo for which an entry shall be created or retrieved * @return a child entry associated with the given cargo. */ - CargoDataEntry *InsertOrRetrieve(CargoType cargo) + CargoDataEntry &InsertOrRetrieve(CargoType cargo) { return this->InsertOrRetrieve(cargo); } @@ -944,7 +948,7 @@ public: void Remove(StationID station) { CargoDataEntry t(station); - this->Remove(&t); + this->Remove(t); } /** @@ -954,7 +958,7 @@ public: void Remove(CargoType cargo) { CargoDataEntry t(cargo); - this->Remove(&t); + this->Remove(t); } /** @@ -965,7 +969,7 @@ public: CargoDataEntry *Retrieve(StationID station) const { CargoDataEntry t(station); - return this->Retrieve(this->children->find(&t)); + return this->Retrieve(this->children->find(t)); } /** @@ -976,7 +980,7 @@ public: CargoDataEntry *Retrieve(CargoType cargo) const { CargoDataEntry t(cargo); - return this->Retrieve(this->children->find(&t)); + return this->Retrieve(this->children->find(t)); } void Resort(CargoSortType type, SortOrder order); @@ -1027,19 +1031,19 @@ public: void SetTransfers(bool value) { this->transfers = value; } void Clear(); -private: CargoDataEntry(StationID station, uint count, CargoDataEntry *parent); CargoDataEntry(CargoType cargo, uint count, CargoDataEntry *parent); CargoDataEntry(StationID station); CargoDataEntry(CargoType cargo); +private: CargoDataEntry *Retrieve(CargoDataSet::iterator i) const; template - CargoDataEntry *InsertOrRetrieve(Tid s); + CargoDataEntry &InsertOrRetrieve(Tid s); - void Remove(CargoDataEntry *entry); + void Remove(CargoDataEntry &entry); void IncrementSize(); CargoDataEntry *parent; ///< the parent of this entry. @@ -1052,7 +1056,7 @@ private: }; uint num_children; ///< the number of subentries belonging to this entry. uint count; ///< sum of counts of all children or amount of cargo for this entry. - CargoDataSet *children; ///< the children of this entry. + std::unique_ptr children; ///< the children of this entry. }; CargoDataEntry::CargoDataEntry() : @@ -1060,7 +1064,7 @@ CargoDataEntry::CargoDataEntry() : station(StationID::Invalid()), num_children(0), count(0), - children(new CargoDataSet(CargoSorter(CargoSortType::CargoType))) + children(std::make_unique(CargoSorter(CargoSortType::CargoType))) {} CargoDataEntry::CargoDataEntry(CargoType cargo, uint count, CargoDataEntry *parent) : @@ -1068,7 +1072,7 @@ CargoDataEntry::CargoDataEntry(CargoType cargo, uint count, CargoDataEntry *pare cargo(cargo), num_children(0), count(count), - children(new CargoDataSet) + children(std::make_unique()) {} CargoDataEntry::CargoDataEntry(StationID station, uint count, CargoDataEntry *parent) : @@ -1076,7 +1080,7 @@ CargoDataEntry::CargoDataEntry(StationID station, uint count, CargoDataEntry *pa station(station), num_children(0), count(count), - children(new CargoDataSet) + children(std::make_unique()) {} CargoDataEntry::CargoDataEntry(StationID station) : @@ -1098,7 +1102,6 @@ CargoDataEntry::CargoDataEntry(CargoType cargo) : CargoDataEntry::~CargoDataEntry() { this->Clear(); - delete this->children; } /** @@ -1106,13 +1109,7 @@ CargoDataEntry::~CargoDataEntry() */ void CargoDataEntry::Clear() { - if (this->children != nullptr) { - for (auto &it : *this->children) { - assert(it != this); - delete it; - } - this->children->clear(); - } + if (this->children != nullptr) this->children->clear(); if (this->parent != nullptr) this->parent->count -= this->count; this->count = 0; this->num_children = 0; @@ -1124,13 +1121,10 @@ void CargoDataEntry::Clear() * which only contains the ID of the entry to be removed. In this case child is * not deleted. */ -void CargoDataEntry::Remove(CargoDataEntry *entry) +void CargoDataEntry::Remove(CargoDataEntry &entry) { CargoDataSet::iterator i = this->children->find(entry); - if (i != this->children->end()) { - delete *i; - this->children->erase(i); - } + if (i != this->children->end()) this->children->erase(i); } /** @@ -1140,17 +1134,16 @@ void CargoDataEntry::Remove(CargoDataEntry *entry) * @return the new or retrieved subentry */ template -CargoDataEntry *CargoDataEntry::InsertOrRetrieve(Tid child_id) +CargoDataEntry &CargoDataEntry::InsertOrRetrieve(Tid child_id) { CargoDataEntry tmp(child_id); - CargoDataSet::iterator i = this->children->find(&tmp); + CargoDataSet::iterator i = this->children->find(tmp); if (i == this->children->end()) { IncrementSize(); - return *(this->children->insert(new CargoDataEntry(child_id, 0, this)).first); + return **(this->children->insert(std::make_unique(child_id, 0, this)).first); } else { - CargoDataEntry *ret = *i; assert(this->children->value_comp().GetSortType() != CargoSortType::Count); - return ret; + return **i; } } @@ -1176,9 +1169,9 @@ void CargoDataEntry::IncrementSize() void CargoDataEntry::Resort(CargoSortType type, SortOrder order) { - CargoDataSet *new_subs = new CargoDataSet(this->children->begin(), this->children->end(), CargoSorter(type, order)); - delete this->children; - this->children = new_subs; + auto new_children = std::make_unique(CargoSorter(type, order)); + new_children->merge(*this->children); + this->children = std::move(new_children); } CargoDataEntry *CargoDataEntry::Retrieve(CargoDataSet::iterator i) const @@ -1187,21 +1180,21 @@ CargoDataEntry *CargoDataEntry::Retrieve(CargoDataSet::iterator i) const return nullptr; } else { assert(this->children->value_comp().GetSortType() != CargoSortType::Count); - return *i; + return i->get(); } } -bool CargoSorter::operator()(const CargoDataEntry *cd1, const CargoDataEntry *cd2) const +bool CargoSorter::operator()(const CargoDataEntry &cd1, const CargoDataEntry &cd2) const { switch (this->type) { case CargoSortType::StationID: - return this->SortId(cd1->GetStation(), cd2->GetStation()); + return this->SortId(cd1.GetStation(), cd2.GetStation()); case CargoSortType::CargoType: - return this->SortId(cd1->GetCargo(), cd2->GetCargo()); + return this->SortId(cd1.GetCargo(), cd2.GetCargo()); case CargoSortType::Count: return this->SortCount(cd1, cd2); case CargoSortType::StationString: - return this->SortStation(cd1->GetStation(), cd2->GetStation()); + return this->SortStation(cd1.GetStation(), cd2.GetStation()); default: NOT_REACHED(); } @@ -1213,12 +1206,12 @@ bool CargoSorter::SortId(Tid st1, Tid st2) const return (this->order == SO_ASCENDING) ? st1 < st2 : st2 < st1; } -bool CargoSorter::SortCount(const CargoDataEntry *cd1, const CargoDataEntry *cd2) const +bool CargoSorter::SortCount(const CargoDataEntry &cd1, const CargoDataEntry &cd2) const { - uint c1 = cd1->GetCount(); - uint c2 = cd2->GetCount(); + uint c1 = cd1.GetCount(); + uint c2 = cd2.GetCount(); if (c1 == c2) { - return this->SortStation(cd1->GetStation(), cd2->GetStation()); + return this->SortStation(cd1.GetStation(), cd2.GetStation()); } else if (this->order == SO_ASCENDING) { return c1 < c2; } else { @@ -1392,25 +1385,25 @@ struct StationViewWindow : public Window { switch (groupings[i]) { case GR_CARGO: assert(i == 0); - data = data->InsertOrRetrieve(cargo); + data = &data->InsertOrRetrieve(cargo); data->SetTransfers(source != this->window_number); expand = expand->Retrieve(cargo); break; case GR_SOURCE: if (auto_distributed || source != this->window_number) { - data = data->InsertOrRetrieve(source); + data = &data->InsertOrRetrieve(source); expand = expand->Retrieve(source); } break; case GR_NEXT: if (auto_distributed) { - data = data->InsertOrRetrieve(next); + data = &data->InsertOrRetrieve(next); expand = expand->Retrieve(next); } break; case GR_DESTINATION: if (auto_distributed) { - data = data->InsertOrRetrieve(dest); + data = &data->InsertOrRetrieve(dest); expand = expand->Retrieve(dest); } break; @@ -1498,7 +1491,7 @@ struct StationViewWindow : public Window { /* Draw waiting cargo. */ NWidgetBase *nwi = this->GetWidget(WID_SV_WAITING); Rect waiting_rect = nwi->GetCurrentRect().Shrink(WidgetDimensions::scaled.framerect); - this->DrawEntries(&cargo, waiting_rect, pos, maxrows, 0); + this->DrawEntries(cargo, waiting_rect, pos, maxrows, 0); scroll_to_row = INT_MAX; } } @@ -1521,20 +1514,20 @@ struct StationViewWindow : public Window { void RecalcDestinations(CargoType cargo) { const Station *st = Station::Get(this->window_number); - CargoDataEntry *entry = cached_destinations.InsertOrRetrieve(cargo); - entry->Clear(); + CargoDataEntry &entry = cached_destinations.InsertOrRetrieve(cargo); + entry.Clear(); if (!st->goods[cargo].HasData()) return; for (const auto &it : st->goods[cargo].GetData().flows) { StationID from = it.first; - CargoDataEntry *source_entry = entry->InsertOrRetrieve(from); + CargoDataEntry &source_entry = entry.InsertOrRetrieve(from); uint32_t prev_count = 0; for (const auto &flow_it : *it.second.GetShares()) { StationID via = flow_it.second; - CargoDataEntry *via_entry = source_entry->InsertOrRetrieve(via); + CargoDataEntry &via_entry = source_entry.InsertOrRetrieve(via); if (via == this->window_number) { - via_entry->InsertOrRetrieve(via)->Update(flow_it.first - prev_count); + via_entry.InsertOrRetrieve(via).Update(flow_it.first - prev_count); } else { EstimateDestinations(cargo, from, via, flow_it.first - prev_count, via_entry); } @@ -1552,7 +1545,7 @@ struct StationViewWindow : public Window { * @param count Size of the batch of cargo. * @param dest CargoDataEntry to save the results in. */ - void EstimateDestinations(CargoType cargo, StationID source, StationID next, uint count, CargoDataEntry *dest) + void EstimateDestinations(CargoType cargo, StationID source, StationID next, uint count, CargoDataEntry &dest) { if (Station::IsValidID(next) && Station::IsValidID(source)) { GoodsEntry &ge = Station::Get(next)->goods[cargo]; @@ -1565,19 +1558,19 @@ struct StationViewWindow : public Window { const FlowStat::SharesMap *shares = map_it->second.GetShares(); uint32_t prev_count = 0; for (FlowStat::SharesMap::const_iterator i = shares->begin(); i != shares->end(); ++i) { - tmp.InsertOrRetrieve(i->second)->Update(i->first - prev_count); + tmp.InsertOrRetrieve(i->second).Update(i->first - prev_count); prev_count = i->first; } } if (tmp.GetCount() == 0) { - dest->InsertOrRetrieve(StationID::Invalid())->Update(count); + dest.InsertOrRetrieve(StationID::Invalid()).Update(count); } else { uint sum_estimated = 0; while (sum_estimated < count) { for (CargoDataSet::iterator i = tmp.Begin(); i != tmp.End() && sum_estimated < count; ++i) { - CargoDataEntry *child = *i; - uint estimate = DivideApprox(child->GetCount() * count, tmp.GetCount()); + CargoDataEntry &child = **i; + uint estimate = DivideApprox(child.GetCount() * count, tmp.GetCount()); if (estimate == 0) estimate = 1; sum_estimated += estimate; @@ -1587,10 +1580,10 @@ struct StationViewWindow : public Window { } if (estimate > 0) { - if (child->GetStation() == next) { - dest->InsertOrRetrieve(next)->Update(estimate); + if (child.GetStation() == next) { + dest.InsertOrRetrieve(next).Update(estimate); } else { - EstimateDestinations(cargo, source, child->GetStation(), estimate, dest); + EstimateDestinations(cargo, source, child.GetStation(), estimate, dest); } } } @@ -1598,7 +1591,7 @@ struct StationViewWindow : public Window { } } } else { - dest->InsertOrRetrieve(StationID::Invalid())->Update(count); + dest.InsertOrRetrieve(StationID::Invalid()).Update(count); } } @@ -1618,8 +1611,8 @@ struct StationViewWindow : public Window { for (FlowStat::SharesMap::const_iterator flow_it = shares->begin(); flow_it != shares->end(); ++flow_it) { const CargoDataEntry *via_entry = source_entry->Retrieve(flow_it->second); for (CargoDataSet::iterator dest_it = via_entry->Begin(); dest_it != via_entry->End(); ++dest_it) { - CargoDataEntry *dest_entry = *dest_it; - ShowCargo(entry, cargo, from, flow_it->second, dest_entry->GetStation(), dest_entry->GetCount()); + CargoDataEntry &dest_entry = **dest_it; + ShowCargo(entry, cargo, from, flow_it->second, dest_entry.GetStation(), dest_entry.GetCount()); } } } @@ -1652,7 +1645,7 @@ struct StationViewWindow : public Window { uint remaining = cp->Count(); for (CargoDataSet::iterator dest_it = via_entry->Begin(); dest_it != via_entry->End();) { - CargoDataEntry *dest_entry = *dest_it; + CargoDataEntry &dest_entry = **dest_it; /* Advance iterator here instead of in the for statement to test whether this is the last entry */ ++dest_it; @@ -1664,10 +1657,10 @@ struct StationViewWindow : public Window { * not matching GoodsEntry::TotalCount() */ val = remaining; } else { - val = std::min(remaining, DivideApprox(cp->Count() * dest_entry->GetCount(), via_entry->GetCount())); + val = std::min(remaining, DivideApprox(cp->Count() * dest_entry.GetCount(), via_entry->GetCount())); remaining -= val; } - this->ShowCargo(entry, cargo, cp->GetFirstStation(), next, dest_entry->GetStation(), val); + this->ShowCargo(entry, cargo, cp->GetFirstStation(), next, dest_entry.GetStation(), val); } } this->ShowCargo(entry, cargo, NEW_STATION, NEW_STATION, NEW_STATION, packets.ReservedCount()); @@ -1701,16 +1694,16 @@ struct StationViewWindow : public Window { * Mark a specific row, characterized by its CargoDataEntry, as expanded. * @param entry The row to be marked as expanded. */ - void SetDisplayedRow(const CargoDataEntry *entry) + void SetDisplayedRow(const CargoDataEntry &entry) { std::list stations; - const CargoDataEntry *parent = entry->GetParent(); + const CargoDataEntry *parent = entry.GetParent(); if (parent->GetParent() == nullptr) { - this->displayed_rows.push_back(RowDisplay(&this->expanded_rows, entry->GetCargo())); + this->displayed_rows.push_back(RowDisplay(&this->expanded_rows, entry.GetCargo())); return; } - StationID next = entry->GetStation(); + StationID next = entry.GetStation(); while (parent->GetParent()->GetParent() != nullptr) { stations.push_back(parent->GetStation()); parent = parent->GetParent(); @@ -1764,9 +1757,9 @@ struct StationViewWindow : public Window { * @param column The "column" the entry will be shown in. * @return either STR_STATION_VIEW_VIA or STR_STATION_VIEW_NONSTOP. */ - StringID SearchNonStop(CargoDataEntry *cd, StationID station, int column) + StringID SearchNonStop(CargoDataEntry &cd, StationID station, int column) { - CargoDataEntry *parent = cd->GetParent(); + CargoDataEntry *parent = cd.GetParent(); for (int i = column - 1; i > 0; --i) { if (this->groupings[i] == GR_DESTINATION) { if (parent->GetStation() == station) { @@ -1779,9 +1772,9 @@ struct StationViewWindow : public Window { } if (this->groupings[column + 1] == GR_DESTINATION) { - CargoDataSet::iterator begin = cd->Begin(); - CargoDataSet::iterator end = cd->End(); - if (begin != end && ++(cd->Begin()) == end && (*(begin))->GetStation() == station) { + CargoDataSet::iterator begin = cd.Begin(); + CargoDataSet::iterator end = cd.End(); + if (begin != end && ++(cd.Begin()) == end && (*(begin))->GetStation() == station) { return STR_STATION_VIEW_NONSTOP; } else { return STR_STATION_VIEW_VIA; @@ -1801,20 +1794,20 @@ struct StationViewWindow : public Window { * @param cargo Current cargo being drawn (if cargo column has been passed). * @return row (in "pos" counting) after the one we have last drawn to. */ - int DrawEntries(CargoDataEntry *entry, const Rect &r, int pos, int maxrows, int column, CargoType cargo = INVALID_CARGO) + int DrawEntries(CargoDataEntry &entry, const Rect &r, int pos, int maxrows, int column, CargoType cargo = INVALID_CARGO) { if (this->sortings[column] == CargoSortType::AsGrouping) { if (this->groupings[column] != GR_CARGO) { - entry->Resort(CargoSortType::StationString, this->sort_orders[column]); + entry.Resort(CargoSortType::StationString, this->sort_orders[column]); } } else { - entry->Resort(CargoSortType::Count, this->sort_orders[column]); + entry.Resort(CargoSortType::Count, this->sort_orders[column]); } - for (CargoDataSet::iterator i = entry->Begin(); i != entry->End(); ++i) { - CargoDataEntry *cd = *i; + for (CargoDataSet::iterator i = entry.Begin(); i != entry.End(); ++i) { + CargoDataEntry &cd = **i; Grouping grouping = this->groupings[column]; - if (grouping == GR_CARGO) cargo = cd->GetCargo(); + if (grouping == GR_CARGO) cargo = cd.GetCargo(); bool auto_distributed = _settings_game.linkgraph.GetDistributionType(cargo) != DT_MANUAL; if (pos > -maxrows && pos <= 0) { @@ -1823,10 +1816,10 @@ struct StationViewWindow : public Window { int y = r.top - pos * GetCharacterHeight(FS_NORMAL); if (this->groupings[column] == GR_CARGO) { str = STR_STATION_VIEW_WAITING_CARGO; - DrawCargoIcons(cd->GetCargo(), cd->GetCount(), r.left + this->expand_shrink_width, r.right - this->expand_shrink_width, y); + DrawCargoIcons(cd.GetCargo(), cd.GetCount(), r.left + this->expand_shrink_width, r.right - this->expand_shrink_width, y); } else { if (!auto_distributed) grouping = GR_SOURCE; - station = cd->GetStation(); + station = cd.GetStation(); str = this->GetGroupingString(grouping, station); if (grouping == GR_NEXT && str == STR_STATION_VIEW_VIA) str = this->SearchNonStop(cd, station, column); @@ -1839,11 +1832,11 @@ struct StationViewWindow : public Window { Rect text = r.Indent(column * WidgetDimensions::scaled.hsep_indent, rtl).Indent(this->expand_shrink_width, !rtl); Rect shrink = r.WithWidth(this->expand_shrink_width, !rtl); - DrawString(text.left, text.right, y, GetString(str, cargo, cd->GetCount(), station)); + DrawString(text.left, text.right, y, GetString(str, cargo, cd.GetCount(), station)); if (column < NUM_COLUMNS - 1) { const char *sym = nullptr; - if (cd->GetNumChildren() > 0) { + if (cd.GetNumChildren() > 0) { sym = "-"; } else if (auto_distributed && str != STR_STATION_VIEW_RESERVED) { sym = "+"; @@ -1852,7 +1845,7 @@ struct StationViewWindow : public Window { const GoodsEntry &ge = Station::Get(this->window_number)->goods[cargo]; if (ge.HasData()) { const StationCargoList &cargo_list = ge.GetData().cargo; - if (grouping == GR_CARGO && (cargo_list.ReservedCount() > 0 || cd->HasTransfers())) { + if (grouping == GR_CARGO && (cargo_list.ReservedCount() > 0 || cd.HasTransfers())) { sym = "+"; } } diff --git a/src/table/townname.h b/src/table/townname.h index e2ff9279be..685e888a97 100644 --- a/src/table/townname.h +++ b/src/table/townname.h @@ -1727,36 +1727,37 @@ static const char * const _name_czech_patmod[][3] = { /* This way the substantive can choose only some adjectives/endings: * At least one of these flags must be satisfied: */ -enum CzechAllow : uint8_t { - CZA_SHORT = 1, - CZA_MIDDLE = 2, - CZA_LONG = 4, - CZA_ALL = CZA_SHORT | CZA_MIDDLE | CZA_LONG, +enum class CzechAllowFlag : uint8_t { + Short, + Middle, + Long, }; -DECLARE_ENUM_AS_BIT_SET(CzechAllow) +using CzechAllowFlags = EnumBitSet; + +static constexpr CzechAllowFlags CZA_ALL = {CzechAllowFlag::Short, CzechAllowFlag::Middle, CzechAllowFlag::Long}; /* All these flags must be satisfied (in the stem->others direction): */ -enum CzechChoose : uint8_t { - CZC_NONE = 0, // No requirements. - CZC_COLOR = 1, - CZC_POSTFIX = 2, // Matched if postfix was inserted. - CZC_NOPOSTFIX = 4, // Matched if no postfix was inserted. - CZC_ANY = CZC_COLOR | CZC_POSTFIX | CZC_NOPOSTFIX, +enum class CzechChooseFlag : uint8_t { + Colour, + Postfix, // Matched if postfix was inserted. + NoPostfix, // Matched if no postfix was inserted. }; -DECLARE_ENUM_AS_BIT_SET(CzechChoose) +using CzechChooseFlags = EnumBitSet; + +static constexpr CzechChooseFlags CZC_ANY = {CzechChooseFlag::Colour, CzechChooseFlag::Postfix, CzechChooseFlag::NoPostfix}; struct CzechNameSubst { CzechGender gender; - CzechAllow allow; - CzechChoose choose; + CzechAllowFlags allow; + CzechChooseFlags choose; const char *name; }; struct CzechNameAdj { CzechPattern pattern; - CzechChoose choose; + CzechChooseFlags choose; const char *name; }; @@ -1791,18 +1792,18 @@ static const CzechNameAdj _name_czech_adj[] = { { CZP_MLADY, CZC_ANY, "Kamenn" }, { CZP_MLADY, CZC_ANY, "Cihlov" }, { CZP_MLADY, CZC_ANY, "Divn" }, - { CZP_MLADY, CZC_COLOR, "\u010cerven" }, - { CZP_MLADY, CZC_COLOR, "\u010cerven" }, - { CZP_MLADY, CZC_COLOR, "\u010cerven" }, - { CZP_MLADY, CZC_COLOR, "Zelen" }, - { CZP_MLADY, CZC_COLOR, "\u017dlut" }, - { CZP_MLADY, CZC_COLOR, "Siv" }, - { CZP_MLADY, CZC_COLOR, "\u0160ed" }, - { CZP_MLADY, CZC_COLOR, "B\u00edl" }, - { CZP_MLADY, CZC_COLOR, "B\u00edl" }, - { CZP_MLADY, CZC_COLOR, "Modr" }, - { CZP_MLADY, CZC_COLOR, "R\u016f\u017eov" }, - { CZP_MLADY, CZC_COLOR, "\u010cern" }, + { CZP_MLADY, CzechChooseFlag::Colour, "\u010cerven" }, + { CZP_MLADY, CzechChooseFlag::Colour, "\u010cerven" }, + { CZP_MLADY, CzechChooseFlag::Colour, "\u010cerven" }, + { CZP_MLADY, CzechChooseFlag::Colour, "Zelen" }, + { CZP_MLADY, CzechChooseFlag::Colour, "\u017dlut" }, + { CZP_MLADY, CzechChooseFlag::Colour, "Siv" }, + { CZP_MLADY, CzechChooseFlag::Colour, "\u0160ed" }, + { CZP_MLADY, CzechChooseFlag::Colour, "B\u00edl" }, + { CZP_MLADY, CzechChooseFlag::Colour, "B\u00edl" }, + { CZP_MLADY, CzechChooseFlag::Colour, "Modr" }, + { CZP_MLADY, CzechChooseFlag::Colour, "R\u016f\u017eov" }, + { CZP_MLADY, CzechChooseFlag::Colour, "\u010cern" }, { CZP_PRIVL, CZC_ANY, "Kr\u00e1l" }, { CZP_PRIVL, CZC_ANY, "Jan" }, { CZP_PRIVL, CZC_ANY, "Karl" }, @@ -1814,68 +1815,68 @@ static const CzechNameAdj _name_czech_adj[] = { /* Considered a stem for choose/allow matching purposes. */ 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, "\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, "L\u00edpa" }, - { CZG_SNEUT, CZA_ALL, CZC_COLOR, "Pole" }, - { 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" }, + { CZG_SMASC, CZA_ALL, CzechChooseFlag::Colour, "Sedlec" }, + { CZG_SMASC, CZA_ALL, CzechChooseFlag::Colour, "Brod" }, + { CZG_SMASC, CZA_ALL, CzechChooseFlag::Colour, "Brod" }, + { CZG_SMASC, CZA_ALL, {}, "\u00daval" }, + { CZG_SMASC, CZA_ALL, CzechChooseFlag::Colour, "\u017d\u010f\u00e1r" }, + { CZG_SMASC, CZA_ALL, CzechChooseFlag::Colour, "Smrk" }, + { CZG_SFEM, CZA_ALL, CzechChooseFlag::Colour, "Hora" }, + { CZG_SFEM, CZA_ALL, CzechChooseFlag::Colour, "Lhota" }, + { CZG_SFEM, CZA_ALL, CzechChooseFlag::Colour, "Lhota" }, + { CZG_SFEM, CZA_ALL, CzechChooseFlag::Colour, "Hlava" }, + { CZG_SFEM, CZA_ALL, CzechChooseFlag::Colour, "L\u00edpa" }, + { CZG_SNEUT, CZA_ALL, CzechChooseFlag::Colour, "Pole" }, + { CZG_SNEUT, CZA_ALL, CzechChooseFlag::Colour, "\u00dadol\u00ed" }, + { CZG_PMASC, CZA_ALL, {}, "\u00davaly" }, + { CZG_PFEM, CZA_ALL, CzechChooseFlag::Colour, "Luka" }, + { CZG_PNEUT, CZA_ALL, CzechChooseFlag::Colour, "Pole" }, }; /* 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, "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, "Ba\u017e" }, - { CZG_NFREE, CZA_MIDDLE, CZC_NONE, "Tes" }, - { 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, "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, "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, "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, "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, "M\u011b\u0159" }, - { CZG_FREE, CZA_MIDDLE | CZA_LONG, CZC_NONE, "Lip" }, + { CZG_SMASC, { CzechAllowFlag::Middle }, CzechChooseFlag::Colour, "Kostel" }, + { CZG_SMASC, { CzechAllowFlag::Middle }, CzechChooseFlag::Colour, "Kl\u00e1\u0161ter" }, + { CZG_SMASC, {CzechAllowFlag::Short }, CzechChooseFlag::Colour, "Lhot" }, + { CZG_SFEM, {CzechAllowFlag::Short }, CzechChooseFlag::Colour, "Lhot" }, + { CZG_SFEM, {CzechAllowFlag::Short }, CzechChooseFlag::Colour, "Hur" }, + { CZG_FREE, { CzechAllowFlag::Middle, CzechAllowFlag::Long}, {}, "Sedl" }, + { CZG_FREE, {CzechAllowFlag::Short, CzechAllowFlag::Middle, CzechAllowFlag::Long}, CzechChooseFlag::Colour, "Hrad" }, + { CZG_NFREE, { CzechAllowFlag::Middle }, {}, "Pras" }, + { CZG_NFREE, { CzechAllowFlag::Middle }, {}, "Ba\u017e" }, + { CZG_NFREE, { CzechAllowFlag::Middle }, {}, "Tes" }, + { CZG_NFREE, { CzechAllowFlag::Middle }, {}, "U\u017e" }, + { CZG_NFREE, { CzechAllowFlag::Middle, CzechAllowFlag::Long}, CzechChooseFlag::Postfix, "B\u0159" }, + { CZG_NFREE, { CzechAllowFlag::Middle, CzechAllowFlag::Long}, {}, "Vod" }, + { CZG_NFREE, { CzechAllowFlag::Middle, CzechAllowFlag::Long}, {}, "Jan" }, + { CZG_NFREE, { CzechAllowFlag::Long}, {}, "Prach" }, + { CZG_NFREE, { CzechAllowFlag::Long}, {}, "Kunr" }, + { CZG_NFREE, { CzechAllowFlag::Long}, {}, "Strak" }, + { CZG_NFREE, { CzechAllowFlag::Long}, {}, "V\u00edt" }, + { CZG_NFREE, { CzechAllowFlag::Long}, {}, "Vy\u0161" }, + { CZG_NFREE, { CzechAllowFlag::Long}, {}, "\u017dat" }, + { CZG_NFREE, { CzechAllowFlag::Long}, {}, "\u017der" }, + { CZG_NFREE, { CzechAllowFlag::Long}, {}, "St\u0159ed" }, + { CZG_NFREE, { CzechAllowFlag::Long}, {}, "Harv" }, + { CZG_NFREE, { CzechAllowFlag::Long}, {}, "Pruh" }, + { CZG_NFREE, { CzechAllowFlag::Long}, {}, "Tach" }, + { CZG_NFREE, { CzechAllowFlag::Long}, {}, "P\u00edsn" }, + { CZG_NFREE, { CzechAllowFlag::Long}, {}, "Jin" }, + { CZG_NFREE, { CzechAllowFlag::Long}, {}, "Jes" }, + { CZG_NFREE, { CzechAllowFlag::Long}, {}, "Jar" }, + { CZG_NFREE, { CzechAllowFlag::Long}, {}, "Sok" }, + { CZG_NFREE, { CzechAllowFlag::Long}, {}, "Hod" }, + { CZG_NFREE, { CzechAllowFlag::Long}, {}, "Net" }, + { CZG_FREE, { CzechAllowFlag::Long}, {}, "Pra\u017e" }, + { CZG_FREE, { CzechAllowFlag::Long}, {}, "Nerat" }, + { CZG_FREE, { CzechAllowFlag::Long}, {}, "Kral" }, + { CZG_FREE, { CzechAllowFlag::Long}, {}, "Hut" }, + { CZG_FREE, { CzechAllowFlag::Long}, CzechChooseFlag::NoPostfix, "Pan" }, + { CZG_FREE, {CzechAllowFlag::Short, CzechAllowFlag::Middle, CzechAllowFlag::Long}, CzechChooseFlag::NoPostfix, "Odst\u0159ed" }, + { CZG_FREE, {CzechAllowFlag::Short, CzechAllowFlag::Middle, CzechAllowFlag::Long}, CzechChooseFlag::Colour, "Mrat" }, + { CZG_FREE, { CzechAllowFlag::Long}, CzechChooseFlag::Colour, "Hlav" }, + { CZG_FREE, {CzechAllowFlag::Short, CzechAllowFlag::Middle }, {}, "M\u011b\u0159" }, + { CZG_FREE, { CzechAllowFlag::Middle, CzechAllowFlag::Long}, {}, "Lip" }, }; /* Optional postfix inserted between stem and ending. */ @@ -1887,26 +1888,26 @@ 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, "\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, "\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, "n\u00e1" }, - { CZG_SFEM, CZA_LONG, CZC_ANY, "ava" }, - { 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, "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, "i\u0161t\u011b" }, + { CZG_SMASC, {CzechAllowFlag::Short, CzechAllowFlag::Middle }, CZC_ANY, "ec" }, + { CZG_SMASC, {CzechAllowFlag::Short, CzechAllowFlag::Middle }, CZC_ANY, "\u00edn" }, + { CZG_SMASC, {CzechAllowFlag::Short, CzechAllowFlag::Middle, CzechAllowFlag::Long}, CZC_ANY, "ov" }, + { CZG_SMASC, {CzechAllowFlag::Short, CzechAllowFlag::Long}, CZC_ANY, "kov" }, + { CZG_SMASC, { CzechAllowFlag::Long}, CzechChooseFlag::Postfix, "\u00edn" }, + { CZG_SMASC, { CzechAllowFlag::Long}, CzechChooseFlag::Postfix, "n\u00edk" }, + { CZG_SMASC, { CzechAllowFlag::Long}, CZC_ANY, "burk" }, + { CZG_SFEM, {CzechAllowFlag::Short }, CZC_ANY, "ka" }, + { CZG_SFEM, { CzechAllowFlag::Middle }, CZC_ANY, "inka" }, + { CZG_SFEM, { CzechAllowFlag::Middle }, CZC_ANY, "n\u00e1" }, + { CZG_SFEM, { CzechAllowFlag::Long}, CZC_ANY, "ava" }, + { CZG_PMASC, { CzechAllowFlag::Long}, CzechChooseFlag::Postfix, "\u00edky" }, + { CZG_PMASC, { CzechAllowFlag::Long}, CZC_ANY, "upy" }, + { CZG_PMASC, { CzechAllowFlag::Long}, CZC_ANY, "olupy" }, + { CZG_PFEM, { CzechAllowFlag::Long}, CZC_ANY, "avy" }, + { CZG_PFEM, {CzechAllowFlag::Short, CzechAllowFlag::Middle, CzechAllowFlag::Long}, CZC_ANY, "ice" }, + { CZG_PFEM, {CzechAllowFlag::Short, CzechAllowFlag::Middle, CzechAllowFlag::Long}, CZC_ANY, "i\u010dky" }, + { CZG_PNEUT, {CzechAllowFlag::Short, CzechAllowFlag::Middle }, CZC_ANY, "na" }, + { CZG_SNEUT, {CzechAllowFlag::Short, CzechAllowFlag::Middle }, CZC_ANY, "no" }, + { CZG_SNEUT, { CzechAllowFlag::Long}, CZC_ANY, "i\u0161t\u011b" }, }; static const char * const _name_czech_suffix[] = { diff --git a/src/townname.cpp b/src/townname.cpp index b19bfef79e..0b6a4380f1 100644 --- a/src/townname.cpp +++ b/src/townname.cpp @@ -602,8 +602,8 @@ static void MakeCzechTownName(StringBuilder &builder, uint32_t seed) /* The select criteria. */ CzechGender gender; - CzechChoose choose; - CzechAllow allow; + CzechChooseFlags choose; + CzechAllowFlags allow; if (do_prefix) prefix = SeedModChance(5, std::size(_name_czech_adj) * 12, seed) / 12; if (do_suffix) suffix = SeedModChance(7, std::size(_name_czech_suffix), seed); @@ -632,18 +632,18 @@ static void MakeCzechTownName(StringBuilder &builder, uint32_t seed) /* Load the postfix (1:1 chance that a postfix will be inserted) */ postfix = SeedModChance(14, std::size(_name_czech_subst_postfix) * 2, seed); - if (choose & CZC_POSTFIX) { + if (choose.Test(CzechChooseFlag::Postfix)) { /* Always get a real postfix. */ postfix %= std::size(_name_czech_subst_postfix); } - if (choose & CZC_NOPOSTFIX) { + if (choose.Test(CzechChooseFlag::NoPostfix)) { /* Always drop a postfix. */ postfix += std::size(_name_czech_subst_postfix); } if (postfix < std::size(_name_czech_subst_postfix)) { - choose |= CZC_POSTFIX; + choose.Set(CzechChooseFlag::Postfix); } else { - choose |= CZC_NOPOSTFIX; + choose.Set(CzechChooseFlag::NoPostfix); } /* Localize the array segment containing a good gender */ @@ -671,7 +671,7 @@ static void MakeCzechTownName(StringBuilder &builder, uint32_t seed) for (ending = ending_start; ending <= ending_stop; ending++) { const CzechNameSubst *e = &_name_czech_subst_ending[ending]; - if ((e->choose & choose) == choose && (e->allow & allow) != 0) { + if ((e->choose & choose) == choose && e->allow.Any(allow)) { map[i++] = ending; } }