diff --git a/.github/script-missing-mode-enforcement.py b/.github/script-missing-mode-enforcement.py index 5903b5f0a0..dfb4764abb 100644 --- a/.github/script-missing-mode-enforcement.py +++ b/.github/script-missing-mode-enforcement.py @@ -30,7 +30,7 @@ def check_mode_enforcement(path): continue if re.match( - r"\t(EnforceDeityMode|EnforceCompanyModeValid|EnforceDeityOrCompanyModeValid|EnforceDeityOrCompanyModeValid_Void)\(", + r"\t(EnforceDeityMode|EnforceCompanyModeValid|EnforceCompanyModeValid_Void|EnforceDeityOrCompanyModeValid|EnforceDeityOrCompanyModeValid_Void)\(", line, ): # Mode enforcement macro found diff --git a/cmake/scripts/SquirrelExport.cmake b/cmake/scripts/SquirrelExport.cmake index d13bd8d4d0..6fc6f094e6 100644 --- a/cmake/scripts/SquirrelExport.cmake +++ b/cmake/scripts/SquirrelExport.cmake @@ -332,13 +332,13 @@ foreach(LINE IN LISTS SOURCE_LINES) endif() string(APPEND SQUIRREL_EXPORT "\n") - string(APPEND SQUIRREL_EXPORT "\ntemplate <> const char *GetClassName<${CLS}, ST_${APIUC}>() { return \"${API_CLS}\"; }") + string(APPEND SQUIRREL_EXPORT "\ntemplate <> const char *GetClassName<${CLS}, ScriptType::${APIUC}>() { return \"${API_CLS}\"; }") string(APPEND SQUIRREL_EXPORT "\n") # Then do the registration functions of the class. string(APPEND SQUIRREL_EXPORT "\nvoid SQ${API_CLS}_Register(Squirrel *engine)") string(APPEND SQUIRREL_EXPORT "\n{") - string(APPEND SQUIRREL_EXPORT "\n DefSQClass<${CLS}, ST_${APIUC}> SQ${API_CLS}(\"${API_CLS}\");") + string(APPEND SQUIRREL_EXPORT "\n DefSQClass<${CLS}, ScriptType::${APIUC}> SQ${API_CLS}(\"${API_CLS}\");") if("${SUPER_CLS}" STREQUAL "Text" OR "${SUPER_CLS}" STREQUAL "ScriptObject" OR "${SUPER_CLS}" STREQUAL "AIAbstractiveList::Valuator") string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.PreRegister(engine);") else() diff --git a/regression/regression/result.txt b/regression/regression/result.txt index 9942857cfb..3dd8b60746 100644 --- a/regression/regression/result.txt +++ b/regression/regression/result.txt @@ -88,9 +88,9 @@ abs( 21): 21 --AIBase-- - Rand(): 2232656694 - Rand(): 2514636170 - Rand(): 3897038727 + Rand(): 2113409458 + Rand(): 2000129769 + Rand(): 1788051963 RandRange(0): 0 RandRange(0): 0 RandRange(0): 0 @@ -99,13 +99,13 @@ RandRange(1): 0 RandRange(2): 0 RandRange(2): 0 - RandRange(2): 0 - RandRange(1000000): 666804 - RandRange(1000000): 624059 - RandRange(1000000): 697029 - Chance(1, 2): true + RandRange(2): 1 + RandRange(1000000): 338687 + RandRange(1000000): 274895 + RandRange(1000000): 217539 Chance(1, 2): false Chance(1, 2): true + Chance(1, 2): false --List-- IsEmpty(): true @@ -420,144 +420,144 @@ 1098 => 46116 1099 => 46158 Randomize ListDump: - 1 => 688298322 - 2 => 2585420314 - 1000 => 1701392078 - 1001 => 2664118875 - 1002 => 3408466361 - 1003 => 4098642324 - 1004 => 3858929894 - 1005 => 3774625512 - 1006 => 2809742492 - 1007 => 3983931060 - 1008 => 2791524857 - 1009 => 4184021601 - 1010 => 4212142121 - 1011 => 46859773 - 1012 => 3095744278 - 1013 => 3104411371 - 1014 => 326384434 - 1015 => 1486817960 - 1016 => 2883541699 - 1017 => 3786540442 - 1018 => 820019294 - 1019 => 710762995 - 1020 => 3534100264 - 1021 => 3585356150 - 1022 => 732190215 - 1023 => 236336673 - 1024 => 740596257 - 1025 => 1135321785 - 1026 => 2067474156 - 1027 => 2899283689 - 1028 => 4054438597 - 1029 => 928616892 - 1030 => 1712486685 - 1031 => 1994118287 - 1032 => 1333321243 - 1033 => 194124284 - 1034 => 615083294 - 1035 => 628086450 - 1036 => 498957825 - 1037 => 1359697121 - 1038 => 1888433963 - 1039 => 941623020 - 1040 => 2369304004 - 1041 => 3523427032 - 1042 => 3236625937 - 1043 => 182127597 - 1044 => 646955927 - 1045 => 2870345582 - 1046 => 623062612 - 1047 => 2308011710 - 1048 => 3026140316 - 1049 => 3838191076 - 1051 => 3182411967 - 1052 => 2762833244 - 1053 => 1960404034 - 1054 => 1573325453 - 1055 => 3978347993 - 1056 => 699712177 - 1057 => 863274966 - 1058 => 1728276475 - 1059 => 4048271407 - 1060 => 1919485436 - 1061 => 111273464 - 1062 => 125435213 - 1063 => 155132602 - 1064 => 4123293220 - 1065 => 655046914 - 1066 => 1577399562 - 1067 => 1028818150 - 1068 => 447058239 - 1069 => 3237047027 - 1070 => 2968751973 - 1071 => 4096278708 - 1072 => 1523643051 - 1073 => 231373233 - 1074 => 1121759962 - 1075 => 1449439846 - 1076 => 2679696543 - 1077 => 2785673432 - 1078 => 2116903943 - 1079 => 672822173 - 1080 => 3325393385 - 1081 => 1589904755 - 1082 => 1148782015 - 1083 => 663503316 - 1084 => 933352745 - 1085 => 577717039 - 1086 => 402172048 - 1087 => 1812250453 - 1088 => 667300501 - 1089 => 2456141519 - 1090 => 3438492520 - 1091 => 420696035 - 1092 => 2131427774 - 1093 => 3859663748 - 1094 => 4134083418 - 1095 => 1969629634 - 1096 => 3739173141 - 1097 => 3459847605 - 1098 => 2834059387 - 1099 => 3148043212 + 1 => 1667006376 + 2 => 814756458 + 1000 => 2792131700 + 1001 => 3417650573 + 1002 => 1856129988 + 1003 => 1800973341 + 1004 => 4197962148 + 1005 => 2463509731 + 1006 => 2312121797 + 1007 => 1357932132 + 1008 => 1603755907 + 1009 => 1718096015 + 1010 => 3850074449 + 1011 => 2711130211 + 1012 => 2371249199 + 1013 => 881020769 + 1014 => 3366660077 + 1015 => 808768948 + 1016 => 3035331984 + 1017 => 2813590961 + 1018 => 2745021820 + 1019 => 3075151719 + 1020 => 2553774560 + 1021 => 4267762096 + 1022 => 3863175846 + 1023 => 4198397908 + 1024 => 817599906 + 1025 => 3149240362 + 1026 => 3003005979 + 1027 => 1214815375 + 1028 => 3784363817 + 1029 => 3181864540 + 1030 => 325341059 + 1031 => 1011889231 + 1032 => 3142617173 + 1033 => 1197220206 + 1034 => 4060510885 + 1035 => 3596342467 + 1036 => 219406671 + 1037 => 3695508783 + 1038 => 2823603997 + 1039 => 2625659720 + 1040 => 4113498476 + 1041 => 1125297786 + 1042 => 671905104 + 1043 => 1231077134 + 1044 => 892292375 + 1045 => 2441486929 + 1046 => 1804593432 + 1047 => 2536560053 + 1048 => 1896826021 + 1049 => 1672512966 + 1051 => 977884299 + 1052 => 681948608 + 1053 => 3853505792 + 1054 => 4118706553 + 1055 => 3581698138 + 1056 => 3073782502 + 1057 => 1084753140 + 1058 => 2266056077 + 1059 => 1239805090 + 1060 => 1183528423 + 1061 => 501361238 + 1062 => 66542127 + 1063 => 775638990 + 1064 => 1111474321 + 1065 => 3465462871 + 1066 => 2317535037 + 1067 => 878310882 + 1068 => 2231368582 + 1069 => 2353633007 + 1070 => 179259867 + 1071 => 1322707275 + 1072 => 1474105363 + 1073 => 619989187 + 1074 => 3221603092 + 1075 => 2400416540 + 1076 => 3926392705 + 1077 => 1122978123 + 1078 => 3266139701 + 1079 => 2948697341 + 1080 => 3262493501 + 1081 => 2200252596 + 1082 => 4091101485 + 1083 => 2797438343 + 1084 => 2608201933 + 1085 => 2577605442 + 1086 => 1178956760 + 1087 => 3047709109 + 1088 => 1065186815 + 1089 => 841440515 + 1090 => 842182476 + 1091 => 289059855 + 1092 => 2114106829 + 1093 => 436435334 + 1094 => 111052607 + 1095 => 81827083 + 1096 => 1961213887 + 1097 => 1374385392 + 1098 => 3255118186 + 1099 => 2245402931 KeepTop(10): - 1 => 688298322 - 2 => 2585420314 - 1000 => 1701392078 - 1001 => 2664118875 - 1002 => 3408466361 - 1003 => 4098642324 - 1004 => 3858929894 - 1005 => 3774625512 - 1006 => 2809742492 - 1007 => 3983931060 + 1 => 1667006376 + 2 => 814756458 + 1000 => 2792131700 + 1001 => 3417650573 + 1002 => 1856129988 + 1003 => 1800973341 + 1004 => 4197962148 + 1005 => 2463509731 + 1006 => 2312121797 + 1007 => 1357932132 KeepBottom(8): - 1000 => 1701392078 - 1001 => 2664118875 - 1002 => 3408466361 - 1003 => 4098642324 - 1004 => 3858929894 - 1005 => 3774625512 - 1006 => 2809742492 - 1007 => 3983931060 + 1000 => 2792131700 + 1001 => 3417650573 + 1002 => 1856129988 + 1003 => 1800973341 + 1004 => 4197962148 + 1005 => 2463509731 + 1006 => 2312121797 + 1007 => 1357932132 RemoveBottom(2): - 1000 => 1701392078 - 1001 => 2664118875 - 1002 => 3408466361 - 1003 => 4098642324 - 1004 => 3858929894 - 1005 => 3774625512 + 1000 => 2792131700 + 1001 => 3417650573 + 1002 => 1856129988 + 1003 => 1800973341 + 1004 => 4197962148 + 1005 => 2463509731 RemoveTop(2): - 1002 => 3408466361 - 1003 => 4098642324 - 1004 => 3858929894 - 1005 => 3774625512 + 1002 => 1856129988 + 1003 => 1800973341 + 1004 => 4197962148 + 1005 => 2463509731 RemoveList({1003, 1004}): - 1002 => 3408466361 - 1005 => 3774625512 + 1002 => 1856129988 + 1005 => 2463509731 KeepList({1003, 1004, 1005}): - 1005 => 3774625512 + 1005 => 2463509731 AddList({1005, 4000, 4001, 4002}): 1005 => 1005 4000 => 8000 @@ -588,7 +588,7 @@ ERROR: IsEnd() is invalid as Begin() is never called SetName(): false GetLastErrorString(): ERR_NAME_IS_NOT_UNIQUE GetName(): Regression - GetPresidentName(): J. Green + GetPresidentName(): F. Gribble SetPresidentName(): true GetPresidentName(): Regression AI GetBankBalance(): 100000 @@ -9320,12 +9320,12 @@ ERROR: IsEnd() is invalid as Begin() is never called GetLocation(): 33417 GetEngineType(): 153 GetUnitNumber(): 1 - GetAge(): 0 + GetAge(): 1 GetMaxAge(): 5490 - GetAgeLeft(): 5490 + GetAgeLeft(): 5489 GetCurrentSpeed(): 7 GetRunningCost(): 421 - GetProfitThisYear(): 0 + GetProfitThisYear(): -1 GetProfitLastYear(): 0 GetCurrentValue(): 5947 GetVehicleType(): 1 @@ -9335,7 +9335,7 @@ ERROR: IsEnd() is invalid as Begin() is never called IsInDepot(): false GetNumWagons(): 1 GetWagonEngineType(): 153 - GetWagonAge(): 0 + GetWagonAge(): 1 GetLength(): 8 GetOwner(): 1 BuildVehicle(): 14 @@ -9408,11 +9408,11 @@ ERROR: IsEnd() is invalid as Begin() is never called 14 => 1 12 => 1 Age ListDump: - 17 => 1 - 16 => 1 14 => 1 13 => 1 12 => 1 + 17 => 0 + 16 => 0 MaxAge ListDump: 16 => 10980 14 => 10980 @@ -9420,9 +9420,9 @@ ERROR: IsEnd() is invalid as Begin() is never called 13 => 5490 12 => 5490 AgeLeft ListDump: - 16 => 10979 + 16 => 10980 14 => 10979 - 17 => 7319 + 17 => 7320 13 => 5489 12 => 5489 CurrentSpeed ListDump: diff --git a/regression/regression/test.sav b/regression/regression/test.sav index cf97052c2e..30b68c12cf 100644 Binary files a/regression/regression/test.sav and b/regression/regression/test.sav differ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index db6d9db160..c1e76c073c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -24,6 +24,7 @@ add_subdirectory(sound) add_subdirectory(spriteloader) add_subdirectory(table) add_subdirectory(tests) +add_subdirectory(timer) add_subdirectory(video) add_subdirectory(widgets) diff --git a/src/ai/ai.hpp b/src/ai/ai.hpp index e090303bd9..667de589eb 100644 --- a/src/ai/ai.hpp +++ b/src/ai/ai.hpp @@ -19,18 +19,6 @@ */ class AI { public: - /** - * The default months AIs start after each other. - */ - enum StartNext { - START_NEXT_EASY = DAYS_IN_YEAR * 2, - START_NEXT_MEDIUM = DAYS_IN_YEAR, - START_NEXT_HARD = DAYS_IN_YEAR / 2, - START_NEXT_MIN = 0, - START_NEXT_MAX = 3600, - START_NEXT_DEVIATION = 60, - }; - /** * Is it possible to start a new AI company? * @return True if a new AI company can be started. @@ -124,11 +112,6 @@ public: */ static void Save(CompanyID company); - /** - * Get the number of days before the next AI should start. - */ - static int GetStartNextTime(); - /** Wrapper function for AIScanner::GetAIConsoleList */ static std::string GetConsoleList(bool newest_only = false); /** Wrapper function for AIScanner::GetAIConsoleLibraryList */ diff --git a/src/ai/ai_config.cpp b/src/ai/ai_config.cpp index 98618feb20..a1c6479952 100644 --- a/src/ai/ai_config.cpp +++ b/src/ai/ai_config.cpp @@ -16,32 +16,6 @@ #include "../safeguards.h" -/** Configuration for AI start date, every AI has this setting. */ -ScriptConfigItem _start_date_config = { - "start_date", - "", // STR_AI_SETTINGS_START_DELAY - AI::START_NEXT_MIN, - AI::START_NEXT_MAX, - AI::START_NEXT_MEDIUM, - AI::START_NEXT_EASY, - AI::START_NEXT_MEDIUM, - AI::START_NEXT_HARD, - AI::START_NEXT_DEVIATION, - 30, - SCRIPTCONFIG_NONE, - nullptr, - false -}; - -AIConfig::AIConfig(const AIConfig *config) : ScriptConfig(config) -{ - /* Override start_date as per AIConfig::AddRandomDeviation(). - * This is necessary because the ScriptConfig constructor will instead call - * ScriptConfig::AddRandomDeviation(). */ - int start_date = config->GetSetting("start_date"); - this->SetSetting("start_date", start_date != 0 ? std::max(1, this->GetSetting("start_date")) : 0); -} - /* static */ AIConfig *AIConfig::GetConfig(CompanyID company, ScriptSettingSource source) { AIConfig **config; @@ -69,70 +43,3 @@ bool AIConfig::ResetInfo(bool force_exact_match) this->info = (ScriptInfo *)AI::FindInfo(this->name, force_exact_match ? this->version : -1, force_exact_match); return this->info != nullptr; } - -void AIConfig::PushExtraConfigList() -{ - this->config_list->push_back(_start_date_config); -} - -void AIConfig::ClearConfigList() -{ - /* The special casing for start_date is here to ensure that the - * start_date setting won't change even if you chose another Script. */ - int start_date = this->GetSetting("start_date"); - - ScriptConfig::ClearConfigList(); - - this->SetSetting("start_date", start_date); -} - -int AIConfig::GetSetting(const char *name) const -{ - if (this->info == nullptr) { - SettingValueList::const_iterator it = this->settings.find(name); - if (it == this->settings.end()) { - assert(strcmp("start_date", name) == 0); - switch (GetGameSettings().script.settings_profile) { - case SP_EASY: return AI::START_NEXT_EASY; - case SP_MEDIUM: return AI::START_NEXT_MEDIUM; - case SP_HARD: return AI::START_NEXT_HARD; - case SP_CUSTOM: return AI::START_NEXT_MEDIUM; - default: NOT_REACHED(); - } - } - - return (*it).second; - } - - return ScriptConfig::GetSetting(name); -} - -void AIConfig::SetSetting(const char *name, int value) -{ - if (this->info == nullptr) { - if (strcmp("start_date", name) != 0) return; - value = Clamp(value, AI::START_NEXT_MIN, AI::START_NEXT_MAX); - - SettingValueList::iterator it = this->settings.find(name); - if (it != this->settings.end()) { - (*it).second = value; - } else { - this->settings[stredup(name)] = value; - } - - return; - } - - ScriptConfig::SetSetting(name, value); -} - -void AIConfig::AddRandomDeviation() -{ - int start_date = this->GetSetting("start_date"); - - ScriptConfig::AddRandomDeviation(); - - /* start_date = 0 is a special case, where random deviation does not occur. - * If start_date was not already 0, then a minimum value of 1 must apply. */ - this->SetSetting("start_date", start_date != 0 ? std::max(1, this->GetSetting("start_date")) : 0); -} diff --git a/src/ai/ai_config.hpp b/src/ai/ai_config.hpp index 6c861126e0..a0f98d2187 100644 --- a/src/ai/ai_config.hpp +++ b/src/ai/ai_config.hpp @@ -24,14 +24,12 @@ public: ScriptConfig() {} - AIConfig(const AIConfig *config); + AIConfig(const AIConfig *config) : + ScriptConfig(config) + {} class AIInfo *GetInfo() const; - int GetSetting(const char *name) const override; - void SetSetting(const char *name, int value) override; - void AddRandomDeviation() override; - /** * When ever the AI Scanner is reloaded, all infos become invalid. This * function tells AIConfig about this. @@ -43,8 +41,6 @@ public: bool ResetInfo(bool force_exact_match); protected: - void PushExtraConfigList() override; - void ClearConfigList() override; ScriptInfo *FindInfo(const char *name, int version, bool force_exact_match) override; }; diff --git a/src/ai/ai_core.cpp b/src/ai/ai_core.cpp index d8030a7b1e..5f3469e890 100644 --- a/src/ai/ai_core.cpp +++ b/src/ai/ai_core.cpp @@ -287,17 +287,6 @@ } } -/* static */ int AI::GetStartNextTime() -{ - /* Find the first company which doesn't exist yet */ - for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) { - if (!Company::IsValidID(c)) return AIConfig::GetConfig(c, AIConfig::SSS_FORCE_GAME)->GetSetting("start_date"); - } - - /* Currently no AI can be started, check again in a year. */ - return DAYS_IN_YEAR; -} - /* static */ std::string AI::GetConsoleList(bool newest_only) { return AI::scanner_info->GetConsoleList(newest_only); diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index c295b6a93c..6324cb0186 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -34,11 +34,17 @@ static const NWidgetPart _nested_ai_config_widgets[] = { NWidget(WWT_PANEL, COLOUR_MAUVE, WID_AIC_BACKGROUND), NWidget(NWID_VERTICAL), SetPIP(4, 4, 4), NWidget(NWID_HORIZONTAL), SetPIP(7, 0, 7), - NWidget(WWT_PUSHARROWBTN, COLOUR_YELLOW, WID_AIC_DECREASE), SetDataTip(AWV_DECREASE, STR_NULL), - NWidget(WWT_PUSHARROWBTN, COLOUR_YELLOW, WID_AIC_INCREASE), SetDataTip(AWV_INCREASE, STR_NULL), + NWidget(WWT_PUSHARROWBTN, COLOUR_YELLOW, WID_AIC_DECREASE_NUMBER), SetDataTip(AWV_DECREASE, STR_NULL), + NWidget(WWT_PUSHARROWBTN, COLOUR_YELLOW, WID_AIC_INCREASE_NUMBER), SetDataTip(AWV_INCREASE, STR_NULL), NWidget(NWID_SPACER), SetMinimalSize(6, 0), NWidget(WWT_TEXT, COLOUR_MAUVE, WID_AIC_NUMBER), SetDataTip(STR_AI_CONFIG_MAX_COMPETITORS, STR_NULL), SetFill(1, 0), EndContainer(), + NWidget(NWID_HORIZONTAL), SetPIP(7, 0, 7), + NWidget(WWT_PUSHARROWBTN, COLOUR_YELLOW, WID_AIC_DECREASE_INTERVAL), SetDataTip(AWV_DECREASE, STR_NULL), + NWidget(WWT_PUSHARROWBTN, COLOUR_YELLOW, WID_AIC_INCREASE_INTERVAL), SetDataTip(AWV_INCREASE, STR_NULL), + NWidget(NWID_SPACER), SetMinimalSize(6, 0), + NWidget(WWT_TEXT, COLOUR_MAUVE, WID_AIC_INTERVAL), SetDataTip(STR_AI_CONFIG_COMPETITORS_INTERVAL, STR_NULL), SetFill(1, 0), + EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(7, 0, 7), NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_MOVE_UP), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_CONFIG_MOVE_UP, STR_AI_CONFIG_MOVE_UP_TOOLTIP), NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_MOVE_DOWN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_AI_CONFIG_MOVE_DOWN, STR_AI_CONFIG_MOVE_DOWN_TOOLTIP), @@ -104,14 +110,20 @@ struct AIConfigWindow : public Window { case WID_AIC_NUMBER: SetDParam(0, GetGameSettings().difficulty.max_no_competitors); break; + + case WID_AIC_INTERVAL: + SetDParam(0, GetGameSettings().difficulty.competitors_interval); + break; } } void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { switch (widget) { - case WID_AIC_DECREASE: - case WID_AIC_INCREASE: + case WID_AIC_DECREASE_NUMBER: + case WID_AIC_INCREASE_NUMBER: + case WID_AIC_DECREASE_INTERVAL: + case WID_AIC_INCREASE_INTERVAL: *size = maxdim(*size, NWidgetScrollbar::GetHorizontalDimension()); break; @@ -177,10 +189,10 @@ struct AIConfigWindow : public Window { } switch (widget) { - case WID_AIC_DECREASE: - case WID_AIC_INCREASE: { + case WID_AIC_DECREASE_NUMBER: + case WID_AIC_INCREASE_NUMBER: { int new_value; - if (widget == WID_AIC_DECREASE) { + if (widget == WID_AIC_DECREASE_NUMBER) { new_value = std::max(0, GetGameSettings().difficulty.max_no_competitors - 1); } else { new_value = std::min(MAX_COMPANIES - 1, GetGameSettings().difficulty.max_no_competitors + 1); @@ -189,6 +201,18 @@ struct AIConfigWindow : public Window { break; } + case WID_AIC_DECREASE_INTERVAL: + case WID_AIC_INCREASE_INTERVAL: { + int new_value; + if (widget == WID_AIC_DECREASE_INTERVAL) { + new_value = std::max(static_cast(MIN_COMPETITORS_INTERVAL), GetGameSettings().difficulty.competitors_interval - 1); + } else { + new_value = std::min(static_cast(MAX_COMPETITORS_INTERVAL), GetGameSettings().difficulty.competitors_interval + 1); + } + IConsoleSetSetting("difficulty.competitors_interval", new_value); + break; + } + case WID_AIC_LIST: { // Select a slot this->selected_slot = (CompanyID)this->vscroll->GetScrolledRowFromWidget(pt.y, this, widget); this->InvalidateData(); @@ -249,8 +273,10 @@ struct AIConfigWindow : public Window { if (!gui_scope) return; - this->SetWidgetDisabledState(WID_AIC_DECREASE, GetGameSettings().difficulty.max_no_competitors == 0); - this->SetWidgetDisabledState(WID_AIC_INCREASE, GetGameSettings().difficulty.max_no_competitors == MAX_COMPANIES - 1); + this->SetWidgetDisabledState(WID_AIC_DECREASE_NUMBER, GetGameSettings().difficulty.max_no_competitors == 0); + this->SetWidgetDisabledState(WID_AIC_INCREASE_NUMBER, GetGameSettings().difficulty.max_no_competitors == MAX_COMPANIES - 1); + this->SetWidgetDisabledState(WID_AIC_DECREASE_INTERVAL, GetGameSettings().difficulty.competitors_interval == MIN_COMPETITORS_INTERVAL); + this->SetWidgetDisabledState(WID_AIC_INCREASE_INTERVAL, GetGameSettings().difficulty.competitors_interval == MAX_COMPETITORS_INTERVAL); this->SetWidgetDisabledState(WID_AIC_CHANGE, this->selected_slot == INVALID_COMPANY); this->SetWidgetDisabledState(WID_AIC_CONFIGURE, this->selected_slot == INVALID_COMPANY || AIConfig::GetConfig(this->selected_slot)->GetConfigList()->size() == 0); this->SetWidgetDisabledState(WID_AIC_MOVE_UP, this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot - 1))); diff --git a/src/ai/ai_info.cpp b/src/ai/ai_info.cpp index 6a71bf2b83..7cc82346d9 100644 --- a/src/ai/ai_info.cpp +++ b/src/ai/ai_info.cpp @@ -32,12 +32,12 @@ static bool CheckAPIVersion(const char *api_version) #if defined(_WIN32) #undef GetClassName #endif /* _WIN32 */ -template <> const char *GetClassName() { return "AIInfo"; } +template <> const char *GetClassName() { return "AIInfo"; } /* static */ void AIInfo::RegisterAPI(Squirrel *engine) { /* Create the AIInfo class, and add the RegisterAI function */ - DefSQClass SQAIInfo("AIInfo"); + DefSQClass SQAIInfo("AIInfo"); SQAIInfo.PreRegister(engine); SQAIInfo.AddConstructor(engine, "x"); SQAIInfo.DefSQAdvancedMethod(engine, &AIInfo::AddSetting, "AddSetting"); @@ -69,11 +69,6 @@ template <> const char *GetClassName() { return "AIInfo"; } SQInteger res = ScriptInfo::Constructor(vm, info); if (res != 0) return res; - ScriptConfigItem config = _start_date_config; - config.name = stredup(config.name); - config.description = stredup(config.description); - info->config_list.push_front(config); - if (info->engine->MethodExists(*info->SQ_instance, "MinVersionToLoad")) { if (!info->engine->CallIntegerMethod(*info->SQ_instance, "MinVersionToLoad", &info->min_loadable_version, MAX_GET_OPS)) return SQ_ERROR; } else { diff --git a/src/ai/ai_instance.cpp b/src/ai/ai_instance.cpp index 672c3810b3..4489c9114d 100644 --- a/src/ai/ai_instance.cpp +++ b/src/ai/ai_instance.cpp @@ -33,7 +33,7 @@ #include "../safeguards.h" AIInstance::AIInstance() : - ScriptInstance("AI", ST_AI) + ScriptInstance("AI", ScriptType::AI) {} void AIInstance::Initialize(AIInfo *info) diff --git a/src/blitter/32bpp_optimized.cpp b/src/blitter/32bpp_optimized.cpp index 6781f7860a..602777fb4a 100644 --- a/src/blitter/32bpp_optimized.cpp +++ b/src/blitter/32bpp_optimized.cpp @@ -304,7 +304,7 @@ template Sprite *Blitter_32bppOptimized::EncodeInternal(const ZoomLevel zoom_min; ZoomLevel zoom_max; - if (sprite->type == ST_FONT) { + if (sprite->type == SpriteType::Font) { zoom_min = ZOOM_LVL_NORMAL; zoom_max = ZOOM_LVL_NORMAL; } else { diff --git a/src/blitter/32bpp_sse2.cpp b/src/blitter/32bpp_sse2.cpp index d4303e0adf..0a116d6495 100644 --- a/src/blitter/32bpp_sse2.cpp +++ b/src/blitter/32bpp_sse2.cpp @@ -28,7 +28,7 @@ Sprite *Blitter_32bppSSE_Base::Encode(const SpriteLoader::Sprite *sprite, Alloca */ ZoomLevel zoom_min = ZOOM_LVL_NORMAL; ZoomLevel zoom_max = ZOOM_LVL_NORMAL; - if (sprite->type != ST_FONT) { + if (sprite->type != SpriteType::Font) { zoom_min = _settings_client.gui.zoom_min; zoom_max = _settings_client.gui.zoom_max; if (zoom_max == zoom_min) zoom_max = ZOOM_LVL_MAX; diff --git a/src/blitter/40bpp_anim.cpp b/src/blitter/40bpp_anim.cpp index 862e21d3fb..db8e56d7c1 100644 --- a/src/blitter/40bpp_anim.cpp +++ b/src/blitter/40bpp_anim.cpp @@ -431,7 +431,7 @@ void Blitter_40bppAnim::DrawColourMappingRect(void *dst, int width, int height, anim = anim - width + _screen.pitch; } while (--height); } else if (pal == PALETTE_NEWSPAPER) { - const uint8 *remap = GetNonSprite(pal, ST_RECOLOUR) + 1; + const uint8 *remap = GetNonSprite(pal, SpriteType::Recolour) + 1; do { for (int i = 0; i != width; i++) { if (*anim == 0) *udst = MakeGrey(*udst); @@ -443,7 +443,7 @@ void Blitter_40bppAnim::DrawColourMappingRect(void *dst, int width, int height, anim = anim - width + _screen.pitch; } while (--height); } else { - const uint8 *remap = GetNonSprite(pal, ST_RECOLOUR) + 1; + const uint8 *remap = GetNonSprite(pal, SpriteType::Recolour) + 1; do { for (int i = 0; i != width; i++) { *anim = remap[*anim]; diff --git a/src/blitter/8bpp_base.cpp b/src/blitter/8bpp_base.cpp index edf040289e..f7aeeb8fdf 100644 --- a/src/blitter/8bpp_base.cpp +++ b/src/blitter/8bpp_base.cpp @@ -16,7 +16,7 @@ void Blitter_8bppBase::DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) { - const uint8 *ctab = GetNonSprite(pal, ST_RECOLOUR) + 1; + const uint8 *ctab = GetNonSprite(pal, SpriteType::Recolour) + 1; do { for (int i = 0; i != width; i++) *((uint8 *)dst + i) = ctab[((uint8 *)dst)[i]]; diff --git a/src/blitter/8bpp_optimized.cpp b/src/blitter/8bpp_optimized.cpp index e153ec829f..cf84bed2b0 100644 --- a/src/blitter/8bpp_optimized.cpp +++ b/src/blitter/8bpp_optimized.cpp @@ -128,7 +128,7 @@ Sprite *Blitter_8bppOptimized::Encode(const SpriteLoader::Sprite *sprite, Alloca ZoomLevel zoom_min; ZoomLevel zoom_max; - if (sprite->type == ST_FONT) { + if (sprite->type == SpriteType::Font) { zoom_min = ZOOM_LVL_NORMAL; zoom_max = ZOOM_LVL_NORMAL; } else { diff --git a/src/cargo_type.h b/src/cargo_type.h index 83af40a83a..3122d54102 100644 --- a/src/cargo_type.h +++ b/src/cargo_type.h @@ -144,10 +144,10 @@ public: /** Types of cargo source and destination */ -enum SourceType : byte { - ST_INDUSTRY, ///< Source/destination is an industry - ST_TOWN, ///< Source/destination is a town - ST_HEADQUARTERS, ///< Source/destination are company headquarters +enum class SourceType : byte { + Industry, ///< Source/destination is an industry + Town, ///< Source/destination is a town + Headquarters, ///< Source/destination are company headquarters }; typedef uint16 SourceID; ///< Contains either industry ID, town ID or company ID (or INVALID_SOURCE) diff --git a/src/cargomonitor.cpp b/src/cargomonitor.cpp index 133aedd055..c85e9b88c0 100644 --- a/src/cargomonitor.cpp +++ b/src/cargomonitor.cpp @@ -123,13 +123,13 @@ void AddCargoDelivery(CargoID cargo_type, CompanyID company, uint32 amount, Sour if (src != INVALID_SOURCE) { /* Handle pickup update. */ switch (src_type) { - case ST_INDUSTRY: { + case SourceType::Industry: { CargoMonitorID num = EncodeCargoIndustryMonitor(company, cargo_type, src); CargoMonitorMap::iterator iter = _cargo_pickups.find(num); if (iter != _cargo_pickups.end()) iter->second += amount; break; } - case ST_TOWN: { + case SourceType::Town: { CargoMonitorID num = EncodeCargoTownMonitor(company, cargo_type, src); CargoMonitorMap::iterator iter = _cargo_pickups.find(num); if (iter != _cargo_pickups.end()) iter->second += amount; diff --git a/src/cargopacket.cpp b/src/cargopacket.cpp index 4620f4d48b..7fabe9a697 100644 --- a/src/cargopacket.cpp +++ b/src/cargopacket.cpp @@ -101,7 +101,7 @@ void DumpCargoPacketDeferredPaymentStats(char *buffer, const char *last) */ CargoPacket::CargoPacket() { - this->source_type = ST_INDUSTRY; + this->source_type = SourceType::Industry; this->source_id = INVALID_SOURCE; } diff --git a/src/cargopacket.h b/src/cargopacket.h index d99a4a2745..cb1805de52 100644 --- a/src/cargopacket.h +++ b/src/cargopacket.h @@ -84,7 +84,7 @@ public: CargoPacket(); CargoPacket(StationID source, TileIndex source_xy, uint16 count, SourceType source_type, SourceID source_id); - CargoPacket(uint16 count, uint16 days_in_transit, StationID source, TileIndex source_xy, TileIndex loaded_at_xy, Money feeder_share = 0, SourceType source_type = ST_INDUSTRY, SourceID source_id = INVALID_SOURCE); + CargoPacket(uint16 count, uint16 days_in_transit, StationID source, TileIndex source_xy, TileIndex loaded_at_xy, Money feeder_share = 0, SourceType source_type = SourceType::Industry, SourceID source_id = INVALID_SOURCE); ~CargoPacket(); CargoPacket *Split(uint new_size); diff --git a/src/company_base.h b/src/company_base.h index 361279190a..df8d362927 100644 --- a/src/company_base.h +++ b/src/company_base.h @@ -181,7 +181,6 @@ struct Company : CompanyPool::PoolItem<&_company_pool>, CompanyProperties { Money CalculateCompanyValue(const Company *c, bool including_loan = true); Money CalculateCompanyValueExcludingShares(const Company *c, bool including_loan = true); -extern uint _next_competitor_start; extern uint _cur_company_tick_index; #endif /* COMPANY_BASE_H */ diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp index 5911dbaf91..b8ffbfc200 100644 --- a/src/company_cmd.cpp +++ b/src/company_cmd.cpp @@ -39,6 +39,8 @@ #include "widgets/statusbar_widget.h" #include "core/backup_type.hpp" #include "debug_desync.h" +#include "timer/timer.h" +#include "timer/timer_game_tick.h" #include "table/strings.h" @@ -54,7 +56,6 @@ CompanyID _current_company; ///< Company currently doing an action. CompanyID _loaded_local_company; ///< Local company in loaded savegame Colours _company_colours[MAX_COMPANIES]; ///< NOSAVE: can be determined from company structs. CompanyManagerFace _company_manager_face; ///< for company manager face storage in openttd.cfg -uint _next_competitor_start; ///< the number of ticks before the next AI is started uint _cur_company_tick_index; ///< used to generate a name for one company that doesn't have a name yet per tick CompanyMask _saved_PLYP_invalid_mask; @@ -622,16 +623,10 @@ Company *DoStartupNewCompany(DoStartupNewCompanyFlag flags, CompanyID company) return c; } -/** Start the next competitor now. */ -void StartupCompanies() -{ - _next_competitor_start = 0; -} - /** Start a new competitor company if possible. */ -static bool MaybeStartNewCompany() -{ - if (_networking && Company::GetNumItems() >= _settings_client.network.max_companies) return false; +TimeoutTimer _new_competitor_timeout(0, []() { + if (_game_mode == GM_MENU || !AI::CanStartNew()) return; + if (_networking && Company::GetNumItems() >= _settings_client.network.max_companies) return; /* count number of competitors */ uint n = 0; @@ -639,13 +634,26 @@ static bool MaybeStartNewCompany() if (c->is_ai) n++; } - if (n < (uint)_settings_game.difficulty.max_no_competitors) { - /* Send a command to all clients to start up a new AI. - * Works fine for Multiplayer and Singleplayer */ - return DoCommandP(0, CCA_NEW_AI | INVALID_COMPANY << 16, 0, CMD_COMPANY_CTRL); - } + if (n >= (uint)_settings_game.difficulty.max_no_competitors) return; - return false; + /* Send a command to all clients to start up a new AI. + * Works fine for Multiplayer and Singleplayer */ + DoCommandP(0, CCA_NEW_AI | INVALID_COMPANY << 16, 0, CMD_COMPANY_CTRL); +}); + +/** Start of a new game. */ +void StartupCompanies() +{ + /* Ensure the timeout is aborted, so it doesn't fire based on information of the last game. */ + _new_competitor_timeout.Abort(); + + /* If there is no delay till the start of the next competitor, start all competitors at the start of the game. */ + if (_settings_game.difficulty.competitors_interval == 0 && _game_mode != GM_MENU && AI::CanStartNew()) { + for (auto i = 0; i < _settings_game.difficulty.max_no_competitors; i++) { + if (_networking && Company::GetNumItems() >= _settings_client.network.max_companies) break; + DoCommandP(0, CCA_NEW_AI | INVALID_COMPANY << 16, 0, CMD_COMPANY_CTRL); + } + } } static void ClearSavedPLYP() @@ -786,20 +794,15 @@ void OnTick_Companies(bool main_tick) if (c->bankrupt_asked != 0 && c->bankrupt_timeout == 0) HandleBankruptcyTakeover(c); } - if (_next_competitor_start == 0) { - /* AI::GetStartNextTime() can return 0. */ - _next_competitor_start = std::max(1, AI::GetStartNextTime() * DAY_TICKS); - } + if (_new_competitor_timeout.HasFired() && _game_mode != GM_MENU && AI::CanStartNew()) { + int32 timeout = _settings_game.difficulty.competitors_interval * 60 * TICKS_PER_SECOND; + /* If the interval is zero, check every ~10 minutes if a company went bankrupt and needs replacing. */ + if (timeout == 0) timeout = 10 * 60 * TICKS_PER_SECOND; - if (_game_mode != GM_MENU && AI::CanStartNew() && --_next_competitor_start == 0) { - /* Allow multiple AIs to possibly start in the same tick. */ - do { - if (!MaybeStartNewCompany()) break; + /* Randomize a bit when the AI is actually going to start; ranges from 87.5% .. 112.5% of indicated value. */ + timeout += ScriptObject::GetRandomizer(OWNER_NONE).Next(timeout / 4) - timeout / 8; - /* In networking mode, we can only send a command to start but it - * didn't execute yet, so we cannot loop. */ - if (_networking) break; - } while (AI::GetStartNextTime() == 0); + _new_competitor_timeout.Reset(std::max(1, timeout)); } } diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 25cf391568..c0c9de0eb6 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -1235,13 +1235,17 @@ void ShowCompanyLiveryWindow(CompanyID company, GroupID group) * Draws the face of a company manager's face. * @param cmf the company manager's face * @param colour the (background) colour of the gradient - * @param x x-position to draw the face - * @param y y-position to draw the face + * @param r position to draw the face */ -void DrawCompanyManagerFace(CompanyManagerFace cmf, int colour, int x, int y) +void DrawCompanyManagerFace(CompanyManagerFace cmf, int colour, const Rect &r) { GenderEthnicity ge = (GenderEthnicity)GetCompanyManagerFaceBits(cmf, CMFV_GEN_ETHN, GE_WM); + /* Determine offset from centre of drawing rect. */ + Dimension d = GetSpriteSize(SPR_GRADIENT); + int x = CenterBounds(r.left, r.right, d.width); + int y = CenterBounds(r.top, r.bottom, d.height); + bool has_moustache = !HasBit(ge, GENDER_FEMALE) && GetCompanyManagerFaceBits(cmf, CMFV_HAS_MOUSTACHE, ge) != 0; bool has_tie_earring = !HasBit(ge, GENDER_FEMALE) || GetCompanyManagerFaceBits(cmf, CMFV_HAS_TIE_EARRING, ge) != 0; bool has_glasses = GetCompanyManagerFaceBits(cmf, CMFV_HAS_GLASSES, ge) != 0; @@ -1544,7 +1548,7 @@ public: break; case WID_SCMF_FACE: { - Dimension face_size = GetSpriteSize(SPR_GRADIENT); + Dimension face_size = GetScaledSpriteSize(SPR_GRADIENT); size->width = std::max(size->width, face_size.width); size->height = std::max(size->height, face_size.height); break; @@ -1696,7 +1700,7 @@ public: { switch (widget) { case WID_SCMF_FACE: - DrawCompanyManagerFace(this->face, Company::Get((CompanyID)this->window_number)->colour, r.left, r.top); + DrawCompanyManagerFace(this->face, Company::Get((CompanyID)this->window_number)->colour, r); break; } } @@ -2481,7 +2485,7 @@ struct CompanyWindow : Window { switch (widget) { case WID_C_FACE: { - Dimension face_size = GetSpriteSize(SPR_GRADIENT); + Dimension face_size = GetScaledSpriteSize(SPR_GRADIENT); size->width = std::max(size->width, face_size.width); size->height = std::max(size->height, face_size.height); break; @@ -2618,7 +2622,7 @@ struct CompanyWindow : Window const Company *c = Company::Get((CompanyID)this->window_number); switch (widget) { case WID_C_FACE: - DrawCompanyManagerFace(c->face, c->colour, r.left, r.top); + DrawCompanyManagerFace(c->face, c->colour, r); break; case WID_C_FACE_TITLE: @@ -2910,7 +2914,7 @@ struct BuyCompanyWindow : Window { { switch (widget) { case WID_BC_FACE: - *size = GetSpriteSize(SPR_GRADIENT); + *size = GetScaledSpriteSize(SPR_GRADIENT); break; case WID_BC_QUESTION: @@ -2937,7 +2941,7 @@ struct BuyCompanyWindow : Window { switch (widget) { case WID_BC_FACE: { const Company *c = Company::Get((CompanyID)this->window_number); - DrawCompanyManagerFace(c->face, c->colour, r.left, r.top); + DrawCompanyManagerFace(c->face, c->colour, r); break; } diff --git a/src/company_manager_face.h b/src/company_manager_face.h index 83bfd29e11..3c947e05b4 100644 --- a/src/company_manager_face.h +++ b/src/company_manager_face.h @@ -236,6 +236,6 @@ static inline SpriteID GetCompanyManagerFaceSprite(CompanyManagerFace cmf, Compa return _cmf_info[cmfv].first_sprite[ge] + GB(cmf, _cmf_info[cmfv].offset, _cmf_info[cmfv].length); } -void DrawCompanyManagerFace(CompanyManagerFace face, int colour, int x, int y); +void DrawCompanyManagerFace(CompanyManagerFace face, int colour, const Rect &r); #endif /* COMPANY_MANAGER_FACE_H */ diff --git a/src/company_type.h b/src/company_type.h index d6a0f17ccf..eaa06b41b7 100644 --- a/src/company_type.h +++ b/src/company_type.h @@ -42,6 +42,9 @@ static const uint MAX_LENGTH_COMPANY_NAME_CHARS = 32; ///< The maximum length static const uint MAX_HISTORY_QUARTERS = 24; ///< The maximum number of quarters kept as performance's history static const uint MAX_COMPANY_SHARE_OWNERS = 4; ///< The maximum number of shares of a company that can be owned by another company. +static const uint MIN_COMPETITORS_INTERVAL = 0; ///< The minimum interval (in minutes) between competitors. +static const uint MAX_COMPETITORS_INTERVAL = 500; ///< The maximum interval (in minutes) between competitors. + /** Define basic enum properties */ template <> struct EnumPropsT : MakeEnumPropsT {}; diff --git a/src/economy.cpp b/src/economy.cpp index 30ee49e678..c14aa457b3 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1151,7 +1151,7 @@ uint DeliverGoodsToIndustryNearestFirst(const Station *st, CargoID cargo_type, u accepted += amount; /* Update the cargo monitor. */ - AddCargoDelivery(cargo_type, company, amount, ST_INDUSTRY, source, st, ind->index); + AddCargoDelivery(cargo_type, company, amount, SourceType::Industry, source, st, ind->index); return num_pieces != 0; }); @@ -1192,7 +1192,7 @@ uint DeliverGoodsToIndustryEqually(const Station *st, CargoID cargo_type, uint n include(_cargo_delivery_destinations, e.ind); e.ind->incoming_cargo_waiting[e.cargo_index] += e.delivered; e.ind->last_cargo_accepted_at[e.cargo_index] = _date; - AddCargoDelivery(cargo_type, company, e.delivered, ST_INDUSTRY, source, st, e.ind->index); + AddCargoDelivery(cargo_type, company, e.delivered, SourceType::Industry, source, st, e.ind->index); }; if (acceptingIndustries.size() == 1) { @@ -1293,7 +1293,7 @@ static Money DeliverGoods(int num_pieces, CargoID cargo_type, StationID dest, Ti Station *st = Station::Get(dest); /* Give the goods to the industry. */ - uint accepted_ind = DeliverGoodsToIndustry(st, cargo_type, num_pieces, src_type == ST_INDUSTRY ? src : INVALID_INDUSTRY, company->index); + uint accepted_ind = DeliverGoodsToIndustry(st, cargo_type, num_pieces, src_type == SourceType::Industry ? src : INVALID_INDUSTRY, company->index); /* If this cargo type is always accepted, accept all */ uint accepted_total = HasBit(st->always_accepted, cargo_type) ? num_pieces : accepted_ind; diff --git a/src/engine.cpp b/src/engine.cpp index dfa3424ae0..424c6d879a 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -1339,6 +1339,9 @@ void CheckEngines() for (const Engine *e : Engine::Iterate()) { if (!e->IsEnabled()) continue; + /* Don't consider train wagons, we need a powered engine available. */ + if (e->type == VEH_TRAIN && e->u.rail.railveh_type == RAILVEH_WAGON) continue; + /* We have an available engine... yay! */ if ((e->flags & ENGINE_AVAILABLE) != 0 && e->company_avail != 0) return; diff --git a/src/error_gui.cpp b/src/error_gui.cpp index adafeb5168..d61077829d 100644 --- a/src/error_gui.cpp +++ b/src/error_gui.cpp @@ -214,7 +214,7 @@ public: break; } case WID_EM_FACE: { - Dimension face_size = GetSpriteSize(SPR_GRADIENT); + Dimension face_size = GetScaledSpriteSize(SPR_GRADIENT); size->width = std::max(size->width, face_size.width); size->height = std::max(size->height, face_size.height); break; @@ -274,7 +274,7 @@ public: switch (widget) { case WID_EM_FACE: { const Company *c = Company::Get(this->face); - DrawCompanyManagerFace(c->face, c->colour, r.left, r.top); + DrawCompanyManagerFace(c->face, c->colour, r); break; } diff --git a/src/fontcache/freetypefontcache.cpp b/src/fontcache/freetypefontcache.cpp index 023367e8f7..f8224a53ae 100644 --- a/src/fontcache/freetypefontcache.cpp +++ b/src/fontcache/freetypefontcache.cpp @@ -243,7 +243,7 @@ const Sprite *FreeTypeFontCache::InternalGetGlyph(GlyphID key, bool aa) /* FreeType has rendered the glyph, now we allocate a sprite and copy the image into it */ SpriteLoader::Sprite sprite; sprite.AllocateData(ZOOM_LVL_NORMAL, static_cast(width) * height); - sprite.type = ST_FONT; + sprite.type = SpriteType::Font; sprite.colours = (aa ? SCC_PAL | SCC_ALPHA : SCC_PAL); sprite.width = width; sprite.height = height; diff --git a/src/fontcache/spritefontcache.cpp b/src/fontcache/spritefontcache.cpp index 171e5dd5d4..da25a9b125 100644 --- a/src/fontcache/spritefontcache.cpp +++ b/src/fontcache/spritefontcache.cpp @@ -124,14 +124,14 @@ const Sprite *SpriteFontCache::GetGlyph(GlyphID key) { SpriteID sprite = this->GetUnicodeGlyph(key); if (sprite == 0) sprite = this->GetUnicodeGlyph('?'); - return GetSprite(sprite, ST_FONT); + return GetSprite(sprite, SpriteType::Font); } uint SpriteFontCache::GetGlyphWidth(GlyphID key) { SpriteID sprite = this->GetUnicodeGlyph(key); if (sprite == 0) sprite = this->GetUnicodeGlyph('?'); - return SpriteExists(sprite) ? GetSprite(sprite, ST_FONT)->width + ScaleFontTrad(this->fs != FS_NORMAL ? 1 : 0) : 0; + return SpriteExists(sprite) ? GetSprite(sprite, SpriteType::Font)->width + ScaleFontTrad(this->fs != FS_NORMAL ? 1 : 0) : 0; } bool SpriteFontCache::GetDrawGlyphShadow() diff --git a/src/fontcache/truetypefontcache.cpp b/src/fontcache/truetypefontcache.cpp index 8b35dd8204..f6f389b7fc 100644 --- a/src/fontcache/truetypefontcache.cpp +++ b/src/fontcache/truetypefontcache.cpp @@ -141,7 +141,7 @@ const Sprite *TrueTypeFontCache::GetGlyph(GlyphID key) 8, // width 0, // x_offs 0, // y_offs - ST_FONT, + SpriteType::Font, SCC_PAL, builtin_questionmark_data }; diff --git a/src/game/game_info.cpp b/src/game/game_info.cpp index d8237d3180..96e1284c09 100644 --- a/src/game/game_info.cpp +++ b/src/game/game_info.cpp @@ -30,12 +30,12 @@ static bool CheckAPIVersion(const char *api_version) #if defined(_WIN32) #undef GetClassName #endif /* _WIN32 */ -template <> const char *GetClassName() { return "GSInfo"; } +template <> const char *GetClassName() { return "GSInfo"; } /* static */ void GameInfo::RegisterAPI(Squirrel *engine) { /* Create the GSInfo class, and add the RegisterGS function */ - DefSQClass SQGSInfo("GSInfo"); + DefSQClass SQGSInfo("GSInfo"); SQGSInfo.PreRegister(engine); SQGSInfo.AddConstructor(engine, "x"); SQGSInfo.DefSQAdvancedMethod(engine, &GameInfo::AddSetting, "AddSetting"); diff --git a/src/game/game_instance.cpp b/src/game/game_instance.cpp index d49d7b9f1d..82cbc0cdcb 100644 --- a/src/game/game_instance.cpp +++ b/src/game/game_instance.cpp @@ -27,7 +27,7 @@ GameInstance::GameInstance() : - ScriptInstance("GS", ST_GS) + ScriptInstance("GS", ScriptType::GS) {} void GameInstance::Initialize(GameInfo *info) diff --git a/src/gfx.cpp b/src/gfx.cpp index edbb80d007..608d69f3d1 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -91,7 +91,7 @@ byte _colour_value[COLOUR_END] = { struct GfxBlitterCtx { const DrawPixelInfo *dpi; const byte *colour_remap_ptr = nullptr; - byte string_colourremap[3]; ///< Recoloursprite for stringdrawing. The grf loader ensures that #ST_FONT sprites only use colours 0 to 2. + byte string_colourremap[3]; ///< Recoloursprite for stringdrawing. The grf loader ensures that #SpriteType::Font sprites only use colours 0 to 2. int sprite_brightness_adjust = 0; GfxBlitterCtx(const DrawPixelInfo *dpi) : dpi(dpi) {} @@ -1031,7 +1031,7 @@ void DrawCharCentered(WChar c, const Rect &r, TextColour colour) */ Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom) { - const Sprite *sprite = GetSprite(sprid, ST_NORMAL); + const Sprite *sprite = GetSprite(sprid, SpriteType::Normal); if (offset != nullptr) { offset->x = UnScaleByZoom(sprite->x_offs, zoom); @@ -1077,7 +1077,7 @@ void DrawSpriteViewport(const SpritePointerHolder &sprite_store, const DrawPixel SpriteID real_sprite = GB(img, 0, SPRITE_WIDTH); if (HasBit(img, PALETTE_MODIFIER_TRANSPARENT)) { ctx.colour_remap_ptr = sprite_store.GetRecolourSprite(GB(pal, 0, PALETTE_WIDTH)) + 1; - GfxMainBlitterViewport(ctx, sprite_store.GetSprite(real_sprite, ST_NORMAL), x, y, BM_TRANSPARENT, sub, real_sprite); + GfxMainBlitterViewport(ctx, sprite_store.GetSprite(real_sprite, SpriteType::Normal), x, y, BM_TRANSPARENT, sub, real_sprite); } else if (pal != PAL_NONE) { if (HasBit(pal, PALETTE_TEXT_RECOLOUR)) { ctx.SetColourRemap((TextColour)GB(pal, 0, PALETTE_WIDTH)); @@ -1090,21 +1090,21 @@ void DrawSpriteViewport(const SpritePointerHolder &sprite_store, const DrawPixel int sign_bit = 1 << (PALETTE_BRIGHTNESS_WIDTH - 1); ctx.sprite_brightness_adjust = (adjust ^ sign_bit) - sign_bit; } - GfxMainBlitterViewport(ctx, sprite_store.GetSprite(real_sprite, ST_NORMAL), x, y, GetBlitterMode(pal), sub, real_sprite); + GfxMainBlitterViewport(ctx, sprite_store.GetSprite(real_sprite, SpriteType::Normal), x, y, GetBlitterMode(pal), sub, real_sprite); } else { - GfxMainBlitterViewport(ctx, sprite_store.GetSprite(real_sprite, ST_NORMAL), x, y, BM_NORMAL, sub, real_sprite); + GfxMainBlitterViewport(ctx, sprite_store.GetSprite(real_sprite, SpriteType::Normal), x, y, BM_NORMAL, sub, real_sprite); } } void PrepareDrawSpriteViewportSpriteStore(SpritePointerHolder &sprite_store, SpriteID img, PaletteID pal) { SpriteID real_sprite = GB(img, 0, SPRITE_WIDTH); - sprite_store.CacheSprite(real_sprite, ST_NORMAL); + sprite_store.CacheSprite(real_sprite, SpriteType::Normal); if (HasBit(img, PALETTE_MODIFIER_TRANSPARENT)) { - sprite_store.CacheSprite(GB(pal, 0, PALETTE_WIDTH), ST_RECOLOUR); + sprite_store.CacheSprite(GB(pal, 0, PALETTE_WIDTH), SpriteType::Recolour); } else if (pal != PAL_NONE) { if (!HasBit(pal, PALETTE_TEXT_RECOLOUR) && GB(pal, 0, PALETTE_WIDTH) != PAL_NONE) { - sprite_store.CacheSprite(GB(pal, 0, PALETTE_WIDTH), ST_RECOLOUR); + sprite_store.CacheSprite(GB(pal, 0, PALETTE_WIDTH), SpriteType::Recolour); } } } @@ -1123,17 +1123,17 @@ void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, GfxBlitterCtx ctx(_cur_dpi); SpriteID real_sprite = GB(img, 0, SPRITE_WIDTH); if (HasBit(img, PALETTE_MODIFIER_TRANSPARENT)) { - ctx.colour_remap_ptr = GetNonSprite(GB(pal, 0, PALETTE_WIDTH), ST_RECOLOUR) + 1; - GfxMainBlitter(ctx, GetSprite(real_sprite, ST_NORMAL), x, y, BM_TRANSPARENT, sub, real_sprite, zoom); + ctx.colour_remap_ptr = GetNonSprite(GB(pal, 0, PALETTE_WIDTH), SpriteType::Recolour) + 1; + GfxMainBlitter(ctx, GetSprite(real_sprite, SpriteType::Normal), x, y, BM_TRANSPARENT, sub, real_sprite, zoom); } else if (pal != PAL_NONE) { if (HasBit(pal, PALETTE_TEXT_RECOLOUR)) { ctx.SetColourRemap((TextColour)GB(pal, 0, PALETTE_WIDTH)); } else { - ctx.colour_remap_ptr = GetNonSprite(GB(pal, 0, PALETTE_WIDTH), ST_RECOLOUR) + 1; + ctx.colour_remap_ptr = GetNonSprite(GB(pal, 0, PALETTE_WIDTH), SpriteType::Recolour) + 1; } - GfxMainBlitter(ctx, GetSprite(real_sprite, ST_NORMAL), x, y, GetBlitterMode(pal), sub, real_sprite, zoom); + GfxMainBlitter(ctx, GetSprite(real_sprite, SpriteType::Normal), x, y, GetBlitterMode(pal), sub, real_sprite, zoom); } else { - GfxMainBlitter(ctx, GetSprite(real_sprite, ST_NORMAL), x, y, BM_NORMAL, sub, real_sprite, zoom); + GfxMainBlitter(ctx, GetSprite(real_sprite, SpriteType::Normal), x, y, BM_NORMAL, sub, real_sprite, zoom); } } @@ -1283,7 +1283,7 @@ std::unique_ptr DrawSpriteToRgbaBuffer(SpriteID spriteId, ZoomLevel zo /* Gather information about the sprite to write, reserve memory */ const SpriteID real_sprite = GB(spriteId, 0, SPRITE_WIDTH); - const Sprite *sprite = GetSprite(real_sprite, ST_NORMAL); + const Sprite *sprite = GetSprite(real_sprite, SpriteType::Normal); Dimension dim = GetSpriteSize(real_sprite, nullptr, zoom); size_t dim_size = static_cast(dim.width) * dim.height; std::unique_ptr result(new uint32[dim_size]); @@ -2155,7 +2155,7 @@ void UpdateCursorSize() static_assert(lengthof(_cursor.sprite_seq) == lengthof(_cursor.sprite_pos)); assert(_cursor.sprite_count <= lengthof(_cursor.sprite_seq)); for (uint i = 0; i < _cursor.sprite_count; ++i) { - const Sprite *p = GetSprite(GB(_cursor.sprite_seq[i].sprite, 0, SPRITE_WIDTH), ST_NORMAL); + const Sprite *p = GetSprite(GB(_cursor.sprite_seq[i].sprite, 0, SPRITE_WIDTH), SpriteType::Normal); Point offs, size; offs.x = UnScaleGUI(p->x_offs) + _cursor.sprite_pos[i].x; offs.y = UnScaleGUI(p->y_offs) + _cursor.sprite_pos[i].y; diff --git a/src/gfx_type.h b/src/gfx_type.h index 919be84485..520e901965 100644 --- a/src/gfx_type.h +++ b/src/gfx_type.h @@ -309,12 +309,12 @@ enum PaletteType { }; /** Types of sprites that might be loaded */ -enum SpriteType : byte { - ST_NORMAL = 0, ///< The most basic (normal) sprite - ST_MAPGEN = 1, ///< Special sprite for the map generator - ST_FONT = 2, ///< A sprite used for fonts - ST_RECOLOUR = 3, ///< Recolour sprite - ST_INVALID = 4, ///< Pseudosprite or other unusable sprite, used only internally +enum class SpriteType : byte { + Normal = 0, ///< The most basic (normal) sprite + MapGen = 1, ///< Special sprite for the map generator + Font = 2, ///< A sprite used for fonts + Recolour = 3, ///< Recolour sprite + Invalid = 4, ///< Pseudosprite or other unusable sprite, used only internally }; /** diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 0adf0801b4..97a1dc545b 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -74,21 +74,16 @@ IndustryBuildData _industry_builder; ///< In-game manager of industries. */ void ResetIndustries() { - for (IndustryType i = 0; i < NUM_INDUSTRYTYPES; i++) { - /* Reset the spec to default */ - if (i < lengthof(_origin_industry_specs)) { - _industry_specs[i] = _origin_industry_specs[i]; - } else { - _industry_specs[i] = IndustrySpec{}; - } + auto industry_insert = std::copy(std::begin(_origin_industry_specs), std::end(_origin_industry_specs), std::begin(_industry_specs)); + std::fill(industry_insert, std::end(_industry_specs), IndustrySpec{}); + for (IndustryType i = 0; i < lengthof(_origin_industry_specs); i++) { /* Enable only the current climate industries */ - _industry_specs[i].enabled = i < NEW_INDUSTRYOFFSET && - HasBit(_origin_industry_specs[i].climate_availability, _settings_game.game_creation.landscape); + _industry_specs[i].enabled = HasBit(_industry_specs[i].climate_availability, _settings_game.game_creation.landscape); } - memset(&_industry_tile_specs, 0, sizeof(_industry_tile_specs)); - memcpy(&_industry_tile_specs, &_origin_industry_tile_specs, sizeof(_origin_industry_tile_specs)); + auto industry_tile_insert = std::copy(std::begin(_origin_industry_tile_specs), std::end(_origin_industry_tile_specs), std::begin(_industry_tile_specs)); + std::fill(industry_tile_insert, std::end(_industry_tile_specs), IndustryTileSpec{}); /* Reset any overrides that have been set. */ _industile_mngr.ResetOverride(); @@ -195,8 +190,8 @@ Industry::~Industry() DeleteWindowById(WC_INDUSTRY_VIEW, this->index); DeleteNewGRFInspectWindow(GSF_INDUSTRIES, this->index); - DeleteSubsidyWith(ST_INDUSTRY, this->index); - CargoPacket::InvalidateAllFrom(ST_INDUSTRY, this->index); + DeleteSubsidyWith(SourceType::Industry, this->index); + CargoPacket::InvalidateAllFrom(SourceType::Industry, this->index); for (Station *st : this->stations_near) { st->RemoveIndustryToDeliver(this); @@ -546,7 +541,7 @@ static bool TransportIndustryGoods(TileIndex tile) i->this_month_production[j] = std::min(i->this_month_production[j] + cw, 0xFFFF); - uint am = MoveGoodsToStation(i->produced_cargo[j], cw, ST_INDUSTRY, i->index, &i->stations_near, i->exclusive_consumer); + uint am = MoveGoodsToStation(i->produced_cargo[j], cw, SourceType::Industry, i->index, &i->stations_near, i->exclusive_consumer); i->this_month_transported[j] += am; moved_cargo |= (am != 0); diff --git a/src/landscape.cpp b/src/landscape.cpp index 56ec9b25e7..5cf8ce6c80 100644 --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -899,7 +899,7 @@ static void GenerateTerrain(int type, uint flag) uint32 r = Random(); /* Choose one of the templates from the graphics file. */ - const Sprite *templ = GetSprite((((r >> 24) * _genterrain_tbl_1[type]) >> 8) + _genterrain_tbl_2[type] + SPR_MAPGEN_BEGIN, ST_MAPGEN); + const Sprite *templ = GetSprite((((r >> 24) * _genterrain_tbl_1[type]) >> 8) + _genterrain_tbl_2[type] + SPR_MAPGEN_BEGIN, SpriteType::MapGen); if (templ == nullptr) usererror("Map generator sprites could not be loaded"); /* Chose a random location to apply the template to. */ diff --git a/src/lang/afrikaans.txt b/src/lang/afrikaans.txt index 5647bce944..0d5f48bf65 100644 --- a/src/lang/afrikaans.txt +++ b/src/lang/afrikaans.txt @@ -4287,7 +4287,6 @@ STR_AI_SETTINGS_CAPTION_AI :AI STR_AI_SETTINGS_CLOSE :{BLACK}Maak toe STR_AI_SETTINGS_RESET :{BLACK}Herstel STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Aantal Dae om die AI te begin na die vorige een (omenby): {ORANGE}{STRING} # Textfile window @@ -5146,10 +5145,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut Helik ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Company {COMMA}) STR_FORMAT_GROUP_NAME :Groep {COMMA} diff --git a/src/lang/arabic_egypt.txt b/src/lang/arabic_egypt.txt index 49f1bceda4..d632dde908 100644 --- a/src/lang/arabic_egypt.txt +++ b/src/lang/arabic_egypt.txt @@ -4842,10 +4842,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :باور هيل ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :شركة {COMMA} STR_FORMAT_GROUP_NAME :مجموعة{COMMA} diff --git a/src/lang/basque.txt b/src/lang/basque.txt index 394885beeb..89f49b2b64 100644 --- a/src/lang/basque.txt +++ b/src/lang/basque.txt @@ -4036,7 +4036,6 @@ STR_AI_SETTINGS_CAPTION_AI :IA STR_AI_SETTINGS_CLOSE :{BLACK}Itxi STR_AI_SETTINGS_RESET :{BLACK}Berrabiarazi STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :IA hau abiarazteko pasa beharko diren egunak (gutxi gora behera): {ORANGE}{STRING} # Textfile window @@ -4878,10 +4877,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut Helik ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :({COMMA} Konpainia) STR_FORMAT_GROUP_NAME :Taldea {COMMA} diff --git a/src/lang/belarusian.txt b/src/lang/belarusian.txt index a927ed9661..0d5f4554ad 100644 --- a/src/lang/belarusian.txt +++ b/src/lang/belarusian.txt @@ -4643,7 +4643,6 @@ STR_AI_SETTINGS_CAPTION_AI :ШI STR_AI_SETTINGS_CLOSE :{BLACK}Закрыць STR_AI_SETTINGS_RESET :{BLACK}Ськід STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Колькасьць дзён да старту гэтага AI/ШI пасьля папярэдняга: {ORANGE}{STRING} # Textfile window @@ -5618,10 +5617,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Шрубалё ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}.{STRING}.{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}.{ZEROFILL_NUM}.{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} г. STR_FORMAT_DATE_LONG :{STRING} {STRING.gen} {NUM} г. -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Кампанiя {COMMA}) STR_FORMAT_GROUP_NAME :Група {COMMA} diff --git a/src/lang/brazilian_portuguese.txt b/src/lang/brazilian_portuguese.txt index e16b9dfcbc..d01ad1f1e7 100644 --- a/src/lang/brazilian_portuguese.txt +++ b/src/lang/brazilian_portuguese.txt @@ -4635,7 +4635,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Script de Jogo STR_AI_SETTINGS_CLOSE :{BLACK}Fechar STR_AI_SETTINGS_RESET :{BLACK}Resetar STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Número de dias para começar esta IA após a última: {ORANGE}{STRING} # Textfile window @@ -5518,10 +5517,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Helicóptero Po ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Companhia {COMMA}) STR_FORMAT_GROUP_NAME :Agrupar {COMMA} diff --git a/src/lang/bulgarian.txt b/src/lang/bulgarian.txt index d978e00f1a..fd653c5818 100644 --- a/src/lang/bulgarian.txt +++ b/src/lang/bulgarian.txt @@ -4114,7 +4114,6 @@ STR_AI_SETTINGS_CAPTION_AI :AI STR_AI_SETTINGS_CLOSE :{BLACK}Затвори STR_AI_SETTINGS_RESET :{BLACK}Рестартиране STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Броят дни докато този ИИ бъде стартиран след предишния (give or take): {ORANGE}{STRING} # Textfile window @@ -4967,10 +4966,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Пауерна ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Компания {COMMA}) STR_FORMAT_GROUP_NAME :Група {COMMA} diff --git a/src/lang/catalan.txt b/src/lang/catalan.txt index cb10d70d1d..eac967f762 100644 --- a/src/lang/catalan.txt +++ b/src/lang/catalan.txt @@ -4635,7 +4635,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Script de la pa STR_AI_SETTINGS_CLOSE :{BLACK}Tanca STR_AI_SETTINGS_RESET :{BLACK}Restableix STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Dies des de l'inici de la IA prèvia fins que s'inicia aquesta: {ORANGE}{STRING} # Textfile window @@ -5518,10 +5517,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :{G=Masculin}Hel ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :{G=Femenin}(Companyia {COMMA}) STR_FORMAT_GROUP_NAME :{G=Masculin}Grup {COMMA} diff --git a/src/lang/chuvash.txt b/src/lang/chuvash.txt index 4b4149f4d1..378e0e7cc7 100644 --- a/src/lang/chuvash.txt +++ b/src/lang/chuvash.txt @@ -1757,10 +1757,10 @@ STR_SV_STNAME_WAYPOINT :{STRING} ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}.{STRING}.{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}.{ZEROFILL_NUM}.{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} ###length 2 diff --git a/src/lang/croatian.txt b/src/lang/croatian.txt index eec916b16b..0f181c624f 100644 --- a/src/lang/croatian.txt +++ b/src/lang/croatian.txt @@ -4473,7 +4473,6 @@ STR_AI_SETTINGS_CAPTION_AI :UI STR_AI_SETTINGS_CLOSE :{BLACK}Zatvori STR_AI_SETTINGS_RESET :{BLACK}Resetiraj STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Broj dana za start ovog UI-ja nakon prethodnog (otprilike): {ORANGE}{STRING} # Textfile window @@ -5371,10 +5370,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Helikopter Powe ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Tvrtka {COMMA}) STR_FORMAT_GROUP_NAME :Groupa {COMMA} diff --git a/src/lang/czech.txt b/src/lang/czech.txt index 615ad24546..64f1342c0b 100644 --- a/src/lang/czech.txt +++ b/src/lang/czech.txt @@ -4724,7 +4724,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Herní skript STR_AI_SETTINGS_CLOSE :{BLACK}Zavřít STR_AI_SETTINGS_RESET :{BLACK}Obnovit nastavení STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Počet dní kdy se spustí tato AI po předchozí (plus/mínus): {ORANGE}{STRING} # Textfile window @@ -5725,11 +5724,11 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Vrtulník Power ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_SHORT.gen :{STRING.gen} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(společnost {COMMA}) STR_FORMAT_GROUP_NAME :Skupina {COMMA} diff --git a/src/lang/danish.txt b/src/lang/danish.txt index c9eb339a0f..19f447f4fc 100644 --- a/src/lang/danish.txt +++ b/src/lang/danish.txt @@ -4634,7 +4634,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Spil Script STR_AI_SETTINGS_CLOSE :{BLACK}Luk STR_AI_SETTINGS_RESET :{BLACK}Nulstil STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Antal dage denne AI skal starte efter den forrige (plus/minus): {ORANGE}{STRING} # Textfile window @@ -5517,10 +5516,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut Helik ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Firma {COMMA}) STR_FORMAT_GROUP_NAME :Gruppe {COMMA} diff --git a/src/lang/dutch.txt b/src/lang/dutch.txt index 86a5938263..fb7cbc72de 100644 --- a/src/lang/dutch.txt +++ b/src/lang/dutch.txt @@ -1926,6 +1926,10 @@ STR_CONFIG_SETTING_LARGER_TOWNS_DISABLED :Geen STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER :Beginfactor voor stadsgroei: {STRING} STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :Gemiddelde grootte van steden in vergelijking tot normale steden bij het begin van het spel. +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL :Distributiegrafiek elke {STRING}{NBSP}second{P 0:2 "" en} bijwerken +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL_HELPTEXT :De tijd tussen opeenvolgende herberekeningen van de koppeling-grafiek. Elke berekening berekent de plannen voor één component van de grafiek. Dat betekent dat een waarde X voor deze instelling niet betekent dat de hele grafiek elke X seconden wordt bijgewerkt. Dat geldt alleen voor één component. Hoe korter je deze waarde instelt, hoe meer CPU-tijd er nodig is voor de berekening. Hoe langer je deze waarde instelt, hoe langer het duurt voordat de vrachtdistributie start op nieuwe routes. +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME :Besteed {STRING}{NBSP}second{P 0:2 "" en} per herberekening van de distributiegrafiek +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME_HELPTEXT :De benodigde tijd voor een herbereking van een koppeling-grafiekcomponent. Wanneer een herberekening wordt gestart, start een draad die dit aantal seconden mag lopen. Hoe korter je deze waarde maakt, hoe groter de kans dat de draad is niet op tijd is afgelopen. Het spel stopt dan totdat dit alsnog gebeurt (het 'hikt'). Hoe langer je deze waarde maakt, hoe langer het duurt voor de distributie wordt bijgewerkt wanneer een route wijzigt. STR_CONFIG_SETTING_DISTRIBUTION_PAX :Distributiemodus voor passagiers: {STRING} STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :'Symmetrisch' betekent dat ongeveer hetzelfde aantal passagiers van station A naar station B gaat als van B naar A. 'Asymmetrisch' betekent dat willekeurige aantallen passagiers reizen in beide richtingen. 'Handmatig' betekent dat er geen automatische distributie plaatsvindt voor passagiers. @@ -4588,6 +4592,7 @@ STR_AI_CONFIG_RANDOM_AI :Willekeurige AI STR_AI_CONFIG_NONE :(geen) STR_AI_CONFIG_NAME_VERSION :{STRING} {YELLOW}v{NUM} STR_AI_CONFIG_MAX_COMPETITORS :{LTBLUE}Maximaal aantal tegenstanders: {ORANGE}{COMMA} +STR_AI_CONFIG_COMPETITORS_INTERVAL :{LTBLUE}Tijdsduur tussen starts van concurrenten: {ORANGE}{COMMA} minu{P "ut" "ten"} STR_AI_CONFIG_MOVE_UP :{BLACK}Omhoog verplaatsen STR_AI_CONFIG_MOVE_UP_TOOLTIP :{BLACK}Geselecteerde AI omhoog verplaatsen in de lijst @@ -4634,7 +4639,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Spelscript STR_AI_SETTINGS_CLOSE :{BLACK}Sluiten STR_AI_SETTINGS_RESET :{BLACK}Terugstellen STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Aantal dagen dat deze AI start na de vorige (ongeveer): {ORANGE}{STRING} # Textfile window @@ -5517,10 +5521,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut-helik ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Bedrijf {COMMA}) STR_FORMAT_GROUP_NAME :Groep {COMMA} diff --git a/src/lang/english.txt b/src/lang/english.txt index 0ea5d374b0..b12b339f9a 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1712,7 +1712,7 @@ STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_HELPTEXT :How much memory STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_VALUE :{COMMA} MiB STR_CONFIG_SETTING_SERVINT_ISPERCENT :Service intervals are in percents: {STRING2} -STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :Choose whether servicing of vehicles is triggered by the time passed since last service or by reliability dropping by a certain percentage of the maximum reliability +STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :When enabled, vehicles try to service when their reliability drops by a given percentage of the maximum reliability.{}{}For example, if a vehicle's maximum reliability is 90% and the service interval is 20%, the vehicle will try to service when it reaches 72% reliability. STR_CONFIG_SETTING_SERVINT_TRAINS :Default service interval for trains: {STRING2} STR_CONFIG_SETTING_SERVINT_TRAINS_HELPTEXT :Set the default service interval for new rail vehicles, if no explicit service interval is set for the vehicle @@ -4592,6 +4592,7 @@ STR_AI_CONFIG_RANDOM_AI :Random AI STR_AI_CONFIG_NONE :(none) STR_AI_CONFIG_NAME_VERSION :{RAW_STRING} {YELLOW}v{NUM} STR_AI_CONFIG_MAX_COMPETITORS :{LTBLUE}Maximum no. competitors: {ORANGE}{COMMA} +STR_AI_CONFIG_COMPETITORS_INTERVAL :{LTBLUE}Interval between starting of competitors: {ORANGE}{COMMA} minute{P "" s} STR_AI_CONFIG_MOVE_UP :{BLACK}Move Up STR_AI_CONFIG_MOVE_UP_TOOLTIP :{BLACK}Move selected AI up in the list @@ -4638,7 +4639,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Game Script STR_AI_SETTINGS_CLOSE :{BLACK}Close STR_AI_SETTINGS_RESET :{BLACK}Reset STR_AI_SETTINGS_SETTING :{RAW_STRING}: {ORANGE}{STRING1} -STR_AI_SETTINGS_START_DELAY :Number of days to start this AI after the previous one (give or take): {ORANGE}{STRING1} # Textfile window @@ -5110,6 +5110,7 @@ STR_ERROR_NO_BUOY :{WHITE}There is STR_ERROR_CAN_T_TIMETABLE_VEHICLE :{WHITE}Can't timetable vehicle... STR_ERROR_TIMETABLE_ONLY_WAIT_AT_STATIONS :{WHITE}Vehicles can only wait at stations STR_ERROR_TIMETABLE_NOT_STOPPING_HERE :{WHITE}This vehicle is not stopping at this station +STR_ERROR_TIMETABLE_INCOMPLETE :{WHITE}... timetable is incomplete # Sign related errors STR_ERROR_TOO_MANY_SIGNS :{WHITE}... too many signs @@ -5521,10 +5522,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut Helic ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{RAW_STRING}-{RAW_STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:RAW_STRING}-{0:RAW_STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Company {COMMA}) STR_FORMAT_GROUP_NAME :Group {COMMA} diff --git a/src/lang/english_AU.txt b/src/lang/english_AU.txt index ab7d6f6207..dcf69b67c6 100644 --- a/src/lang/english_AU.txt +++ b/src/lang/english_AU.txt @@ -1712,7 +1712,7 @@ STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_HELPTEXT :How much memory STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_VALUE :{COMMA} MiB STR_CONFIG_SETTING_SERVINT_ISPERCENT :Service intervals are in percents: {STRING} -STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :Choose whether servicing of vehicles is triggered by the time passed since last service or by reliability dropping by a certain percentage of the maximum reliability +STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :When enabled, vehicles try to service when their reliability drops by a given percentage of the maximum reliability.{}{}For example, if a vehicle's maximum reliability is 90% and the service interval is 20%, the vehicle will try to service when it reaches 72% reliability. STR_CONFIG_SETTING_SERVINT_TRAINS :Default service interval for trains: {STRING} STR_CONFIG_SETTING_SERVINT_TRAINS_HELPTEXT :Set the default service interval for new rail vehicles, if no explicit service interval is set for the vehicle @@ -1926,6 +1926,10 @@ STR_CONFIG_SETTING_LARGER_TOWNS_DISABLED :None STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER :Initial city size multiplier: {STRING} STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :Average size of cities relative to normal towns at start of the game +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL :Update distribution graph every {STRING}{NBSP}second{P 0:2 "" s} +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL_HELPTEXT :Time between subsequent recalculations of the link graph. Each recalculation calculates the plans for one component of the graph. That means that a value X for this setting does not mean the whole graph will be updated every X seconds. Only some component will. The shorter you set it the more CPU time will be necessary to calculate it. The longer you set it the longer it will take until the cargo distribution starts on new routes. +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME :Take {STRING}{NBSP}second{P 0:2 "" s} for recalculation of distribution graph +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME_HELPTEXT :Time taken for each recalculation of a link graph component. When a recalculation is started, a thread is spawned which is allowed to run for this number of seconds. The shorter you set this the more likely it is that the thread is not finished when it's supposed to. Then the game stops until it is ("lag"). The longer you set it the longer it takes for the distribution to be updated when routes change. STR_CONFIG_SETTING_DISTRIBUTION_PAX :Distribution mode for passengers: {STRING} STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :"Symmetric" means that roughly the same number of passengers will go from a station A to a station B as from B to A. "Asymmetric" means that arbitrary numbers of passengers can go in either direction. "Manual" means that no automatic distribution will take place for passengers. @@ -4588,6 +4592,7 @@ STR_AI_CONFIG_RANDOM_AI :Random AI STR_AI_CONFIG_NONE :(none) STR_AI_CONFIG_NAME_VERSION :{STRING} {YELLOW}v{NUM} STR_AI_CONFIG_MAX_COMPETITORS :{LTBLUE}Maximum no. competitors: {ORANGE}{COMMA} +STR_AI_CONFIG_COMPETITORS_INTERVAL :{LTBLUE}Interval between starting of competitors: {ORANGE}{COMMA} minute{P "" s} STR_AI_CONFIG_MOVE_UP :{BLACK}Move Up STR_AI_CONFIG_MOVE_UP_TOOLTIP :{BLACK}Move selected AI up in the list @@ -4634,7 +4639,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Game Script STR_AI_SETTINGS_CLOSE :{BLACK}Close STR_AI_SETTINGS_RESET :{BLACK}Reset STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Number of days to start this AI after the previous one (give or take): {ORANGE}{STRING} # Textfile window @@ -5517,10 +5521,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut Helic ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Company {COMMA}) STR_FORMAT_GROUP_NAME :Group {COMMA} diff --git a/src/lang/english_US.txt b/src/lang/english_US.txt index f417b60c98..355043283c 100644 --- a/src/lang/english_US.txt +++ b/src/lang/english_US.txt @@ -1712,7 +1712,7 @@ STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_HELPTEXT :How much memory STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_VALUE :{COMMA} MiB STR_CONFIG_SETTING_SERVINT_ISPERCENT :Maintenance intervals are in percents: {STRING} -STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :Choose whether maintenance of vehicles is triggered by the time passed since last maintenance or by reliability dropping by a certain percentage of the maximum reliability +STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :When enabled, vehicles try to service when their reliability drops by a given percentage of the maximum reliability.{}{}For example, if a vehicle's maximum reliability is 90% and the service interval is 20%, the vehicle will try to service when it reaches 72% reliability. STR_CONFIG_SETTING_SERVINT_TRAINS :Default maintenance interval for trains: {STRING} STR_CONFIG_SETTING_SERVINT_TRAINS_HELPTEXT :Set the default maintenance interval for new rail vehicles, if no explicit maintenance interval is set for the vehicle @@ -1926,6 +1926,10 @@ STR_CONFIG_SETTING_LARGER_TOWNS_DISABLED :None STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER :Initial city size multiplier: {STRING} STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :Average size of cities relative to normal towns at start of the game +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL :Update distribution graph every {STRING}{NBSP}second{P 0:2 "" s} +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL_HELPTEXT :Time between subsequent recalculations of the link graph. Each recalculation calculates the plans for one component of the graph. That means that a value X for this setting does not mean the whole graph will be updated every X seconds. Only some component will. The shorter you set it the more CPU time will be necessary to calculate it. The longer you set it the longer it will take until the cargo distribution starts on new routes. +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME :Take {STRING}{NBSP}second{P 0:2 "" s} for recalculation of distribution graph +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME_HELPTEXT :Time taken for each recalculation of a link graph component. When a recalculation is started, a thread is spawned which is allowed to run for this number of seconds. The shorter you set this the more likely it is that the thread is not finished when it's supposed to. Then the game stops until it is ("lag"). The longer you set it the longer it takes for the distribution to be updated when routes change. STR_CONFIG_SETTING_DISTRIBUTION_PAX :Distribution mode for passengers: {STRING} STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :"Symmetric" means that roughly the same number of passengers will go from a station A to a station B as from B to A. "Asymmetric" means that arbitrary numbers of passengers can go in either direction. "Manual" means that no automatic distribution will take place for passengers. @@ -4588,6 +4592,7 @@ STR_AI_CONFIG_RANDOM_AI :Random AI STR_AI_CONFIG_NONE :(none) STR_AI_CONFIG_NAME_VERSION :{STRING} {YELLOW}v{NUM} STR_AI_CONFIG_MAX_COMPETITORS :{LTBLUE}Maximum no. competitors: {ORANGE}{COMMA} +STR_AI_CONFIG_COMPETITORS_INTERVAL :{LTBLUE}Interval between starting of competitors: {ORANGE}{COMMA} minute{P "" s} STR_AI_CONFIG_MOVE_UP :{BLACK}Move Up STR_AI_CONFIG_MOVE_UP_TOOLTIP :{BLACK}Move selected AI up in the list @@ -4634,7 +4639,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Game Script STR_AI_SETTINGS_CLOSE :{BLACK}Close STR_AI_SETTINGS_RESET :{BLACK}Reset STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Number of days to start this AI after the previous one (give or take): {ORANGE}{STRING} # Textfile window @@ -5517,10 +5521,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut Helic ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{1:STRING}/{0:STRING}/{2:NUM} +STR_FORMAT_DATE_TINY :{1:ZEROFILL_NUM}/{0:ZEROFILL_NUM}/{2:NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{1:STRING} {0:STRING}, {2:NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Company {COMMA}) STR_FORMAT_GROUP_NAME :Group {COMMA} diff --git a/src/lang/esperanto.txt b/src/lang/esperanto.txt index ad26d147e0..439231b78c 100644 --- a/src/lang/esperanto.txt +++ b/src/lang/esperanto.txt @@ -4378,10 +4378,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Helikoptero "Po ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Kompanio {COMMA}) STR_FORMAT_GROUP_NAME :Group {COMMA} diff --git a/src/lang/estonian.txt b/src/lang/estonian.txt index 7dda278f20..2ae60e435c 100644 --- a/src/lang/estonian.txt +++ b/src/lang/estonian.txt @@ -4684,7 +4684,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :GameScript STR_AI_SETTINGS_CLOSE :{BLACK}Sulge STR_AI_SETTINGS_RESET :{BLACK}Nulli STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Päevade arv pärast eelmise AI lõpetamist, millal see AI käivitub (umbkaudselt): {ORANGE}{STRING} # Textfile window @@ -5555,10 +5554,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut helik ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{1:NUM}. {0:STRING} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Ettevõte {COMMA}) STR_FORMAT_GROUP_NAME :Jagu {COMMA} diff --git a/src/lang/faroese.txt b/src/lang/faroese.txt index b0f3dec43f..fc2f86ae28 100644 --- a/src/lang/faroese.txt +++ b/src/lang/faroese.txt @@ -3690,7 +3690,6 @@ STR_AI_SETTINGS_CAPTION_AI :AI STR_AI_SETTINGS_CLOSE :{BLACK}Lat aftur STR_AI_SETTINGS_RESET :{BLACK}Endurstilla STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Tali av døgum til hetta AI byrjar aftaná tað fyrra (umleið): {ORANGE}{STRING} # Textfile window @@ -4522,10 +4521,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut Tyrla ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Fyritøka {COMMA}) STR_FORMAT_GROUP_NAME :Bólkur {COMMA} diff --git a/src/lang/finnish.txt b/src/lang/finnish.txt index ce7a0e95d7..f90c989494 100644 --- a/src/lang/finnish.txt +++ b/src/lang/finnish.txt @@ -1926,6 +1926,10 @@ STR_CONFIG_SETTING_LARGER_TOWNS_DISABLED :Ei yhtään STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER :Kasvukerroin alussa: {STRING} STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :Kaupunkien keskimääräinen koko suhteessa muihin kuntiin pelin alussa +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL :Päivitä yhteyskuvaaja {STRING}{NBSP}sekunnin välein +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL_HELPTEXT :Yhteyskuvaajan uudelleenlaskentojen välinen aika. Jokainen uudelleenlaskenta laskee suunnitelmat kuvaajan yhdelle osalle. Tämän asetuksen arvo X ei siis tarkoita, että koko kuvaaja päivittyisi X sekunnin välein, vaan ainoastaan sen yksi osa. Mitä lyhyemmäksi asetat tämän ajan, sitä enemmän suoritinaikaa kuluu laskentaan. Mitä pitemmäksi asetat ajan, sitä pitempään kestää rahdin jakautumisen alkaminen uusille reiteille. +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME :Käytä {STRING}{NBSP}sekunti{P 0:2 "" a} yhteyskuvaajan uudelleenlaskentaan +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME_HELPTEXT :Yhteyskuvaajan kunkin osan uudelleenlaskentaan käytettävä aika. Uudelleenlaskennan alkaessa käynnistetään säie, jonka annetaan toimia näin monta sekuntia. Mitä lyhyemmäksi asetat tämän ajan, sitä todennäköisemmin säie ei ehdi päättymään ajoissa, jolloin peli pysähtyy (”jumii”) säikeen valmistumiseen asti. Mitä pitemmäksi asetat ajan, sitä pitempään rahdin jakautumisen päivittyminen kestää reittien muuttuessa. STR_CONFIG_SETTING_DISTRIBUTION_PAX :Matkustajien jakautuminen: {STRING} STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :”Symmetrinen” tarkoittaa, että suunnilleen sama määrä matkustajia kulkee asemalta A asemalle B kuin asemalta B asemalle A. ”Epäsymmetrinen” tarkoittaa, että matkustajia voi kulkea mielivaltainen määrä kumpaankin suuntaan. ”Manuaalinen” tarkoittaa, että automaattista jakautumista ei sovelleta matkustajiin. @@ -4588,6 +4592,7 @@ STR_AI_CONFIG_RANDOM_AI :Sattumanvaraine STR_AI_CONFIG_NONE :(ei mitään) STR_AI_CONFIG_NAME_VERSION :{STRING} {YELLOW}v{NUM} STR_AI_CONFIG_MAX_COMPETITORS :{LTBLUE}Vastustajien enimmäismäärä: {ORANGE}{COMMA} +STR_AI_CONFIG_COMPETITORS_INTERVAL :{LTBLUE}Kilpailijoiden käynnistämisen välinen aika: {ORANGE}{COMMA} minuutti{P "" a} STR_AI_CONFIG_MOVE_UP :{BLACK}Siirrä ylöspäin STR_AI_CONFIG_MOVE_UP_TOOLTIP :{BLACK}Siirrä valittua tekoälyä ylöspäin listalla @@ -4634,7 +4639,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Peliskripti STR_AI_SETTINGS_CLOSE :{BLACK}Sulje STR_AI_SETTINGS_RESET :{BLACK}Palauta STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Päiviä edellisen tekoälyn aloittamisesta tämän tekoälyn aloittamiseen (arvio): {ORANGE}{STRING} # Textfile window @@ -5517,10 +5521,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut-helik ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(yhtiö {COMMA}) STR_FORMAT_GROUP_NAME :Ryhmä {COMMA} diff --git a/src/lang/french.txt b/src/lang/french.txt index 7819134765..3d2fc3e413 100644 --- a/src/lang/french.txt +++ b/src/lang/french.txt @@ -1927,6 +1927,10 @@ STR_CONFIG_SETTING_LARGER_TOWNS_DISABLED :Aucune STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER :Multiplicateur initial pour la taille des métropoles{NBSP}: {STRING} STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :Taille moyenne des métropoles par rapport aux villes normales au début de la partie +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL :Mise à jour le graphe de distribution toutes les {STRING}{NBSP}seconde{P 0:2 "" s} +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL_HELPTEXT :Intervalle entre les recalculs successifs du graphe de liaison. Chaque recalcul planifie un composant du graphe. Cela signifie qu'une valeur X pour ce paramètre ne signifie pas que l'ensemble du graphe sera mis à jour toutes les X secondes. Seul un composant le sera. Plus vous définissez cet intervalle court, plus le temps de processeur nécessaire pour le calcul sera important. Plus vous définissez cet intervalle long, plus il faudra de temps pour que la distribution de marchandises commence sur de nouveaux itinéraires. +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME :Prend {STRING}{NBSP}seconde{P 0:2 "" s} pour le recalcul du graphe de distribution +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME_HELPTEXT :Temps pris pour chaque recalcul d'un composant du graphe de liaison. Lorsqu'un recalcul est lancé, un fil d'exécution est créé et autorisé à fonctionner pendant ce nombre de secondes. Plus vous définissez cette durée courte, plus il est probable que le fil ne soit pas terminé lorsqu'il est censé l'être. Ensuite, le jeu s'arrête jusqu'à ce qu'il le soit ("lag"). Plus vous définissez cette durée longue, plus il faut de temps pour que la distribution soit mise à jour lorsque les itinéraires changent. STR_CONFIG_SETTING_DISTRIBUTION_PAX :Type de distribution pour les passagers{NBSP}: {STRING} STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :"Symétrique" signifie qu'autant de passagers iront d'une station A vers une station B, que de la station B vers la station A. "Asymétrique" signifie qu'un nombre arbitraire de passagers peut être envoyé dans les deux directions. "Manuel" signifie qu'aucune distribution n'est mise en place pour les passagers. @@ -4589,6 +4593,7 @@ STR_AI_CONFIG_RANDOM_AI :IA aléatoire STR_AI_CONFIG_NONE :(aucun) STR_AI_CONFIG_NAME_VERSION :{STRING} {YELLOW}v{NUM} STR_AI_CONFIG_MAX_COMPETITORS :{LTBLUE}Nombre maximal de concurrents{NBSP}: {ORANGE}{COMMA} +STR_AI_CONFIG_COMPETITORS_INTERVAL :{LTBLUE}Intervalle entre le démarrage des concurrents : {ORANGE}{COMMA} minute{P "" s} STR_AI_CONFIG_MOVE_UP :{BLACK}Déplacer vers le haut STR_AI_CONFIG_MOVE_UP_TOOLTIP :{BLACK}Déplacer l'IA sélectionnée vers le haut @@ -4635,7 +4640,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :du script de je STR_AI_SETTINGS_CLOSE :{BLACK}Fermer STR_AI_SETTINGS_RESET :{BLACK}Réinitialiser STR_AI_SETTINGS_SETTING :{STRING}{NBSP}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Nombre de jours avant de démarrer cette IA après la précédente (approximativement){NBSP}: {ORANGE}{STRING} # Textfile window @@ -5518,10 +5522,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Hélicoptère P ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}/{STRING}/{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}/{ZEROFILL_NUM}/{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Compagnie {COMMA}) STR_FORMAT_GROUP_NAME :Groupe {COMMA} diff --git a/src/lang/frisian.txt b/src/lang/frisian.txt index a1f449cdb3..d84d8cb866 100644 --- a/src/lang/frisian.txt +++ b/src/lang/frisian.txt @@ -4714,10 +4714,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut Helik ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Bedriuw {COMMA}) STR_FORMAT_GROUP_NAME :Klobke {COMMA} diff --git a/src/lang/gaelic.txt b/src/lang/gaelic.txt index bc34a57eef..8da18cc02e 100644 --- a/src/lang/gaelic.txt +++ b/src/lang/gaelic.txt @@ -4428,7 +4428,6 @@ STR_AI_SETTINGS_CAPTION_AI :IF STR_AI_SETTINGS_CLOSE :{BLACK}Dùin STR_AI_SETTINGS_RESET :{BLACK}Ath-shuidhich STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :An àireamh dhe làithean mus tèid an IF seo a thòiseachadh an dèidh an tè mu dheireadh (mu thimcheall): {ORANGE}{STRING} # Textfile window @@ -5428,10 +5427,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :{G=m}Heileacopt ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Companaidh {COMMA}) STR_FORMAT_GROUP_NAME :Buidheann {COMMA} diff --git a/src/lang/galician.txt b/src/lang/galician.txt index b4c4b768f8..3381f4f61e 100644 --- a/src/lang/galician.txt +++ b/src/lang/galician.txt @@ -4627,7 +4627,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Script do xogo STR_AI_SETTINGS_CLOSE :{BLACK}Pechar STR_AI_SETTINGS_RESET :{BLACK}Restablecer STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Número de días para iniciar esta IA despois da anterior: {ORANGE}{STRING} # Textfile window @@ -5498,10 +5497,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Helicóptero Po ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Compañía {COMMA}) STR_FORMAT_GROUP_NAME :Grupo {COMMA} diff --git a/src/lang/german.txt b/src/lang/german.txt index 322000de67..da807a6473 100644 --- a/src/lang/german.txt +++ b/src/lang/german.txt @@ -4583,6 +4583,7 @@ STR_AI_CONFIG_HUMAN_PLAYER :Menschlicher Sp STR_AI_CONFIG_RANDOM_AI :Zufällige KI STR_AI_CONFIG_NONE :- STR_AI_CONFIG_MAX_COMPETITORS :{LTBLUE}Max. Mitbewerber-Zahl: {ORANGE}{COMMA} +STR_AI_CONFIG_COMPETITORS_INTERVAL :{LTBLUE}Intervall zwischen Start von Wettbewerbern: {ORANGE}{COMMA} minute{P "" n} STR_AI_CONFIG_MOVE_UP :{BLACK}Nach oben verschieben STR_AI_CONFIG_MOVE_UP_TOOLTIP :{BLACK}Die ausgewählte KI in der Liste nach oben verschieben @@ -4629,7 +4630,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Spielskript STR_AI_SETTINGS_CLOSE :{BLACK}Schließen STR_AI_SETTINGS_RESET :{BLACK}Zurücksetzen STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Wartezeit in Tagen zwischen dem Starten dieser KI und dem der vorherigen: {ORANGE}{STRING} # Textfile window @@ -5512,10 +5512,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut-Hubsc ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}.{STRING}.{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}.{ZEROFILL_NUM}.{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Firma {COMMA}) STR_FORMAT_GROUP_NAME :Gruppe {COMMA} diff --git a/src/lang/greek.txt b/src/lang/greek.txt index 565b6fa653..0ec59002c9 100644 --- a/src/lang/greek.txt +++ b/src/lang/greek.txt @@ -4729,7 +4729,6 @@ STR_AI_SETTINGS_CAPTION_AI :AI STR_AI_SETTINGS_CLOSE :{BLACK}Κλείσιμο STR_AI_SETTINGS_RESET :{BLACK}Επαναφορά STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Αριθμός ημερών για την εκκίνηση της επόμενης AI μετά από τη προηγούμενη (περίπου): {ORANGE}{STRING} # Textfile window @@ -5603,10 +5602,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Ελικόπτ ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING.date} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Εταιρία {COMMA}) STR_FORMAT_GROUP_NAME :Ομάδα {COMMA} diff --git a/src/lang/hebrew.txt b/src/lang/hebrew.txt index 3cb271db99..a567be6133 100644 --- a/src/lang/hebrew.txt +++ b/src/lang/hebrew.txt @@ -4332,7 +4332,6 @@ STR_AI_SETTINGS_CAPTION_AI :שחקן מחש STR_AI_SETTINGS_CLOSE :{BLACK}סגור STR_AI_SETTINGS_RESET :{BLACK}אתחל STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :מספר הימים להתחלת שחקן מחשב זה אחרי הקודם (פחות או יותר): {ORANGE}{STRING} # Textfile window @@ -5194,10 +5193,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :הליקופט ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{2:NUM} ב{1:STRING} {LRM}{0:STRING} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :({COMMA} חברה) STR_FORMAT_GROUP_NAME :{COMMA} קבוצה diff --git a/src/lang/hungarian.txt b/src/lang/hungarian.txt index 2dfe80d35e..538343553f 100644 --- a/src/lang/hungarian.txt +++ b/src/lang/hungarian.txt @@ -4680,7 +4680,6 @@ STR_AI_SETTINGS_CAPTION_AI :{WHITE}MI param STR_AI_SETTINGS_CLOSE :{BLACK}Bezárás STR_AI_SETTINGS_RESET :{BLACK}Visszaállítás STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Az előző MI indításától eltelt napok száma ezen MI indításáig (megközelítőleg): {ORANGE}{STRING} # Textfile window @@ -5588,10 +5587,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :SemmiErő Helik ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :({COMMA}. vállalat) STR_FORMAT_GROUP_NAME :{COMMA} csoport diff --git a/src/lang/icelandic.txt b/src/lang/icelandic.txt index c4f274dde2..b44b3b8d16 100644 --- a/src/lang/icelandic.txt +++ b/src/lang/icelandic.txt @@ -3923,7 +3923,6 @@ STR_AI_SETTINGS_CAPTION_AI :Gervigreindar STR_AI_SETTINGS_CLOSE :{BLACK}Loka STR_AI_SETTINGS_RESET :{BLACK}Frumstilla STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Hversu mörgum dögum eftir síðustu gervigreind á að hlaða þessari (sirka): {ORANGE}{STRING} # Textfile window @@ -4765,10 +4764,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut Þyrl ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Fyrirtæki {COMMA}) STR_FORMAT_GROUP_NAME :Hópur {COMMA} diff --git a/src/lang/ido.txt b/src/lang/ido.txt index b2422ef37d..297233d123 100644 --- a/src/lang/ido.txt +++ b/src/lang/ido.txt @@ -1627,10 +1627,10 @@ STR_SV_STNAME_WAYPOINT :{STRING} ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} ###length 2 diff --git a/src/lang/indonesian.txt b/src/lang/indonesian.txt index e9dc5414e3..4528fb3c5a 100644 --- a/src/lang/indonesian.txt +++ b/src/lang/indonesian.txt @@ -4616,7 +4616,6 @@ STR_AI_SETTINGS_CAPTION_AI :{WHITE}Paramete STR_AI_SETTINGS_CLOSE :{BLACK}Tutup STR_AI_SETTINGS_RESET :{BLACK}Reset STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Jalankan AI setelah berapa hari : {ORANGE}{STRING} # Textfile window @@ -5487,10 +5486,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Helikopter Powe ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Perusahaan {COMMA}) STR_FORMAT_GROUP_NAME :Kelompok {COMMA} diff --git a/src/lang/irish.txt b/src/lang/irish.txt index e4e8135e93..bf2411ab3c 100644 --- a/src/lang/irish.txt +++ b/src/lang/irish.txt @@ -4532,7 +4532,6 @@ STR_AI_SETTINGS_CAPTION_AI :AI STR_AI_SETTINGS_CLOSE :{BLACK}Dún STR_AI_SETTINGS_RESET :{BLACK}Athshocraigh STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Líon na laethanta a thógfaidh sé chun an AI seo a thosú tar éis an ceann roimhe (a bheag nó a mhór): {ORANGE}{STRING} # Textfile window @@ -5396,10 +5395,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Héileacaptar P ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Cuideachta {COMMA}) STR_FORMAT_GROUP_NAME :Grúpa {COMMA} diff --git a/src/lang/italian.txt b/src/lang/italian.txt index 2b4c9b33a8..5bed11d88f 100644 --- a/src/lang/italian.txt +++ b/src/lang/italian.txt @@ -197,6 +197,7 @@ STR_UNITS_VELOCITY_IMPERIAL :{COMMA}{NBSP}mp STR_UNITS_VELOCITY_METRIC :{COMMA}{NBSP}km/h STR_UNITS_VELOCITY_SI :{COMMA}{NBSP}m/s STR_UNITS_VELOCITY_GAMEUNITS :{DECIMAL}{NBSP}caselle/giorno +STR_UNITS_VELOCITY_KNOTS :{COMMA}{NBSP}nodi STR_UNITS_POWER_IMPERIAL :{COMMA}{NBSP}hp STR_UNITS_POWER_METRIC :{COMMA}{NBSP}hp @@ -345,9 +346,9 @@ STR_GOTO_ORDER_VIEW_TOOLTIP :{BLACK}Apri la ###length 31 STR_TOOLBAR_TOOLTIP_PAUSE_GAME :{BLACK}Pausa STR_TOOLBAR_TOOLTIP_FORWARD :{BLACK}Aumenta la velocità di gioco -STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Opzioni -STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Salva la partita, abbandona la partita, esci -STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Mostra la mappa, apre una mini visuale extra o mostra l'elenco dei cartelli +STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Opzioni e impostazioni +STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Salvare, caricare o abbandonare il gioco, uscire dal programma +STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Visualizzazione di una mappa, di una finestra supplementare, di un flusso di carico o di un elenco di segnali. STR_TOOLBAR_TOOLTIP_DISPLAY_TOWN_DIRECTORY :{BLACK}Mostra l'elenco delle città STR_TOOLBAR_TOOLTIP_DISPLAY_SUBSIDIES :{BLACK}Mostra i sussidi STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_STATIONS :{BLACK}Mostra l'elenco delle stazioni di una compagnia @@ -355,9 +356,9 @@ STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_FINANCES :{BLACK}Mostra i STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_GENERAL :{BLACK}Mostra informazioni generali sulle compagnie STR_TOOLBAR_TOOLTIP_DISPLAY_STORY_BOOK :{BLACK}Mostra la storia delle compagnie STR_TOOLBAR_TOOLTIP_DISPLAY_GOALS_LIST :{BLACK}Mostra le liste degli obiettivi -STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}Mostra i grafici +STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}Visualizzare i grafici aziendali e i tassi di pagamento del carico STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_LEAGUE :{BLACK}Mostra la classifica delle compagnie -STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}Finanzia la costruzione di una nuova industria o mostra l'elenco delle industrie +STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}Esaminare le industrie o finanziare la costruzione di una nuova industria STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_TRAINS :{BLACK}Mostra l'elenco dei treni di una compagnia. CTRL+clic non apre la lista gruppi. STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_ROAD_VEHICLES :{BLACK}Mostra l'elenco degli automezzi di una compagnia. CTRL+clic non apre la lista gruppi. STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_SHIPS :{BLACK}Mostra l'elenco delle navi di una compagnia. CTRL+clic non apre la lista gruppi. @@ -371,8 +372,8 @@ STR_TOOLBAR_TOOLTIP_BUILD_SHIP_DOCKS :{BLACK}Costruzi STR_TOOLBAR_TOOLTIP_BUILD_AIRPORTS :{BLACK}Costruzione aeroporti STR_TOOLBAR_TOOLTIP_LANDSCAPING :{BLACK}Apre la barra di modellazione del terreno per alzare/abbassare il terreno, piantare alberi, etc. STR_TOOLBAR_TOOLTIP_SHOW_SOUND_MUSIC_WINDOW :{BLACK}Mostra la finestra suoni/musica -STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Mostra l'ultimo messaggio/notizia, mostra le opzioni dei messaggi -STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Informazioni area terreno, console, debug degli script, screenshot, informazioni su OpenTTD +STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Mostra l'ultimo messaggio/notizia, la cronologia dei messaggi o cancella tutti i messaggi +STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Informazioni sull'area del terreno, screenshot, su OpenTTD e sugli strumenti per gli sviluppatori STR_TOOLBAR_TOOLTIP_SWITCH_TOOLBAR :{BLACK}Alterna barre degli strumenti # Extra tooltips for the scenario editor toolbar @@ -1746,7 +1747,7 @@ STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_HELPTEXT :Quantità massi STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_VALUE :{COMMA} MiB STR_CONFIG_SETTING_SERVINT_ISPERCENT :Gli intervalli di manutenzione sono in percentuale: {STRING} -STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :Determina se la manutenzione dei veicoli è controllata dal tempo trascorso dall'ultima manutenzione piuttosto che dalla riduzione dell'affidabilità di una certa frazione di quella massima +STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :Quando è abilitata, i veicoli tentano la manutenzione quando la loro affidabilità scende di una determinata percentuale dell'affidabilità massima.{}{}Ad esempio, se l'affidabilità massima di un veicolo è del 90% e l'intervallo di manutenzione è del 20%, il veicolo tenterà la manutenzione quando raggiunge il 72% di affidabilità. STR_CONFIG_SETTING_SERVINT_TRAINS :Intervallo manutenzione predefinito treni: {STRING} STR_CONFIG_SETTING_SERVINT_TRAINS_HELPTEXT :Imposta l'intervallo di manutenzione predefinito per i nuovi veicoli ferroviari, quando non viene impostato nessun intervallo esplicito @@ -1843,7 +1844,9 @@ STR_CONFIG_SETTING_ALLOW_SHARES_HELPTEXT :Se abilitata, c STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES :Età minima della compagnia per lo scambio delle sue azioni: {STRING} STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_HELPTEXT :Imposta l'età minima di una compagnia affinchè sia possibile acquistarne o venderne le azioni. +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_VALUE :{COMMA} {P "anno" anni} ###setting-zero-is-special +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_NO_MIN :Nessun minimo STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE :Percentuale profitto da pagare per una tappa di trasferimento: {STRING} STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE_HELPTEXT :Percentuale di ricavi assegnata ai tratti intermedi di una catena di trasferimenti, in questo si conferisce un maggiore controllo sul reddito. @@ -1958,6 +1961,10 @@ STR_CONFIG_SETTING_LARGER_TOWNS_DISABLED :Nessuna STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER :Moltiplicatore iniziale dimensioni metropoli: {STRING} STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :Dimensione media delle metropoli in rapporto alle normali città all'inizio della partita. +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL :Aggiornare il grafico di distribuzione ogni {STRING}{NBSP}{P 0:2 "secondo" secondi} +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL_HELPTEXT :Tempo tra i successivi ricalcoli del grafico dei collegamenti. Ogni ricalcolo calcola i piani per un componente del grafico. Ciò significa che un valore X per questa impostazione non significa che l'intero grafico verrà aggiornato ogni X secondi. Solo alcuni componenti lo saranno. Quanto più breve è l'impostazione, tanto più tempo di CPU sarà necessario per il calcolo. Più lungo è il valore impostato, più tempo ci vorrà prima che la distribuzione del carico inizi su nuove rotte. +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME :Prendere {STRING}{NBSP}{P 0:2 "secondo" secondi} per il ricalcolo del grafico di distribuzione +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME_HELPTEXT :Tempo necessario per ogni ricalcolo di un componente del grafo dei collegamenti. Quando viene avviato un ricalcolo, viene generato un thread che può essere eseguito per questo numero di secondi. Quanto più breve è il tempo impostato, tanto più è probabile che il thread non finisca quando dovrebbe. In questo caso il gioco si ferma finché non viene terminato ("lag"). Più lungo è il valore impostato, più tempo ci vuole per aggiornare la distribuzione quando i percorsi cambiano. STR_CONFIG_SETTING_DISTRIBUTION_PAX :Modalità di distribuzione dei passeggeri: {STRING} STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :In modalità "Simmetrica" il numero di passeggeri che viaggiano da una stazione A ad una stazione B è approssimativamente lo stesso di quelli che viaggiano da B ad A. In modalità "Asimmetrica" è consentito il viaggio di un numero di passeggeri arbitrario in entrambe le direzioni. In modalità "Manuale" non viene effettuata alcuna distribuzione automatica dei passeggeri. @@ -1983,13 +1990,15 @@ STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :Impostarla a me STR_CONFIG_SETTING_SHORT_PATH_SATURATION :Saturazione dei percorsi corti prima di utilizzare quelli a più alta capacità: {STRING} STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :È frequente che esistano più percorsi fra due stazioni. L'algoritmo Cargodist cercherà di saturare innanzi tutto il percorso più corto, quindi il secondo più corto fino a saturazione e così via. Il grado di saturazione è determinato dalla stima della capacità e dell'utilizo programmato. Se con tutti i percorsi saturi permane ancora domanda, l'algoritmo sovraccaricherà i percorsi indipendentemente dalla lunghezza, preferendo quelli a più alta capacità. Tuttavia, il più delle volte l'algoritmo non stimerà la capacità in modo accurato. Questa impostazione permette di specificare fino a quale percentuale saturare un percorso corto durante il primo passaggio dell'algoritmo prima di sceglierne uno più lungo. Impostarlo a meno di 100% in modo da evitare sovraffollamento delle stazioni in caso di capacità sovrastimata. -STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Unità di velocità: {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Unità di velocità (terrestre): {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :Unità di velocità (nautica): {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :Seleziona le unità di misura da utilizzare per mostrare le velocità nell'interfaccia utente ###length 5 STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :Imperiali (mph) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC :Metriche (km/h) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI :SI (m/s) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS :Unità di gioco (caselle/giorno) +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :Nodi STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :Unità di potenza veicoli: {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :Seleziona le unità di misura da utilizzare per mostrare i valori di potenza dei veicoli nell'interfaccia utente @@ -4622,7 +4631,9 @@ STR_AI_CONFIG_AILIST_TOOLTIP :{BLACK}Lista de STR_AI_CONFIG_HUMAN_PLAYER :Giocatore umano STR_AI_CONFIG_RANDOM_AI :IA casuale STR_AI_CONFIG_NONE :(nessuno) +STR_AI_CONFIG_NAME_VERSION :{STRING} {YELLOW}v{NUM} STR_AI_CONFIG_MAX_COMPETITORS :{LTBLUE}Numero massimo di avversari: {ORANGE}{COMMA} +STR_AI_CONFIG_COMPETITORS_INTERVAL :{LTBLUE}Intervallo tra l'inizio dei concorrenti: {ORANGE}{COMMA} {P minuto minuti} STR_AI_CONFIG_MOVE_UP :{BLACK}Sposta su STR_AI_CONFIG_MOVE_UP_TOOLTIP :{BLACK}Sposta l'IA selezionata più in alto nell'elenco @@ -4635,7 +4646,7 @@ STR_AI_CONFIG_AI :{SILVER}IA STR_AI_CONFIG_CHANGE_AI :{BLACK}Seleziona IA STR_AI_CONFIG_CHANGE_GAMESCRIPT :{BLACK}Seleziona lo script di gioco -STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}Carica un altro script +STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}Carica un altro script. Ctrl+clic per visualizzare tutte le versioni disponibili STR_AI_CONFIG_CONFIGURE :{BLACK}Configura STR_AI_CONFIG_CONFIGURE_TOOLTIP :{BLACK}Configura i parametri dello script @@ -4669,7 +4680,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Script di gioco STR_AI_SETTINGS_CLOSE :{BLACK}Chiudi STR_AI_SETTINGS_RESET :{BLACK}Reimposta STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Giorni da attendere per l'avvio di questa IA dopo la precedente (approssimativo): {ORANGE}{STRING} # Textfile window @@ -5552,10 +5562,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Elicottero Powe ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Compagnia {COMMA}) STR_FORMAT_GROUP_NAME :Gruppo {COMMA} diff --git a/src/lang/japanese.txt b/src/lang/japanese.txt index dac89946ad..1033f065e8 100644 --- a/src/lang/japanese.txt +++ b/src/lang/japanese.txt @@ -4628,7 +4628,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :ゲームスク STR_AI_SETTINGS_CLOSE :{BLACK}閉じる STR_AI_SETTINGS_RESET :{BLACK}リセット STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :AI企業の設立間隔(倒産/買収後): {ORANGE}{STRING} # Textfile window @@ -5511,10 +5510,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :パワーノー ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_TINY :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_DATE_SHORT :{1:NUM}年{0:STRING}月 STR_FORMAT_DATE_LONG :{2:NUM}年{1:STRING}月{0:STRING}日 -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(会社{COMMA}) STR_FORMAT_GROUP_NAME :グループ {COMMA} diff --git a/src/lang/korean.txt b/src/lang/korean.txt index 404726b4c8..9287729682 100644 --- a/src/lang/korean.txt +++ b/src/lang/korean.txt @@ -4635,7 +4635,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :게임 스크 STR_AI_SETTINGS_CLOSE :{BLACK}닫기 STR_AI_SETTINGS_RESET :{BLACK}초기화 STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :이전 인공지능 이후 이 인공지능이 나타나기 위한 날짜수: {ORANGE}약 {STRING}일 # Textfile window @@ -5518,10 +5517,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut 헬 ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{2:NUM}.{1:STRING}.{0:STRING} +STR_FORMAT_DATE_TINY :{2:NUM}.{1:ZEROFILL_NUM}.{0:ZEROFILL_NUM} STR_FORMAT_DATE_SHORT :{1:NUM}년 {0:STRING} STR_FORMAT_DATE_LONG :{2:NUM}년 {1:STRING}월 {0:STRING}일 -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(회사 {COMMA}) STR_FORMAT_GROUP_NAME :그룹 {COMMA} diff --git a/src/lang/latin.txt b/src/lang/latin.txt index e9054c7ea4..967083a7f1 100644 --- a/src/lang/latin.txt +++ b/src/lang/latin.txt @@ -4421,7 +4421,6 @@ STR_AI_SETTINGS_CAPTION_AI :IA STR_AI_SETTINGS_CLOSE :{BLACK}Claudere STR_AI_SETTINGS_RESET :{BLACK}Revertere STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Quot dies post IA priorem haec IA incipiet (plus minusve): {ORANGE}{STRING} # Textfile window @@ -5385,10 +5384,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Helicopterum Po ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Societas {COMMA}) STR_FORMAT_GROUP_NAME :Grex {COMMA} diff --git a/src/lang/latvian.txt b/src/lang/latvian.txt index 5a5aeee827..740b6a7a6b 100644 --- a/src/lang/latvian.txt +++ b/src/lang/latvian.txt @@ -4633,7 +4633,6 @@ STR_AI_SETTINGS_CAPTION_AI :{WHITE}MI Param STR_AI_SETTINGS_CLOSE :{BLACK}Aizvērt STR_AI_SETTINGS_RESET :{BLACK}Atiestatīt STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Aptuvenais dienu skaits, līdz palaist šo MI pēc iepriekšējā: {ORANGE}{STRING} # Textfile window @@ -5504,10 +5503,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut helik ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :({COMMA}. uzņēmums) STR_FORMAT_GROUP_NAME :Grupa {COMMA} diff --git a/src/lang/lithuanian.txt b/src/lang/lithuanian.txt index 3cf751fa80..bf0eefea0d 100644 --- a/src/lang/lithuanian.txt +++ b/src/lang/lithuanian.txt @@ -4827,7 +4827,6 @@ STR_AI_SETTINGS_CAPTION_AI :DI STR_AI_SETTINGS_CLOSE :{BLACK}Uždaryti STR_AI_SETTINGS_RESET :{BLACK}Atstatyti STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Dienų skaičius po kurio šitas DI bus paleistas po paskutiniojo (maždaug): {ORANGE}{STRING} # Textfile window @@ -5955,10 +5954,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut malun ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Kompanija {COMMA}) STR_FORMAT_GROUP_NAME :Grupė {COMMA} diff --git a/src/lang/luxembourgish.txt b/src/lang/luxembourgish.txt index 5b6e2ab0d2..9c08da2187 100644 --- a/src/lang/luxembourgish.txt +++ b/src/lang/luxembourgish.txt @@ -4626,7 +4626,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Spill-Script STR_AI_SETTINGS_CLOSE :{BLACK}Zoumaachen STR_AI_SETTINGS_RESET :{BLACK}Reset STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Unzuel un Deeg wou des KI gestart gëtt no der leschter: {ORANGE}{STRING} # Textfile window @@ -5497,10 +5496,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut Helik ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Firma {COMMA}) STR_FORMAT_GROUP_NAME :Grupp {COMMA} diff --git a/src/lang/macedonian.txt b/src/lang/macedonian.txt index 6f665df7ee..ac3b40b60f 100644 --- a/src/lang/macedonian.txt +++ b/src/lang/macedonian.txt @@ -1964,7 +1964,6 @@ STR_AI_LIST_CAPTION_GAMESCRIPT :GameScripts # Script Parameters STR_AI_SETTINGS_CAPTION_AI :АИ STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Број на денови за да започнете оваа Пи по претходниот (се дава или зема): {ORANGE}{STRING} # Textfile window @@ -2175,10 +2174,10 @@ STR_SV_STNAME_WAYPOINT :{STRING} ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} ###length 2 diff --git a/src/lang/malay.txt b/src/lang/malay.txt index 5ac9a62cb5..14cc903a8b 100644 --- a/src/lang/malay.txt +++ b/src/lang/malay.txt @@ -3833,7 +3833,6 @@ STR_AI_SETTINGS_CAPTION_AI :AI STR_AI_SETTINGS_CLOSE :{BLACK}Tutup STR_AI_SETTINGS_RESET :{BLACK}Semula STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Bilangan hari Kepintaran Tiruan dimulakan selepas yang terdahulu (lebih kurang): {ORANGE}{STRING} # Textfile window @@ -4671,10 +4670,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Helikopter Powe ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Company {COMMA}) STR_FORMAT_GROUP_NAME :Group {COMMA} diff --git a/src/lang/maltese.txt b/src/lang/maltese.txt index d2d42383cf..d7af4d76b5 100644 --- a/src/lang/maltese.txt +++ b/src/lang/maltese.txt @@ -1671,10 +1671,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Ħelikopter Pow ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_INDUSTRY_NAME :{TOWN} {STRING} diff --git a/src/lang/marathi.txt b/src/lang/marathi.txt index 129365581e..f4799eb7c9 100644 --- a/src/lang/marathi.txt +++ b/src/lang/marathi.txt @@ -2038,10 +2038,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :पॉवरन ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_GROUP_NAME :गट्टा {COMMA} STR_FORMAT_INDUSTRY_NAME :{TOWN} {STRING} diff --git a/src/lang/norwegian_bokmal.txt b/src/lang/norwegian_bokmal.txt index 9fe4350928..563fa80774 100644 --- a/src/lang/norwegian_bokmal.txt +++ b/src/lang/norwegian_bokmal.txt @@ -4554,7 +4554,6 @@ STR_AI_SETTINGS_CAPTION_AI :AI STR_AI_SETTINGS_CLOSE :{BLACK}Lukk STR_AI_SETTINGS_RESET :{BLACK}Tilbakestill STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Antall dager denne AIen skal starte etter den forrige (ca): {ORANGE}{STRING} # Textfile window @@ -5418,10 +5417,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut-helik ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Firma {COMMA}) STR_FORMAT_GROUP_NAME :Gruppe {COMMA} diff --git a/src/lang/norwegian_nynorsk.txt b/src/lang/norwegian_nynorsk.txt index 78796c7015..8d69c390f5 100644 --- a/src/lang/norwegian_nynorsk.txt +++ b/src/lang/norwegian_nynorsk.txt @@ -4056,7 +4056,6 @@ STR_AI_SETTINGS_CAPTION_AI :AI STR_AI_SETTINGS_CLOSE :{BLACK}Lukk STR_AI_SETTINGS_RESET :{BLACK}Tilbakestill STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Antall dagar denne AIen skal starte etter den førre (ca): {ORANGE}{STRING} # Textfile window @@ -4907,10 +4906,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut-helik ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Firma {COMMA}) STR_FORMAT_GROUP_NAME :Gruppe {COMMA} diff --git a/src/lang/persian.txt b/src/lang/persian.txt index 673f3bfe7c..4f88d8ae87 100644 --- a/src/lang/persian.txt +++ b/src/lang/persian.txt @@ -3480,7 +3480,6 @@ STR_AI_LIST_CANCEL_TOOLTIP :{BLACK}کد ر STR_AI_SETTINGS_CAPTION_AI :هوش مصنوعی(AI) STR_AI_SETTINGS_CLOSE :{BLACK}بستن STR_AI_SETTINGS_RESET :{BLACK}بازنشاندن -STR_AI_SETTINGS_START_DELAY :تعداد روزهایی که این بازیگر هوش مصنوعی پس از بازیگر هوش مصنوعی قبلی قبل از اتصال صبر می کند(کم و بیش): {ORANGE}{STRING} # Textfile window @@ -4207,10 +4206,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :هلیکوپت ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(شرکت {COMMA}) STR_FORMAT_GROUP_NAME :گروه {COMMA} diff --git a/src/lang/polish.txt b/src/lang/polish.txt index fbb53a3726..6dbbbbb604 100644 --- a/src/lang/polish.txt +++ b/src/lang/polish.txt @@ -5020,7 +5020,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Game Script STR_AI_SETTINGS_CLOSE :{BLACK}Zamknij STR_AI_SETTINGS_RESET :{BLACK}Resetuj STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Liczba dni do aktywowania tej SI po uruchomieniu poprzedniej (zwiększ lub zmniejsz): {ORANGE}{STRING} # Textfile window @@ -5940,10 +5939,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Helikopter Powe ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Firma {COMMA}) STR_FORMAT_GROUP_NAME :Grupa {COMMA} diff --git a/src/lang/portuguese.txt b/src/lang/portuguese.txt index 3a1ed850f9..2e75bb44b2 100644 --- a/src/lang/portuguese.txt +++ b/src/lang/portuguese.txt @@ -1713,7 +1713,7 @@ STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_HELPTEXT :Definir o volum STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_VALUE :{COMMA} MiB STR_CONFIG_SETTING_SERVINT_ISPERCENT :Os intervalos de serviço são em percentagem: {STRING} -STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :Escolher se a manutenção de veículos é ativada pelo tempo decorrido deste a última manutenção, ou pela fiabilidade abaixo de uma certa percentagem da fiabilidade máxima +STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :Quando ativado, os veículos procuram fazer a manutenção quando sua fiabilidade reduz para uma determinada percentagem da fiabilidade máxima.{}{}Por exemplo, se a fiabilidade máxima de um veículo for 90% e o intervalo de manutenção for 20%, o veículo tentará fazer a manutenção quando atinge 72% de fiabilidade. STR_CONFIG_SETTING_SERVINT_TRAINS :Intervalo de serviço para comboios por omissão: {STRING} STR_CONFIG_SETTING_SERVINT_TRAINS_HELPTEXT :Definir o intervalo de manutenção por omissão para novos veículos sobre carris, se não for configurado um intervalo de manutenção explícito para o veículo @@ -1927,6 +1927,10 @@ STR_CONFIG_SETTING_LARGER_TOWNS_DISABLED :Nenhum STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER :Multiplicador inicial para a dimensão das metrópoles: {STRING} STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :Tamanho relativo das cidades em relação ao tamanho normal das localidades aquando o início do jogo +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL :Atualizar o gráfico de distribuição a cada {STRING}{NBSP}segundo{P 0:2 "" s} +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL_HELPTEXT :Tempo de intervalo entre recalculos subsequentes do gráfico de ligações. Cada recalculo calcula os planos para um componente do gráfico. Isso significa que um valor X para esta configuração não significa que todo o gráfico será atualizado a cada X segundos. Apenas algum componente será. Quanto mais curto escolher, mais tempo de CPU será necessário para calcular. Quanto mais tempo for definido, mais tempo levará até que a distribuição de carga inicie nas novas rotas. +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME :Usar {STRING}{NBSP}segundo{P 0:2 "" s} para recalcular o gráfico de distribuição +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME_HELPTEXT :Tempo gasto para cada recalculo de um componente de gráfico de ligação. Quando um recalculo é iniciado, um encadeamento é gerado e pode ser executado nesse número de segundos. Quanto mais curto você definir, mais provável será que o encadeamento não seja concluído quando deveria. Então o jogo pára até que seja ("lag"). Quanto mais tempo você definir, mais tempo levará para a distribuição ser atualizada quando as rotas mudarem. STR_CONFIG_SETTING_DISTRIBUTION_PAX :Modo de distribuição para os passageiros: {STRING} STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :"Simétrico" significa que aproximadamente o mesmo numero de passageiros irá de uma estação A para uma estação B e de B para A. "Assimétrico" significa que um numero arbitrário de passageiros poderá seguir em qualquer direção. "Manual" significa que nenhuma distribuição automática terá lugar para passageiros. @@ -4589,6 +4593,7 @@ STR_AI_CONFIG_RANDOM_AI :IA aleatória STR_AI_CONFIG_NONE :(nenhum) STR_AI_CONFIG_NAME_VERSION :{STRING} {YELLOW}v{NUM} STR_AI_CONFIG_MAX_COMPETITORS :{LTBLUE}Número máximo de oponentes: {ORANGE}{COMMA} +STR_AI_CONFIG_COMPETITORS_INTERVAL :{LTBLUE}Intervalo entre o arranque dos competidores: {ORANGE}{COMMA} minuto{P "" s} STR_AI_CONFIG_MOVE_UP :{BLACK}Mover para cima STR_AI_CONFIG_MOVE_UP_TOOLTIP :{BLACK}Move a IA seleccionada para cima @@ -4635,7 +4640,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Script de Jogo STR_AI_SETTINGS_CLOSE :{BLACK}Fechar STR_AI_SETTINGS_RESET :{BLACK}Repor STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Número de dias para iniciar esta IA depois da anterior (aproximadamente): {ORANGE}{STRING} # Textfile window @@ -5518,10 +5522,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Helicóptero Po ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Empresa {COMMA}) STR_FORMAT_GROUP_NAME :Grupo {COMMA} diff --git a/src/lang/romanian.txt b/src/lang/romanian.txt index 8f074c764b..8b96a026c0 100644 --- a/src/lang/romanian.txt +++ b/src/lang/romanian.txt @@ -4627,7 +4627,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Script de joc STR_AI_SETTINGS_CLOSE :{BLACK}Închide STR_AI_SETTINGS_RESET :{BLACK}Resetează STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Perioada (în zile) după care această librărie IA va fi activată, după cea anterioară (valoare aproximativă): {ORANGE}{STRING} # Textfile window @@ -5510,10 +5509,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Elicopter Power ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Companie {COMMA}) STR_FORMAT_GROUP_NAME :Grup {COMMA} diff --git a/src/lang/russian.txt b/src/lang/russian.txt index 55d2cd8ed6..e96ca4d49b 100644 --- a/src/lang/russian.txt +++ b/src/lang/russian.txt @@ -1863,7 +1863,7 @@ STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_HELPTEXT :Объём па STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_VALUE :{COMMA} МиБ STR_CONFIG_SETTING_SERVINT_ISPERCENT :Интервал тех. обслуживания в процентах: {STRING} -STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :Выберите, должно ли техническое обслуживание транспорта выполняться через определённые промежутки времени, либо при снижении надёжности транспортного средства на определённый процент от максимума +STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :При включении транспортные средства будут отправляться на техническое обслуживание после падения надёжности на указанный процент от максимальной.{}Например, при максимальной надёжности 90% и указанном интервале ТО 20% транспортное средство уйдёт на обслуживание при падении надёжности до 72%. STR_CONFIG_SETTING_SERVINT_TRAINS :Интервал ТО по умолчанию для поездов: {STRING} STR_CONFIG_SETTING_SERVINT_TRAINS_HELPTEXT :Настройка периодичности технического обслуживания для новых поездов @@ -2077,6 +2077,10 @@ STR_CONFIG_SETTING_LARGER_TOWNS_DISABLED :нет STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER :Стартовый множитель размера мегаполисов: {STRING} STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :Средний размер мегаполисов по сравнению с остальными городами в начале игры +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL :Обновлять граф распределения кажд{P 0:2 ую ые ые} {STRING}{NBSP}секунд{P 0:2 у ы ""} +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL_HELPTEXT :Интервалы между перерасчётами графов распределения грузов. Каждый перерасчёт обновляет один компонент графа. То есть, по истечении указанного здесь времени будет обновлён не весь граф, а только один из его компонентов. Чем ниже значение, тем выше нагрузка на процессор. Чем выше значение, тем дольше не будет работать распределение грузов на новых маршрутах. +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME :Продолжительность перерасчёта графа распределения: {STRING}{NBSP}секунд{P 0:2 а ы ""} +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME_HELPTEXT :Время, выделяемое на каждый перерасчёт одного из компонентов графа распределения грузов. Расчёт выполняется в отдельном вычислительном потоке. Чем ниже значение, тем выше вероятность того, что расчёт не будет выполнен за указанное время; в таком случае игра будет приостановлена до завершения расчёта. Чем выше значение, тем медленнее будет обновляться граф распределения в случае изменения маршрутов. STR_CONFIG_SETTING_DISTRIBUTION_PAX :Распределение пассажиров: {STRING} STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :«Симметричное» означает, что примерно одинаковое количество пассажиров будет направляться по прямому и обратному маршрутам.{}«Несимметричное» означает, что пассажиропотоки в любых направлениях не будут зависеть друг от друга.{}«Вручную» - не использовать автоматическое распределение для пассажиров. @@ -4775,6 +4779,7 @@ STR_AI_CONFIG_RANDOM_AI :Случайн STR_AI_CONFIG_NONE :(нет) STR_AI_CONFIG_NAME_VERSION :{STRING} {YELLOW}v{NUM} STR_AI_CONFIG_MAX_COMPETITORS :{LTBLUE}Максимальное количество конкурентов: {ORANGE}{COMMA} +STR_AI_CONFIG_COMPETITORS_INTERVAL :{LTBLUE}Интервал между запуском конкурентов: {ORANGE}{COMMA} минут{P а ы ""} STR_AI_CONFIG_MOVE_UP :{BLACK}Вверх STR_AI_CONFIG_MOVE_UP_TOOLTIP :{BLACK}Переместить этот модуль ИИ вверх по списку @@ -4821,7 +4826,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :игровых STR_AI_SETTINGS_CLOSE :{BLACK}Закрыть STR_AI_SETTINGS_RESET :{BLACK}Сброс STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Запускать этот ИИ через {ORANGE}{STRING} д{P 0:1 ень ня ней} после предыдущего # Textfile window @@ -5741,10 +5745,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Вертолё ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}.{STRING}.{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}.{ZEROFILL_NUM}.{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} г. STR_FORMAT_DATE_LONG :{STRING} {STRING.gen} {NUM} г. -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Компания {COMMA}) STR_FORMAT_GROUP_NAME :Группа {COMMA} diff --git a/src/lang/serbian.txt b/src/lang/serbian.txt index 6cf07fd6cc..928fc41c31 100644 --- a/src/lang/serbian.txt +++ b/src/lang/serbian.txt @@ -4827,7 +4827,6 @@ STR_AI_SETTINGS_CAPTION_AI :{WHITE}Parametr STR_AI_SETTINGS_CLOSE :{BLACK}Zatvori STR_AI_SETTINGS_RESET :{BLACK}Poništi STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Broj dana za pokretanje ove VI posle prethodne (otprilike): {ORANGE}{STRING} # Textfile window @@ -5698,10 +5697,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut helik ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Preduzeće {COMMA}) STR_FORMAT_GROUP_NAME :Grupa {COMMA} diff --git a/src/lang/simplified_chinese.txt b/src/lang/simplified_chinese.txt index 8e2bab288f..4a977e293f 100644 --- a/src/lang/simplified_chinese.txt +++ b/src/lang/simplified_chinese.txt @@ -4626,7 +4626,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :游戏脚本 STR_AI_SETTINGS_CLOSE :{BLACK}关闭 STR_AI_SETTINGS_RESET :{BLACK}重设 STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :当前AI在前一个AI运行 {ORANGE}{STRING}天之后开始运行 # Textfile window @@ -5507,10 +5506,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut 直 ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(公司 {COMMA}) STR_FORMAT_GROUP_NAME :组 {COMMA} diff --git a/src/lang/slovak.txt b/src/lang/slovak.txt index bca60fd327..82f2920048 100644 --- a/src/lang/slovak.txt +++ b/src/lang/slovak.txt @@ -259,6 +259,7 @@ STR_UNITS_VELOCITY_IMPERIAL :{COMMA} mph STR_UNITS_VELOCITY_METRIC :{COMMA} km/h STR_UNITS_VELOCITY_SI :{COMMA} m/s STR_UNITS_VELOCITY_GAMEUNITS :{DECIMAL}{NBSP}políč{P ko ka ok}/deň +STR_UNITS_VELOCITY_KNOTS :{COMMA}{NBSP}uzlov STR_UNITS_POWER_IMPERIAL :{COMMA}hp STR_UNITS_POWER_METRIC :{COMMA}hp @@ -407,9 +408,9 @@ STR_GOTO_ORDER_VIEW_TOOLTIP :{BLACK}Otvoriť ###length 31 STR_TOOLBAR_TOOLTIP_PAUSE_GAME :{BLACK}Pozastaviť hru STR_TOOLBAR_TOOLTIP_FORWARD :{BLACK}Zrýchliť priebeh hry -STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Nastavenia -STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Uložiť hru, opustiť hru, ukončiť -STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Zobraziť mapu +STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Možnosti a nastavenia +STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Uložiť, načítať alebo opustiť hru, ukončiť program +STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Zobraziť mapu, extra výrez, tok nákladu alebo zoznam značiek STR_TOOLBAR_TOOLTIP_DISPLAY_TOWN_DIRECTORY :{BLACK}Zobraziť zoznam miest STR_TOOLBAR_TOOLTIP_DISPLAY_SUBSIDIES :{BLACK}Zobraziť dotácie STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_STATIONS :{BLACK}Zoznam staníc spoločnosti @@ -417,9 +418,9 @@ STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_FINANCES :{BLACK}Finančn STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_GENERAL :{BLACK}Informácie o spoločnosti STR_TOOLBAR_TOOLTIP_DISPLAY_STORY_BOOK :{BLACK}Zobraziť knihu príbehov STR_TOOLBAR_TOOLTIP_DISPLAY_GOALS_LIST :{BLACK}Zobraziť zoznam cieľov -STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}Grafy +STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}Zobrazte firemné grafy a sadzby platieb za náklad STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_LEAGUE :{BLACK}Hodnotenie spoločností -STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}Financovať výstavbu nového priemyslu +STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}Preskúmať odvetvia alebo zafinancovať výstavbu nového odvetvia STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_TRAINS :{BLACK}Zoznam vlakov spoločnosti. Ctrl+klik prepína zoznam skupín/vozidiel STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_ROAD_VEHICLES :{BLACK}Zoznam cestných vozidiel spoločnosti. Ctrl+klik prepína zoznam skupín/vozidiel STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_SHIPS :{BLACK}Zoznam lodí spoločnosti. Ctrl+klik prepína zoznam skupín/vozidiel @@ -433,8 +434,8 @@ STR_TOOLBAR_TOOLTIP_BUILD_SHIP_DOCKS :{BLACK}Výstavb STR_TOOLBAR_TOOLTIP_BUILD_AIRPORTS :{BLACK}Výstavba letísk STR_TOOLBAR_TOOLTIP_LANDSCAPING :{BLACK}Otvoriť panel nástrojov pre úpravy terénu, výsadbu stromov, a pod. STR_TOOLBAR_TOOLTIP_SHOW_SOUND_MUSIC_WINDOW :{BLACK}Zobraziť okno zvuku a hudby -STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Zobraziť poslednú správu/novinku, nastavenia správ -STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Informácie o pozemku, konzola, ladenie skriptu, snímky obrazovky, o OpenTTD +STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Zobraziť poslednú správu/novinku, históriu správ alebo vymazať všetky správy +STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Informácie o pozemku, snímka obrazovky, o OpenTTD a nástrojoch pre vývojárov STR_TOOLBAR_TOOLTIP_SWITCH_TOOLBAR :{BLACK}Prepnúť panely nástrojov # Extra tooltips for the scenario editor toolbar @@ -1876,7 +1877,9 @@ STR_CONFIG_SETTING_ALLOW_SHARES_HELPTEXT :Ak je zapnuté, STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES :Minimálny vek spoločnosti na obchodovanie s podielmi: {STRING} STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_HELPTEXT :Určuje minimálny vek spoločnosti na to, aby od nej mohli ostatné spoločnosti kupovať a predavať podiely. +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_VALUE :{COMMA} rok{P "" "y" "ov"} ###setting-zero-is-special +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_NO_MIN :Žiadne minimum STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE :Percentáž zisku na zaplatenie podávacieho systému: {STRING} STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE_HELPTEXT :Percento príjmov dať na strednú ´nohu´ vo feeder systémoch, získate väčšiu kontrolu nad príjmami @@ -2016,13 +2019,15 @@ STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :Nastavením na STR_CONFIG_SETTING_SHORT_PATH_SATURATION :Vyťaženie krátkych ciest pred použitím vysokokapacitných ciest: {STRING} STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :Často je viac ciest medzi dvoma stanicami. Cargodist vyťaží najprv najkratšiu cestu, potom využije druhú najkratšiu cestu až kým nebude vyťažená atď. Vyťaženie je určené podľa odhadu kapacity a plánovaného využitia. Ak sú vyťažené všetky trasy a nepostačuje to, preťaží všetky trasy, s preferenciou najkapacitnejšej. Väčšinou algoritmus neodhadne kapacitu presne. Toto nastavenie umožňuje určiť na koľko percent musí byť vyťažená prvá pred výberom nasledujúcej dlhšej. Nastavte na menej ako 100%, aby sa zabránilo preplneniu staníc v prípade nadhodnotenia kapacity. -STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Jednotky rýchlosti: {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Jednotky rýchlosti (pozemné): {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :Jednotky rýchlosti (námorné): {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :Vždy, keď sa zobrazí rýchlosť v užívateľskom rozhraní, zobrazí sa vo vybraných jednotkách ###length 5 STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :Imperiálne (mph) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC :Metrické (km/h) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI :SI (m/s) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS :Jednotky v hre (políčka/deň) +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :Uzle STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :Jednotky výkonu vozidiel: {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :Vždy, keď sa zobrazí výkon vozidla v užívateľskom rozhraní, zobrazí sa vo vybraných jednotkách @@ -4649,6 +4654,7 @@ STR_AI_CONFIG_AILIST_TOOLTIP :{BLACK}AI, ktor STR_AI_CONFIG_HUMAN_PLAYER :Človek STR_AI_CONFIG_RANDOM_AI :Náhodná AI STR_AI_CONFIG_NONE :(žiadne) +STR_AI_CONFIG_NAME_VERSION :{STRING} {YELLOW}v{NUM} STR_AI_CONFIG_MAX_COMPETITORS :{LTBLUE}Maximálny počet konkurentov: {ORANGE}{COMMA} STR_AI_CONFIG_MOVE_UP :{BLACK}Posunúť vyššie @@ -4662,7 +4668,7 @@ STR_AI_CONFIG_AI :{SILVER}AI (ume STR_AI_CONFIG_CHANGE_AI :{BLACK}Vyber AI STR_AI_CONFIG_CHANGE_GAMESCRIPT :{BLACK}Vyber skript -STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}Spusti ďalší skript +STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}Spusti ďalší skript. Ctrl+klik zobrazí všetky dostupné verzie STR_AI_CONFIG_CONFIGURE :{BLACK}Nastaviť STR_AI_CONFIG_CONFIGURE_TOOLTIP :{BLACK}Nastaviť parametre skriptu @@ -4696,7 +4702,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Herný skript STR_AI_SETTINGS_CLOSE :{BLACK}Zavrieť STR_AI_SETTINGS_RESET :{BLACK}Resetovať STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Koľko dní prejde od spustenia predchádzajúcej umelej inteligencie k naštartovaniu novej: {ORANGE}{STRING} # Textfile window @@ -5579,10 +5584,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut Helic ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Spoločnosť {COMMA}) STR_FORMAT_GROUP_NAME :Skupina {COMMA} diff --git a/src/lang/slovenian.txt b/src/lang/slovenian.txt index 9331bab1a7..4e200cb91b 100644 --- a/src/lang/slovenian.txt +++ b/src/lang/slovenian.txt @@ -4310,7 +4310,6 @@ STR_AI_SETTINGS_CAPTION_AI :UI STR_AI_SETTINGS_CLOSE :{BLACK}Zapri STR_AI_SETTINGS_RESET :{BLACK}Resetiraj STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Število dni zamika med zagonom sledeče po predhodni UI: {ORANGE}{STRING} # Textfile window @@ -5207,10 +5206,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut helik ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Podjetje {COMMA}) STR_FORMAT_GROUP_NAME :Skupina {COMMA} diff --git a/src/lang/spanish.txt b/src/lang/spanish.txt index 3c916581d3..92df45c636 100644 --- a/src/lang/spanish.txt +++ b/src/lang/spanish.txt @@ -4623,7 +4623,6 @@ STR_AI_SETTINGS_CAPTION_AI :{WHITE}Parámet STR_AI_SETTINGS_CLOSE :{BLACK}Cerrar STR_AI_SETTINGS_RESET :{BLACK}Reiniciar STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Número de días (aproximados) de espera antes de comenzar esta IA desde el momento en el que empezó la anterior: {ORANGE}{STRING} # Textfile window @@ -5494,10 +5493,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Helicóptero Po ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Empresa {COMMA}) STR_FORMAT_GROUP_NAME :Grupo {COMMA} diff --git a/src/lang/spanish_MX.txt b/src/lang/spanish_MX.txt index 9b0128cf81..0fa8e683bb 100644 --- a/src/lang/spanish_MX.txt +++ b/src/lang/spanish_MX.txt @@ -4624,7 +4624,6 @@ STR_AI_SETTINGS_CAPTION_AI :{WHITE}Parámet STR_AI_SETTINGS_CLOSE :{BLACK}Cerrar STR_AI_SETTINGS_RESET :{BLACK}Reiniciar STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Número de días a esperar antes de comenzar esta IA desde el momento en el que empezó la anterior: {ORANGE}{STRING} # Textfile window @@ -5497,10 +5496,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Helicóptero Po ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{0:STRING}/{1:STRING}/{2:NUM} +STR_FORMAT_DATE_TINY :{0:ZEROFILL_NUM}/{1:ZEROFILL_NUM}/{2:NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{0:STRING} {1:STRING} {2:NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Empresa {COMMA}) STR_FORMAT_GROUP_NAME :Grupo {COMMA} diff --git a/src/lang/swedish.txt b/src/lang/swedish.txt index 223259f4fa..2f5f480dc2 100644 --- a/src/lang/swedish.txt +++ b/src/lang/swedish.txt @@ -4628,7 +4628,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Spelskript STR_AI_SETTINGS_CLOSE :{BLACK}Stäng STR_AI_SETTINGS_RESET :{BLACK}Återställ STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Ungefärligt antal dagar som denna datorspelare startar efter föregående datorspelare: {ORANGE}{STRING} # Textfile window @@ -5511,10 +5510,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut helik ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Företag {COMMA}) STR_FORMAT_GROUP_NAME :Grupp {COMMA} diff --git a/src/lang/tamil.txt b/src/lang/tamil.txt index 052983d97c..7f1fec6d7b 100644 --- a/src/lang/tamil.txt +++ b/src/lang/tamil.txt @@ -4129,7 +4129,6 @@ STR_AI_SETTINGS_CAPTION_AI :AI STR_AI_SETTINGS_CLOSE :{BLACK}மூடு STR_AI_SETTINGS_RESET :{BLACK}முன்னிருந்தமாதிரி மாற்று STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :இந்த AI-இனை தொடங்குவதற்கான நாட்கள், முந்தின AI-இற்கு பிறகு: {ORANGE}{STRING} # Textfile window @@ -4984,10 +4983,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :பவர்ன ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(நிறுவனம் {COMMA}) STR_FORMAT_GROUP_NAME :குழு {COMMA} diff --git a/src/lang/thai.txt b/src/lang/thai.txt index 73830d8c02..fcdc273c0d 100644 --- a/src/lang/thai.txt +++ b/src/lang/thai.txt @@ -4271,7 +4271,6 @@ STR_AI_SETTINGS_CAPTION_AI :AI STR_AI_SETTINGS_CLOSE :{BLACK}ปิด STR_AI_SETTINGS_RESET :{BLACK}เริ่มใหม่ STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :จำนวนที่จะให้เริ่มต้น AI นี้หลังจากที่มีการเริ่มต้น AI ก่อนหน้านี้ไป: {ORANGE}{STRING} # Textfile window @@ -5123,10 +5122,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut Helic ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(บริษัท {COMMA}) STR_FORMAT_GROUP_NAME :กลุ่ม {COMMA} diff --git a/src/lang/traditional_chinese.txt b/src/lang/traditional_chinese.txt index b06170468a..96ab183b87 100644 --- a/src/lang/traditional_chinese.txt +++ b/src/lang/traditional_chinese.txt @@ -4628,7 +4628,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :遊戲腳本 STR_AI_SETTINGS_CLOSE :{BLACK}關閉 STR_AI_SETTINGS_RESET :{BLACK}重設 STR_AI_SETTINGS_SETTING :{STRING}:{ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :此 AI 與上一個 AI 的啟動時間相隔天數 (近似值):{ORANGE}{STRING} # Textfile window @@ -5511,10 +5510,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut 直 ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{2:NUM} 年 {1:STRING} 月 {0:STRING} 日 -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(公司 {COMMA}) STR_FORMAT_GROUP_NAME :群組 {COMMA} diff --git a/src/lang/turkish.txt b/src/lang/turkish.txt index 6265117af5..a6ab7390ca 100644 --- a/src/lang/turkish.txt +++ b/src/lang/turkish.txt @@ -157,7 +157,7 @@ STR_ABBREV_COLA :{TINY_FONT}KO STR_ABBREV_CANDYFLOSS :{TINY_FONT}PŞ STR_ABBREV_BUBBLES :{TINY_FONT}BA STR_ABBREV_TOFFEE :{TINY_FONT}ŞL -STR_ABBREV_BATTERIES :{TINY_FONT}Pİ +STR_ABBREV_BATTERIES :{TINY_FONT}PİL STR_ABBREV_PLASTIC :{TINY_FONT}PL STR_ABBREV_FIZZY_DRINKS :{TINY_FONT}İÇ STR_ABBREV_NONE :{TINY_FONT}YO @@ -196,6 +196,7 @@ STR_UNITS_VELOCITY_IMPERIAL :{COMMA}{NBSP}mi STR_UNITS_VELOCITY_METRIC :{COMMA}{NBSP}km/s STR_UNITS_VELOCITY_SI :{COMMA}{NBSP}m/s STR_UNITS_VELOCITY_GAMEUNITS :{DECIMAL}{NBSP}karo/gün +STR_UNITS_VELOCITY_KNOTS :{COMMA}{NBSP}hava hızı STR_UNITS_POWER_IMPERIAL :{COMMA}{NBSP}bg STR_UNITS_POWER_METRIC :{COMMA}{NBSP}bg @@ -344,9 +345,9 @@ STR_GOTO_ORDER_VIEW_TOOLTIP :{BLACK}Emir gö ###length 31 STR_TOOLBAR_TOOLTIP_PAUSE_GAME :{BLACK}Oyunu durdur STR_TOOLBAR_TOOLTIP_FORWARD :{BLACK}Oyunu hızlandır -STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Seçenekler -STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Kaydet, oyunu terk et, çık -STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Haritayı göster +STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Seçenekler ve ayarlar +STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Kaydet, oyunu yükle veya terk et, program'dan çık +STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Haritayı, ekstra vitrini, kargo akşını veya işaret listesini görüntüleyin STR_TOOLBAR_TOOLTIP_DISPLAY_TOWN_DIRECTORY :{BLACK}Şehir listesini göster STR_TOOLBAR_TOOLTIP_DISPLAY_SUBSIDIES :{BLACK}Teşvikleri göster STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_STATIONS :{BLACK}Şirkete ait istasyonları listele @@ -354,9 +355,9 @@ STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_FINANCES :{BLACK}Şirketi STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_GENERAL :{BLACK}Şirketin genel durumunu göster STR_TOOLBAR_TOOLTIP_DISPLAY_STORY_BOOK :{BLACK}Hikaye kitabını görüntüle STR_TOOLBAR_TOOLTIP_DISPLAY_GOALS_LIST :{BLACK}Amaç listesini görüntüle -STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}Grafikleri göster +STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}Şirket grafiğini ve kargo ödeme oranlarını görüntüleyin STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_LEAGUE :{BLACK}Şirketler ligini göster -STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}Yeni fabrika kur veya tüm fabrikaları listele +STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}Endüstrileri inceleyin veya yeni endüstri inşasını fonlayın STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_TRAINS :{BLACK}Şirkete ait trenleri listele. Ctrl+Sol tıklama ile grup/araç listesini açar veya kapatır STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_ROAD_VEHICLES :{BLACK}Şirkete ait karayolu taşıtlarını listele. Ctrl+Sol tıklama ile grup/araç listesini açıp kapatır STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_SHIPS :{BLACK}Şirkete ait gemileri listele. Ctrl+Sol tık ile grup/araç listesini açar veya kapatır @@ -370,8 +371,8 @@ STR_TOOLBAR_TOOLTIP_BUILD_SHIP_DOCKS :{BLACK}Rıhtım STR_TOOLBAR_TOOLTIP_BUILD_AIRPORTS :{BLACK}Havalimanı yapımı STR_TOOLBAR_TOOLTIP_LANDSCAPING :{BLACK}Arazi düzenleme araç çubuğunu aç (ağaç dikme, alçaltma/yükseltme vb. için). STR_TOOLBAR_TOOLTIP_SHOW_SOUND_MUSIC_WINDOW :{BLACK}Ses/müzik penceresini göster -STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Son mesajı/haberi göster, mesaj ayarlarını göster -STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Arazi bilgisi, konsol, betik hata ayıklama, ekran görüntüleri, OpenTTD hakkında +STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Son mesajı/haberi göster, mesaj geçmişini göster veya tüm mesajları sil +STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Arazi bilgisi, ekran görüntüsü, OpenTTD ve geliştirici araçları hakkında STR_TOOLBAR_TOOLTIP_SWITCH_TOOLBAR :{BLACK}Araç çubuklarını değiştir # Extra tooltips for the scenario editor toolbar @@ -1712,7 +1713,7 @@ STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_HELPTEXT :Tek bir betiği STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_VALUE :{COMMA} MiB STR_CONFIG_SETTING_SERVINT_ISPERCENT :Servis gecikmeleri yüzde ile: {STRING} -STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :Araçlara bakım yapılmasına bir önceki bakımın üzerinden geçen zamana göre mi, yoksa aracın güvenilirlik değerinin azami güvenilirliğe kıyasla belli bir yüzde oranında düşmesine bağlı olarak mı karar verileceğini seçin +STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :Etkinleştirildiğinde, araçların güvenilirlik değerinin azami güvenilirliğe kıyasla belli bir yüzde oranında düşmesine bağlı olarak bakım yapar.{}{}Örneğin, eğer aracın azami güvenirliği %90 ve bakım aralığı %20 ise araç %72 güvenilirliğe ulaştığında bakım yapmayı dener. STR_CONFIG_SETTING_SERVINT_TRAINS :Trenler için varsayılan bakım aralığı: {STRING} STR_CONFIG_SETTING_SERVINT_TRAINS_HELPTEXT :Yeni tren yolu araçları için varsayılan bakım aralığını ayarlar, eğer araç için özel bir bakım aralığı belirtilmemişse geçerlidir @@ -1809,7 +1810,9 @@ STR_CONFIG_SETTING_ALLOW_SHARES_HELPTEXT :Etkinleştirild STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES :Hisse satmak için gerekli minimum şirket yaşı: {STRING} STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_HELPTEXT :Bir şirketin hisselerinin satılabileceği ve diğer şirketlerin alabileceği minimum şirket yaşını belirleyin. +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_VALUE :{COMMA} yıl{P ""} ###setting-zero-is-special +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_NO_MIN :Minimum yok STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE :Besleme sistemlerinde, bölümlerden elde edilen kardan ödenecek yüzde: {STRING} STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE_HELPTEXT :Besleme sistemlerinde, sistemi oluşturan ara bölümlere verilen kar yüzdesi. Böylece kar miktarı üzerinde daha fazla kontrol elde edilmiş olur @@ -1924,6 +1927,10 @@ STR_CONFIG_SETTING_LARGER_TOWNS_DISABLED :Hiçbiri STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER :Birincil şehir büyüklüğü çarpanı: {STRING} STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :Oyun başlangıcında şehirlerin normal kasabalara kıyasla ortalama büyüklüğü +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL :Dağıtım grafiğini her {STRING}{NBSP}saniyede{P 0:2 ""} güncelle +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL_HELPTEXT :Bağlantı grafiğinin sonraki yeniden hesaplamaları arasındaki süre. Her yeniden hesaplama, grafiğin bir bileşeni için planları hesaplar. Bu, bu ayar için bir X değerinin tüm grafiğin her X saniyede bir güncelleneceği anlamına gelmediği anlamına gelir. Sadece bazı bileşenler olacaktır. Ne kadar kısa ayarlarsanız, hesaplamak için o kadar fazla CPU süresi gerekir. Ne kadar uzun ayarlarsanız, kargo dağıtımının yeni rotalarda başlaması o kadar uzun sürer. +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME :Dağıtım grafiğinin yeniden hesaplanması için {STRING}{NBSP}saniye{P 0:2 ""} bekleyin +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME_HELPTEXT :Bir bağlantı grafiği bileşeninin her yeniden hesaplanması için geçen süre. Bir yeniden hesaplama başlatıldığında, bu sayıda saniye boyunca çalışmasına izin verilen bir iş parçacığı oluşturulur. Bunu ne kadar kısa ayarlarsanız, iş parçacığının olması gerektiği zamanda bitmemiş olma olasılığı o kadar artar. Ardından oyun ("gecikme") olana kadar durur. Ne kadar uzun ayarlarsanız, rotalar değiştiğinde dağıtımın güncellenmesi o kadar uzun sürer. STR_CONFIG_SETTING_DISTRIBUTION_PAX :Yolcular için dağıtım kipi: {STRING} STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :"Simetrik" seçildiğinde A durağından B durağına taşınan ile B'den A'ya taşınan yolcu miktarı kabaca eşit olur. "Asimetrik" seçildiğinde iki yönde de rastgele miktarda yolcu gönderilebilir. "el ile" seçildiğinde yolcular için otomatik dağıtım yapılmaz. @@ -1949,13 +1956,15 @@ STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :Buraya %100'den STR_CONFIG_SETTING_SHORT_PATH_SATURATION :Yüksek kapasiteli güzergahları kullanmadan önce daha kısa güzergah doygunluğu: {STRING} STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :Sıklıkla iki durak arasında birden fazla güzergah bulunur. Kargo dağıtımı önce en kısa güzergahı doygunluğa ulaştırır, ardından ikinci en kısa güzergahı doygunluğa ulaşana kadar kullanır ve böyle devam eder. Doygunluk, kapasite tahmini ve planlanan kullanım miktarına göre hesaplanır. Tüm güzergahlar doygunluğa ulaştığında eğer hala talep varsa, yüksek kapasiteli olan güzergahları tercih ederek tüm güzergahları aşırı yükler. Fakat çoğu zaman algoritma kapasiteyi isabetli olarak hesaplayamaz. Bu değer, daha kısa bir güzergahın yüzde kaç oranında doygunluğa ulaştığı zaman bir sonraki güzergahın seçileceğini ayarlamanızı sağlar. Yanlış (büyük) kapasite tahmini ihtimaline karşı aşırı dolu durakları önlemek için %100'den daha düşük bir değer seçin. -STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Hız birimi: {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Hız birimi (kara): {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :Hız birimleri (denizcilik): {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :Kullanıcı arayüzünde hız görüntülendiğinde, bunu seçili birimde göster. ###length 5 STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :Imperial (İngiliz ölçü birimleri) (mph) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC :Metrik (km/s) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI :SI (Uluslararası Ölçüm Sistemi) (m/s) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS :Oyun birimleri (karo/gün) +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :Hava hızı STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :Araç gücü ölçü birimi: {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :Kullanıcı arayüzünde bir aracın gücü görüntülendiğinde, bunu seçili ölçü biriminde göster. @@ -4582,7 +4591,9 @@ STR_AI_CONFIG_AILIST_TOOLTIP :{BLACK}Bir sonr STR_AI_CONFIG_HUMAN_PLAYER :İnsan oyuncu STR_AI_CONFIG_RANDOM_AI :Rastgele YZ STR_AI_CONFIG_NONE :(hiçbiri) +STR_AI_CONFIG_NAME_VERSION :{STRING} {YELLOW}v{NUM} STR_AI_CONFIG_MAX_COMPETITORS :{LTBLUE}En fazla yarışmacı sayısı: {ORANGE}{COMMA} +STR_AI_CONFIG_COMPETITORS_INTERVAL :{LTBLUE}Yarışmacıların başlama arasındaki aralık: {ORANGE}{COMMA} dakika {P ""} STR_AI_CONFIG_MOVE_UP :{BLACK}Yukarı taşı STR_AI_CONFIG_MOVE_UP_TOOLTIP :{BLACK}Seçilen YZ'yi listede yukarı taşı @@ -4595,7 +4606,7 @@ STR_AI_CONFIG_AI :{SILVER}YZ'ler STR_AI_CONFIG_CHANGE_AI :{BLACK}YZ Seç STR_AI_CONFIG_CHANGE_GAMESCRIPT :{BLACK}Oyun Betiği Seç -STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}Başka bir betik yükle +STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}Başka bir betik yükle. Kullanılabilir tüm sürümleri göstermek için Ctrl+Tıkla STR_AI_CONFIG_CONFIGURE :{BLACK}Yapılandır STR_AI_CONFIG_CONFIGURE_TOOLTIP :{BLACK}Betik parametrelerini yapılandır @@ -4629,7 +4640,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Oyun Betiği STR_AI_SETTINGS_CLOSE :{BLACK}Kapat STR_AI_SETTINGS_RESET :{BLACK}Yeniden başlat STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Bu YZ bir öncekinden kaç gün sonra başlayacak (yaklaşık): {ORANGE}{STRING} # Textfile window @@ -5084,6 +5094,18 @@ STR_ERROR_TOO_FAR_FROM_PREVIOUS_DESTINATION :{WHITE}... önc STR_ERROR_AIRCRAFT_NOT_ENOUGH_RANGE :{WHITE}... uçağın menzili yeterli değil # Extra messages which go on the third line of errors, explaining why orders failed +STR_ERROR_NO_RAIL_STATION :{WHITE} Tren istasyonu yok +STR_ERROR_NO_BUS_STATION :{WHITE}Otobüs istasyonu yok +STR_ERROR_NO_TRUCK_STATION :{WHITE} Kamyon istasyonu yok +STR_ERROR_NO_DOCK :{WHITE}Liman yok +STR_ERROR_NO_AIRPORT :{WHITE}Havalimanı/Helikopter pisti yok +STR_ERROR_NO_STOP_COMPATIBLE_ROAD_TYPE :{WHITE}Uyumlu bir yol tipine sahip durak yok +STR_ERROR_NO_STOP_COMPATIBLE_TRAM_TYPE :{WHITE}Uyumlu bir tramvay tipine sahip durak yok +STR_ERROR_NO_STOP_ARTICULATED_VEHICLE :{WHITE} Körüklü karayolu taşıtları için uygun durak yoktur.{}Körüklü karayolu taşıtları üzerinden geçme durağı gerektirir, körfez durağı değil +STR_ERROR_AIRPORT_NO_PLANES :{WHITE}Bu uçak bu helikopter pistine inemez +STR_ERROR_AIRPORT_NO_HELICOPTERS :{WHITE}Helikopter bu havalimanı'na inemez +STR_ERROR_NO_RAIL_WAYPOINT :{WHITE} Demiryolu ara noktası yok +STR_ERROR_NO_BUOY :{WHITE}Şamandıra yok # Timetable related errors STR_ERROR_CAN_T_TIMETABLE_VEHICLE :{WHITE}Aracın zaman çizelgesi oluşturulamıyor... @@ -5510,10 +5532,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut Helik ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Company {COMMA}) STR_FORMAT_GROUP_NAME :Grup {COMMA} diff --git a/src/lang/ukrainian.txt b/src/lang/ukrainian.txt index be0d09713e..0a0ad48013 100644 --- a/src/lang/ukrainian.txt +++ b/src/lang/ukrainian.txt @@ -4749,7 +4749,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Ігровий STR_AI_SETTINGS_CLOSE :{BLACK}Закрити STR_AI_SETTINGS_RESET :{BLACK}Скидання STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Кількість днів до запуску цього АІ після запуску попереднього АІ: {ORANGE}{STRING} # Textfile window @@ -5657,10 +5656,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Гелікоп ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Компанія {COMMA}) STR_FORMAT_GROUP_NAME :Група {COMMA} diff --git a/src/lang/urdu.txt b/src/lang/urdu.txt index 49abf06991..9421f86052 100644 --- a/src/lang/urdu.txt +++ b/src/lang/urdu.txt @@ -3099,10 +3099,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut ہی ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(کمپنی {COMMA}) STR_FORMAT_GROUP_NAME :گروہ {COMMA} diff --git a/src/lang/vietnamese.txt b/src/lang/vietnamese.txt index d8d9815f25..0ab7cc6bc3 100644 --- a/src/lang/vietnamese.txt +++ b/src/lang/vietnamese.txt @@ -195,6 +195,7 @@ STR_UNITS_VELOCITY_IMPERIAL :{COMMA}{NBSP}mp STR_UNITS_VELOCITY_METRIC :{COMMA}{NBSP}km/h STR_UNITS_VELOCITY_SI :{COMMA}{NBSP}m/s STR_UNITS_VELOCITY_GAMEUNITS :{DECIMAL}{NBSP}ô/ngày +STR_UNITS_VELOCITY_KNOTS :{COMMA}{NBSP}hải lý STR_UNITS_POWER_IMPERIAL :{COMMA}{NBSP}hp STR_UNITS_POWER_METRIC :{COMMA}{NBSP}hp @@ -343,9 +344,9 @@ STR_GOTO_ORDER_VIEW_TOOLTIP :{BLACK}Mở b ###length 31 STR_TOOLBAR_TOOLTIP_PAUSE_GAME :{BLACK}Tạm dừng trò chơi STR_TOOLBAR_TOOLTIP_FORWARD :{BLACK}Tua nhanh trò chơi -STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Tùy chọn -STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Lưu, bỏ ván chơi, thoát chương trình -STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Hiển thị bản đồ +STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Tùy chọn và thiết lập +STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Lưu, nạp hoặc bỏ ván chơi, thoát chương trình +STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Hiển thị bản đồ, khung nhìn bổ sung, dòng chảy hàng hóa hoặc danh sách biển hiệu STR_TOOLBAR_TOOLTIP_DISPLAY_TOWN_DIRECTORY :{BLACK}Hiển thị danh sách đô thị STR_TOOLBAR_TOOLTIP_DISPLAY_SUBSIDIES :{BLACK}Hiện tiền trợ cấp STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_STATIONS :{BLACK}Hiển thị danh sách công ty @@ -353,9 +354,9 @@ STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_FINANCES :{BLACK}Hiện t STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_GENERAL :{BLACK}Hiện thông tin tổng quát của công ty STR_TOOLBAR_TOOLTIP_DISPLAY_STORY_BOOK :{BLACK}Hiển thị tình tiết STR_TOOLBAR_TOOLTIP_DISPLAY_GOALS_LIST :{BLACK}Hiển thị danh sách mục tiêu -STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}Hiển thị biểu đồ +STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}Hiển thị biểu đồ của công ty và giá cước hàng hóa STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_LEAGUE :{BLACK}Hiện bảng tầm cỡ các công ty -STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}Bỏ vốn cho những ngành mới hoặc hiện tất cả các ngành +STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}Khảo sát các ngành công nghiệp hoặc bỏ vốn cho những ngành mới STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_TRAINS :{BLACK}Hiện danh sách tàu hỏa của công ty. Ctrl+Click vào chốt néo để mở danh sách nhóm/phương tiện STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_ROAD_VEHICLES :{BLACK}Hiện danh sách xe cộ của công ty. Ctrl+Click vào chốt néo để mở danh sách nhóm/phương tiện STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_SHIPS :{BLACK}Hiện danh sách tàu thủy của công ty. Ctrl+Click vào chốt néo để mở danh sách nhóm/phương tiện @@ -369,8 +370,8 @@ STR_TOOLBAR_TOOLTIP_BUILD_SHIP_DOCKS :{BLACK}Xây b STR_TOOLBAR_TOOLTIP_BUILD_AIRPORTS :{BLACK}Xây sân bay STR_TOOLBAR_TOOLTIP_LANDSCAPING :{BLACK}Mở thanh địa hình để nâng cao/hạ thấp ô đất, trồng cây, etc. STR_TOOLBAR_TOOLTIP_SHOW_SOUND_MUSIC_WINDOW :{BLACK}Hiện cửa sổ âm thanh/nhạc -STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Hiện thông báo/tin tức cuối cùng, hiện tùy chọn thông báo -STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Thông tin vùng đất, bảng lệnh, script debug, ảnh chụp, về OpenTTD +STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Hiện thông báo/tin tức cuối cùng, lịch sử thông báo hoặc xóa tất cả thông báo +STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Thông tin vùng đất, chụp màng hình, công cụ dành cho nhà phát triển và thông tin về OpenTTD STR_TOOLBAR_TOOLTIP_SWITCH_TOOLBAR :{BLACK}Chuyển thanh công cụ # Extra tooltips for the scenario editor toolbar @@ -816,7 +817,7 @@ STR_NEWS_MESSAGE_CAPTION :{WHITE}Thông STR_NEWS_CUSTOM_ITEM :{BIG_FONT}{BLACK}{STRING} STR_NEWS_FIRST_TRAIN_ARRIVAL :{BIG_FONT}{BLACK}Người dân chào đón . . .{}Tàu hoả đầu tiên đến {STATION}! -STR_NEWS_FIRST_BUS_ARRIVAL :{BIG_FONT}{BLACK}Người dân chào đón . . .{}Xe bus đầu tiên đến {STATION}! +STR_NEWS_FIRST_BUS_ARRIVAL :{BIG_FONT}{BLACK}Người dân chào đón . . .{}Xe buýt đầu tiên đến {STATION}! STR_NEWS_FIRST_TRUCK_ARRIVAL :{BIG_FONT}{BLACK}Người dân chào đón . . .{}Xe tải đầu tiên đến {STATION}! STR_NEWS_FIRST_PASSENGER_TRAM_ARRIVAL :{BIG_FONT}{BLACK}Người dân chào đón . . .{}Xe điện chở khách đầu tiên đến {STATION}! STR_NEWS_FIRST_CARGO_TRAM_ARRIVAL :{BIG_FONT}{BLACK}Người dân chào đón . . .{}Xe tải điện đầu tiên đến {STATION}! @@ -1287,7 +1288,7 @@ STR_CONFIG_SETTING_ROAD_VEHICLE_SLOPE_STEEPNESS :Sự giảm t STR_CONFIG_SETTING_ROAD_VEHICLE_SLOPE_STEEPNESS_HELPTEXT :Sự giảm tốc cho ôtô tại một ô dốc. Giá trị càng cao thì càng khó leo dốc STR_CONFIG_SETTING_FORBID_90_DEG :Ngăn tàu hỏa chuyển hướng 90 độ: {STRING} -STR_CONFIG_SETTING_FORBID_90_DEG_HELPTEXT :quay 90 độ chỉ xảy ra khi một ray ngang nối với một ray dọc ở 2 ô liền kề, khiến cho tàu hỏa cua 90 độ khi đến ô rẽ thay vì 45 độ như bình thường. +STR_CONFIG_SETTING_FORBID_90_DEG_HELPTEXT :Chuyển hướng 90 độ chỉ xảy ra khi một ray ngang nối với một ray dọc ở 2 ô liền kề, khiến cho tàu hỏa cua 90 độ khi đến ô rẽ thay vì 45 độ như bình thường. STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS :Cho phép gộp ga, bến, cảng không sát nhau: {STRING} STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS_HELPTEXT :Cho phép thêm đoạn vào ga mà không phải sửa cái hiện có. Phải bấm Ctrl+Click để thêm đoạn vào ga @@ -1375,9 +1376,9 @@ STR_CONFIG_SETTING_PLANE_CRASHES_REDUCED :giảm bớt STR_CONFIG_SETTING_PLANE_CRASHES_NORMAL :bình thường STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD :Cho phép xây điểm dừng xe buýt trên đường của thị trấn: {STRING} -STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD_HELPTEXT :Cho phép xây dựng điểm dừng xe bus trên đường sở hữu bởi địa phương +STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD_HELPTEXT :Cho phép xây dựng điểm dừng xe buýt trên đường sở hữu bởi địa phương STR_CONFIG_SETTING_STOP_ON_COMPETITOR_ROAD :Cho phép xây điểm dừng xe buýt trên đường của đối thủ: {STRING} -STR_CONFIG_SETTING_STOP_ON_COMPETITOR_ROAD_HELPTEXT :Cho phép xây dựng điểm dừng xe bus trên đường sở hữu bởi công ty khác +STR_CONFIG_SETTING_STOP_ON_COMPETITOR_ROAD_HELPTEXT :Cho phép xây dựng điểm dừng xe buýt trên đường sở hữu bởi công ty khác STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES :{WHITE}Không thể đổi thiết đặt này khi vẫn còn các phương tiện giao thông. STR_CONFIG_SETTING_INFRASTRUCTURE_MAINTENANCE :Phí bảo trì cơ sở hạ tầng: {STRING} @@ -1711,7 +1712,7 @@ STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_HELPTEXT :Số lượng b STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_VALUE :{COMMA} MiB STR_CONFIG_SETTING_SERVINT_ISPERCENT :Tần suất bảo trì theo đơn vị phần trăm: {STRING} -STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :Lựa chọn liệu rằng việc bảo trì phương tiện sẽ được tiến hành sau một khoảng thời gian nhất định hay là độ tin cậy bị giảm xuống bao nhiều phần trăm so với mức tối đa +STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :Khi được bật, việc bảo trì phương tiện sẽ được thực thực hiện khi độ tin cậy của phương tiện giảm xuống so với độ tin cậy tối đa.{}{}Ví dụ, nếu độ tin cậy tối đa của phương tiện là 90% và tần suất bảo trì là 20%, phương tiện sẽ được bảo trì khi độ tin cậy giảm xuống 72%. STR_CONFIG_SETTING_SERVINT_TRAINS :Tần suất bảo trì mặc định đối với tàu hỏa: {STRING} STR_CONFIG_SETTING_SERVINT_TRAINS_HELPTEXT :Thiết lập khoảng thời gian bảo trì tùy chọn đối với các tàu hỏa, nếu phương tiện không có riêng thời gian bảo trì này @@ -1808,7 +1809,9 @@ STR_CONFIG_SETTING_ALLOW_SHARES_HELPTEXT :Nếu bật, ch STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES :Tuổi công ty tối thiểu để bán cổ phần: {STRING} STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_HELPTEXT :Đặt số tuổi tối thiểu của công ty để cho các bên khác có thể mua và bán cổ phần +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_VALUE :{COMMA} năm ###setting-zero-is-special +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_NO_MIN :Không có tuổi tối thiểu STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE :Tỉ lệ lợi tức cổ phiếu chi trả cho môi giới: {STRING} STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE_HELPTEXT :Tỉ lệ thu nhập cho mỗi trung gian trên hệ thống vận tải, cho phép điều chỉnh thu nhập @@ -1923,6 +1926,10 @@ STR_CONFIG_SETTING_LARGER_TOWNS_DISABLED :Không STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER :Hệ số quy mô đô thị coi là thành phố: {STRING} STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :Kích thước trung bình của thành phố tỉ lệ với đô thị lúc bắt đầu trò chơi +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL :Cập nhật biểu đồ phân phối mỗi {STRING}{NBSP}giây +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL_HELPTEXT :Thời gian giữa các lần tính toán lại tiếp theo của biểu đồ liên kết. Mỗi lần tính toán lại sẽ tính toán các kế hoạch cho một thành phần của biểu đồ. Điều đó có nghĩa là giá trị X cho cài đặt này không có nghĩa là toàn bộ biểu đồ sẽ được cập nhật X giây một lần. Chỉ một số thành phần sẽ làm như vậy. Bạn đặt nó càng ngắn thì càng cần nhiều thời gian CPU để tính toán nó. Bạn đặt càng lâu thì càng mất nhiều thời gian cho đến khi việc phân phối hàng hóa bắt đầu trên các tuyến đường mới. +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME :Mất {STRING}{NBSP}giây để tính toán lại biểu đồ phân phối +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME_HELPTEXT :Thời gian tiêu tốn cho mỗi lần tính toán lại một thành phần biểu đồ liên kết. Khi bắt đầu tính toán lại, một luồng sẽ được sinh ra và chạy trong số giây được thiết lập. Bạn đặt thông số này càng ngắn thì càng có nhiều khả luồng được tạo chưa hoàn thành công việc của nó. Sau đó, trò chơi dừng lại cho đến khi nó ("lag"). Bạn đặt càng lâu thì biểu đồ phân phối càng mất nhiều thời gian để cập nhật khi các tuyến thay đổi. STR_CONFIG_SETTING_DISTRIBUTION_PAX :Chế độ phân phối đối với hành khách: {STRING} STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :"Đối xứng" có nghĩa là số lượng hành khách đi từ nhà ga A đến nhà ga B và từ B đến A sẽ tương đương nhau . "Không đối xứng" có nghĩa là số lượng hành khách tùy ý có thể đi theo một trong hai hướng. "Thủ công" có nghĩa là hành khách sẽ không được phân phối tự động. @@ -1948,13 +1955,15 @@ STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :Thiết lập g STR_CONFIG_SETTING_SHORT_PATH_SATURATION :Tỉ lệ bảo hòa (hết tải) của đường tắt trước khi chuyển sang đường khác dài hơn: {STRING} STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :Thường sẽ có nhiều con đường giữa 2 ga/bến. Việc vận tải hàng hóa sẽ chọn con đường ngắn nhất trước cho đến khi hết tải. Sau đó chọn con đường ngắn thứ 2, 3... cho đến khi hết tải. Việc hết tải được tính toán bằng khối lượng vận chuyển thực tế so với dự tính. Khi hết tải tất cả các con đường, nếu vẫn còn hàng hóa cần chuyển, thì nó có thể gây quá tải. Dầu vậy thuật toán này không phải lúc nào cũng chính xác trong việc tính toán năng lực vận tải. Thiết lập này cho phép bạn tinh chỉnh tỉ lệ mà một con đường sẽ hết tải trước khi chọn con đường kế tiếp. Nhỏ hơn 100% sẽ giúp tránh việc một ga bến quá đông đúc và bù trừ việc tính toán sai lệch này. -STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Đơn vị tốc độ: {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Đơn vị tốc độ (đất liền): {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :Đơn vị tốc độ (hàng hải): {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :Khi thể hiện tốc độ trên giao diện, thể hiện nó bằng đơn vị đã chọn. ###length 5 STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :Imperial (mph) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC :Metric (km/h) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI :SI (m/s) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS :Đơn vị trong trò chơi (ô/ngày) +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :Hải lý STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :Đơn vị công suất phương tiện: {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :Khi thể hiện công suất phương tiện, thể hiện nó bằng đơn vị đã chọn. @@ -3938,7 +3947,7 @@ STR_BUY_VEHICLE_SHIP_BUY_VEHICLE_TOOLTIP :{BLACK}Mua tàu STR_BUY_VEHICLE_AIRCRAFT_BUY_VEHICLE_TOOLTIP :{BLACK}Mua máy bay đã ấn định. Shift+Click để xem giá mua dự tính ###length VEHICLE_TYPES -STR_BUY_VEHICLE_TRAIN_BUY_REFIT_VEHICLE_TOOLTIP :{BLACK}Mua và cải biến toa tầu được chọn. Shift+Click để xem giá mua dự tính +STR_BUY_VEHICLE_TRAIN_BUY_REFIT_VEHICLE_TOOLTIP :{BLACK}Mua và cải biến toa tàu được chọn. Shift+Click để xem giá mua dự tính STR_BUY_VEHICLE_ROAD_VEHICLE_BUY_REFIT_VEHICLE_TOOLTIP :{BLACK}Mua và cải biến ô-tô đang chọn. Shift+Click để xem giá mua dự tính STR_BUY_VEHICLE_SHIP_BUY_REFIT_VEHICLE_TOOLTIP :{BLACK}Mua và cải biến tàu thuỷ đã chọn. Shift+Click để dự tính giá mà không mua STR_BUY_VEHICLE_AIRCRAFT_BUY_REFIT_VEHICLE_TOOLTIP :{BLACK}Mua và cải biến máy bay được chọn. Shift+Click để xem chi phí dự tính @@ -4069,7 +4078,7 @@ STR_DEPOT_SELL_CONFIRMATION_TEXT :{YELLOW}Bạn STR_ENGINE_PREVIEW_CAPTION :{WHITE}Thông cáo từ nhà sản xuất phương tiện vận tải STR_ENGINE_PREVIEW_MESSAGE :{GOLD}Chúng tôi vừa thiết kế một {STRING} mới - bạn có muốn mua nó trước khi chúng tôi hoàn thiện 1 năm, để chúng tôi đánh giá nó trước khi bán rộng rãi? -STR_ENGINE_PREVIEW_RAILROAD_LOCOMOTIVE :đầu máy tầu hoả +STR_ENGINE_PREVIEW_RAILROAD_LOCOMOTIVE :đầu máy tàu hoả STR_ENGINE_PREVIEW_ELRAIL_LOCOMOTIVE :ngành vận tải đường sắt điện lực STR_ENGINE_PREVIEW_MONORAIL_LOCOMOTIVE :đầu máy ray đơn STR_ENGINE_PREVIEW_MAGLEV_LOCOMOTIVE :đầu máy đệm từ @@ -4581,7 +4590,9 @@ STR_AI_CONFIG_AILIST_TOOLTIP :{BLACK}Các AIs STR_AI_CONFIG_HUMAN_PLAYER :Nhân vật người STR_AI_CONFIG_RANDOM_AI :AI ngẫu nhiên STR_AI_CONFIG_NONE :(không) +STR_AI_CONFIG_NAME_VERSION :{STRING} {YELLOW}v{NUM} STR_AI_CONFIG_MAX_COMPETITORS :{LTBLUE}Số đối thủ cạnh tranh tối đa: {ORANGE}{COMMA} +STR_AI_CONFIG_COMPETITORS_INTERVAL :{LTBLUE}Khoảng thời gian giữa các lần khởi sự của đối thủ cạnh tranh: {ORANGE}{COMMA} phút STR_AI_CONFIG_MOVE_UP :{BLACK}Chuyển Lên Trên STR_AI_CONFIG_MOVE_UP_TOOLTIP :{BLACK}Di chuyển AI lên trên danh sách @@ -4594,7 +4605,7 @@ STR_AI_CONFIG_AI :{SILVER}AIs STR_AI_CONFIG_CHANGE_AI :{BLACK}Chọn AI STR_AI_CONFIG_CHANGE_GAMESCRIPT :{BLACK}Chọn Game Script -STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}Chạy tập lệnh khác +STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}Chạy tập lệnh khác. Ctrl+Click để hiển thị những phiên bản sẵn có STR_AI_CONFIG_CONFIGURE :{BLACK}Tham Số STR_AI_CONFIG_CONFIGURE_TOOLTIP :{BLACK}Cấu hình tham số cho AI @@ -4628,7 +4639,6 @@ STR_AI_SETTINGS_CAPTION_GAMESCRIPT :Game Script STR_AI_SETTINGS_CLOSE :{BLACK}Đóng STR_AI_SETTINGS_RESET :{BLACK}Thiết Lập Lại STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Số ngày cần chờ để chạy AI này sau cái trước (sớm hay muộn): {ORANGE}{STRING} # Textfile window @@ -5084,7 +5094,16 @@ STR_ERROR_AIRCRAFT_NOT_ENOUGH_RANGE :{WHITE}... máy # Extra messages which go on the third line of errors, explaining why orders failed STR_ERROR_NO_RAIL_STATION :{WHITE}Không có ga xe lửa +STR_ERROR_NO_BUS_STATION :{WHITE}Không có trạm xe buýt +STR_ERROR_NO_TRUCK_STATION :{WHITE}Không có trạm xe tải +STR_ERROR_NO_DOCK :{WHITE}Không có bến cảng +STR_ERROR_NO_AIRPORT :{WHITE}Không có sân bay/bãi đỗ trực thăng +STR_ERROR_NO_STOP_COMPATIBLE_ROAD_TYPE :{WHITE}Không có điểm dừng nào phù hợp với kiểu đường +STR_ERROR_NO_STOP_COMPATIBLE_TRAM_TYPE :{WHITE}Không có điểm dừng phù hợp với kiểu tàu điện +STR_ERROR_NO_STOP_ARTICULATED_VEHICLE :Không có điểm dừng phù hợp với ô tô kéo rơ moóc.{}Ô tô kéo rơ moóc cần điểm dừng ngắn trên đường, không phải bến dừng +STR_ERROR_AIRPORT_NO_PLANES :{WHITE}Không thể hạ cánh máy bay tại bãi đỗ trực thăng này STR_ERROR_AIRPORT_NO_HELICOPTERS :{WHITE}Không thể hạ cánh trực thăng ở sân bay này +STR_ERROR_NO_RAIL_WAYPOINT :{WHITE}Không có điểm mốc tàu hỏa STR_ERROR_NO_BUOY :{WHITE}Không có cái phao nào # Timetable related errors @@ -5502,10 +5521,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Trực thăng P ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Công ty {COMMA}) STR_FORMAT_GROUP_NAME :Nhóm {COMMA} diff --git a/src/lang/welsh.txt b/src/lang/welsh.txt index 603f1058bd..7f47899011 100644 --- a/src/lang/welsh.txt +++ b/src/lang/welsh.txt @@ -4177,7 +4177,6 @@ STR_AI_SETTINGS_CAPTION_AI :AI STR_AI_SETTINGS_CLOSE :{BLACK}Cau STR_AI_SETTINGS_RESET :{BLACK}Ailosod STR_AI_SETTINGS_SETTING :{STRING}: {ORANGE}{STRING} -STR_AI_SETTINGS_START_DELAY :Nifer o ddiwrnodau i aros wedi dechrau AI blaenorol cyn dechrau hon (fwy neu lai): {ORANGE}{STRING} # Textfile window @@ -5031,10 +5030,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Hofrennydd Powe ##id 0x8800 # Formatting of some strings -STR_FORMAT_DATE_TINY :{STRING}-{STRING}-{NUM} +STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM} STR_FORMAT_DATE_SHORT :{STRING} {NUM} STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM} -STR_FORMAT_DATE_ISO :{2:NUM}-{1:STRING}-{0:STRING} +STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM} STR_FORMAT_COMPANY_NUM :(Cwmni {COMMA}) STR_FORMAT_GROUP_NAME :Grŵp {COMMA} diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 14b86c8f75..dc410490b4 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -625,7 +625,7 @@ void ShowSelectGameWindow(); void SetupColoursAndInitialWindow() { for (uint i = 0; i != 16; i++) { - const byte *b = GetNonSprite(PALETTE_RECOLOUR_START + i, ST_RECOLOUR); + const byte *b = GetNonSprite(PALETTE_RECOLOUR_START + i, SpriteType::Recolour); assert(b); memcpy(_colour_gradient[i], b + 0xC6, sizeof(_colour_gradient[i])); diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 2cce0e77b8..ecafcd0121 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -250,7 +250,7 @@ struct GRFTempEngineData { } }; -static GRFTempEngineData *_gted; ///< Temporary engine data used during NewGRF loading +static std::vector _gted; ///< Temporary engine data used during NewGRF loading /** * Contains the GRF ID of the owner of a vehicle if it has been reserved. @@ -590,11 +590,7 @@ static Engine *GetNewEngine(const GRFFile *file, VehicleType type, uint16 intern if (engine_pool_size != Engine::GetPoolSize()) { /* Resize temporary engine data ... */ - _gted = ReallocT(_gted, Engine::GetPoolSize()); - - /* and blank the new block. */ - size_t len = (Engine::GetPoolSize() - engine_pool_size) * sizeof(*_gted); - memset(_gted + engine_pool_size, 0, len); + _gted.resize(Engine::GetPoolSize()); } if (type == VEH_TRAIN) { _gted[e->index].railtypelabel = GetRailTypeInfo(e->u.rail.railtype)->label; @@ -1869,10 +1865,10 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, cons } /* Allocate station specs if necessary */ - if (_cur.grffile->stations == nullptr) _cur.grffile->stations = CallocT(NUM_STATIONS_PER_GRF); + if (_cur.grffile->stations.size() < stid + numinfo) _cur.grffile->stations.resize(stid + numinfo); for (int i = 0; i < numinfo; i++) { - StationSpec *statspec = _cur.grffile->stations[stid + i]; + StationSpec *statspec = _cur.grffile->stations[stid + i].get(); /* Check that the station we are modifying is defined. */ if (statspec == nullptr && prop != 0x08) { @@ -1882,14 +1878,15 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, cons switch (prop) { case 0x08: { // Class ID - StationSpec **spec = &_cur.grffile->stations[stid + i]; - /* Property 0x08 is special; it is where the station is allocated */ - if (*spec == nullptr) *spec = new StationSpec(); + if (statspec == nullptr) { + _cur.grffile->stations[stid + i] = std::make_unique(); + statspec = _cur.grffile->stations[stid + i].get(); + } /* Swap classid because we read it in BE meaning WAYP or DFLT */ uint32 classid = buf->ReadDWord(); - (*spec)->cls_id = StationClass::Allocate(BSWAP32(classid)); + statspec->cls_id = StationClass::Allocate(BSWAP32(classid)); break; } @@ -1945,7 +1942,7 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, cons case 0x0A: { // Copy sprite layout byte srcid = buf->ReadByte(); - const StationSpec *srcstatspec = srcid >= NUM_STATIONS_PER_GRF ? nullptr : _cur.grffile->stations[srcid]; + const StationSpec *srcstatspec = srcid >= _cur.grffile->stations.size() ? nullptr : _cur.grffile->stations[srcid].get(); if (srcstatspec == nullptr) { grfmsg(1, "StationChangeInfo: Station %u is not defined, cannot copy sprite layout to %u.", srcid, stid + i); @@ -1999,7 +1996,7 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, cons case 0x0F: { // Copy custom layout byte srcid = buf->ReadByte(); - const StationSpec *srcstatspec = srcid >= NUM_STATIONS_PER_GRF ? nullptr : _cur.grffile->stations[srcid]; + const StationSpec *srcstatspec = srcid >= _cur.grffile->stations.size() ? nullptr : _cur.grffile->stations[srcid].get(); if (srcstatspec == nullptr) { grfmsg(1, "StationChangeInfo: Station %u is not defined, cannot copy tile layout to %u.", srcid, stid + i); @@ -2358,12 +2355,10 @@ static ChangeInfoResult TownHouseChangeInfo(uint hid, int numinfo, int prop, con } /* Allocate house specs if they haven't been allocated already. */ - if (_cur.grffile->housespec == nullptr) { - _cur.grffile->housespec = CallocT(NUM_HOUSES_PER_GRF); - } + if (_cur.grffile->housespec.size() < hid + numinfo) _cur.grffile->housespec.resize(hid + numinfo); for (int i = 0; i < numinfo; i++) { - HouseSpec *housespec = _cur.grffile->housespec[hid + i]; + HouseSpec *housespec = _cur.grffile->housespec[hid + i].get(); if (prop != 0x08 && housespec == nullptr) { /* If the house property 08 is not yet set, ignore this property */ @@ -2374,13 +2369,11 @@ static ChangeInfoResult TownHouseChangeInfo(uint hid, int numinfo, int prop, con switch (prop) { case 0x08: { // Substitute building type, and definition of a new house - HouseSpec **house = &_cur.grffile->housespec[hid + i]; byte subs_id = buf->ReadByte(); - if (subs_id == 0xFF) { /* Instead of defining a new house, a substitute house id * of 0xFF disables the old house with the current id. */ - HouseSpec::Get(hid + i)->enabled = false; + if (hid + i < NEW_HOUSE_OFFSET) HouseSpec::Get(hid + i)->enabled = false; continue; } else if (subs_id >= NEW_HOUSE_OFFSET) { /* The substitute id must be one of the original houses. */ @@ -2389,11 +2382,10 @@ static ChangeInfoResult TownHouseChangeInfo(uint hid, int numinfo, int prop, con } /* Allocate space for this house. */ - if (*house == nullptr) *house = CallocT(1); - - housespec = *house; - - MemCpyT(housespec, HouseSpec::Get(subs_id)); + if (housespec == nullptr) { + _cur.grffile->housespec[hid + i] = std::make_unique(*HouseSpec::Get(subs_id)); + housespec = _cur.grffile->housespec[hid + i].get(); + } housespec->enabled = true; housespec->grf_prop.local_id = hid + i; @@ -3240,12 +3232,10 @@ static ChangeInfoResult IndustrytilesChangeInfo(uint indtid, int numinfo, int pr } /* Allocate industry tile specs if they haven't been allocated already. */ - if (_cur.grffile->indtspec == nullptr) { - _cur.grffile->indtspec = CallocT(NUM_INDUSTRYTILES_PER_GRF); - } + if (_cur.grffile->indtspec.size() < indtid + numinfo) _cur.grffile->indtspec.resize(indtid + numinfo); for (int i = 0; i < numinfo; i++) { - IndustryTileSpec *tsp = _cur.grffile->indtspec[indtid + i]; + IndustryTileSpec *tsp = _cur.grffile->indtspec[indtid + i].get(); if (prop != 0x08 && tsp == nullptr) { ChangeInfoResult cir = IgnoreIndustryTileProperty(prop, buf); @@ -3255,9 +3245,7 @@ static ChangeInfoResult IndustrytilesChangeInfo(uint indtid, int numinfo, int pr switch (prop) { case 0x08: { // Substitute industry tile type - IndustryTileSpec **tilespec = &_cur.grffile->indtspec[indtid + i]; byte subs_id = buf->ReadByte(); - if (subs_id >= NEW_INDUSTRYTILEOFFSET) { /* The substitute id must be one of the original industry tile. */ grfmsg(2, "IndustryTilesChangeInfo: Attempt to use new industry tile %u as substitute industry tile for %u. Ignoring.", subs_id, indtid + i); @@ -3265,11 +3253,10 @@ static ChangeInfoResult IndustrytilesChangeInfo(uint indtid, int numinfo, int pr } /* Allocate space for this industry. */ - if (*tilespec == nullptr) { - *tilespec = CallocT(1); - tsp = *tilespec; + if (tsp == nullptr) { + _cur.grffile->indtspec[indtid + i] = std::make_unique(_industry_tile_specs[subs_id]); + tsp = _cur.grffile->indtspec[indtid + i].get(); - memcpy(tsp, &_industry_tile_specs[subs_id], sizeof(_industry_tile_specs[subs_id])); tsp->enabled = true; /* A copied tile should not have the animation infos copied too. @@ -3501,12 +3488,10 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop, } /* Allocate industry specs if they haven't been allocated already. */ - if (_cur.grffile->industryspec == nullptr) { - _cur.grffile->industryspec = CallocT(NUM_INDUSTRYTYPES_PER_GRF); - } + if (_cur.grffile->industryspec.size() < indid + numinfo) _cur.grffile->industryspec.resize(indid + numinfo); for (int i = 0; i < numinfo; i++) { - IndustrySpec *indsp = _cur.grffile->industryspec[indid + i]; + IndustrySpec *indsp = _cur.grffile->industryspec[indid + i].get(); if (prop != 0x08 && indsp == nullptr) { ChangeInfoResult cir = IgnoreIndustryProperty(prop, buf); @@ -3516,9 +3501,7 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop, switch (prop) { case 0x08: { // Substitute industry type - IndustrySpec **indspec = &_cur.grffile->industryspec[indid + i]; byte subs_id = buf->ReadByte(); - if (subs_id == 0xFF) { /* Instead of defining a new industry, a substitute industry id * of 0xFF disables the old industry with the current id. */ @@ -3533,11 +3516,10 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop, /* Allocate space for this industry. * Only need to do it once. If ever it is called again, it should not * do anything */ - if (*indspec == nullptr) { - *indspec = new IndustrySpec; - indsp = *indspec; + if (indsp == nullptr) { + _cur.grffile->industryspec[indid + i] = std::make_unique(_origin_industry_specs[subs_id]); + indsp = _cur.grffile->industryspec[indid + i].get(); - *indsp = _origin_industry_specs[subs_id]; indsp->enabled = true; indsp->grf_prop.local_id = indid + i; indsp->grf_prop.subst_id = subs_id; @@ -3913,12 +3895,10 @@ static ChangeInfoResult AirportChangeInfo(uint airport, int numinfo, int prop, c } /* Allocate industry specs if they haven't been allocated already. */ - if (_cur.grffile->airportspec == nullptr) { - _cur.grffile->airportspec = CallocT(NUM_AIRPORTS_PER_GRF); - } + if (_cur.grffile->airportspec.size() < airport + numinfo) _cur.grffile->airportspec.resize(airport + numinfo); for (int i = 0; i < numinfo; i++) { - AirportSpec *as = _cur.grffile->airportspec[airport + i]; + AirportSpec *as = _cur.grffile->airportspec[airport + i].get(); if (as == nullptr && prop != 0x08 && prop != 0x09) { grfmsg(2, "AirportChangeInfo: Attempt to modify undefined airport %u, ignoring", airport + i); @@ -3928,7 +3908,6 @@ static ChangeInfoResult AirportChangeInfo(uint airport, int numinfo, int prop, c switch (prop) { case 0x08: { // Modify original airport byte subs_id = buf->ReadByte(); - if (subs_id == 0xFF) { /* Instead of defining a new airport, an airport id * of 0xFF disables the old airport with the current id. */ @@ -3940,15 +3919,13 @@ static ChangeInfoResult AirportChangeInfo(uint airport, int numinfo, int prop, c continue; } - AirportSpec **spec = &_cur.grffile->airportspec[airport + i]; /* Allocate space for this airport. * Only need to do it once. If ever it is called again, it should not * do anything */ - if (*spec == nullptr) { - *spec = MallocT(1); - as = *spec; + if (as == nullptr) { + _cur.grffile->airportspec[airport + i] = std::make_unique(*AirportSpec::GetWithoutOverride(subs_id)); + as = _cur.grffile->airportspec[airport + i].get(); - memcpy(as, AirportSpec::GetWithoutOverride(subs_id), sizeof(*as)); as->enabled = true; as->grf_prop.local_id = airport + i; as->grf_prop.subst_id = subs_id; @@ -4304,7 +4281,7 @@ static ChangeInfoResult ObjectChangeInfo(uint id, int numinfo, int prop, const G } for (int i = 0; i < numinfo; i++) { - ObjectSpec *spec = _cur.grffile->objectspec[id + i]; + ObjectSpec *spec = _cur.grffile->objectspec[id + i].get(); if (prop != 0x08 && spec == nullptr) { /* If the object property 08 is not yet set, ignore this property */ @@ -4315,18 +4292,17 @@ static ChangeInfoResult ObjectChangeInfo(uint id, int numinfo, int prop, const G switch (prop) { case 0x08: { // Class ID - ObjectSpec **ospec = &_cur.grffile->objectspec[id + i]; - /* Allocate space for this object. */ - if (*ospec == nullptr) { - *ospec = CallocT(1); - (*ospec)->views = 1; // Default for NewGRFs that don't set it. - (*ospec)->size = OBJECT_SIZE_1X1; // Default for NewGRFs that manage to not set it (1x1) + if (spec == nullptr) { + _cur.grffile->objectspec[id + i] = std::make_unique(); + spec = _cur.grffile->objectspec[id + i].get(); + spec->views = 1; // Default for NewGRFs that don't set it. + spec->size = OBJECT_SIZE_1X1; // Default for NewGRFs that manage to not set it (1x1) } /* Swap classid because we read it in BE. */ uint32 classid = buf->ReadDWord(); - (*ospec)->cls_id = ObjectClass::Allocate(BSWAP32(classid)); + spec->cls_id = ObjectClass::Allocate(BSWAP32(classid)); break; } @@ -4954,12 +4930,10 @@ static ChangeInfoResult AirportTilesChangeInfo(uint airtid, int numinfo, int pro } /* Allocate airport tile specs if they haven't been allocated already. */ - if (_cur.grffile->airtspec == nullptr) { - _cur.grffile->airtspec = CallocT(NUM_AIRPORTTILES_PER_GRF); - } + if (_cur.grffile->airtspec.size() < airtid + numinfo) _cur.grffile->airtspec.resize(airtid + numinfo); for (int i = 0; i < numinfo; i++) { - AirportTileSpec *tsp = _cur.grffile->airtspec[airtid + i]; + AirportTileSpec *tsp = _cur.grffile->airtspec[airtid + i].get(); if (prop != 0x08 && tsp == nullptr) { grfmsg(2, "AirportTileChangeInfo: Attempt to modify undefined airport tile %u. Ignoring.", airtid + i); @@ -4968,9 +4942,7 @@ static ChangeInfoResult AirportTilesChangeInfo(uint airtid, int numinfo, int pro switch (prop) { case 0x08: { // Substitute airport tile type - AirportTileSpec **tilespec = &_cur.grffile->airtspec[airtid + i]; byte subs_id = buf->ReadByte(); - if (subs_id >= NEW_AIRPORTTILE_OFFSET) { /* The substitute id must be one of the original airport tiles. */ grfmsg(2, "AirportTileChangeInfo: Attempt to use new airport tile %u as substitute airport tile for %u. Ignoring.", subs_id, airtid + i); @@ -4978,11 +4950,10 @@ static ChangeInfoResult AirportTilesChangeInfo(uint airtid, int numinfo, int pro } /* Allocate space for this airport tile. */ - if (*tilespec == nullptr) { - *tilespec = CallocT(1); - tsp = *tilespec; + if (tsp == nullptr) { + _cur.grffile->airtspec[airtid + i] = std::make_unique(*AirportTileSpec::Get(subs_id)); + tsp = _cur.grffile->airtspec[airtid + i].get(); - memcpy(tsp, AirportTileSpec::Get(subs_id), sizeof(AirportTileSpec)); tsp->enabled = true; tsp->animation.status = ANIM_STATUS_NO_ANIMATION; @@ -5088,7 +5059,7 @@ static ChangeInfoResult RoadStopChangeInfo(uint id, int numinfo, int prop, const } for (int i = 0; i < numinfo; i++) { - RoadStopSpec *rs = _cur.grffile->roadstops[id + i]; + RoadStopSpec *rs = _cur.grffile->roadstops[id + i].get(); if (rs == nullptr && prop != 0x08 && prop != A0RPI_ROADSTOP_CLASS_ID) { grfmsg(1, "RoadStopChangeInfo: Attempt to modify undefined road stop %u, ignoring", id + i); @@ -5102,16 +5073,14 @@ static ChangeInfoResult RoadStopChangeInfo(uint id, int numinfo, int prop, const if (MappedPropertyLengthMismatch(buf, 4, mapping_entry)) break; FALLTHROUGH; case 0x08: { // Road Stop Class ID - RoadStopSpec **spec = &_cur.grffile->roadstops[id + i]; - - if (*spec == nullptr) { - *spec = CallocT(1); - new (*spec) RoadStopSpec(); + if (rs == nullptr) { + _cur.grffile->roadstops[id + i] = std::make_unique(); + rs = _cur.grffile->roadstops[id + i].get(); } uint32 classid = buf->ReadDWord(); - (*spec)->cls_id = RoadStopClass::Allocate(BSWAP32(classid)); - (*spec)->spec_id = id + i; + rs->cls_id = RoadStopClass::Allocate(BSWAP32(classid)); + rs->spec_id = id + i; break; } @@ -6485,7 +6454,7 @@ static void CanalMapSpriteGroup(ByteReader *buf, uint8 idcount) static void StationMapSpriteGroup(ByteReader *buf, uint8 idcount) { - if (_cur.grffile->stations == nullptr) { + if (_cur.grffile->stations.empty()) { grfmsg(1, "StationMapSpriteGroup: No stations defined, skipping"); return; } @@ -6505,7 +6474,7 @@ static void StationMapSpriteGroup(ByteReader *buf, uint8 idcount) if (ctype == CT_INVALID) continue; for (uint i = 0; i < idcount; i++) { - StationSpec *statspec = stations[i] >= NUM_STATIONS_PER_GRF ? nullptr : _cur.grffile->stations[stations[i]]; + StationSpec *statspec = stations[i] >= _cur.grffile->stations.size() ? nullptr : _cur.grffile->stations[stations[i]].get(); if (statspec == nullptr) { grfmsg(1, "StationMapSpriteGroup: Station with ID 0x%02X does not exist, skipping", stations[i]); @@ -6520,7 +6489,7 @@ static void StationMapSpriteGroup(ByteReader *buf, uint8 idcount) if (!IsValidGroupID(groupid, "StationMapSpriteGroup")) return; for (uint i = 0; i < idcount; i++) { - StationSpec *statspec = stations[i] >= NUM_STATIONS_PER_GRF ? nullptr : _cur.grffile->stations[stations[i]]; + StationSpec *statspec = stations[i] >= _cur.grffile->stations.size() ? nullptr : _cur.grffile->stations[stations[i]].get(); if (statspec == nullptr) { grfmsg(1, "StationMapSpriteGroup: Station with ID 0x%02X does not exist, skipping", stations[i]); @@ -6542,7 +6511,7 @@ static void StationMapSpriteGroup(ByteReader *buf, uint8 idcount) static void TownHouseMapSpriteGroup(ByteReader *buf, uint8 idcount) { - if (_cur.grffile->housespec == nullptr) { + if (_cur.grffile->housespec.empty()) { grfmsg(1, "TownHouseMapSpriteGroup: No houses defined, skipping"); return; } @@ -6560,7 +6529,7 @@ static void TownHouseMapSpriteGroup(ByteReader *buf, uint8 idcount) if (!IsValidGroupID(groupid, "TownHouseMapSpriteGroup")) return; for (uint i = 0; i < idcount; i++) { - HouseSpec *hs = houses[i] >= NUM_HOUSES_PER_GRF ? nullptr : _cur.grffile->housespec[houses[i]]; + HouseSpec *hs = houses[i] >= _cur.grffile->housespec.size() ? nullptr : _cur.grffile->housespec[houses[i]].get(); if (hs == nullptr) { grfmsg(1, "TownHouseMapSpriteGroup: House %d undefined, skipping.", houses[i]); @@ -6573,7 +6542,7 @@ static void TownHouseMapSpriteGroup(ByteReader *buf, uint8 idcount) static void IndustryMapSpriteGroup(ByteReader *buf, uint8 idcount) { - if (_cur.grffile->industryspec == nullptr) { + if (_cur.grffile->industryspec.empty()) { grfmsg(1, "IndustryMapSpriteGroup: No industries defined, skipping"); return; } @@ -6591,7 +6560,7 @@ static void IndustryMapSpriteGroup(ByteReader *buf, uint8 idcount) if (!IsValidGroupID(groupid, "IndustryMapSpriteGroup")) return; for (uint i = 0; i < idcount; i++) { - IndustrySpec *indsp = industries[i] >= NUM_INDUSTRYTYPES_PER_GRF ? nullptr : _cur.grffile->industryspec[industries[i]]; + IndustrySpec *indsp = industries[i] >= _cur.grffile->industryspec.size() ? nullptr : _cur.grffile->industryspec[industries[i]].get(); if (indsp == nullptr) { grfmsg(1, "IndustryMapSpriteGroup: Industry %d undefined, skipping", industries[i]); @@ -6604,7 +6573,7 @@ static void IndustryMapSpriteGroup(ByteReader *buf, uint8 idcount) static void IndustrytileMapSpriteGroup(ByteReader *buf, uint8 idcount) { - if (_cur.grffile->indtspec == nullptr) { + if (_cur.grffile->indtspec.empty()) { grfmsg(1, "IndustrytileMapSpriteGroup: No industry tiles defined, skipping"); return; } @@ -6622,7 +6591,7 @@ static void IndustrytileMapSpriteGroup(ByteReader *buf, uint8 idcount) if (!IsValidGroupID(groupid, "IndustrytileMapSpriteGroup")) return; for (uint i = 0; i < idcount; i++) { - IndustryTileSpec *indtsp = indtiles[i] >= NUM_INDUSTRYTILES_PER_GRF ? nullptr : _cur.grffile->indtspec[indtiles[i]]; + IndustryTileSpec *indtsp = indtiles[i] >= _cur.grffile->indtspec.size() ? nullptr : _cur.grffile->indtspec[indtiles[i]].get(); if (indtsp == nullptr) { grfmsg(1, "IndustrytileMapSpriteGroup: Industry tile %d undefined, skipping", indtiles[i]); @@ -6716,7 +6685,7 @@ static void ObjectMapSpriteGroup(ByteReader *buf, uint8 idcount) if (ctype == CT_INVALID) continue; for (uint i = 0; i < idcount; i++) { - ObjectSpec *spec = (objects[i] >= _cur.grffile->objectspec.size()) ? nullptr : _cur.grffile->objectspec[objects[i]]; + ObjectSpec *spec = (objects[i] >= _cur.grffile->objectspec.size()) ? nullptr : _cur.grffile->objectspec[objects[i]].get(); if (spec == nullptr) { grfmsg(1, "ObjectMapSpriteGroup: Object with ID 0x%02X undefined, skipping", objects[i]); @@ -6731,7 +6700,7 @@ static void ObjectMapSpriteGroup(ByteReader *buf, uint8 idcount) if (!IsValidGroupID(groupid, "ObjectMapSpriteGroup")) return; for (uint i = 0; i < idcount; i++) { - ObjectSpec *spec = (objects[i] >= _cur.grffile->objectspec.size()) ? nullptr : _cur.grffile->objectspec[objects[i]]; + ObjectSpec *spec = (objects[i] >= _cur.grffile->objectspec.size()) ? nullptr : _cur.grffile->objectspec[objects[i]].get(); if (spec == nullptr) { grfmsg(1, "ObjectMapSpriteGroup: Object with ID 0x%02X undefined, skipping", objects[i]); @@ -6815,7 +6784,7 @@ static void RoadTypeMapSpriteGroup(ByteReader *buf, uint8 idcount, RoadTramType static void AirportMapSpriteGroup(ByteReader *buf, uint8 idcount) { - if (_cur.grffile->airportspec == nullptr) { + if (_cur.grffile->airportspec.empty()) { grfmsg(1, "AirportMapSpriteGroup: No airports defined, skipping"); return; } @@ -6833,7 +6802,7 @@ static void AirportMapSpriteGroup(ByteReader *buf, uint8 idcount) if (!IsValidGroupID(groupid, "AirportMapSpriteGroup")) return; for (uint i = 0; i < idcount; i++) { - AirportSpec *as = airports[i] >= NUM_AIRPORTS_PER_GRF ? nullptr : _cur.grffile->airportspec[airports[i]]; + AirportSpec *as = airports[i] >= _cur.grffile->airportspec.size() ? nullptr : _cur.grffile->airportspec[airports[i]].get(); if (as == nullptr) { grfmsg(1, "AirportMapSpriteGroup: Airport %d undefined, skipping", airports[i]); @@ -6846,7 +6815,7 @@ static void AirportMapSpriteGroup(ByteReader *buf, uint8 idcount) static void AirportTileMapSpriteGroup(ByteReader *buf, uint8 idcount) { - if (_cur.grffile->airtspec == nullptr) { + if (_cur.grffile->airtspec.empty()) { grfmsg(1, "AirportTileMapSpriteGroup: No airport tiles defined, skipping"); return; } @@ -6864,7 +6833,7 @@ static void AirportTileMapSpriteGroup(ByteReader *buf, uint8 idcount) if (!IsValidGroupID(groupid, "AirportTileMapSpriteGroup")) return; for (uint i = 0; i < idcount; i++) { - AirportTileSpec *airtsp = airptiles[i] >= NUM_AIRPORTTILES_PER_GRF ? nullptr : _cur.grffile->airtspec[airptiles[i]]; + AirportTileSpec *airtsp = airptiles[i] >= _cur.grffile->airtspec.size() ? nullptr : _cur.grffile->airtspec[airptiles[i]].get(); if (airtsp == nullptr) { grfmsg(1, "AirportTileMapSpriteGroup: Airport tile %d undefined, skipping", airptiles[i]); @@ -6892,7 +6861,7 @@ static void RoadStopMapSpriteGroup(ByteReader *buf, uint8 idcount) if (ctype == CT_INVALID) continue; for (uint i = 0; i < idcount; i++) { - RoadStopSpec *roadstopspec = (roadstops[i] >= _cur.grffile->roadstops.size()) ? nullptr : _cur.grffile->roadstops[roadstops[i]]; + RoadStopSpec *roadstopspec = (roadstops[i] >= _cur.grffile->roadstops.size()) ? nullptr : _cur.grffile->roadstops[roadstops[i]].get(); if (roadstopspec == nullptr) { grfmsg(1, "RoadStopMapSpriteGroup: Road stop with ID 0x%02X does not exist, skipping", roadstops[i]); @@ -6912,7 +6881,7 @@ static void RoadStopMapSpriteGroup(ByteReader *buf, uint8 idcount) } for (uint i = 0; i < idcount; i++) { - RoadStopSpec *roadstopspec = (roadstops[i] >= _cur.grffile->roadstops.size()) ? nullptr : _cur.grffile->roadstops[roadstops[i]]; + RoadStopSpec *roadstopspec = (roadstops[i] >= _cur.grffile->roadstops.size()) ? nullptr : _cur.grffile->roadstops[roadstops[i]].get(); if (roadstopspec == nullptr) { grfmsg(1, "RoadStopMapSpriteGroup: Road stop with ID 0x%02X does not exist, skipping.", roadstops[i]); @@ -7156,7 +7125,7 @@ static void FeatureNewName(ByteReader *buf) switch (GB(id, 8, 8)) { case 0xC4: // Station class name - if (GB(id, 0, 8) >= NUM_STATIONS_PER_GRF || _cur.grffile->stations == nullptr || _cur.grffile->stations[GB(id, 0, 8)] == nullptr) { + if (GB(id, 0, 8) >= _cur.grffile->stations.size() || _cur.grffile->stations[GB(id, 0, 8)] == nullptr) { grfmsg(1, "FeatureNewName: Attempt to name undefined station 0x%X, ignoring", GB(id, 0, 8)); } else { StationClassID cls_id = _cur.grffile->stations[GB(id, 0, 8)]->cls_id; @@ -7165,7 +7134,7 @@ static void FeatureNewName(ByteReader *buf) break; case 0xC5: // Station name - if (GB(id, 0, 8) >= NUM_STATIONS_PER_GRF || _cur.grffile->stations == nullptr || _cur.grffile->stations[GB(id, 0, 8)] == nullptr) { + if (GB(id, 0, 8) >= _cur.grffile->stations.size() || _cur.grffile->stations[GB(id, 0, 8)] == nullptr) { grfmsg(1, "FeatureNewName: Attempt to name undefined station 0x%X, ignoring", GB(id, 0, 8)); } else { _cur.grffile->stations[GB(id, 0, 8)]->name = AddGRFString(_cur.grffile->grfid, id, lang, new_scheme, false, name, STR_UNDEFINED); @@ -7173,7 +7142,7 @@ static void FeatureNewName(ByteReader *buf) break; case 0xC7: // Airporttile name - if (GB(id, 0, 8) >= NUM_AIRPORTTILES_PER_GRF || _cur.grffile->airtspec == nullptr || _cur.grffile->airtspec[GB(id, 0, 8)] == nullptr) { + if (GB(id, 0, 8) >= _cur.grffile->airtspec.size() || _cur.grffile->airtspec[GB(id, 0, 8)] == nullptr) { grfmsg(1, "FeatureNewName: Attempt to name undefined airport tile 0x%X, ignoring", GB(id, 0, 8)); } else { _cur.grffile->airtspec[GB(id, 0, 8)]->name = AddGRFString(_cur.grffile->grfid, id, lang, new_scheme, false, name, STR_UNDEFINED); @@ -7181,7 +7150,7 @@ static void FeatureNewName(ByteReader *buf) break; case 0xC9: // House name - if (GB(id, 0, 8) >= NUM_HOUSES_PER_GRF || _cur.grffile->housespec == nullptr || _cur.grffile->housespec[GB(id, 0, 8)] == nullptr) { + if (GB(id, 0, 8) >= _cur.grffile->housespec.size() || _cur.grffile->housespec[GB(id, 0, 8)] == nullptr) { grfmsg(1, "FeatureNewName: Attempt to name undefined house 0x%X, ignoring.", GB(id, 0, 8)); } else { _cur.grffile->housespec[GB(id, 0, 8)]->building_name = AddGRFString(_cur.grffile->grfid, id, lang, new_scheme, false, name, STR_UNDEFINED); @@ -8648,8 +8617,8 @@ static void FeatureTownName(ByteReader *buf) bool new_scheme = _cur.grffile->grf_version >= 7; byte lang = buf->ReadByte(); + StringID style = STR_UNDEFINED; - byte nb_gen = townname->nb_gen; do { ClrBit(lang, 7); @@ -8658,53 +8627,48 @@ static void FeatureTownName(ByteReader *buf) std::string lang_name = TranslateTTDPatchCodes(grfid, lang, false, name); grfmsg(6, "FeatureTownName: lang 0x%X -> '%s'", lang, lang_name.c_str()); - townname->name[nb_gen] = AddGRFString(grfid, id, lang, new_scheme, false, name, STR_UNDEFINED); + style = AddGRFString(grfid, id, lang, new_scheme, false, name, STR_UNDEFINED); lang = buf->ReadByte(); } while (lang != 0); - townname->id[nb_gen] = id; - townname->nb_gen++; + townname->styles.emplace_back(style, id); } - byte nb = buf->ReadByte(); - grfmsg(6, "FeatureTownName: %u parts", nb); + uint8 parts = buf->ReadByte(); + grfmsg(6, "FeatureTownName: %u parts", parts); - townname->nbparts[id] = nb; - townname->partlist[id] = CallocT(nb); + townname->partlists[id].reserve(parts); + for (uint partnum = 0; partnum < parts; partnum++) { + NamePartList &partlist = townname->partlists[id].emplace_back(); + uint8 texts = buf->ReadByte(); + partlist.bitstart = buf->ReadByte(); + partlist.bitcount = buf->ReadByte(); + partlist.maxprob = 0; + grfmsg(6, "FeatureTownName: part %u contains %u texts and will use GB(seed, %u, %u)", partnum, texts, partlist.bitstart, partlist.bitcount); - for (int i = 0; i < nb; i++) { - byte nbtext = buf->ReadByte(); - townname->partlist[id][i].bitstart = buf->ReadByte(); - townname->partlist[id][i].bitcount = buf->ReadByte(); - townname->partlist[id][i].maxprob = 0; - townname->partlist[id][i].partcount = nbtext; - townname->partlist[id][i].parts = CallocT(nbtext); - grfmsg(6, "FeatureTownName: part %d contains %d texts and will use GB(seed, %d, %d)", i, nbtext, townname->partlist[id][i].bitstart, townname->partlist[id][i].bitcount); + partlist.parts.reserve(texts); + for (uint textnum = 0; textnum < texts; textnum++) { + NamePart &part = partlist.parts.emplace_back(); + part.prob = buf->ReadByte(); - for (int j = 0; j < nbtext; j++) { - byte prob = buf->ReadByte(); - - if (HasBit(prob, 7)) { + if (HasBit(part.prob, 7)) { byte ref_id = buf->ReadByte(); - - if (townname->nbparts[ref_id] == 0) { + if (ref_id >= GRFTownName::MAX_LISTS || townname->partlists[ref_id].empty()) { grfmsg(0, "FeatureTownName: definition 0x%02X doesn't exist, deactivating", ref_id); DelGRFTownName(grfid); DisableGrf(STR_NEWGRF_ERROR_INVALID_ID); return; } - - grfmsg(6, "FeatureTownName: part %d, text %d, uses intermediate definition 0x%02X (with probability %d)", i, j, ref_id, prob & 0x7F); - townname->partlist[id][i].parts[j].data.id = ref_id; + part.id = ref_id; + grfmsg(6, "FeatureTownName: part %u, text %u, uses intermediate definition 0x%02X (with probability %u)", partnum, textnum, ref_id, part.prob & 0x7F); } else { const char *text = buf->ReadString(); - townname->partlist[id][i].parts[j].data.text = stredup(TranslateTTDPatchCodes(grfid, 0, false, text).c_str()); - grfmsg(6, "FeatureTownName: part %d, text %d, '%s' (with probability %d)", i, j, townname->partlist[id][i].parts[j].data.text, prob); + part.text = TranslateTTDPatchCodes(grfid, 0, false, text); + grfmsg(6, "FeatureTownName: part %u, text %u, '%s' (with probability %u)", partnum, textnum, part.text.c_str(), part.prob); } - townname->partlist[id][i].parts[j].prob = prob; - townname->partlist[id][i].maxprob += GB(prob, 0, 7); + partlist.maxprob += GB(part.prob, 0, 7); } - grfmsg(6, "FeatureTownName: part %d, total probability %d", i, townname->partlist[id][i].maxprob); + grfmsg(6, "FeatureTownName: part %u, total probability %u", partnum, partlist.maxprob); } } @@ -10313,19 +10277,7 @@ bool HasTTDPatchFlagBeenObserved(uint flag) static void ResetCustomStations() { for (GRFFile * const file : _grf_files) { - StationSpec **&stations = file->stations; - if (stations == nullptr) continue; - for (uint i = 0; i < NUM_STATIONS_PER_GRF; i++) { - if (stations[i] == nullptr) continue; - StationSpec *statspec = stations[i]; - - /* Release this station */ - delete statspec; - } - - /* Free and reset the station data */ - free(stations); - stations = nullptr; + file->stations.clear(); } } @@ -10333,14 +10285,7 @@ static void ResetCustomStations() static void ResetCustomHouses() { for (GRFFile * const file : _grf_files) { - HouseSpec **&housespec = file->housespec; - if (housespec == nullptr) continue; - for (uint i = 0; i < NUM_HOUSES_PER_GRF; i++) { - free(housespec[i]); - } - - free(housespec); - housespec = nullptr; + file->housespec.clear(); } } @@ -10348,36 +10293,20 @@ static void ResetCustomHouses() static void ResetCustomAirports() { for (GRFFile * const file : _grf_files) { - AirportSpec **aslist = file->airportspec; - if (aslist != nullptr) { - for (uint i = 0; i < NUM_AIRPORTS_PER_GRF; i++) { - AirportSpec *as = aslist[i]; - - if (as != nullptr) { - /* We need to remove the tiles layouts */ - for (int j = 0; j < as->num_table; j++) { - /* remove the individual layouts */ - free(as->table[j]); - } - free(as->table); - free(as->depot_table); - free(as->rotation); - - free(as); + for (auto &as : file->airportspec) { + if (as != nullptr) { + /* We need to remove the tiles layouts */ + for (int j = 0; j < as->num_table; j++) { + /* remove the individual layouts */ + free(as->table[j]); } + free(as->table); + free(as->depot_table); + free(as->rotation); } - free(aslist); - file->airportspec = nullptr; - } - - AirportTileSpec **&airporttilespec = file->airtspec; - if (airporttilespec != nullptr) { - for (uint i = 0; i < NUM_AIRPORTTILES_PER_GRF; i++) { - free(airporttilespec[i]); - } - free(airporttilespec); - airporttilespec = nullptr; } + file->airportspec.clear(); + file->airtspec.clear(); } } @@ -10385,28 +10314,8 @@ static void ResetCustomAirports() static void ResetCustomIndustries() { for (GRFFile * const file : _grf_files) { - IndustrySpec **&industryspec = file->industryspec; - IndustryTileSpec **&indtspec = file->indtspec; - - /* We are verifiying both tiles and industries specs loaded from the grf file - * First, let's deal with industryspec */ - if (industryspec != nullptr) { - for (uint i = 0; i < NUM_INDUSTRYTYPES_PER_GRF; i++) { - IndustrySpec *ind = industryspec[i]; - delete ind; - } - - free(industryspec); - industryspec = nullptr; - } - - if (indtspec == nullptr) continue; - for (uint i = 0; i < NUM_INDUSTRYTILES_PER_GRF; i++) { - free(indtspec[i]); - } - - free(indtspec); - indtspec = nullptr; + file->industryspec.clear(); + file->indtspec.clear(); } } @@ -10414,24 +10323,14 @@ static void ResetCustomIndustries() static void ResetCustomObjects() { for (GRFFile * const file : _grf_files) { - std::vector &objectspec = file->objectspec; - for (ObjectSpec *spec : objectspec) { - free(spec); - } - - objectspec.clear(); + file->objectspec.clear(); } } static void ResetCustomRoadStops() { for (auto file : _grf_files) { - std::vector &roadstops = file->roadstops; - for (RoadStopSpec *spec : roadstops) { - free(spec); - } - - roadstops.clear(); + file->roadstops.clear(); } } @@ -10482,7 +10381,7 @@ void ResetNewGRFData() ResetRoadTypes(); /* Allocate temporary refit/cargo class data */ - _gted = CallocT(Engine::GetPoolSize()); + _gted.resize(Engine::GetPoolSize()); /* Fill rail type label temporary data for default trains */ for (const Engine *e : Engine::IterateType(VEH_TRAIN)) { @@ -11021,17 +10920,17 @@ static void FinaliseHouseArray() * minimum introduction date to 0. */ for (GRFFile * const file : _grf_files) { - HouseSpec **&housespec = file->housespec; - if (housespec == nullptr) continue; + if (file->housespec.empty()) continue; - for (int i = 0; i < NUM_HOUSES_PER_GRF; i++) { - HouseSpec *hs = housespec[i]; + size_t num_houses = file->housespec.size(); + for (size_t i = 0; i < num_houses; i++) { + HouseSpec *hs = file->housespec[i].get(); if (hs == nullptr) continue; - const HouseSpec *next1 = (i + 1 < NUM_HOUSES_PER_GRF ? housespec[i + 1] : nullptr); - const HouseSpec *next2 = (i + 2 < NUM_HOUSES_PER_GRF ? housespec[i + 2] : nullptr); - const HouseSpec *next3 = (i + 3 < NUM_HOUSES_PER_GRF ? housespec[i + 3] : nullptr); + const HouseSpec *next1 = (i + 1 < num_houses ? file->housespec[i + 1].get() : nullptr); + 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; @@ -11039,7 +10938,7 @@ static void FinaliseHouseArray() } } - for (int i = 0; i < NUM_HOUSES; i++) { + for (size_t i = 0; i < NUM_HOUSES; i++) { HouseSpec *hs = HouseSpec::Get(i); const HouseSpec *next1 = (i + 1 < NUM_HOUSES ? HouseSpec::Get(i + 1) : nullptr); const HouseSpec *next2 = (i + 2 < NUM_HOUSES ? HouseSpec::Get(i + 2) : nullptr); @@ -11083,50 +10982,41 @@ static void FinaliseHouseArray() static void FinaliseIndustriesArray() { for (GRFFile * const file : _grf_files) { - IndustrySpec **&industryspec = file->industryspec; - IndustryTileSpec **&indtspec = file->indtspec; - if (industryspec != nullptr) { - for (int i = 0; i < NUM_INDUSTRYTYPES_PER_GRF; i++) { - IndustrySpec *indsp = industryspec[i]; + for (const auto &indsp : file->industryspec) { + if (indsp == nullptr || !indsp->enabled) continue; - if (indsp != nullptr && indsp->enabled) { - StringID strid; - /* process the conversion of text at the end, so to be sure everything will be fine - * and available. Check if it does not return undefind marker, which is a very good sign of a - * substitute industry who has not changed the string been examined, thus using it as such */ - strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->name); - if (strid != STR_UNDEFINED) indsp->name = strid; + StringID strid; + /* process the conversion of text at the end, so to be sure everything will be fine + * and available. Check if it does not return undefind marker, which is a very good sign of a + * substitute industry who has not changed the string been examined, thus using it as such */ + strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->name); + if (strid != STR_UNDEFINED) indsp->name = strid; - strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->closure_text); - if (strid != STR_UNDEFINED) indsp->closure_text = strid; + strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->closure_text); + if (strid != STR_UNDEFINED) indsp->closure_text = strid; - strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->production_up_text); - if (strid != STR_UNDEFINED) indsp->production_up_text = strid; + strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->production_up_text); + if (strid != STR_UNDEFINED) indsp->production_up_text = strid; - strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->production_down_text); - if (strid != STR_UNDEFINED) indsp->production_down_text = strid; + strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->production_down_text); + if (strid != STR_UNDEFINED) indsp->production_down_text = strid; - strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->new_industry_text); - if (strid != STR_UNDEFINED) indsp->new_industry_text = strid; + strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->new_industry_text); + if (strid != STR_UNDEFINED) indsp->new_industry_text = strid; - if (indsp->station_name != STR_NULL) { - /* STR_NULL (0) can be set by grf. It has a meaning regarding assignation of the - * station's name. Don't want to lose the value, therefore, do not process. */ - strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->station_name); - if (strid != STR_UNDEFINED) indsp->station_name = strid; - } - - _industry_mngr.SetEntitySpec(indsp); - } + if (indsp->station_name != STR_NULL) { + /* STR_NULL (0) can be set by grf. It has a meaning regarding assignation of the + * station's name. Don't want to lose the value, therefore, do not process. */ + strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->station_name); + if (strid != STR_UNDEFINED) indsp->station_name = strid; } + + _industry_mngr.SetEntitySpec(indsp.get()); } - if (indtspec != nullptr) { - for (int i = 0; i < NUM_INDUSTRYTILES_PER_GRF; i++) { - IndustryTileSpec *indtsp = indtspec[i]; - if (indtsp != nullptr) { - _industile_mngr.SetEntitySpec(indtsp); - } + for (const auto &indtsp : file->indtspec) { + if (indtsp != nullptr) { + _industile_mngr.SetEntitySpec(indtsp.get()); } } } @@ -11152,9 +11042,9 @@ static void FinaliseIndustriesArray() static void FinaliseObjectsArray() { for (GRFFile * const file : _grf_files) { - for (ObjectSpec *spec : file->objectspec) { - if (spec != nullptr && spec->grf_prop.grffile != nullptr && spec->IsEnabled()) { - _object_mngr.SetEntitySpec(spec); + for (auto &objectspec : file->objectspec) { + if (objectspec != nullptr && objectspec->grf_prop.grffile != nullptr && objectspec->IsEnabled()) { + _object_mngr.SetEntitySpec(objectspec.get()); } } } @@ -11170,21 +11060,15 @@ static void FinaliseObjectsArray() static void FinaliseAirportsArray() { for (GRFFile * const file : _grf_files) { - AirportSpec **&airportspec = file->airportspec; - if (airportspec != nullptr) { - for (int i = 0; i < NUM_AIRPORTS_PER_GRF; i++) { - if (airportspec[i] != nullptr && airportspec[i]->enabled) { - _airport_mngr.SetEntitySpec(airportspec[i]); - } + for (auto &as : file->airportspec) { + if (as != nullptr && as->enabled) { + _airport_mngr.SetEntitySpec(as.get()); } } - AirportTileSpec **&airporttilespec = file->airtspec; - if (airporttilespec != nullptr) { - for (uint i = 0; i < NUM_AIRPORTTILES_PER_GRF; i++) { - if (airporttilespec[i] != nullptr && airporttilespec[i]->enabled) { - _airporttile_mngr.SetEntitySpec(airporttilespec[i]); - } + for (auto &ats : file->airtspec) { + if (ats != nullptr && ats->enabled) { + _airporttile_mngr.SetEntitySpec(ats.get()); } } } @@ -11692,7 +11576,7 @@ static void AfterLoadGRFs() FinalisePriceBaseMultipliers(); /* Deallocate temporary loading data */ - free(_gted); + _gted.clear(); _grm_sprites.clear(); } diff --git a/src/newgrf.h b/src/newgrf.h index 5bc269bd26..7c3501534d 100644 --- a/src/newgrf.h +++ b/src/newgrf.h @@ -314,14 +314,14 @@ struct GRFFile : ZeroedMemoryAllocator { uint sound_offset; uint16 num_sounds; - struct StationSpec **stations; - struct HouseSpec **housespec; - struct IndustrySpec **industryspec; - struct IndustryTileSpec **indtspec; - std::vector objectspec; - struct AirportSpec **airportspec; - struct AirportTileSpec **airtspec; - std::vector roadstops; + std::vector> stations; + std::vector> housespec; + std::vector> industryspec; + std::vector> indtspec; + std::vector> objectspec; + std::vector> airportspec; + std::vector> airtspec; + std::vector> roadstops; GRFFeatureMapRemapSet feature_id_remaps; GRFFilePropertyRemapSet action0_property_remaps[GSF_END]; diff --git a/src/newgrf_airport.cpp b/src/newgrf_airport.cpp index 1e3031601e..fdc2561846 100644 --- a/src/newgrf_airport.cpp +++ b/src/newgrf_airport.cpp @@ -152,9 +152,10 @@ bool AirportSpec::IsWithinMapBounds(byte table, TileIndex tile) const */ void AirportSpec::ResetAirports() { - extern const AirportSpec _origin_airport_specs[]; - memset(&AirportSpec::specs, 0, sizeof(AirportSpec::specs)); - memcpy(&AirportSpec::specs, &_origin_airport_specs, sizeof(AirportSpec) * NEW_AIRPORT_OFFSET); + extern const AirportSpec _origin_airport_specs[NEW_AIRPORT_OFFSET]; + + auto insert = std::copy(std::begin(_origin_airport_specs), std::end(_origin_airport_specs), std::begin(AirportSpec::specs)); + std::fill(insert, std::end(AirportSpec::specs), AirportSpec{}); _airport_mngr.ResetOverride(); } @@ -180,7 +181,7 @@ void AirportOverrideManager::SetEntitySpec(AirportSpec *as) return; } - memcpy(AirportSpec::GetWithoutOverride(airport_id), as, sizeof(*as)); + *AirportSpec::GetWithoutOverride(airport_id) = *as; /* Now add the overrides. */ for (int i = 0; i < this->max_offset; i++) { diff --git a/src/newgrf_airporttiles.cpp b/src/newgrf_airporttiles.cpp index b8949d45dd..e9180cf603 100644 --- a/src/newgrf_airporttiles.cpp +++ b/src/newgrf_airporttiles.cpp @@ -57,8 +57,8 @@ AirportTileOverrideManager _airporttile_mngr(NEW_AIRPORTTILE_OFFSET, NUM_AIRPORT */ void AirportTileSpec::ResetAirportTiles() { - memset(&AirportTileSpec::tiles, 0, sizeof(AirportTileSpec::tiles)); - memcpy(&AirportTileSpec::tiles, &_origin_airporttile_specs, sizeof(_origin_airporttile_specs)); + auto insert = std::copy(std::begin(_origin_airporttile_specs), std::end(_origin_airporttile_specs), std::begin(AirportTileSpec::tiles)); + std::fill(insert, std::end(AirportTileSpec::tiles), AirportTileSpec{}); /* Reset any overrides that have been set. */ _airporttile_mngr.ResetOverride(); @@ -73,7 +73,7 @@ void AirportTileOverrideManager::SetEntitySpec(const AirportTileSpec *airpts) return; } - memcpy(&AirportTileSpec::tiles[airpt_id], airpts, sizeof(*airpts)); + AirportTileSpec::tiles[airpt_id] = *airpts; /* Now add the overrides. */ for (int i = 0; i < this->max_offset; i++) { diff --git a/src/newgrf_commons.cpp b/src/newgrf_commons.cpp index 6c45df37c5..43b2a77d5a 100644 --- a/src/newgrf_commons.cpp +++ b/src/newgrf_commons.cpp @@ -165,7 +165,7 @@ void HouseOverrideManager::SetEntitySpec(const HouseSpec *hs) return; } - MemCpyT(HouseSpec::Get(house_id), hs); + *HouseSpec::Get(house_id) = *hs; /* Now add the overrides. */ for (int i = 0; i < this->max_offset; i++) { @@ -274,7 +274,7 @@ void IndustryTileOverrideManager::SetEntitySpec(const IndustryTileSpec *its) return; } - memcpy(&_industry_tile_specs[indt_id], its, sizeof(*its)); + _industry_tile_specs[indt_id] = *its; /* Now add the overrides. */ for (int i = 0; i < this->max_offset; i++) { diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index d31f40aa45..0007f2679b 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -1264,12 +1264,12 @@ struct SpriteAlignerWindow : Window { this->SetWidgetLoweredState(WID_SA_CROSSHAIR, SpriteAlignerWindow::crosshair); /* Oh yes, we assume there is at least one normal sprite! */ - while (GetSpriteType(this->current_sprite) != ST_NORMAL) this->current_sprite++; + while (GetSpriteType(this->current_sprite) != SpriteType::Normal) this->current_sprite++; } void SetStringParameters(int widget) const override { - const Sprite *spr = GetSprite(this->current_sprite, ST_NORMAL); + const Sprite *spr = GetSprite(this->current_sprite, SpriteType::Normal); switch (widget) { case WID_SA_CAPTION: SetDParam(0, this->current_sprite); @@ -1324,7 +1324,7 @@ struct SpriteAlignerWindow : Window { switch (widget) { case WID_SA_SPRITE: { /* Center the sprite ourselves */ - const Sprite *spr = GetSprite(this->current_sprite, ST_NORMAL); + const Sprite *spr = GetSprite(this->current_sprite, SpriteType::Normal); Rect ir = r.Shrink(WidgetDimensions::scaled.bevel); int x; int y; @@ -1372,7 +1372,7 @@ struct SpriteAlignerWindow : Window { case WID_SA_PREVIOUS: do { this->current_sprite = (this->current_sprite == 0 ? GetMaxSpriteID() : this->current_sprite) - 1; - } while (GetSpriteType(this->current_sprite) != ST_NORMAL); + } while (GetSpriteType(this->current_sprite) != SpriteType::Normal); this->SetDirty(); break; @@ -1383,7 +1383,7 @@ struct SpriteAlignerWindow : Window { case WID_SA_NEXT: do { this->current_sprite = (this->current_sprite + 1) % GetMaxSpriteID(); - } while (GetSpriteType(this->current_sprite) != ST_NORMAL); + } while (GetSpriteType(this->current_sprite) != SpriteType::Normal); this->SetDirty(); break; @@ -1400,7 +1400,7 @@ struct SpriteAlignerWindow : Window { uint i = this->vscroll->GetPosition() + (pt.y - nwid->pos_y) / step_size; if (i < _newgrf_debug_sprite_picker.sprites.size()) { SpriteID spr = _newgrf_debug_sprite_picker.sprites[i]; - if (GetSpriteType(spr) == ST_NORMAL) this->current_sprite = spr; + if (GetSpriteType(spr) == SpriteType::Normal) this->current_sprite = spr; } this->SetDirty(); break; @@ -1423,7 +1423,7 @@ struct SpriteAlignerWindow : Window { * used by someone and the sprite cache isn't big enough for that * particular NewGRF developer. */ - Sprite *spr = const_cast(GetSprite(this->current_sprite, ST_NORMAL)); + Sprite *spr = const_cast(GetSprite(this->current_sprite, SpriteType::Normal)); /* Remember the original offsets of the current sprite, if not already in mapping. */ if (!(this->offs_start_map.Contains(this->current_sprite))) { @@ -1468,7 +1468,7 @@ struct SpriteAlignerWindow : Window { this->current_sprite = atoi(str); if (this->current_sprite >= GetMaxSpriteID()) this->current_sprite = 0; - while (GetSpriteType(this->current_sprite) != ST_NORMAL) { + while (GetSpriteType(this->current_sprite) != SpriteType::Normal) { this->current_sprite = (this->current_sprite + 1) % GetMaxSpriteID(); } this->SetDirty(); diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp index cc5ab7baf1..026f77f07c 100644 --- a/src/newgrf_object.cpp +++ b/src/newgrf_object.cpp @@ -126,11 +126,11 @@ void ResetObjects() _object_specs.clear(); /* And add our originals. */ - _object_specs.resize(lengthof(_original_objects)); + _object_specs.reserve(lengthof(_original_objects)); for (uint16 i = 0; i < lengthof(_original_objects); i++) { - _object_specs[i] = _original_objects[i]; - _object_specs[i].grf_prop.local_id = i; + ObjectSpec &spec = _object_specs.emplace_back(_original_objects[i]); + spec.grf_prop.local_id = i; } /* Set class for originals. */ diff --git a/src/newgrf_townname.cpp b/src/newgrf_townname.cpp index a7bc4deeaf..ce394be77e 100644 --- a/src/newgrf_townname.cpp +++ b/src/newgrf_townname.cpp @@ -21,15 +21,13 @@ #include "safeguards.h" -static GRFTownName *_grf_townnames = nullptr; +static std::vector _grf_townnames; static std::vector _grf_townname_names; GRFTownName *GetGRFTownName(uint32 grfid) { - GRFTownName *t = _grf_townnames; - for (; t != nullptr; t = t->next) { - if (t->grfid == grfid) return t; - } + auto found = std::find_if(std::begin(_grf_townnames), std::end(_grf_townnames), [&grfid](const GRFTownName &t){ return t.grfid == grfid; }); + if (found != std::end(_grf_townnames)) return &*found; return nullptr; } @@ -37,53 +35,31 @@ GRFTownName *AddGRFTownName(uint32 grfid) { GRFTownName *t = GetGRFTownName(grfid); if (t == nullptr) { - t = CallocT(1); + t = &_grf_townnames.emplace_back(); t->grfid = grfid; - t->next = _grf_townnames; - _grf_townnames = t; } return t; } void DelGRFTownName(uint32 grfid) { - GRFTownName *t = _grf_townnames; - GRFTownName *p = nullptr; - for (;t != nullptr; p = t, t = t->next) if (t->grfid == grfid) break; - if (t != nullptr) { - for (int i = 0; i < 128; i++) { - for (int j = 0; j < t->nbparts[i]; j++) { - for (int k = 0; k < t->partlist[i][j].partcount; k++) { - if (!HasBit(t->partlist[i][j].parts[k].prob, 7)) free(t->partlist[i][j].parts[k].data.text); - } - free(t->partlist[i][j].parts); - } - free(t->partlist[i]); - } - if (p != nullptr) { - p->next = t->next; - } else { - _grf_townnames = t->next; - } - free(t); - } + _grf_townnames.erase(std::find_if(std::begin(_grf_townnames), std::end(_grf_townnames), [&grfid](const GRFTownName &t){ return t.grfid == grfid; })); } -static char *RandomPart(char *buf, GRFTownName *t, uint32 seed, byte id, const char *last) +static char *RandomPart(char *buf, const GRFTownName *t, uint32 seed, byte id, const char *last) { assert(t != nullptr); - for (int i = 0; i < t->nbparts[id]; i++) { - byte count = t->partlist[id][i].bitcount; - uint16 maxprob = t->partlist[id][i].maxprob; - uint32 r = (GB(seed, t->partlist[id][i].bitstart, count) * maxprob) >> count; - for (int j = 0; j < t->partlist[id][i].partcount; j++) { - byte prob = t->partlist[id][i].parts[j].prob; - maxprob -= GB(prob, 0, 7); + for (const auto &partlist : t->partlists[id]) { + byte count = partlist.bitcount; + uint16 maxprob = partlist.maxprob; + uint32 r = (GB(seed, partlist.bitstart, count) * maxprob) >> count; + for (const auto &part : partlist.parts) { + maxprob -= GB(part.prob, 0, 7); if (maxprob > r) continue; - if (HasBit(prob, 7)) { - buf = RandomPart(buf, t, seed, t->partlist[id][i].parts[j].data.id, last); + if (HasBit(part.prob, 7)) { + buf = RandomPart(buf, t, seed, part.id, last); } else { - buf = strecat(buf, t->partlist[id][i].parts[j].data.text, last); + buf = strecat(buf, part.text.c_str(), last); } break; } @@ -94,12 +70,10 @@ static char *RandomPart(char *buf, GRFTownName *t, uint32 seed, byte id, const c char *GRFTownNameGenerate(char *buf, uint32 grfid, uint16 gen, uint32 seed, const char *last) { strecpy(buf, "", last); - for (GRFTownName *t = _grf_townnames; t != nullptr; t = t->next) { - if (t->grfid == grfid) { - assert(gen < t->nb_gen); - buf = RandomPart(buf, t, seed, t->id[gen], last); - break; - } + const GRFTownName *t = GetGRFTownName(grfid); + if (t != nullptr) { + assert(gen < t->styles.size()); + buf = RandomPart(buf, t, seed, t->styles[gen].id, last); } return buf; } @@ -109,8 +83,10 @@ char *GRFTownNameGenerate(char *buf, uint32 grfid, uint16 gen, uint32 seed, cons void InitGRFTownGeneratorNames() { _grf_townname_names.clear(); - for (GRFTownName *t = _grf_townnames; t != nullptr; t = t->next) { - for (int j = 0; j < t->nb_gen; j++) _grf_townname_names.push_back(t->name[j]); + for (const auto &t : _grf_townnames) { + for (const auto &style : t.styles) { + _grf_townname_names.push_back(style.name); + } } } @@ -119,31 +95,31 @@ const std::vector& GetGRFTownNameList() return _grf_townname_names; } -StringID GetGRFTownNameName(uint gen) +StringID GetGRFTownNameName(uint16 gen) { return gen < _grf_townname_names.size() ? _grf_townname_names[gen] : STR_UNDEFINED; } void CleanUpGRFTownNames() { - while (_grf_townnames != nullptr) DelGRFTownName(_grf_townnames->grfid); + _grf_townnames.clear(); } -uint32 GetGRFTownNameId(int gen) +uint32 GetGRFTownNameId(uint16 gen) { - for (GRFTownName *t = _grf_townnames; t != nullptr; t = t->next) { - if (gen < t->nb_gen) return t->grfid; - gen -= t->nb_gen; + for (const auto &t : _grf_townnames) { + if (gen < t.styles.size()) return t.grfid; + gen -= static_cast(t.styles.size()); } /* Fallback to no NewGRF */ return 0; } -uint16 GetGRFTownNameType(int gen) +uint16 GetGRFTownNameType(uint16 gen) { - for (GRFTownName *t = _grf_townnames; t != nullptr; t = t->next) { - if (gen < t->nb_gen) return gen; - gen -= t->nb_gen; + for (const auto &t : _grf_townnames) { + if (gen < t.styles.size()) return gen; + gen -= static_cast(t.styles.size()); } /* Fallback to english original */ return SPECSTR_TOWNNAME_ENGLISH; diff --git a/src/newgrf_townname.h b/src/newgrf_townname.h index d8fc462aae..c2fc94a53b 100644 --- a/src/newgrf_townname.h +++ b/src/newgrf_townname.h @@ -17,29 +17,31 @@ #include "strings_type.h" struct NamePart { - byte prob; ///< The relative probability of the following name to appear in the bottom 7 bits. - union { - char *text; ///< If probability bit 7 is clear - byte id; ///< If probability bit 7 is set - } data; + std::string text; ///< If probability bit 7 is clear + byte id; ///< If probability bit 7 is set + byte prob; ///< The relative probability of the following name to appear in the bottom 7 bits. }; struct NamePartList { - byte partcount; - byte bitstart; - byte bitcount; - uint16 maxprob; - NamePart *parts; + byte bitstart; ///< Start of random seed bits to use. + byte bitcount; ///< Number of bits of random seed to use. + uint16 maxprob; ///< Total probability of all parts. + std::vector parts; ///< List of parts to choose from. +}; + +struct TownNameStyle { + StringID name; ///< String ID of this town name style. + byte id; ///< Index within partlist for this town name style. + + TownNameStyle(StringID name, byte id) : name(name), id(id) { } }; struct GRFTownName { - uint32 grfid; - byte nb_gen; - byte id[128]; - StringID name[128]; - byte nbparts[128]; - NamePartList *partlist[128]; - GRFTownName *next; + static const uint MAX_LISTS = 128; ///< Maximum number of town name lists that can be defined per GRF. + + uint32 grfid; ///< GRF ID of NewGRF. + std::vector styles; ///< Style names defined by the Town Name NewGRF. + std::vector partlists[MAX_LISTS]; ///< Lists of town name parts. }; GRFTownName *AddGRFTownName(uint32 grfid); @@ -47,9 +49,9 @@ GRFTownName *GetGRFTownName(uint32 grfid); void DelGRFTownName(uint32 grfid); void CleanUpGRFTownNames(); char *GRFTownNameGenerate(char *buf, uint32 grfid, uint16 gen, uint32 seed, const char *last); -uint32 GetGRFTownNameId(int gen); -uint16 GetGRFTownNameType(int gen); -StringID GetGRFTownNameName(uint gen); +uint32 GetGRFTownNameId(uint16 gen); +uint16 GetGRFTownNameType(uint16 gen); +StringID GetGRFTownNameName(uint16 gen); const std::vector& GetGRFTownNameList(); diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 865a831c8e..80ef9fc2e2 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -358,7 +358,7 @@ struct NewsWindow : Window { } case WID_N_MGR_FACE: - *size = maxdim(*size, GetSpriteSize(SPR_GRADIENT)); + *size = maxdim(*size, GetScaledSpriteSize(SPR_GRADIENT)); break; case WID_N_MGR_NAME: @@ -441,7 +441,7 @@ struct NewsWindow : Window { case WID_N_MGR_FACE: { const CompanyNewsInformation *cni = static_cast(this->ni->data.get()); - DrawCompanyManagerFace(cni->face, cni->colour, r.left, r.top); + DrawCompanyManagerFace(cni->face, cni->colour, r); GfxFillRect(r.left, r.top, r.right, r.bottom, PALETTE_NEWSPAPER, FILLRECT_RECOLOUR); break; } diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp index 2ba8a90c15..c072e2570f 100644 --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -777,7 +777,7 @@ static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlag flags) if (flags & DC_EXEC) { c->location_of_HQ = INVALID_TILE; // reset HQ position SetWindowDirty(WC_COMPANY, c->index); - CargoPacket::InvalidateAllFrom(ST_HEADQUARTERS, c->index); + CargoPacket::InvalidateAllFrom(SourceType::Headquarters, c->index); } /* cost of relocating company is 1% of company value */ @@ -979,7 +979,7 @@ static void TileLoop_Object(TileIndex tile) if (GB(r, 0, 8) < (256 / 4 / (6 - level))) { uint amt = GB(r, 0, 8) / 8 / 4 + 1; if (EconomyIsInRecession()) amt = (amt + 1) >> 1; - MoveGoodsToStation(CT_PASSENGERS, amt, ST_HEADQUARTERS, GetTileOwner(tile), stations.GetStations()); + MoveGoodsToStation(CT_PASSENGERS, amt, SourceType::Headquarters, GetTileOwner(tile), stations.GetStations()); } /* Top town building generates 90, HQ can make up to 196. The @@ -988,7 +988,7 @@ static void TileLoop_Object(TileIndex tile) if (GB(r, 8, 8) < (196 / 4 / (6 - level))) { uint amt = GB(r, 8, 8) / 8 / 4 + 1; if (EconomyIsInRecession()) amt = (amt + 1) >> 1; - MoveGoodsToStation(CT_MAIL, amt, ST_HEADQUARTERS, GetTileOwner(tile), stations.GetStations()); + MoveGoodsToStation(CT_MAIL, amt, SourceType::Headquarters, GetTileOwner(tile), stations.GetStations()); } } diff --git a/src/openttd.cpp b/src/openttd.cpp index a03ed219ce..d4fb8f1ade 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -86,6 +86,8 @@ #include "tunnelbridge.h" #include "worker_thread.h" #include "scope_info.h" +#include "timer/timer.h" +#include "timer/timer_game_tick.h" #include "linkgraph/linkgraphschedule.h" #include "tracerestrict.h" @@ -1313,7 +1315,7 @@ void SwitchToMode(SwitchMode new_mode) if (!SafeLoad(_file_to_saveload.name, _file_to_saveload.file_op, _file_to_saveload.detail_ftype, GM_NORMAL, NO_DIRECTORY)) { SetDParamStr(0, GetSaveLoadErrorString()); - ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR); + ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_CRITICAL); } else { if (_file_to_saveload.abstract_ftype == FT_SCENARIO) { OnStartScenario(); @@ -1346,7 +1348,7 @@ void SwitchToMode(SwitchMode new_mode) DoCommandP(0, PM_PAUSED_SAVELOAD, 0, CMD_PAUSE); } else { SetDParamStr(0, GetSaveLoadErrorString()); - ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR); + ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_CRITICAL); } break; } @@ -2004,6 +2006,7 @@ void StateGameLoop() RunTileLoop(); CallVehicleTicks(); CallLandscapeTick(); + TimerManager::Elapsed(1); BasePersistentStorageArray::SwitchMode(PSM_LEAVE_GAMELOOP); UpdateLandscapingLimits(); @@ -2049,6 +2052,7 @@ void StateGameLoop() CallLandscapeTick(); OnTick_Companies(true); } + TimerManager::Elapsed(1); BasePersistentStorageArray::SwitchMode(PSM_LEAVE_GAMELOOP); #ifndef DEBUG_DUMP_COMMANDS diff --git a/src/os/macosx/font_osx.cpp b/src/os/macosx/font_osx.cpp index bbc0450754..864325afb7 100644 --- a/src/os/macosx/font_osx.cpp +++ b/src/os/macosx/font_osx.cpp @@ -289,7 +289,7 @@ const Sprite *CoreTextFontCache::InternalGetGlyph(GlyphID key, bool use_aa) SpriteLoader::Sprite sprite; sprite.AllocateData(ZOOM_LVL_NORMAL, width * height); - sprite.type = ST_FONT; + sprite.type = SpriteType::Font; sprite.colours = (use_aa ? SCC_PAL | SCC_ALPHA : SCC_PAL); sprite.width = width; sprite.height = height; diff --git a/src/os/windows/font_win32.cpp b/src/os/windows/font_win32.cpp index fa8624f545..126fcf5a3f 100644 --- a/src/os/windows/font_win32.cpp +++ b/src/os/windows/font_win32.cpp @@ -457,7 +457,7 @@ void Win32FontCache::ClearFontCache() /* GDI has rendered the glyph, now we allocate a sprite and copy the image into it. */ SpriteLoader::Sprite sprite; sprite.AllocateData(ZOOM_LVL_NORMAL, width * height); - sprite.type = ST_FONT; + sprite.type = SpriteType::Font; sprite.colours = (aa ? SCC_PAL | SCC_ALPHA : SCC_PAL); sprite.width = width; sprite.height = height; diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index 3afa2569b1..f46c91a1cd 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -3279,7 +3279,7 @@ void DrawSingleSignal(TileIndex tile, const RailtypeInfo *rti, Track track, Sign } else { AddSortableSpriteToDraw(sprite, pal, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, z); } - const Sprite *sp = GetSprite(sprite, ST_NORMAL); + const Sprite *sp = GetSprite(sprite, SpriteType::Normal); if (sp->x_offs < -SIGNAL_DIRTY_LEFT || sp->x_offs + sp->width > SIGNAL_DIRTY_RIGHT || sp->y_offs < -SIGNAL_DIRTY_TOP || sp->y_offs + sp->height > SIGNAL_DIRTY_BOTTOM) { _signal_sprite_oversized = true; } diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 5cea2a27bf..47e868d43b 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -71,6 +71,8 @@ #include "../event_logs.h" #include "../newgrf_object.h" #include "../newgrf_industrytiles.h" +#include "../timer/timer.h" +#include "../timer/timer_game_tick.h" #include "saveload_internal.h" @@ -2617,19 +2619,19 @@ bool AfterLoadGame() case TE_PASSENGERS: case TE_MAIL: /* Town -> Town */ - s->src_type = s->dst_type = ST_TOWN; + s->src_type = s->dst_type = SourceType::Town; if (Town::IsValidID(s->src) && Town::IsValidID(s->dst)) continue; break; case TE_GOODS: case TE_FOOD: /* Industry -> Town */ - s->src_type = ST_INDUSTRY; - s->dst_type = ST_TOWN; + s->src_type = SourceType::Industry; + s->dst_type = SourceType::Town; if (Industry::IsValidID(s->src) && Town::IsValidID(s->dst)) continue; break; default: /* Industry -> Industry */ - s->src_type = s->dst_type = ST_INDUSTRY; + s->src_type = s->dst_type = SourceType::Industry; if (Industry::IsValidID(s->src) && Industry::IsValidID(s->dst)) continue; break; } @@ -2647,7 +2649,7 @@ bool AfterLoadGame() const Station *sd = Station::GetIfValid(s->dst); if (ss != nullptr && sd != nullptr && ss->owner == sd->owner && Company::IsValidID(ss->owner)) { - s->src_type = s->dst_type = ST_TOWN; + s->src_type = s->dst_type = SourceType::Town; s->src = ss->town->index; s->dst = sd->town->index; s->awarded = ss->owner; @@ -4201,6 +4203,16 @@ bool AfterLoadGame() _settings_game.economy.tick_rate = IsSavegameVersionUntil(SLV_MORE_CARGO_AGE) ? TRM_TRADITIONAL : TRM_MODERN; } + if (SlXvIsFeatureMissing(XSLFI_AI_START_DATE) && IsSavegameVersionBefore(SLV_AI_START_DATE)) { + /* For older savegames, we don't now the actual interval; so set it to the newgame value. */ + _settings_game.difficulty.competitors_interval = _settings_newgame.difficulty.competitors_interval; + + /* We did load the "period" of the timer, but not the fired/elapsed. We can deduce that here. */ + extern TimeoutTimer _new_competitor_timeout; + _new_competitor_timeout.storage.elapsed = 0; + _new_competitor_timeout.fired = _new_competitor_timeout.period == 0; + } + InitializeRoadGUI(); /* This needs to be done after conversion. */ diff --git a/src/saveload/extended_ver_sl.cpp b/src/saveload/extended_ver_sl.cpp index 6d4cafff7c..dedbcfe77b 100644 --- a/src/saveload/extended_ver_sl.cpp +++ b/src/saveload/extended_ver_sl.cpp @@ -197,6 +197,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = { { XSLFI_VELOCITY_NAUTICAL, XSCF_IGNORABLE_ALL, 1, 1, "velocity_nautical", nullptr, nullptr, nullptr }, { XSLFI_CONSISTENT_PARTIAL_Z, XSCF_NULL, 1, 1, "consistent_partial_z", nullptr, nullptr, nullptr }, { XSLFI_MORE_CARGO_AGE, XSCF_NULL, 1, 1, "more_cargo_age", nullptr, nullptr, nullptr }, + { XSLFI_AI_START_DATE, XSCF_NULL, 1, 1, "slv_ai_start_date", nullptr, nullptr, nullptr }, { XSLFI_NULL, XSCF_NULL, 0, 0, nullptr, nullptr, nullptr, nullptr },// This is the end marker }; diff --git a/src/saveload/extended_ver_sl.h b/src/saveload/extended_ver_sl.h index 48761631e2..c75c31cebe 100644 --- a/src/saveload/extended_ver_sl.h +++ b/src/saveload/extended_ver_sl.h @@ -149,6 +149,7 @@ enum SlXvFeatureIndex { XSLFI_VELOCITY_NAUTICAL, ///< See: SLV_VELOCITY_NAUTICAL (PR #10594) XSLFI_CONSISTENT_PARTIAL_Z, ///< See: SLV_CONSISTENT_PARTIAL_Z (PR #10570) XSLFI_MORE_CARGO_AGE, ///< See: SLV_MORE_CARGO_AGE (PR #10596) + XSLFI_AI_START_DATE, ///< See: SLV_AI_START_DATE (PR PR#10653) XSLFI_RIFF_HEADER_60_BIT, ///< Size field in RIFF chunk header is 60 bit XSLFI_HEIGHT_8_BIT, ///< Map tile height is 8 bit instead of 4 bit, but savegame version may be before this became true in trunk diff --git a/src/saveload/misc_sl.cpp b/src/saveload/misc_sl.cpp index bbbe783f6f..26071eef7a 100644 --- a/src/saveload/misc_sl.cpp +++ b/src/saveload/misc_sl.cpp @@ -19,6 +19,8 @@ #include "../road_type.h" #include "../core/checksum_func.hpp" #include "../event_logs.h" +#include "../timer/timer.h" +#include "../timer/timer_game_tick.h" #include "saveload.h" @@ -72,6 +74,7 @@ void ResetViewportAfterLoadGame() } byte _age_cargo_skip_counter; ///< Skip aging of cargo? Used before savegame version 162. +extern TimeoutTimer _new_competitor_timeout; static const SaveLoad _date_desc[] = { SLEG_CONDVAR(_date, SLE_FILE_U16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_31), @@ -95,8 +98,8 @@ static const SaveLoad _date_desc[] = { SLE_CONDNULL(1, SL_MIN_VERSION, SLV_10), SLE_CONDNULL(4, SLV_10, SLV_120), SLEG_VAR(_cur_company_tick_index, SLE_FILE_U8 | SLE_VAR_U32), - SLEG_CONDVAR(_next_competitor_start, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_109), - SLEG_CONDVAR(_next_competitor_start, SLE_UINT32, SLV_109, SL_MAX_VERSION), + SLEG_CONDVAR(_new_competitor_timeout.period, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_109), + SLEG_CONDVAR_X(_new_competitor_timeout.period, SLE_UINT32, SLV_109, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_AI_START_DATE, 0, 0)), SLEG_VAR(_trees_tick_ctr, SLE_UINT8), SLEG_CONDVAR(_pause_mode, SLE_UINT8, SLV_4, SL_MAX_VERSION), SLEG_CONDVAR_X(_game_events_overall, SLE_UINT32, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_GAME_EVENTS)), @@ -105,6 +108,9 @@ static const SaveLoad _date_desc[] = { SLEG_CONDVAR_X(_aspect_cfg_hash, SLE_UINT64, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_REALISTIC_TRAIN_BRAKING, 7)), SLEG_CONDVAR_X(_aux_tileloop_tile, SLE_UINT32, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_AUX_TILE_LOOP)), SLE_CONDNULL(4, SLV_11, SLV_120), + SLEG_CONDVAR_X(_new_competitor_timeout.period, SLE_UINT32, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_AI_START_DATE)), + SLEG_CONDVAR_X(_new_competitor_timeout.storage.elapsed, SLE_UINT32, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_AI_START_DATE)), + SLEG_CONDVAR_X(_new_competitor_timeout.fired, SLE_BOOL, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_AI_START_DATE)), }; static const SaveLoad _date_check_desc[] = { @@ -129,8 +135,8 @@ static const SaveLoad _date_check_desc[] = { SLE_CONDNULL(1, SL_MIN_VERSION, SLV_10), SLE_CONDNULL(4, SLV_10, SLV_120), SLE_NULL(1), // _cur_company_tick_index - SLE_CONDNULL(2, SL_MIN_VERSION, SLV_109), // _next_competitor_start - SLE_CONDNULL(4, SLV_109, SL_MAX_VERSION), // _next_competitor_start + SLE_CONDNULL(2, SL_MIN_VERSION, SLV_109), // _new_competitor_timeout.period + SLE_CONDNULL_X(4, SLV_109, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_AI_START_DATE, 0, 0)), // _new_competitor_timeout.period SLE_NULL(1), // _trees_tick_ctr SLE_CONDNULL(1, SLV_4, SL_MAX_VERSION), // _pause_mode SLE_CONDNULL_X(4, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_GAME_EVENTS)), // _game_events_overall @@ -139,6 +145,7 @@ static const SaveLoad _date_check_desc[] = { SLE_CONDNULL_X(8, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_REALISTIC_TRAIN_BRAKING, 7)), // _aspect_cfg_hash SLE_CONDNULL_X(4, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_AUX_TILE_LOOP)), // _aux_tileloop_tile SLE_CONDNULL(4, SLV_11, SLV_120), + SLE_CONDNULL_X(9, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_AI_START_DATE)), // _new_competitor_timeout }; /* Save load date related variables as well as persistent tick counters diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp index 0362ae1675..bfd6e5eff1 100644 --- a/src/saveload/oldloader_sl.cpp +++ b/src/saveload/oldloader_sl.cpp @@ -28,6 +28,8 @@ #include "../disaster_vehicle.h" #include "../animated_tile.h" #include "../core/smallvec_type.hpp" +#include "../timer/timer.h" +#include "../timer/timer_game_tick.h" #include "saveload_internal.h" #include "oldloader.h" #include @@ -485,6 +487,7 @@ static inline uint RemapOrderIndex(uint x) return _savegame_type == SGT_TTO ? (x - 0x1AC4) / 2 : (x - 0x1C18) / 2; } +extern TimeoutTimer _new_competitor_timeout; extern char *_old_name_array; static uint32 _old_town_index; @@ -1674,7 +1677,7 @@ static const OldChunks main_chunk[] = { OCL_ASSERT( OC_TTO, 0x496CE ), - OCL_VAR ( OC_FILE_U16 | OC_VAR_U32, 1, &_next_competitor_start ), + OCL_VAR ( OC_FILE_U16 | OC_VAR_U32, 1, &_new_competitor_timeout.period ), OCL_CNULL( OC_TTO, 2 ), ///< available monorail bitmask diff --git a/src/saveload/saveload_common.h b/src/saveload/saveload_common.h index 6295b90aab..b1f856ec06 100644 --- a/src/saveload/saveload_common.h +++ b/src/saveload/saveload_common.h @@ -360,6 +360,7 @@ enum SaveLoadVersion : uint16 { SLV_CONSISTENT_PARTIAL_Z, ///< 306 PR#10570 Conversion from an inconsistent partial Z calculation for slopes, to one that is (more) consistent. SLV_MORE_CARGO_AGE, ///< 307 PR#10596 Track cargo age for a longer period. SLV_LINKGRAPH_SECONDS, ///< 308 PR#10610 Store linkgraph update intervals in seconds instead of days. + SLV_AI_START_DATE, ///< 309 PR#10653 Removal of individual AI start dates and added a generic one. SL_MAX_VERSION, ///< Highest possible saveload version diff --git a/src/saveload/upstream/misc_sl.cpp b/src/saveload/upstream/misc_sl.cpp index fdda96b540..683c2527e9 100644 --- a/src/saveload/upstream/misc_sl.cpp +++ b/src/saveload/upstream/misc_sl.cpp @@ -20,6 +20,8 @@ #include "../../gfx_func.h" #include "../../core/random_func.hpp" #include "../../fios.h" +#include "../../timer/timer.h" +#include "../../timer/timer_game_tick.h" #include "../../safeguards.h" @@ -34,6 +36,7 @@ extern int _saved_scrollpos_y; extern ZoomLevel _saved_scrollpos_zoom; extern byte _age_cargo_skip_counter; ///< Skip aging of cargo? Used before savegame version 162. +extern TimeoutTimer _new_competitor_timeout; namespace upstream_sl { @@ -50,10 +53,14 @@ static const SaveLoad _date_desc[] = { SLEG_VAR("random_state[0]", _random.state[0], SLE_UINT32), SLEG_VAR("random_state[1]", _random.state[1], SLE_UINT32), SLEG_VAR("company_tick_counter", _cur_company_tick_index, SLE_FILE_U8 | SLE_VAR_U32), - SLEG_CONDVAR("next_competitor_start", _next_competitor_start, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_109), - SLEG_CONDVAR("next_competitor_start", _next_competitor_start, SLE_UINT32, SLV_109, SL_MAX_VERSION), SLEG_VAR("trees_tick_counter", _trees_tick_ctr, SLE_UINT8), SLEG_CONDVAR("pause_mode", _pause_mode, SLE_UINT8, SLV_4, SL_MAX_VERSION), + /* For older savegames, we load the current value as the "period"; afterload will set the "fired" and "elapsed". */ + SLEG_CONDVAR("next_competitor_start", _new_competitor_timeout.period, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_109), + SLEG_CONDVAR("next_competitor_start", _new_competitor_timeout.period, SLE_UINT32, SLV_109, SLV_AI_START_DATE), + SLEG_CONDVAR("competitors_interval", _new_competitor_timeout.period, SLE_UINT32, SLV_AI_START_DATE, SL_MAX_VERSION), + SLEG_CONDVAR("competitors_interval_elapsed", _new_competitor_timeout.storage.elapsed, SLE_UINT32, SLV_AI_START_DATE, SL_MAX_VERSION), + SLEG_CONDVAR("competitors_interval_fired", _new_competitor_timeout.fired, SLE_BOOL, SLV_AI_START_DATE, SL_MAX_VERSION), }; static const SaveLoad _date_check_desc[] = { diff --git a/src/schdispatch_gui.cpp b/src/schdispatch_gui.cpp index 881004190e..4ff03d0bce 100644 --- a/src/schdispatch_gui.cpp +++ b/src/schdispatch_gui.cpp @@ -259,7 +259,7 @@ struct SchdispatchWindow : GeneralVehicleWindow { SetDParamMaxValue(0, _settings_time.time_in_minutes ? 0 : MAX_YEAR * DAYS_IN_YEAR); Dimension unumber = GetStringBoundingBox(STR_JUST_DATE_WALLCLOCK_TINY); - const Sprite *spr = GetSprite(SPR_FLAG_VEH_STOPPED, ST_NORMAL); + const Sprite *spr = GetSprite(SPR_FLAG_VEH_STOPPED, SpriteType::Normal); this->flag_width = UnScaleGUI(spr->width) + WidgetDimensions::scaled.framerect.right; this->flag_height = UnScaleGUI(spr->height); diff --git a/src/script/api/ai/ai_controller.hpp.sq b/src/script/api/ai/ai_controller.hpp.sq index ba1cc3fa57..d37cb75b51 100644 --- a/src/script/api/ai/ai_controller.hpp.sq +++ b/src/script/api/ai/ai_controller.hpp.sq @@ -7,11 +7,11 @@ #include "../script_controller.hpp" -template <> const char *GetClassName() { return "AIController"; } +template <> const char *GetClassName() { return "AIController"; } void SQAIController_Register(Squirrel *engine) { - DefSQClass SQAIController("AIController"); + DefSQClass SQAIController("AIController"); SQAIController.PreRegister(engine); SQAIController.DefSQStaticMethod(engine, &ScriptController::GetTick, "GetTick", 1, "."); diff --git a/src/script/api/game/game_controller.hpp.sq b/src/script/api/game/game_controller.hpp.sq index e7f7c58306..cbf61b89cd 100644 --- a/src/script/api/game/game_controller.hpp.sq +++ b/src/script/api/game/game_controller.hpp.sq @@ -7,11 +7,11 @@ #include "../script_controller.hpp" -template <> const char *GetClassName() { return "GSController"; } +template <> const char *GetClassName() { return "GSController"; } void SQGSController_Register(Squirrel *engine) { - DefSQClass SQGSController("GSController"); + DefSQClass SQGSController("GSController"); SQGSController.PreRegister(engine); SQGSController.DefSQStaticMethod(engine, &ScriptController::GetTick, "GetTick", 1, "."); diff --git a/src/script/api/game_changelog.hpp b/src/script/api/game_changelog.hpp index 30ac4b7612..798b7d0289 100644 --- a/src/script/api/game_changelog.hpp +++ b/src/script/api/game_changelog.hpp @@ -22,6 +22,58 @@ * \li GSCompanyMode::IsDeity * \li GSTown::ROAD_LAYOUT_RANDOM * \li GSVehicle::IsPrimaryVehicle + * \li GSOrder::SetOrderJumpTo + * \li GSOrder::SetOrderCondition + * \li GSOrder::SetOrderCompareFunction + * \li GSOrder::SetOrderCompareValue + * \li GSOrder::SetStopLocation + * \li GSOrder::SetOrderRefit + * \li GSOrder::AppendOrder + * \li GSOrder::AppendConditionalOrder + * \li GSOrder::InsertOrder + * \li GSOrder::InsertConditionalOrder + * \li GSOrder::RemoveOrder + * \li GSOrder::SetOrderFlags + * \li GSOrder::MoveOrder + * \li GSOrder::SkipToOrder + * \li GSOrder::CopyOrders + * \li GSOrder::ShareOrders + * \li GSOrder::UnshareOrders + * \li GSCompany::IsMine + * \li GSCompany::SetPresidentGender + * \li GSCompany::SetAutoRenewStatus + * \li GSCompany::SetAutoRenewMonths + * \li GSCompany::SetAutoRenewMoney + * \li GSGameSettings::IsDisabledVehicleType + * \li GSGroup::GroupID + * \li GSGroup::IsValidGroup + * \li GSGroup::CreateGroup + * \li GSGroup::DeleteGroup + * \li GSGroup::GetVehicleType + * \li GSGroup::SetName + * \li GSGroup::GetName + * \li GSGroup::SetParent + * \li GSGroup::GetParent + * \li GSGroup::EnableAutoReplaceProtection + * \li GSGroup::GetAutoReplaceProtection + * \li GSGroup::GetNumEngines + * \li GSGroup::GetNumVehicles + * \li GSGroup::MoveVehicle + * \li GSGroup::EnableWagonRemoval + * \li GSGroup::HasWagonRemoval + * \li GSGroup::SetAutoReplace + * \li GSGroup::GetEngineReplacement + * \li GSGroup::StopAutoReplace + * \li GSGroup::GetProfitThisYear + * \li GSGroup::GetProfitLastYear + * \li GSGroup::GetCurrentUsage + * \li GSGroup::SetPrimaryColour + * \li GSGroup::SetSecondaryColour + * \li GSGroup::GetPrimaryColour + * \li GSGroup::GetSecondaryColour + * \li GSGroupList + * \li GSVehicleList_Group + * \li GSVehicleList_DefaultGroup * * API removals: * \li GSError::ERR_PRECONDITION_TOO_MANY_PARAMETERS, that error is never returned anymore. diff --git a/src/script/api/script_company.cpp b/src/script/api/script_company.cpp index b44c6f8a3e..ab706abe3d 100644 --- a/src/script/api/script_company.cpp +++ b/src/script/api/script_company.cpp @@ -36,6 +36,7 @@ /* static */ bool ScriptCompany::IsMine(ScriptCompany::CompanyID company) { + EnforceCompanyModeValid(false); return ResolveCompanyID(company) == ResolveCompanyID(COMPANY_SELF); } diff --git a/src/script/api/script_company.hpp b/src/script/api/script_company.hpp index a874de314b..b57c4b8d8b 100644 --- a/src/script/api/script_company.hpp +++ b/src/script/api/script_company.hpp @@ -130,8 +130,8 @@ public: /** * Check if a CompanyID is your CompanyID, to ease up checks. * @param company The company index to check. + * @game @pre ScriptCompanyMode::IsValid(). * @return True if and only if this company is your CompanyID. - * @api -game */ static bool IsMine(CompanyID company); @@ -178,7 +178,6 @@ public: * @game @pre ScriptCompanyMode::IsValid(). * @return True if the gender was changed. * @note When successful a random face will be created. - * @api -game */ static bool SetPresidentGender(Gender gender); @@ -350,7 +349,6 @@ public: * @param autorenew The new autorenew status. * @game @pre ScriptCompanyMode::IsValid(). * @return True if autorenew status has been modified. - * @api -game */ static bool SetAutoRenewStatus(bool autorenew); @@ -368,7 +366,6 @@ public: * The value will be clamped to MIN(int16) .. MAX(int16). * @game @pre ScriptCompanyMode::IsValid(). * @return True if autorenew months has been modified. - * @api -game */ static bool SetAutoRenewMonths(SQInteger months); @@ -387,7 +384,6 @@ public: * @return True if autorenew money has been modified. * @pre money >= 0 * @pre money < 2**32 - * @api -game */ static bool SetAutoRenewMoney(Money money); diff --git a/src/script/api/script_error.hpp b/src/script/api/script_error.hpp index f4adb84cec..e461a7d46d 100644 --- a/src/script/api/script_error.hpp +++ b/src/script/api/script_error.hpp @@ -55,6 +55,15 @@ #define EnforceCompanyModeValid(returnval) \ EnforcePreconditionCustomError(returnval, ScriptCompanyMode::IsValid(), ScriptError::ERR_PRECONDITION_INVALID_COMPANY) +/** + * Helper to enforce the precondition that the company mode is valid. + */ +#define EnforceCompanyModeValid_Void() \ + if (!ScriptCompanyMode::IsValid()) { \ + ScriptObject::SetLastError(ScriptError::ERR_PRECONDITION_INVALID_COMPANY); \ + return; \ + } + /** * Helper to enforce the precondition that we are in a deity mode. * @param returnval The value to return on failure. diff --git a/src/script/api/script_gamesettings.hpp b/src/script/api/script_gamesettings.hpp index a2d238c82a..83d023e70f 100644 --- a/src/script/api/script_gamesettings.hpp +++ b/src/script/api/script_gamesettings.hpp @@ -75,7 +75,6 @@ public: * Checks whether the given vehicle-type is disabled for companies. * @param vehicle_type The vehicle-type to check. * @return True if the vehicle-type is disabled. - * @api -game */ static bool IsDisabledVehicleType(ScriptVehicle::VehicleType vehicle_type); }; diff --git a/src/script/api/script_group.hpp b/src/script/api/script_group.hpp index c685813a88..ba61be3fd4 100644 --- a/src/script/api/script_group.hpp +++ b/src/script/api/script_group.hpp @@ -15,7 +15,7 @@ /** * Class that handles all group related functions. - * @api ai + * @api ai game */ class ScriptGroup : public ScriptObject { public: diff --git a/src/script/api/script_grouplist.cpp b/src/script/api/script_grouplist.cpp index 11099ca67e..3fb9358e8d 100644 --- a/src/script/api/script_grouplist.cpp +++ b/src/script/api/script_grouplist.cpp @@ -16,7 +16,7 @@ ScriptGroupList::ScriptGroupList() { - EnforceDeityOrCompanyModeValid_Void(); + EnforceCompanyModeValid_Void(); for (const Group *g : Group::Iterate()) { if (g->owner == ScriptObject::GetCompany()) this->AddItem(g->index); } diff --git a/src/script/api/script_grouplist.hpp b/src/script/api/script_grouplist.hpp index d8195ed96a..49e8028dcb 100644 --- a/src/script/api/script_grouplist.hpp +++ b/src/script/api/script_grouplist.hpp @@ -15,11 +15,14 @@ /** * Creates a list of groups of which you are the owner. * @note Neither ScriptGroup::GROUP_ALL nor ScriptGroup::GROUP_DEFAULT is in this list. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptGroupList : public ScriptList { public: + /** + * @game @pre ScriptCompanyMode::IsValid(). + */ ScriptGroupList(); }; diff --git a/src/script/api/script_object.cpp b/src/script/api/script_object.cpp index 157c35b7ee..dccf8ba5f5 100644 --- a/src/script/api/script_object.cpp +++ b/src/script/api/script_object.cpp @@ -357,7 +357,7 @@ ScriptObject::ActiveInstance::~ActiveInstance() bool estimate_only = GetDoCommandMode() != nullptr && !GetDoCommandMode()(); /* Should the command be executed asynchronously? */ - bool asynchronous = GetDoCommandAsyncMode() != nullptr && GetDoCommandAsyncMode()() && GetActiveInstance()->GetScriptType() == ST_GS; + bool asynchronous = GetDoCommandAsyncMode() != nullptr && GetDoCommandAsyncMode()() && GetActiveInstance()->GetScriptType() == ScriptType::GS; /* Only set p2 when the command does not come from the network. */ if (GetCommandFlags(cmd) & CMD_CLIENT_ID && p2 == 0) p2 = UINT32_MAX; @@ -406,7 +406,7 @@ ScriptObject::ActiveInstance::~ActiveInstance() } else if (_networking) { /* Suspend the script till the command is really executed. */ throw Script_Suspend(-(int)GetDoCommandDelay(), callback); - } else if (GetActiveInstance()->GetScriptType() == ST_GS && (_pause_mode & PM_PAUSED_GAME_SCRIPT) != PM_UNPAUSED) { + } else if (GetActiveInstance()->GetScriptType() == ScriptType::GS && (_pause_mode & PM_PAUSED_GAME_SCRIPT) != PM_UNPAUSED) { /* Game is paused due to GS, just execute as fast as possible */ IncreaseDoCommandCosts(res.GetCost()); ScriptController::DecreaseOps(100); diff --git a/src/script/api/script_order.hpp b/src/script/api/script_order.hpp index 2163e3860c..dc1288b9dc 100644 --- a/src/script/api/script_order.hpp +++ b/src/script/api/script_order.hpp @@ -358,7 +358,6 @@ public: * @pre order_position != ORDER_CURRENT && IsConditionalOrder(vehicle_id, order_position). * @game @pre ScriptCompanyMode::IsValid(). * @return Whether the order has been/can be changed. - * @api -game */ static bool SetOrderJumpTo(VehicleID vehicle_id, OrderPosition order_position, OrderPosition jump_to); @@ -372,7 +371,6 @@ public: * @pre condition >= OC_LOAD_PERCENTAGE && condition <= OC_UNCONDITIONALLY. * @game @pre ScriptCompanyMode::IsValid(). * @return Whether the order has been/can be changed. - * @api -game */ static bool SetOrderCondition(VehicleID vehicle_id, OrderPosition order_position, OrderCondition condition); @@ -386,7 +384,6 @@ public: * @pre compare >= CF_EQUALS && compare <= CF_IS_FALSE. * @game @pre ScriptCompanyMode::IsValid(). * @return Whether the order has been/can be changed. - * @api -game */ static bool SetOrderCompareFunction(VehicleID vehicle_id, OrderPosition order_position, CompareFunction compare); @@ -400,7 +397,6 @@ public: * @pre value >= 0 && value < 2048. * @game @pre ScriptCompanyMode::IsValid(). * @return Whether the order has been/can be changed. - * @api -game */ static bool SetOrderCompareValue(VehicleID vehicle_id, OrderPosition order_position, SQInteger value); @@ -415,7 +411,6 @@ public: * @pre stop_location >= STOPLOCATION_NEAR && stop_location <= STOPLOCATION_FAR * @game @pre ScriptCompanyMode::IsValid(). * @return Whether the order has been/can be changed. - * @api -game */ static bool SetStopLocation(VehicleID vehicle_id, OrderPosition order_position, StopLocation stop_location); @@ -429,7 +424,6 @@ public: * @pre ScriptCargo::IsValidCargo(refit_cargo) || refit_cargo == CT_AUTO_REFIT || refit_cargo == CT_NO_REFIT * @game @pre ScriptCompanyMode::IsValid(). * @return Whether the order has been/can be changed. - * @api -game */ static bool SetOrderRefit(VehicleID vehicle_id, OrderPosition order_position, CargoID refit_cargo); @@ -445,7 +439,6 @@ public: * @exception ScriptOrder::ERR_ORDER_TOO_MANY * @exception ScriptOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION * @return True if and only if the order was appended. - * @api -game */ static bool AppendOrder(VehicleID vehicle_id, TileIndex destination, ScriptOrderFlags order_flags); @@ -459,7 +452,6 @@ public: * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY * @exception ScriptOrder::ERR_ORDER_TOO_MANY * @return True if and only if the order was appended. - * @api -game */ static bool AppendConditionalOrder(VehicleID vehicle_id, OrderPosition jump_to); @@ -477,7 +469,6 @@ public: * @exception ScriptOrder::ERR_ORDER_TOO_MANY * @exception ScriptOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION * @return True if and only if the order was inserted. - * @api -game */ static bool InsertOrder(VehicleID vehicle_id, OrderPosition order_position, TileIndex destination, ScriptOrderFlags order_flags); @@ -493,7 +484,6 @@ public: * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY * @exception ScriptOrder::ERR_ORDER_TOO_MANY * @return True if and only if the order was inserted. - * @api -game */ static bool InsertConditionalOrder(VehicleID vehicle_id, OrderPosition order_position, OrderPosition jump_to); @@ -505,7 +495,6 @@ public: * @game @pre ScriptCompanyMode::IsValid(). * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY * @return True if and only if the order was removed. - * @api -game */ static bool RemoveOrder(VehicleID vehicle_id, OrderPosition order_position); @@ -526,7 +515,6 @@ public: * @game @pre ScriptCompanyMode::IsValid(). * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY * @return True if and only if the order was changed. - * @api -game */ static bool SetOrderFlags(VehicleID vehicle_id, OrderPosition order_position, ScriptOrderFlags order_flags); @@ -545,7 +533,6 @@ public: * the target order is moved upwards (e.g. 3). If the order is moved * to a higher place (e.g. from 7 to 9) the target will be moved * downwards (e.g. 8). - * @api -game */ static bool MoveOrder(VehicleID vehicle_id, OrderPosition order_position_move, OrderPosition order_position_target); @@ -557,7 +544,6 @@ public: * @game @pre ScriptCompanyMode::IsValid(). * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY * @return True if and only the current order was changed. - * @api -game */ static bool SkipToOrder(VehicleID vehicle_id, OrderPosition next_order); @@ -573,7 +559,6 @@ public: * @exception ScriptOrder::ERR_ORDER_TOO_MANY * @exception ScriptOrder::ERR_ORDER_AIRCRAFT_NOT_ENOUGH_RANGE * @return True if and only if the copying succeeded. - * @api -game */ static bool CopyOrders(VehicleID vehicle_id, VehicleID main_vehicle_id); @@ -588,7 +573,6 @@ public: * @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY * @exception ScriptOrder::ERR_ORDER_AIRCRAFT_NOT_ENOUGH_RANGE * @return True if and only if the sharing succeeded. - * @api -game */ static bool ShareOrders(VehicleID vehicle_id, VehicleID main_vehicle_id); @@ -599,7 +583,6 @@ public: * @pre ScriptVehicle::IsPrimaryVehicle(vehicle_id). * @game @pre ScriptCompanyMode::IsValid(). * @return True if and only if the unsharing succeeded. - * @api -game */ static bool UnshareOrders(VehicleID vehicle_id); diff --git a/src/script/api/script_subsidy.hpp b/src/script/api/script_subsidy.hpp index dd71ab036b..5bfcf1c9a2 100644 --- a/src/script/api/script_subsidy.hpp +++ b/src/script/api/script_subsidy.hpp @@ -25,7 +25,7 @@ public: */ enum SubsidyParticipantType { /* Values are important, as they represent the internal state of the game. - * It is originally named SourceType. ST_HEADQUARTERS is intentionally + * It is originally named SourceType. SourceType::Headquarters is intentionally * left out, as it cannot be used for Subsidies. */ SPT_INDUSTRY = 0, ///< Subsidy participant is an industry SPT_TOWN = 1, ///< Subsidy participant is a town diff --git a/src/script/api/script_vehiclelist.cpp b/src/script/api/script_vehiclelist.cpp index 0687ac366c..a00ec91c85 100644 --- a/src/script/api/script_vehiclelist.cpp +++ b/src/script/api/script_vehiclelist.cpp @@ -103,7 +103,7 @@ ScriptVehicleList_SharedOrders::ScriptVehicleList_SharedOrders(VehicleID vehicle ScriptVehicleList_Group::ScriptVehicleList_Group(GroupID group_id) { - EnforceDeityOrCompanyModeValid_Void(); + EnforceCompanyModeValid_Void(); if (!ScriptGroup::IsValidGroup((ScriptGroup::GroupID)group_id)) return; for (const Vehicle *v : Vehicle::Iterate()) { @@ -115,7 +115,7 @@ ScriptVehicleList_Group::ScriptVehicleList_Group(GroupID group_id) ScriptVehicleList_DefaultGroup::ScriptVehicleList_DefaultGroup(ScriptVehicle::VehicleType vehicle_type) { - EnforceDeityOrCompanyModeValid_Void(); + EnforceCompanyModeValid_Void(); if (vehicle_type < ScriptVehicle::VT_RAIL || vehicle_type > ScriptVehicle::VT_AIR) return; for (const Vehicle *v : Vehicle::Iterate()) { diff --git a/src/script/api/script_vehiclelist.hpp b/src/script/api/script_vehiclelist.hpp index 0ce2d86a35..22de3e344c 100644 --- a/src/script/api/script_vehiclelist.hpp +++ b/src/script/api/script_vehiclelist.hpp @@ -69,26 +69,28 @@ public: /** * Creates a list of vehicles that are in a group. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptVehicleList_Group : public ScriptList { public: /** * @param group_id The ID of the group the vehicles are in. + * @game @pre ScriptCompanyMode::IsValid(). */ ScriptVehicleList_Group(GroupID group_id); }; /** * Creates a list of vehicles that are in the default group. - * @api ai + * @api ai game * @ingroup ScriptList */ class ScriptVehicleList_DefaultGroup : public ScriptList { public: /** * @param vehicle_type The VehicleType to get the list of vehicles for. + * @game @pre ScriptCompanyMode::IsValid(). */ ScriptVehicleList_DefaultGroup(ScriptVehicle::VehicleType vehicle_type); }; diff --git a/src/script/script_config.cpp b/src/script/script_config.cpp index 7f4cfebb6d..29ab7af430 100644 --- a/src/script/script_config.cpp +++ b/src/script/script_config.cpp @@ -26,7 +26,6 @@ void ScriptConfig::Change(const char *name, int version, bool force_exact_match, this->is_random = is_random; if (this->config_list != nullptr) delete this->config_list; this->config_list = (info == nullptr) ? nullptr : new ScriptConfigItemList(); - if (this->config_list != nullptr) this->PushExtraConfigList(); this->to_load_data.reset(); this->ClearConfigList(); @@ -79,7 +78,6 @@ const ScriptConfigItemList *ScriptConfig::GetConfigList() if (this->info != nullptr) return this->info->GetConfigList(); if (this->config_list == nullptr) { this->config_list = new ScriptConfigItemList(); - this->PushExtraConfigList(); } return this->config_list; } diff --git a/src/script/script_config.hpp b/src/script/script_config.hpp index b243f3061f..be788d0526 100644 --- a/src/script/script_config.hpp +++ b/src/script/script_config.hpp @@ -51,8 +51,6 @@ struct ScriptConfigItem { typedef std::list ScriptConfigItemList; ///< List of ScriptConfig items. -extern ScriptConfigItem _start_date_config; - /** * Script settings. */ @@ -127,12 +125,12 @@ public: * @return The (default) value of the setting, or -1 if the setting was not * found. */ - virtual int GetSetting(const char *name) const; + int GetSetting(const char *name) const; /** * Set the value of a setting for this config. */ - virtual void SetSetting(const char *name, int value); + void SetSetting(const char *name, int value); /** * Reset all settings to their default value. @@ -147,7 +145,7 @@ public: /** * Randomize all settings the Script requested to be randomized. */ - virtual void AddRandomDeviation(); + void AddRandomDeviation(); /** * Is this config attached to an Script? In other words, is there a Script @@ -202,16 +200,10 @@ protected: bool is_random; ///< True if the AI in this slot was randomly chosen. std::unique_ptr to_load_data; ///< Data to load after the Script start. - /** - * In case you have mandatory non-Script-definable config entries in your - * list, add them to this function. - */ - virtual void PushExtraConfigList() {}; - /** * Routine that clears the config list. */ - virtual void ClearConfigList(); + void ClearConfigList(); /** * This function should call back to the Scanner in charge of this Config, diff --git a/src/script/script_gui.cpp b/src/script/script_gui.cpp index 51b18f0218..93c551029d 100644 --- a/src/script/script_gui.cpp +++ b/src/script/script_gui.cpp @@ -388,14 +388,8 @@ struct ScriptSettingsWindow : public Window { TextColour colour; uint idx = 0; if (StrEmpty(config_item.description)) { - if (this->slot != OWNER_DEITY && !strcmp(config_item.name, "start_date")) { - /* Build-in translation */ - str = STR_AI_SETTINGS_START_DELAY; - colour = TC_LIGHT_BLUE; - } else { - str = STR_JUST_STRING; - colour = TC_ORANGE; - } + str = STR_JUST_STRING; + colour = TC_ORANGE; } else { str = STR_AI_SETTINGS_SETTING; colour = TC_LIGHT_BLUE; diff --git a/src/script/script_instance.cpp b/src/script/script_instance.cpp index 869adcaea3..3371924b91 100644 --- a/src/script/script_instance.cpp +++ b/src/script/script_instance.cpp @@ -92,7 +92,7 @@ void ScriptInstance::Initialize(const char *main_script, const char *instance_na return; } - if (this->script_type == ST_GS) { + if (this->script_type == ScriptType::GS) { if (strcmp(instance_name, "BeeRewardClass") == 0) { this->LoadCompatibilityScripts("brgs", GAME_DIR); } @@ -791,7 +791,7 @@ void ScriptInstance::LimitOpsTillSuspend(SQInteger suspend) uint32 ScriptInstance::GetMaxOpsTillSuspend() const { - if (this->script_type == ST_GS && (_pause_mode & PM_PAUSED_GAME_SCRIPT) != PM_UNPAUSED) { + if (this->script_type == ScriptType::GS && (_pause_mode & PM_PAUSED_GAME_SCRIPT) != PM_UNPAUSED) { /* Boost opcodes till suspend when paused due to game script */ return std::min(250000, _settings_game.script.script_max_opcode_till_suspend * 10); } diff --git a/src/script/squirrel.hpp b/src/script/squirrel.hpp index c6531e83df..1d7f535b10 100644 --- a/src/script/squirrel.hpp +++ b/src/script/squirrel.hpp @@ -13,9 +13,9 @@ #include /** The type of script we're working with, i.e. for who is it? */ -enum ScriptType { - ST_AI, ///< The script is for AI scripts. - ST_GS, ///< The script is for Game scripts. +enum class ScriptType { + AI, ///< The script is for AI scripts. + GS, ///< The script is for Game scripts. }; struct ScriptAllocator; diff --git a/src/settings_type.h b/src/settings_type.h index ee9f0580bd..2e2879832b 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -77,6 +77,7 @@ struct DifficultySettings { byte competitor_intelligence; ///< Unused value, used to load old savegames. byte max_no_competitors; ///< the number of competitors (AIs) + uint16 competitors_interval; ///< the interval (in minutes) between adding competitors byte number_towns; ///< the amount of towns byte industry_density; ///< The industry density. @see IndustryDensity uint32 max_loan; ///< the maximum initial loan diff --git a/src/sprite.cpp b/src/sprite.cpp index 7f2bfb1bb9..23dc63448b 100644 --- a/src/sprite.cpp +++ b/src/sprite.cpp @@ -119,7 +119,7 @@ void DrawCommonTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32 orig Point pt = RemapCoords(dtss->delta_x, dtss->delta_y, dtss->delta_z); DrawSprite(image, pal, x + UnScaleGUI(pt.x), y + UnScaleGUI(pt.y)); - const Sprite *spr = GetSprite(image & SPRITE_MASK, ST_NORMAL); + const Sprite *spr = GetSprite(image & SPRITE_MASK, SpriteType::Normal); child_offset.x = UnScaleGUI(pt.x + spr->x_offs); child_offset.y = UnScaleGUI(pt.y + spr->y_offs); } else { diff --git a/src/spritecache.cpp b/src/spritecache.cpp index 1633f86fb1..9172217c4a 100644 --- a/src/spritecache.cpp +++ b/src/spritecache.cpp @@ -211,7 +211,7 @@ bool SpriteExists(SpriteID id) */ SpriteType GetSpriteType(SpriteID sprite) { - if (!SpriteExists(sprite)) return ST_INVALID; + if (!SpriteExists(sprite)) return SpriteType::Invalid; return GetSpriteCache(sprite)->GetType(); } @@ -491,6 +491,18 @@ static void *ReadRecolourSprite(SpriteFile &file, uint num) return dest; } +static const char *GetSpriteTypeName(SpriteType type) +{ + static const char * const sprite_types[] = { + "normal", // SpriteType::Normal + "map generator", // SpriteType::MapGen + "character", // SpriteType::Font + "recolour", // SpriteType::Recolour + }; + + return sprite_types[static_cast(type)]; +} + /** * Read a sprite from disk. * @param sc Location of sprite. @@ -508,10 +520,10 @@ static void *ReadSprite(const SpriteCache *sc, SpriteID id, SpriteType sprite_ty SpriteFile &file = *sc->file; size_t file_pos = sc->file_pos; - SCOPE_INFO_FMT([&], "ReadSprite: pos: " PRINTF_SIZE ", id: %u, file: (%s), type: %u", file_pos, id, file.GetSimplifiedFilename().c_str(), sprite_type); + SCOPE_INFO_FMT([&], "ReadSprite: pos: " PRINTF_SIZE ", id: %u, file: (%s), type: %s", file_pos, id, file.GetSimplifiedFilename().c_str(), GetSpriteTypeName(sprite_type)); - assert(sprite_type != ST_RECOLOUR); - assert(IsMapgenSpriteID(id) == (sprite_type == ST_MAPGEN)); + assert(sprite_type != SpriteType::Recolour); + assert(IsMapgenSpriteID(id) == (sprite_type == SpriteType::MapGen)); assert(sc->GetType() == sprite_type); DEBUG(sprite, 9, "Load sprite %d", id); @@ -521,7 +533,7 @@ static void *ReadSprite(const SpriteCache *sc, SpriteID id, SpriteType sprite_ty sprite[ZOOM_LVL_NORMAL].type = sprite_type; SpriteLoaderGrf sprite_loader(file.GetContainerVersion()); - if (sprite_type != ST_MAPGEN && sc->GetHasNonPalette() && encoder->Is32BppSupported()) { + if (sprite_type != SpriteType::MapGen && sc->GetHasNonPalette() && encoder->Is32BppSupported()) { /* Try for 32bpp sprites first. */ sprite_avail = sprite_loader.LoadSprite(sprite, file, file_pos, sprite_type, true, sc->count, sc->flags); } @@ -530,12 +542,12 @@ static void *ReadSprite(const SpriteCache *sc, SpriteID id, SpriteType sprite_ty } if (sprite_avail == 0) { - if (sprite_type == ST_MAPGEN) return nullptr; + if (sprite_type == SpriteType::MapGen) return nullptr; if (id == SPR_IMG_QUERY) usererror("Okay... something went horribly wrong. I couldn't load the fallback sprite. What should I do?"); - return (void*)GetRawSprite(SPR_IMG_QUERY, ST_NORMAL, allocator, encoder); + return (void*)GetRawSprite(SPR_IMG_QUERY, SpriteType::Normal, allocator, encoder); } - if (sprite_type == ST_MAPGEN) { + if (sprite_type == SpriteType::MapGen) { /* Ugly hack to work around the problem that the old landscape * generator assumes that those sprites are stored uncompressed in * the memory, and they are only read directly by the code, never @@ -565,10 +577,10 @@ static void *ReadSprite(const SpriteCache *sc, SpriteID id, SpriteType sprite_ty if (!ResizeSprites(sprite, sprite_avail, encoder)) { if (id == SPR_IMG_QUERY) usererror("Okay... something went horribly wrong. I couldn't resize the fallback sprite. What should I do?"); - return (void*)GetRawSprite(SPR_IMG_QUERY, ST_NORMAL, allocator, encoder); + return (void*)GetRawSprite(SPR_IMG_QUERY, SpriteType::Normal, allocator, encoder); } - if (sprite->type == ST_FONT && _font_zoom != ZOOM_LVL_NORMAL) { + if (sprite->type == SpriteType::Font && _font_zoom != ZOOM_LVL_NORMAL) { /* Make ZOOM_LVL_NORMAL be ZOOM_LVL_GUI */ sprite[ZOOM_LVL_NORMAL].width = sprite[_font_zoom].width; sprite[ZOOM_LVL_NORMAL].height = sprite[_font_zoom].height; @@ -686,7 +698,7 @@ bool LoadNextSprite(int load_index, SpriteFile &file, uint file_sprite_id) file.ReadByte(); return false; } - type = ST_RECOLOUR; + type = SpriteType::Recolour; data = ReadRecolourSprite(file, num); } else if (file.GetContainerVersion() >= 2 && grf_type == 0xFD) { if (num != 4) { @@ -703,15 +715,15 @@ bool LoadNextSprite(int load_index, SpriteFile &file, uint file_sprite_id) } else { file_pos = SIZE_MAX; } - type = ST_NORMAL; + type = SpriteType::Normal; } else { file.SkipBytes(7); - type = SkipSpriteData(file, grf_type, num - 8) ? ST_NORMAL : ST_INVALID; + type = SkipSpriteData(file, grf_type, num - 8) ? SpriteType::Normal : SpriteType::Invalid; /* Inline sprites are not supported for container version >= 2. */ if (file.GetContainerVersion() >= 2) return false; } - if (type == ST_INVALID) return false; + if (type == SpriteType::Invalid) return false; if (load_index == -1) { if (data != nullptr) _last_sprite_allocation.Clear(); @@ -725,8 +737,8 @@ bool LoadNextSprite(int load_index, SpriteFile &file, uint file_sprite_id) bool is_mapgen = IsMapgenSpriteID(load_index); if (is_mapgen) { - if (type != ST_NORMAL) usererror("Uhm, would you be so kind not to load a NewGRF that changes the type of the map generator sprites?"); - type = ST_MAPGEN; + if (type != SpriteType::Normal) usererror("Uhm, would you be so kind not to load a NewGRF that changes the type of the map generator sprites?"); + type = SpriteType::MapGen; } SpriteCache *sc = AllocateSpriteCache(load_index); @@ -807,14 +819,14 @@ static void DeleteEntriesFromSpriteCache(size_t target) SpriteID i = 0; for (; i != _spritecache.size() && candidate_bytes < target; i++) { SpriteCache *sc = GetSpriteCache(i); - if (sc->GetType() != ST_RECOLOUR && sc->GetPtr() != nullptr) { + if (sc->GetType() != SpriteType::Recolour && sc->GetPtr() != nullptr) { push({ sc->lru, i, sc->buffer.GetSize() }); if (candidate_bytes >= target) break; } } for (; i != _spritecache.size(); i++) { SpriteCache *sc = GetSpriteCache(i); - if (sc->GetType() != ST_RECOLOUR && sc->GetPtr() != nullptr && sc->lru <= candidates.front().lru) { + if (sc->GetType() != SpriteType::Recolour && sc->GetPtr() != nullptr && sc->lru <= candidates.front().lru) { push({ sc->lru, i, sc->buffer.GetSize() }); while (!candidates.empty() && candidate_bytes - candidates.front().size >= target) { pop(); @@ -875,7 +887,7 @@ void *SimpleSpriteAlloc(size_t size) /** * Handles the case when a sprite of different type is requested than is present in the SpriteCache. - * For ST_FONT sprites, it is normal. In other cases, default sprite is loaded instead. + * For SpriteType::Font sprites, it is normal. In other cases, default sprite is loaded instead. * @param sprite ID of loaded sprite * @param requested requested sprite type * @param sc the currently known sprite cache for the requested sprite @@ -884,34 +896,27 @@ void *SimpleSpriteAlloc(size_t size) */ static void *HandleInvalidSpriteRequest(SpriteID sprite, SpriteType requested, SpriteCache *sc, AllocatorProc *allocator) { - static const char * const sprite_types[] = { - "normal", // ST_NORMAL - "map generator", // ST_MAPGEN - "character", // ST_FONT - "recolour", // ST_RECOLOUR - }; - SpriteType available = sc->GetType(); - if (requested == ST_FONT && available == ST_NORMAL) { - if (sc->GetPtr() == nullptr) sc->SetType(ST_FONT); + if (requested == SpriteType::Font && available == SpriteType::Normal) { + if (sc->GetPtr() == nullptr) sc->SetType(SpriteType::Font); return GetRawSprite(sprite, sc->GetType(), allocator); } byte warning_level = sc->GetWarned() ? 6 : 0; sc->SetWarned(true); - DEBUG(sprite, warning_level, "Tried to load %s sprite #%d as a %s sprite. Probable cause: NewGRF interference", sprite_types[available], sprite, sprite_types[requested]); + DEBUG(sprite, warning_level, "Tried to load %s sprite #%d as a %s sprite. Probable cause: NewGRF interference", GetSpriteTypeName(available), sprite, GetSpriteTypeName(requested)); switch (requested) { - case ST_NORMAL: + case SpriteType::Normal: if (sprite == SPR_IMG_QUERY) usererror("Uhm, would you be so kind not to load a NewGRF that makes the 'query' sprite a non-normal sprite?"); FALLTHROUGH; - case ST_FONT: - return GetRawSprite(SPR_IMG_QUERY, ST_NORMAL, allocator); - case ST_RECOLOUR: + case SpriteType::Font: + return GetRawSprite(SPR_IMG_QUERY, SpriteType::Normal, allocator); + case SpriteType::Recolour: if (sprite == PALETTE_TO_DARK_BLUE) usererror("Uhm, would you be so kind not to load a NewGRF that makes the 'PALETTE_TO_DARK_BLUE' sprite a non-remap sprite?"); - return GetRawSprite(PALETTE_TO_DARK_BLUE, ST_RECOLOUR, allocator); - case ST_MAPGEN: - /* this shouldn't happen, overriding of ST_MAPGEN sprites is checked in LoadNextSprite() + return GetRawSprite(PALETTE_TO_DARK_BLUE, SpriteType::Recolour, allocator); + case SpriteType::MapGen: + /* this shouldn't happen, overriding of SpriteType::MapGen sprites is checked in LoadNextSprite() * (the only case the check fails is when these sprites weren't even loaded...) */ default: NOT_REACHED(); @@ -929,8 +934,8 @@ static void *HandleInvalidSpriteRequest(SpriteID sprite, SpriteType requested, S */ void *GetRawSprite(SpriteID sprite, SpriteType type, AllocatorProc *allocator, SpriteEncoder *encoder) { - assert(type != ST_MAPGEN || IsMapgenSpriteID(sprite)); - assert(type < ST_INVALID); + assert(type != SpriteType::MapGen || IsMapgenSpriteID(sprite)); + assert(type < SpriteType::Invalid); if (!SpriteExists(sprite)) { DEBUG(sprite, 1, "Tried to load non-existing sprite #%d. Probable cause: Wrong/missing NewGRFs", sprite); @@ -974,22 +979,22 @@ uint32 GetSpriteMainColour(SpriteID sprite_id, PaletteID palette_id) if (!SpriteExists(sprite_id)) return 0; SpriteCache *sc = GetSpriteCache(sprite_id); - if (sc->GetType() != ST_NORMAL) return 0; + if (sc->GetType() != SpriteType::Normal) return 0; - const byte * const remap = (palette_id == PAL_NONE ? nullptr : GetNonSprite(GB(palette_id, 0, PALETTE_WIDTH), ST_RECOLOUR) + 1); + const byte * const remap = (palette_id == PAL_NONE ? nullptr : GetNonSprite(GB(palette_id, 0, PALETTE_WIDTH), SpriteType::Recolour) + 1); SpriteFile &file = *sc->file; size_t file_pos = sc->file_pos; SpriteLoader::Sprite sprites[ZOOM_LVL_COUNT]; - sprites[ZOOM_LVL_NORMAL].type = ST_NORMAL; + sprites[ZOOM_LVL_NORMAL].type = SpriteType::Normal; SpriteLoaderGrf sprite_loader(file.GetContainerVersion()); uint8 sprite_avail; const uint8 screen_depth = BlitterFactory::GetCurrentBlitter()->GetScreenDepth(); /* Try to read the 32bpp sprite first. */ if (screen_depth == 32 && sc->GetHasNonPalette()) { - sprite_avail = sprite_loader.LoadSprite(sprites, file, file_pos, ST_NORMAL, true, sc->count, sc->flags); + sprite_avail = sprite_loader.LoadSprite(sprites, file, file_pos, SpriteType::Normal, true, sc->count, sc->flags); if (sprite_avail != 0) { SpriteLoader::Sprite *sprite = &sprites[FindFirstBit(sprite_avail)]; /* Return the average colour. */ @@ -1019,7 +1024,7 @@ uint32 GetSpriteMainColour(SpriteID sprite_id, PaletteID palette_id) } /* No 32bpp, try 8bpp. */ - sprite_avail = sprite_loader.LoadSprite(sprites, file, file_pos, ST_NORMAL, false, sc->count, sc->flags); + sprite_avail = sprite_loader.LoadSprite(sprites, file, file_pos, SpriteType::Normal, false, sc->count, sc->flags); if (sprite_avail != 0) { SpriteLoader::Sprite *sprite = &sprites[FindFirstBit(sprite_avail)]; SpriteLoader::CommonPixel *pixel = sprite->data; @@ -1078,7 +1083,7 @@ void GfxClearSpriteCache() /* Clear sprite ptr for all cached items */ for (uint i = 0; i != _spritecache.size(); i++) { SpriteCache *sc = GetSpriteCache(i); - if (sc->GetType() != ST_RECOLOUR && sc->GetPtr() != nullptr) DeleteEntryFromSpriteCache(i); + if (sc->GetType() != SpriteType::Recolour && sc->GetPtr() != nullptr) DeleteEntryFromSpriteCache(i); } VideoDriver::GetInstance()->ClearSystemSprites(); @@ -1093,7 +1098,7 @@ void GfxClearFontSpriteCache() /* Clear sprite ptr for all cached font items */ for (uint i = 0; i != _spritecache.size(); i++) { SpriteCache *sc = GetSpriteCache(i); - if (sc->GetType() == ST_FONT && sc->GetPtr() != nullptr) DeleteEntryFromSpriteCache(i); + if (sc->GetType() == SpriteType::Font && sc->GetPtr() != nullptr) DeleteEntryFromSpriteCache(i); } } diff --git a/src/spritecache.h b/src/spritecache.h index 837028df56..9e358bbccb 100644 --- a/src/spritecache.h +++ b/src/spritecache.h @@ -49,13 +49,13 @@ uint GetMaxSpriteID(); static inline const Sprite *GetSprite(SpriteID sprite, SpriteType type) { - dbg_assert(type != ST_RECOLOUR); + dbg_assert(type != SpriteType::Recolour); return (Sprite*)GetRawSprite(sprite, type); } static inline const byte *GetNonSprite(SpriteID sprite, SpriteType type) { - dbg_assert(type == ST_RECOLOUR); + dbg_assert(type == SpriteType::Recolour); return (byte*)GetRawSprite(sprite, type); } @@ -81,12 +81,12 @@ private: public: inline const Sprite *GetSprite(SpriteID sprite, SpriteType type) const { - return (const Sprite*)(this->cache.find(sprite | (type << 29))->second); + return (const Sprite*)(this->cache.find(sprite | (static_cast(type) << 29))->second); } inline const byte *GetRecolourSprite(SpriteID sprite) const { - return (const byte*)(this->cache.find(sprite | (ST_RECOLOUR << 29))->second); + return (const byte*)(this->cache.find(sprite | (static_cast(SpriteType::Recolour) << 29))->second); } void Clear() @@ -96,7 +96,7 @@ public: inline void CacheSprite(SpriteID sprite, SpriteType type) { - this->cache[sprite | (type << 29)] = GetRawSprite(sprite, type); + this->cache[sprite | (static_cast(type) << 29)] = GetRawSprite(sprite, type); } }; diff --git a/src/spriteloader/grf.cpp b/src/spriteloader/grf.cpp index 3861332c57..75ed1f6e40 100644 --- a/src/spriteloader/grf.cpp +++ b/src/spriteloader/grf.cpp @@ -164,8 +164,8 @@ bool DecodeSingleSprite(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t f data->a = (colour_fmt & SCC_ALPHA) ? *dest++ : 0xFF; if (colour_fmt & SCC_PAL) { switch (sprite_type) { - case ST_NORMAL: data->m = file.NeedsPaletteRemap() ? _palmap_w2d[*dest] : *dest; break; - case ST_FONT: data->m = std::min(*dest, 2u); break; + case SpriteType::Normal: data->m = file.NeedsPaletteRemap() ? _palmap_w2d[*dest] : *dest; break; + case SpriteType::Font: data->m = std::min(*dest, 2u); break; default: data->m = *dest; break; } /* Magic blue. */ @@ -201,8 +201,8 @@ bool DecodeSingleSprite(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t f sprite->data[i].a = (colour_fmt & SCC_ALPHA) ? *pixel++ : 0xFF; if (colour_fmt & SCC_PAL) { switch (sprite_type) { - case ST_NORMAL: sprite->data[i].m = file.NeedsPaletteRemap() ? _palmap_w2d[*pixel] : *pixel; break; - case ST_FONT: sprite->data[i].m = std::min(*pixel, 2u); break; + case SpriteType::Normal: sprite->data[i].m = file.NeedsPaletteRemap() ? _palmap_w2d[*pixel] : *pixel; break; + case SpriteType::Font: sprite->data[i].m = std::min(*pixel, 2u); break; default: sprite->data[i].m = *pixel; break; } /* Magic blue. */ @@ -230,7 +230,7 @@ uint8 LoadSpriteV1(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t file_p /* Type 0xFF indicates either a colourmap or some other non-sprite info; we do not handle them here */ if (type == 0xFF) return 0; - ZoomLevel zoom_lvl = (sprite_type != ST_MAPGEN) ? ZOOM_LVL_OUT_4X : ZOOM_LVL_NORMAL; + ZoomLevel zoom_lvl = (sprite_type != SpriteType::MapGen) ? ZOOM_LVL_OUT_4X : ZOOM_LVL_NORMAL; sprite[zoom_lvl].height = file.ReadByte(); sprite[zoom_lvl].width = file.ReadWord(); @@ -283,10 +283,10 @@ uint8 LoadSpriteV2(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t file_p bool is_wanted_colour_depth = (colour != 0 && (load_32bpp ? colour != SCC_PAL : colour == SCC_PAL)); bool is_wanted_zoom_lvl; - if (sprite_type != ST_MAPGEN) { + if (sprite_type != SpriteType::MapGen) { if (zoom < lengthof(zoom_lvl_map)) { is_wanted_zoom_lvl = true; - ZoomLevel zoom_min = sprite_type == ST_FONT ? ZOOM_LVL_NORMAL : _settings_client.gui.sprite_zoom_min; + ZoomLevel zoom_min = sprite_type == SpriteType::Font ? ZOOM_LVL_NORMAL : _settings_client.gui.sprite_zoom_min; if (zoom_min >= ZOOM_LVL_OUT_2X && HasBit(control_flags, load_32bpp ? SCCF_ALLOW_ZOOM_MIN_2X_32BPP : SCCF_ALLOW_ZOOM_MIN_2X_PAL) && zoom_lvl_map[zoom] < ZOOM_LVL_OUT_2X) { is_wanted_zoom_lvl = false; @@ -303,7 +303,7 @@ uint8 LoadSpriteV2(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t file_p } if (is_wanted_colour_depth && is_wanted_zoom_lvl) { - ZoomLevel zoom_lvl = (sprite_type != ST_MAPGEN) ? zoom_lvl_map[zoom] : ZOOM_LVL_NORMAL; + ZoomLevel zoom_lvl = (sprite_type != SpriteType::MapGen) ? zoom_lvl_map[zoom] : ZOOM_LVL_NORMAL; if (HasBit(loaded_sprites, zoom_lvl)) { /* We already have this zoom level, skip sprite. */ diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 4e3b531ccb..88c8fcdc40 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -956,17 +956,17 @@ enum SortOrder { class CargoDataEntry; -enum CargoSortType { - ST_AS_GROUPING, ///< by the same principle the entries are being grouped - ST_COUNT, ///< by amount of cargo - ST_STATION_STRING, ///< by station name - ST_STATION_ID, ///< by station id - ST_CARGO_ID, ///< by cargo id +enum class CargoSortType : byte { + AsGrouping, ///< by the same principle the entries are being grouped + Count, ///< by amount of cargo + StationString, ///< by station name + StationID, ///< by station id + CargoID, ///< by cargo id }; class CargoSorter { public: - CargoSorter(CargoSortType t = ST_STATION_ID, SortOrder o = SO_ASCENDING) : type(t), order(o) {} + 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; @@ -1137,7 +1137,7 @@ CargoDataEntry::CargoDataEntry() : station(INVALID_STATION), num_children(0), count(0), - children(new CargoDataSet(CargoSorter(ST_CARGO_ID))) + children(new CargoDataSet(CargoSorter(CargoSortType::CargoID))) {} CargoDataEntry::CargoDataEntry(CargoID cargo, uint count, CargoDataEntry *parent) : @@ -1226,7 +1226,7 @@ CargoDataEntry *CargoDataEntry::InsertOrRetrieve(Tid child_id) return *(this->children->insert(new CargoDataEntry(child_id, 0, this)).first); } else { CargoDataEntry *ret = *i; - assert(this->children->value_comp().GetSortType() != ST_COUNT); + assert(this->children->value_comp().GetSortType() != CargoSortType::Count); return ret; } } @@ -1263,7 +1263,7 @@ CargoDataEntry *CargoDataEntry::Retrieve(CargoDataSet::iterator i) const if (i == this->children->end()) { return nullptr; } else { - assert(this->children->value_comp().GetSortType() != ST_COUNT); + assert(this->children->value_comp().GetSortType() != CargoSortType::Count); return *i; } } @@ -1271,13 +1271,13 @@ CargoDataEntry *CargoDataEntry::Retrieve(CargoDataSet::iterator i) const bool CargoSorter::operator()(const CargoDataEntry *cd1, const CargoDataEntry *cd2) const { switch (this->type) { - case ST_STATION_ID: + case CargoSortType::StationID: return this->SortId(cd1->GetStation(), cd2->GetStation()); - case ST_CARGO_ID: + case CargoSortType::CargoID: return this->SortId(cd1->GetCargo(), cd2->GetCargo()); - case ST_COUNT: + case CargoSortType::Count: return this->SortCount(cd1, cd2); - case ST_STATION_STRING: + case CargoSortType::StationString: return this->SortStation(cd1->GetStation(), cd2->GetStation()); default: NOT_REACHED(); @@ -1393,7 +1393,7 @@ struct StationViewWindow : public Window { /** * Sort types of the different 'columns'. - * In fact only ST_COUNT and ST_AS_GROUPING are active and you can only + * In fact only CargoSortType::Count and CargoSortType::AsGrouping are active and you can only * sort all the columns in the same way. The other options haven't been * included in the GUI due to lack of space. */ @@ -1426,7 +1426,7 @@ struct StationViewWindow : public Window { this->FinishInitNested(window_number); this->groupings[0] = GR_CARGO; - this->sortings[0] = ST_AS_GROUPING; + this->sortings[0] = CargoSortType::AsGrouping; this->SelectGroupBy(_settings_client.gui.station_gui_group_order); this->SelectSortBy(_settings_client.gui.station_gui_sort_by); this->sort_orders[0] = SO_ASCENDING; @@ -1897,12 +1897,12 @@ struct StationViewWindow : public Window { */ int DrawEntries(CargoDataEntry *entry, const Rect &r, int pos, int maxrows, int column, CargoID cargo = CT_INVALID) { - if (this->sortings[column] == ST_AS_GROUPING) { + if (this->sortings[column] == CargoSortType::AsGrouping) { if (this->groupings[column] != GR_CARGO) { - entry->Resort(ST_STATION_STRING, this->sort_orders[column]); + entry->Resort(CargoSortType::StationString, this->sort_orders[column]); } } else { - entry->Resort(ST_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; @@ -2143,7 +2143,7 @@ struct StationViewWindow : public Window { * sorted by cargo ID. The others can theoretically be sorted * by different things but there is no UI for that. */ ShowDropDownMenu(this, _sort_names, - this->current_mode * 2 + (this->sortings[1] == ST_COUNT ? 1 : 0), + this->current_mode * 2 + (this->sortings[1] == CargoSortType::Count ? 1 : 0), WID_SV_SORT_BY, 0, 0); break; } @@ -2230,19 +2230,19 @@ struct StationViewWindow : public Window { switch (_sort_names[index]) { case STR_STATION_VIEW_WAITING_STATION: this->current_mode = MODE_WAITING; - this->sortings[1] = this->sortings[2] = this->sortings[3] = ST_AS_GROUPING; + this->sortings[1] = this->sortings[2] = this->sortings[3] = CargoSortType::AsGrouping; break; case STR_STATION_VIEW_WAITING_AMOUNT: this->current_mode = MODE_WAITING; - this->sortings[1] = this->sortings[2] = this->sortings[3] = ST_COUNT; + this->sortings[1] = this->sortings[2] = this->sortings[3] = CargoSortType::Count; break; case STR_STATION_VIEW_PLANNED_STATION: this->current_mode = MODE_PLANNED; - this->sortings[1] = this->sortings[2] = this->sortings[3] = ST_AS_GROUPING; + this->sortings[1] = this->sortings[2] = this->sortings[3] = CargoSortType::AsGrouping; break; case STR_STATION_VIEW_PLANNED_AMOUNT: this->current_mode = MODE_PLANNED; - this->sortings[1] = this->sortings[2] = this->sortings[3] = ST_COUNT; + this->sortings[1] = this->sortings[2] = this->sortings[3] = CargoSortType::Count; break; default: NOT_REACHED(); diff --git a/src/stdafx.h b/src/stdafx.h index d523c59ea9..44426f957a 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -156,6 +156,13 @@ # define NOACCESS(args) #endif +/* [[nodiscard]] on constructors doesn't work in GCC older than 10.1. */ +#if __GNUC__ < 10 || (__GNUC__ == 10 && __GNUC_MINOR__ < 1) +# define NODISCARD +#else +# define NODISCARD [[nodiscard]] +#endif + #if defined(__WATCOMC__) # define NORETURN # define CDECL diff --git a/src/strings.cpp b/src/strings.cpp index bd63367124..39de033d65 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -500,13 +500,8 @@ static char *FormatTinyOrISODate(char *buff, Date date, StringID str, const char YearMonthDay ymd; ConvertDateToYMD(date, &ymd); - char day[3]; - char month[3]; - /* We want to zero-pad the days and months */ - seprintf(day, lastof(day), "%02i", ymd.day); - seprintf(month, lastof(month), "%02i", ymd.month + 1); - - int64 args[] = {(int64)(size_t)day, (int64)(size_t)month, ymd.year}; + /* Day and month are zero-padded with ZEROFILL_NUM, hence the two 2s. */ + int64 args[] = {ymd.day, 2, ymd.month + 1, 2, ymd.year}; StringParameters tmp_params(args); return FormatString(buff, GetStringPtr(str), &tmp_params, last); } diff --git a/src/subsidy.cpp b/src/subsidy.cpp index 9ab9869c61..94a657a228 100644 --- a/src/subsidy.cpp +++ b/src/subsidy.cpp @@ -79,11 +79,11 @@ std::pair SetupSubsidyDecodeParam(const Su SetDParam(parameter_offset, cs->name); switch (s->src_type) { - case ST_INDUSTRY: + case SourceType::Industry: reftype1 = NR_INDUSTRY; SetDParam(parameter_offset + 1, STR_INDUSTRY_NAME); break; - case ST_TOWN: + case SourceType::Town: reftype1 = NR_TOWN; SetDParam(parameter_offset + 1, STR_TOWN_NAME); break; @@ -92,11 +92,11 @@ std::pair SetupSubsidyDecodeParam(const Su SetDParam(parameter_offset + 2, s->src); switch (s->dst_type) { - case ST_INDUSTRY: + case SourceType::Industry: reftype2 = NR_INDUSTRY; SetDParam(parameter_offset + 4, STR_INDUSTRY_NAME); break; - case ST_TOWN: + case SourceType::Town: reftype2 = NR_TOWN; SetDParam(parameter_offset + 4, STR_TOWN_NAME); break; @@ -121,8 +121,8 @@ std::pair SetupSubsidyDecodeParam(const Su static inline void SetPartOfSubsidyFlag(SourceType type, SourceID index, PartOfSubsidy flag) { switch (type) { - case ST_INDUSTRY: Industry::Get(index)->part_of_subsidy |= flag; return; - case ST_TOWN: Town::Get(index)->cache.part_of_subsidy |= flag; return; + case SourceType::Industry: Industry::Get(index)->part_of_subsidy |= flag; return; + case SourceType::Town: Town::Get(index)->cache.part_of_subsidy |= flag; return; default: NOT_REACHED(); } } @@ -193,8 +193,8 @@ static bool CheckSubsidyDuplicate(CargoID cargo, SourceType src_type, SourceID s */ static bool CheckSubsidyDistance(SourceType src_type, SourceID src, SourceType dst_type, SourceID dst) { - TileIndex tile_src = (src_type == ST_TOWN) ? Town::Get(src)->xy : Industry::Get(src)->location.tile; - TileIndex tile_dst = (dst_type == ST_TOWN) ? Town::Get(dst)->xy : Industry::Get(dst)->location.tile; + TileIndex tile_src = (src_type == SourceType::Town) ? Town::Get(src)->xy : Industry::Get(src)->location.tile; + TileIndex tile_dst = (dst_type == SourceType::Town) ? Town::Get(dst)->xy : Industry::Get(dst)->location.tile; return (DistanceManhattan(tile_src, tile_dst) <= SUBSIDY_MAX_DISTANCE); } @@ -257,20 +257,20 @@ CommandCost CmdCreateSubsidy(TileIndex tile, DoCommandFlag flags, uint32 p1, uin if (cid >= NUM_CARGO || !::CargoSpec::Get(cid)->IsValid()) return CMD_ERROR; switch (src_type) { - case ST_TOWN: + case SourceType::Town: if (!Town::IsValidID(src)) return CMD_ERROR; break; - case ST_INDUSTRY: + case SourceType::Industry: if (!Industry::IsValidID(src)) return CMD_ERROR; break; default: return CMD_ERROR; } switch (dst_type) { - case ST_TOWN: + case SourceType::Town: if (!Town::IsValidID(dst)) return CMD_ERROR; break; - case ST_INDUSTRY: + case SourceType::Industry: if (!Industry::IsValidID(dst)) return CMD_ERROR; break; default: @@ -304,9 +304,9 @@ bool FindSubsidyPassengerRoute() } if (DistanceManhattan(src->xy, dst->xy) > SUBSIDY_MAX_DISTANCE) return false; - if (CheckSubsidyDuplicate(CT_PASSENGERS, ST_TOWN, src->index, ST_TOWN, dst->index)) return false; + if (CheckSubsidyDuplicate(CT_PASSENGERS, SourceType::Town, src->index, SourceType::Town, dst->index)) return false; - CreateSubsidy(CT_PASSENGERS, ST_TOWN, src->index, ST_TOWN, dst->index); + CreateSubsidy(CT_PASSENGERS, SourceType::Town, src->index, SourceType::Town, dst->index); return true; } @@ -322,7 +322,7 @@ bool FindSubsidyTownCargoRoute() { if (!Subsidy::CanAllocateItem()) return false; - SourceType src_type = ST_TOWN; + SourceType src_type = SourceType::Town; /* Select a random town. */ const Town *src_town = Town::GetRandom(); @@ -380,7 +380,7 @@ bool FindSubsidyIndustryCargoRoute() { if (!Subsidy::CanAllocateItem()) return false; - SourceType src_type = ST_INDUSTRY; + SourceType src_type = SourceType::Industry; /* Select a random industry. */ const Industry *src_ind = Industry::GetRandom(); @@ -431,11 +431,11 @@ bool FindSubsidyIndustryCargoRoute() bool FindSubsidyCargoDestination(CargoID cid, SourceType src_type, SourceID src) { /* Choose a random destination. */ - SourceType dst_type = Chance16(1, 2) ? ST_TOWN : ST_INDUSTRY; + SourceType dst_type = Chance16(1, 2) ? SourceType::Town : SourceType::Industry; SourceID dst; switch (dst_type) { - case ST_TOWN: { + case SourceType::Town: { /* Select a random town. */ const Town *dst_town = Town::GetRandom(); @@ -455,7 +455,7 @@ bool FindSubsidyCargoDestination(CargoID cid, SourceType src_type, SourceID src) break; } - case ST_INDUSTRY: { + case SourceType::Industry: { /* Select a random industry. */ const Industry *dst_ind = Industry::GetRandom(); if (dst_ind == nullptr) return false; @@ -572,10 +572,10 @@ bool CheckSubsidised(CargoID cargo_type, CompanyID company, SourceType src_type, /* If the source isn't subsidised, don't continue */ if (src == INVALID_SOURCE) return false; switch (src_type) { - case ST_INDUSTRY: + case SourceType::Industry: if (!(Industry::Get(src)->part_of_subsidy & POS_SRC)) return false; break; - case ST_TOWN: + case SourceType::Town: if (!(Town::Get(src)->cache.part_of_subsidy & POS_SRC)) return false; break; default: return false; @@ -587,7 +587,7 @@ bool CheckSubsidised(CargoID cargo_type, CompanyID company, SourceType src_type, if (!st->rect.IsEmpty()) { for (const Subsidy *s : Subsidy::Iterate()) { /* Don't create the cache if there is no applicable subsidy with town as destination */ - if (s->dst_type != ST_TOWN) continue; + if (s->dst_type != SourceType::Town) continue; if (s->cargo_type != cargo_type || s->src_type != src_type || s->src != src) continue; if (s->IsAwarded() && s->awarded != company) continue; @@ -608,7 +608,7 @@ bool CheckSubsidised(CargoID cargo_type, CompanyID company, SourceType src_type, for (Subsidy *s : Subsidy::Iterate()) { if (s->cargo_type == cargo_type && s->src_type == src_type && s->src == src && (!s->IsAwarded() || s->awarded == company)) { switch (s->dst_type) { - case ST_INDUSTRY: + case SourceType::Industry: for (const auto &i : st->industries_near) { if (s->dst == i.industry->index) { assert(i.industry->part_of_subsidy & POS_DST); @@ -617,7 +617,7 @@ bool CheckSubsidised(CargoID cargo_type, CompanyID company, SourceType src_type, } } break; - case ST_TOWN: + case SourceType::Town: for (const Town *tp : towns_near) { if (s->dst == tp->index) { assert(tp->cache.part_of_subsidy & POS_DST); diff --git a/src/subsidy_base.h b/src/subsidy_base.h index 120c5cecef..1f7ad0caff 100644 --- a/src/subsidy_base.h +++ b/src/subsidy_base.h @@ -23,8 +23,8 @@ struct Subsidy : SubsidyPool::PoolItem<&_subsidy_pool> { CargoID cargo_type; ///< Cargo type involved in this subsidy, CT_INVALID for invalid subsidy uint16 remaining; ///< Remaining months when this subsidy is valid CompanyID awarded; ///< Subsidy is awarded to this company; INVALID_COMPANY if it's not awarded to anyone - SourceType src_type; ///< Source of subsidised path (ST_INDUSTRY or ST_TOWN) - SourceType dst_type; ///< Destination of subsidised path (ST_INDUSTRY or ST_TOWN) + SourceType src_type; ///< Source of subsidised path (SourceType::Industry or SourceType::Town) + SourceType dst_type; ///< Destination of subsidised path (SourceType::Industry or SourceType::Town) SourceID src; ///< Index of source. Either TownID or IndustryID SourceID dst; ///< Index of destination. Either TownID or IndustryID diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp index 0e2911ac6a..d5533a208d 100644 --- a/src/subsidy_gui.cpp +++ b/src/subsidy_gui.cpp @@ -77,8 +77,8 @@ struct SubsidyListWindow : Window { /* determine src coordinate for subsidy and try to scroll to it */ TileIndex xy; switch (s->src_type) { - case ST_INDUSTRY: xy = Industry::Get(s->src)->location.tile; break; - case ST_TOWN: xy = Town::Get(s->src)->xy; break; + case SourceType::Industry: xy = Industry::Get(s->src)->location.tile; break; + case SourceType::Town: xy = Town::Get(s->src)->xy; break; default: NOT_REACHED(); } @@ -87,8 +87,8 @@ struct SubsidyListWindow : Window { /* otherwise determine dst coordinate for subsidy and scroll to it */ switch (s->dst_type) { - case ST_INDUSTRY: xy = Industry::Get(s->dst)->location.tile; break; - case ST_TOWN: xy = Town::Get(s->dst)->xy; break; + case SourceType::Industry: xy = Industry::Get(s->dst)->location.tile; break; + case SourceType::Town: xy = Town::Get(s->dst)->xy; break; default: NOT_REACHED(); } diff --git a/src/table/settings/settings.ini b/src/table/settings/settings.ini index f90d5f9801..692e1ba7f2 100644 --- a/src/table/settings/settings.ini +++ b/src/table/settings/settings.ini @@ -249,6 +249,15 @@ interval = 1 post_cb = MaxNoAIsChange cat = SC_BASIC +[SDT_VAR] +var = difficulty.competitors_interval +type = SLE_UINT16 +from = SLV_AI_START_DATE +def = 10 +min = MIN_COMPETITORS_INTERVAL +max = MAX_COMPETITORS_INTERVAL +interval = 1 + [SDT_VAR] var = difficulty.competitor_start_time type = SLE_UINT8 diff --git a/src/timer/CMakeLists.txt b/src/timer/CMakeLists.txt new file mode 100644 index 0000000000..50c294c3ae --- /dev/null +++ b/src/timer/CMakeLists.txt @@ -0,0 +1,6 @@ +add_files( + timer_game_tick.cpp + timer_game_tick.h + timer_manager.h + timer.h +) diff --git a/src/timer/timer.h b/src/timer/timer.h new file mode 100644 index 0000000000..d49d60aaff --- /dev/null +++ b/src/timer/timer.h @@ -0,0 +1,186 @@ +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/** @file timer.h Definition of Interval and OneShot timers */ + +#ifndef TIMER_H +#define TIMER_H + +#include "timer_manager.h" + + +/** + * The base where every other type of timer is derived from. + * + * Never use this class directly yourself. + */ +template +class BaseTimer { +public: + using TPeriod = typename TTimerType::TPeriod; + using TElapsed = typename TTimerType::TElapsed; + using TStorage = typename TTimerType::TStorage; + + /** + * Create a new timer. + * + * @param period The period of the timer. + */ + NODISCARD BaseTimer(const TPeriod period) : + period(period) + { + TimerManager::RegisterTimer(*this); + } + + /** + * Delete the timer. + */ + virtual ~BaseTimer() + { + TimerManager::UnregisterTimer(*this); + } + + /* Although these variables are public, they are only public to make saveload easier; not for common use. */ + + TPeriod period; ///< The period of the timer. + TStorage storage = {}; ///< The storage of the timer. + +protected: + /** + * Called by the timer manager to notify the timer that the given amount of time has elapsed. + * + * @param delta Depending on the time type, this is either in milliseconds or in ticks. + */ + virtual void Elapsed(TElapsed delta) = 0; + + /* To ensure only TimerManager can access Elapsed. */ + friend class TimerManager; +}; + +/** + * An interval timer will fire every interval, and will continue to fire until it is deleted. + * + * The callback receives how many times the timer has fired since the last time it fired. + * It will always try to fire every interval, but in times of severe stress it might be late. + * + * Each Timer-type needs to implement the Elapsed() method, and call the callback if needed. + * + * Setting the period to zero disables the interval. It can be reenabled at any time by + * calling SetInterval() with a non-zero period. + */ +template +class IntervalTimer : public BaseTimer { +public: + using TPeriod = typename TTimerType::TPeriod; + using TElapsed = typename TTimerType::TElapsed; + + /** + * Create a new interval timer. + * + * @param interval The interval between each callback. + * @param callback The callback to call when the interval has passed. + */ + NODISCARD IntervalTimer(const TPeriod interval, std::function callback) : + BaseTimer(interval), + callback(callback) + { + } + + /** + * Set a new interval for the timer. + * + * @param interval The interval between each callback. + * @param reset Whether to reset the timer to zero. + */ + void SetInterval(const TPeriod interval, bool reset = true) + { + this->period = interval; + if (reset) this->storage = {}; + } + +private: + std::function callback; + + void Elapsed(TElapsed count) override; +}; + +/** + * A timeout timer will fire once after the interval. You can reset it to fire again. + * The timer will never fire before the interval has passed, but in times of severe stress it might be late. + */ +template +class TimeoutTimer : public BaseTimer { +public: + using TPeriod = typename TTimerType::TPeriod; + using TElapsed = typename TTimerType::TElapsed; + + /** + * Create a new timeout timer. + * + * By default the timeout starts aborted; you will have to call Reset() before it starts. + * + * @param timeout The timeout after which the timer will fire. + * @param callback The callback to call when the timeout has passed. + * @param start Whether to start the timer immediately. If false, you can call Reset() to start it. + */ + NODISCARD TimeoutTimer(const TPeriod timeout, std::function callback, bool start = false) : + BaseTimer(timeout), + fired(!start), + callback(callback) + { + } + + /** + * Reset the timer, so it will fire again after the timeout. + */ + void Reset() + { + this->fired = false; + this->storage = {}; + } + + /** + * Reset the timer, so it will fire again after the timeout. + * + * @param timeout Set a new timeout for the next trigger. + */ + void Reset(const TPeriod timeout) + { + this->period = timeout; + this->fired = false; + this->storage = {}; + } + + /** + * Abort the timer so it doesn't fire if it hasn't yet. + */ + void Abort() + { + this->fired = true; + } + + /** + * Check whether the timeout occurred. + * + * @return True iff the timeout occurred. + */ + bool HasFired() const + { + return this->fired; + } + + /* Although these variables are public, they are only public to make saveload easier; not for common use. */ + + bool fired; ///< Whether the timeout has occurred. + +private: + std::function callback; + + void Elapsed(TElapsed count) override; +}; + +#endif /* TIMER_H */ diff --git a/src/timer/timer_game_tick.cpp b/src/timer/timer_game_tick.cpp new file mode 100644 index 0000000000..75ed88d63d --- /dev/null +++ b/src/timer/timer_game_tick.cpp @@ -0,0 +1,64 @@ +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/** + * @file timer_game_tick.cpp + * This file implements the timer logic for the tick-based game-timer. + */ + +#include "stdafx.h" +#include "timer.h" +#include "timer_game_tick.h" + +#include "safeguards.h" + +template<> +void IntervalTimer::Elapsed(TimerGameTick::TElapsed delta) +{ + if (this->period == 0) return; + + this->storage.elapsed += delta; + + uint count = 0; + while (this->storage.elapsed >= this->period) { + this->storage.elapsed -= this->period; + count++; + } + + if (count > 0) { + this->callback(count); + } +} + +template<> +void TimeoutTimer::Elapsed(TimerGameTick::TElapsed delta) +{ + if (this->fired) return; + if (this->period == 0) return; + + this->storage.elapsed += delta; + + if (this->storage.elapsed >= this->period) { + this->callback(); + this->fired = true; + } +} + +template<> +void TimerManager::Elapsed(TimerGameTick::TElapsed delta) +{ + for (auto timer : TimerManager::GetTimers()) { + timer->Elapsed(delta); + } +} + +#ifdef WITH_ASSERT +template<> +void TimerManager::Validate(TimerGameTick::TPeriod period) +{ +} +#endif /* WITH_ASSERT */ diff --git a/src/timer/timer_game_tick.h b/src/timer/timer_game_tick.h new file mode 100644 index 0000000000..56f407a0ba --- /dev/null +++ b/src/timer/timer_game_tick.h @@ -0,0 +1,34 @@ +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/** @file timer_game_tick.h Definition of the tick-based game-timer */ + +#ifndef TIMER_GAME_TICK_H +#define TIMER_GAME_TICK_H + +#include "gfx_type.h" + +#include + +/** Estimation of how many ticks fit in a single second. */ +static const uint TICKS_PER_SECOND = 1000 / 27 /*MILLISECONDS_PER_TICK*/; + +/** + * Timer that represents the game-ticks. It will pause when the game is paused. + * + * @note Callbacks are executed in the game-thread. + */ +class TimerGameTick { +public: + using TPeriod = uint; + using TElapsed = uint; + struct TStorage { + uint elapsed; + }; +}; + +#endif /* TIMER_GAME_TICK_H */ diff --git a/src/timer/timer_manager.h b/src/timer/timer_manager.h new file mode 100644 index 0000000000..1cda384a98 --- /dev/null +++ b/src/timer/timer_manager.h @@ -0,0 +1,104 @@ +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/** @file timer_manager.h Definition of the TimerManager */ +/** @note don't include this file; include "timer.h". */ + +#ifndef TIMER_MANAGER_H +#define TIMER_MANAGER_H + +#include "stdafx.h" +#include + +template +class BaseTimer; + +/** + * The TimerManager manages a single Timer-type. + * + * It allows for automatic registration and unregistration of timers like Interval and OneShot. + * + * Each Timer-type needs to implement the Elapsed() method, and distribute that to the timers if needed. + */ +template +class TimerManager { +public: + using TPeriod = typename TTimerType::TPeriod; + using TElapsed = typename TTimerType::TElapsed; + + /* Avoid copying this object; it is a singleton object. */ + TimerManager(TimerManager const &) = delete; + TimerManager &operator=(TimerManager const &) = delete; + + /** + * Register a timer. + * + * @param timer The timer to register. + */ + static void RegisterTimer(BaseTimer &timer) { +#ifdef WITH_ASSERT + Validate(timer.period); +#endif /* WITH_ASSERT */ + GetTimers().insert(&timer); + } + + /** + * Unregister a timer. + * + * @param timer The timer to unregister. + */ + static void UnregisterTimer(BaseTimer &timer) { + GetTimers().erase(&timer); + } + +#ifdef WITH_ASSERT + /** + * Validate that a new period is actually valid. + * + * For most timers this is not an issue, but some want to make sure their + * period is unique, to ensure deterministic game-play. + * + * This is meant purely to protect a developer from making a mistake. + * As such, assert() when validation fails. + * + * @param period The period to validate. + */ + static void Validate(TPeriod period); +#endif /* WITH_ASSERT */ + + /** + * Called when time for this timer elapsed. + * + * The implementation per type is different, but they all share a similar goal: + * Call the Elapsed() method of all active timers. + * + * @param value The amount of time that has elapsed. + */ + static void Elapsed(TElapsed value); + +private: + /** + * Sorter for timers. + * + * It will sort based on the period, smaller first. If the period is the + * same, it will sort based on the pointer value. + */ + struct base_timer_sorter { + bool operator() (BaseTimer *a, BaseTimer *b) const { + if (a->period == b->period) return a < b; + return a->period < b->period; + } + }; + + /** Singleton list, to store all the active timers. */ + static std::set *, base_timer_sorter> &GetTimers() { + static std::set *, base_timer_sorter> timers; + return timers; + } +}; + +#endif /* TIMER_MANAGER_H */ diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp index 1daf061bc5..7eb6e272eb 100644 --- a/src/timetable_cmd.cpp +++ b/src/timetable_cmd.cpp @@ -478,7 +478,7 @@ CommandCost CmdSetTimetableStart(TileIndex tile, DoCommandFlag flags, uint32 p1, CommandCost ret = CheckOwnership(v->owner); if (ret.Failed()) return ret; - if (timetable_all && !v->orders->IsCompleteTimetable()) return CMD_ERROR; + if (timetable_all && !v->orders->IsCompleteTimetable()) return CommandCost(STR_ERROR_TIMETABLE_INCOMPLETE); const DateTicksScaled now = _scaled_date_ticks; DateTicksScaled start_date_scaled = DateTicksToScaledDateTicks(_date * DAY_TICKS + _date_fract + (int32)p2) + sub_ticks; diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index ff5fd5ed5c..1a2049bd2e 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -919,7 +919,7 @@ struct TimetableWindow : GeneralVehicleWindow { SetDParam(0, time); ShowQueryString(str, STR_TIMETABLE_STARTING_DATE, 31, this, CS_NUMERAL, QSF_ACCEPT_UNCHANGED); } else { - ShowSetDateWindow(this, v->index | (v->orders->IsCompleteTimetable() && _ctrl_pressed ? 1U << 20 : 0), + ShowSetDateWindow(this, v->index | (_ctrl_pressed ? 1U << 20 : 0), _scaled_date_ticks, _cur_year, _cur_year + 15, ChangeTimetableStartCallback); } break; diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index a93c0b60ee..f5bc9adc30 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -149,9 +149,9 @@ Town::~Town() /* Clear the persistent storage list. */ this->psa_list.clear(); - DeleteSubsidyWith(ST_TOWN, this->index); + DeleteSubsidyWith(SourceType::Town, this->index); DeleteNewGRFInspectWindow(GSF_FAKE_TOWNS, this->index); - CargoPacket::InvalidateAllFrom(ST_TOWN, this->index); + CargoPacket::InvalidateAllFrom(SourceType::Town, this->index); MarkWholeScreenDirty(); } @@ -653,7 +653,7 @@ static void TownGenerateCargo(Town *t, CargoID ct, uint amount, StationFinder &s if (amount == 0) return; t->supplied[ct].new_max += amount; - t->supplied[ct].new_act += MoveGoodsToStation(ct, amount, ST_TOWN, t->index, stations.GetStations()); + t->supplied[ct].new_act += MoveGoodsToStation(ct, amount, SourceType::Town, t->index, stations.GetStations()); } /** @@ -4427,8 +4427,8 @@ HouseSpec _house_specs[NUM_HOUSES]; void ResetHouses() { - memset(&_house_specs, 0, sizeof(_house_specs)); - memcpy(&_house_specs, &_original_house_specs, sizeof(_original_house_specs)); + auto insert = std::copy(std::begin(_original_house_specs), std::end(_original_house_specs), std::begin(_house_specs)); + std::fill(insert, std::end(_house_specs), HouseSpec{}); /* Reset any overrides that have been set. */ _house_mngr.ResetOverride(); diff --git a/src/vehicle.cpp b/src/vehicle.cpp index bfe770f614..22401a740b 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -117,7 +117,7 @@ Rect16 VehicleSpriteSeq::GetBounds() const Rect16 bounds; bounds.left = bounds.top = bounds.right = bounds.bottom = 0; for (uint i = 0; i < this->count; ++i) { - const Sprite *spr = GetSprite(this->seq[i].sprite, ST_NORMAL); + const Sprite *spr = GetSprite(this->seq[i].sprite, SpriteType::Normal); if (i == 0) { bounds.left = spr->x_offs; bounds.top = spr->y_offs; diff --git a/src/video/opengl.cpp b/src/video/opengl.cpp index bcd17b37d6..1740b880b9 100644 --- a/src/video/opengl.cpp +++ b/src/video/opengl.cpp @@ -1114,7 +1114,7 @@ void OpenGLBackend::PopulateCursorCache() SpriteID sprite = _cursor.sprite_seq[i].sprite; if (!this->cursor_cache.Contains(sprite)) { - Sprite *old = this->cursor_cache.Insert(sprite, (Sprite *)GetRawSprite(sprite, ST_NORMAL, &SimpleSpriteAlloc, this)); + Sprite *old = this->cursor_cache.Insert(sprite, (Sprite *)GetRawSprite(sprite, SpriteType::Normal, &SimpleSpriteAlloc, this)); if (old != nullptr) { OpenGLSprite *gl_sprite = (OpenGLSprite *)old->data; gl_sprite->~OpenGLSprite(); @@ -1272,10 +1272,10 @@ void OpenGLBackend::ReleaseAnimBuffer(const Rect &update_rect) Sprite *dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sizeof(OpenGLSprite)); OpenGLSprite *gl_sprite = (OpenGLSprite *)dest_sprite->data; - new (gl_sprite) OpenGLSprite(sprite->width, sprite->height, sprite->type == ST_FONT ? 1 : ZOOM_LVL_COUNT, sprite->colours); + new (gl_sprite) OpenGLSprite(sprite->width, sprite->height, sprite->type == SpriteType::Font ? 1 : ZOOM_LVL_COUNT, sprite->colours); /* Upload texture data. */ - for (int i = 0; i < (sprite->type == ST_FONT ? 1 : ZOOM_LVL_COUNT); i++) { + for (int i = 0; i < (sprite->type == SpriteType::Font ? 1 : ZOOM_LVL_COUNT); i++) { gl_sprite->Update(sprite[i].width, sprite[i].height, i, sprite[i].data); } @@ -1310,7 +1310,7 @@ void OpenGLBackend::RenderOglSprite(OpenGLSprite *gl_sprite, PaletteID pal, int _glBindBuffer(GL_PIXEL_UNPACK_BUFFER, OpenGLSprite::pal_pbo); _glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - _glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, 256, GetNonSprite(GB(pal, 0, PALETTE_WIDTH), ST_RECOLOUR) + 1); + _glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, 256, GetNonSprite(GB(pal, 0, PALETTE_WIDTH), SpriteType::Recolour) + 1); _glTexSubImage1D(GL_TEXTURE_1D, 0, 0, 256, GL_RED, GL_UNSIGNED_BYTE, nullptr); _glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); diff --git a/src/viewport.cpp b/src/viewport.cpp index b5ace3deb5..c1e3cd77d1 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -1062,7 +1062,7 @@ void OffsetGroundSprite(int x, int y) static void AddCombinedSprite(SpriteID image, PaletteID pal, int x, int y, int z, const SubSprite *sub) { Point pt = RemapCoords(x, y, z); - const Sprite *spr = GetSprite(image & SPRITE_MASK, ST_NORMAL); + const Sprite *spr = GetSprite(image & SPRITE_MASK, SpriteType::Normal); int left = pt.x + spr->x_offs; int right = pt.x + spr->x_offs + spr->width; @@ -1138,7 +1138,7 @@ void AddSortableSpriteToDraw(SpriteID image, PaletteID pal, int x, int y, int w, tmp_width = right - left; tmp_height = bottom - top; } else { - const Sprite *spr = GetSprite(image & SPRITE_MASK, ST_NORMAL); + const Sprite *spr = GetSprite(image & SPRITE_MASK, SpriteType::Normal); left = tmp_left = (pt.x += spr->x_offs); right = (pt.x + spr->width ); top = tmp_top = (pt.y += spr->y_offs); @@ -3743,7 +3743,7 @@ void ViewportDoDraw(Viewport *vp, int left, int top, int right, int bottom, uint if (_settings_client.gui.show_slopes_on_viewport_map) ViewportMapDraw(vp); else ViewportMapDraw(vp); } else { - _pal2trsp_remap_ptr = IsTransparencySet(TO_TREES) ? GetNonSprite(GB(PALETTE_TO_TRANSPARENT, 0, PALETTE_WIDTH), ST_RECOLOUR) + 1 : nullptr; + _pal2trsp_remap_ptr = IsTransparencySet(TO_TREES) ? GetNonSprite(GB(PALETTE_TO_TRANSPARENT, 0, PALETTE_WIDTH), SpriteType::Recolour) + 1 : nullptr; if (_settings_client.gui.show_slopes_on_viewport_map) ViewportMapDraw(vp); else ViewportMapDraw(vp); } diff --git a/src/widgets/ai_widget.h b/src/widgets/ai_widget.h index f50b6632c8..4d6418bcfe 100644 --- a/src/widgets/ai_widget.h +++ b/src/widgets/ai_widget.h @@ -15,9 +15,12 @@ /** Widgets of the #AIConfigWindow class. */ enum AIConfigWidgets { WID_AIC_BACKGROUND, ///< Window background. - WID_AIC_DECREASE, ///< Decrease the number of AIs. - WID_AIC_INCREASE, ///< Increase the number of AIs. + WID_AIC_DECREASE_NUMBER, ///< Decrease the number of AIs. + WID_AIC_INCREASE_NUMBER, ///< Increase the number of AIs. WID_AIC_NUMBER, ///< Number of AIs. + WID_AIC_DECREASE_INTERVAL,///< Decrease the interval. + WID_AIC_INCREASE_INTERVAL,///< Increase the interval. + WID_AIC_INTERVAL, ///< Interval between time AIs start. WID_AIC_LIST, ///< List with currently selected AIs. WID_AIC_SCROLLBAR, ///< Scrollbar to scroll through the selected AIs. WID_AIC_MOVE_UP, ///< Move up button.