From 078e27bd8435eb1967e1c1222d43bffbea3bd449 Mon Sep 17 00:00:00 2001 From: PeterN Date: Sun, 9 Apr 2023 19:28:55 +0100 Subject: [PATCH 01/16] Fix #10619: Crash loading linkgraph for older savegames. (#10620) --- src/saveload/linkgraph_sl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/saveload/linkgraph_sl.cpp b/src/saveload/linkgraph_sl.cpp index fc6059f97a..691de0dd5f 100644 --- a/src/saveload/linkgraph_sl.cpp +++ b/src/saveload/linkgraph_sl.cpp @@ -58,7 +58,7 @@ public: if (IsSavegameVersionBefore(SLV_191)) { /* We used to save the full matrix ... */ for (NodeID to = 0; to < max_size; ++to) { - SlObject(&_linkgraph->nodes[_linkgraph_from].edges[to], this->GetLoadDescription()); + SlObject(&edges[to], this->GetLoadDescription()); } } else { size_t used_size = IsSavegameVersionBefore(SLV_SAVELOAD_LIST_LENGTH) ? max_size : SlGetStructListLength(UINT16_MAX); From 58e629ca8415de4f1466596a0234928754e9c9d8 Mon Sep 17 00:00:00 2001 From: translators Date: Sun, 9 Apr 2023 18:39:31 +0000 Subject: [PATCH 02/16] Update: Translations from eints korean: 8 changes by telk5093 russian: 7 changes by Ln-Wolf finnish: 8 changes by hpiirai --- src/lang/finnish.txt | 10 ++++++++-- src/lang/korean.txt | 10 ++++++++-- src/lang/russian.txt | 9 +++++++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/lang/finnish.txt b/src/lang/finnish.txt index 373372d05d..81f6f894e7 100644 --- a/src/lang/finnish.txt +++ b/src/lang/finnish.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}ruutua/vrk +STR_UNITS_VELOCITY_KNOTS :{COMMA}{NBSP}solmua STR_UNITS_POWER_IMPERIAL :{COMMA}{NBSP}hv STR_UNITS_POWER_METRIC :{COMMA}{NBSP}hv @@ -1808,7 +1809,9 @@ STR_CONFIG_SETTING_ALLOW_SHARES_HELPTEXT :Mikäli käytö STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES :Yhtiön vähimmäisikä osakekaupoille: {STRING} STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_HELPTEXT :Aseta yhtiölle vähimmäisikä, jonka jälkeen muut voivat ostaa ja myydä yhtiön osakkeita. +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_VALUE :{COMMA} vuo{P 0 si tta} ###setting-zero-is-special +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_NO_MIN :Ei vähimmäisaikaa STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE :Syöttöjärjestelmään maksettavan tuoton osuus: {STRING} STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE_HELPTEXT :Osuus tuotosta, joka annetaan välittäjille syöttöjärjestelmissä @@ -1952,13 +1955,15 @@ STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :Mikäli asetuks STR_CONFIG_SETTING_SHORT_PATH_SATURATION :Lyhyiden reittien kuormittuminen ennen vapaampien reittien käyttämistä: {STRING} STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :Kahden aseman välillä on usein useita reittejä. Lyhintä reittiä käytetään ensisijaisesti, toiseksi lyhintä ensimmäisen kuormittuessa ja niin edelleen. Kuormitus määritellään arvioidun kapasiteetin ja suunnitellun käytön mukaan. Kaikkien reittien ollessa kuormittuneita reittejä aletaan ylikuormittaa, suurimman kapasiteetin omaavista reiteista aloittaen. Algoritmi ei kuitenkaan aina arvioi kapasiteettia oikein. Tämä asetus mahdollistaa reitin kuormitustason määrittämisen ennen seuraavan reitin käyttämistä. Määritä arvoksi vähemmän kuin 100{NBSP}% välttääksesi ylikuormittuneita asemia, jos kapasiteetti yliarvioidaan. -STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Nopeuden yksikkö: {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Nopeuden yksikkö (maaliikenne): {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :Nopeuden yksikkö (vesiliikenne): {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :Kun käyttöliittymässä näytetään nopeus, näytä se valittua yksikköä käyttäen ###length 5 STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :Brittiläinen (mph) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC :Metrinen (km/h) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI :SI (m/s) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS :Pelin yksiköt (ruutuja vuorokaudessa) +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :Solmut STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :Kulkuneuvon tehon yksikkö: {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :Kun käyttöliittymässä näytetään kulkuneuvon teho, näytä se valittua yksikköä käyttäen @@ -4585,6 +4590,7 @@ STR_AI_CONFIG_AILIST_TOOLTIP :{BLACK}Seuraava STR_AI_CONFIG_HUMAN_PLAYER :Ihmispelaaja STR_AI_CONFIG_RANDOM_AI :Sattumanvarainen tekoäly 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_MOVE_UP :{BLACK}Siirrä ylöspäin @@ -4598,7 +4604,7 @@ STR_AI_CONFIG_AI :{SILVER}Tekoäl STR_AI_CONFIG_CHANGE_AI :{BLACK}Valitse tekoäly STR_AI_CONFIG_CHANGE_GAMESCRIPT :{BLACK}Valitse peliskripti -STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}Lataa toinen skripti +STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}Lataa toinen skripti. Ctrl+napsautus näyttää kaikki saatavilla olevat versiot STR_AI_CONFIG_CONFIGURE :{BLACK}Määritä STR_AI_CONFIG_CONFIGURE_TOOLTIP :{BLACK}Määritä skriptin parametrit diff --git a/src/lang/korean.txt b/src/lang/korean.txt index 630654847e..866b1c293e 100644 --- a/src/lang/korean.txt +++ b/src/lang/korean.txt @@ -196,6 +196,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}칸/일 +STR_UNITS_VELOCITY_KNOTS :{COMMA}노트 STR_UNITS_POWER_IMPERIAL :{COMMA}마력 STR_UNITS_POWER_METRIC :{COMMA}마력 @@ -1809,7 +1810,9 @@ STR_CONFIG_SETTING_ALLOW_SHARES_HELPTEXT :이 설정을 STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES :지분 거래를 허용할 최소 회사 나이: {STRING}년 STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_HELPTEXT :지분을 사고 팔기 위해 필요한 회사의 최소 나이를 설정합니다. +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_VALUE :{COMMA}년 ###setting-zero-is-special +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_NO_MIN :제한 없음 STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE :환승시 벌어들이는 중간 수익의 비율: {STRING} STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE_HELPTEXT :더 많은 수익을 내기 위해, 수송 관계상 중간 구간에게 주어진 수익의 비율을 설정합니다. @@ -1953,13 +1956,15 @@ STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :이 값을 100% STR_CONFIG_SETTING_SHORT_PATH_SATURATION :다음으로 짧은 경로를 사용하기 위한 경로의 포화도: {STRING} STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :종종 두 역 사이에는 여러 가지 경로가 존재할 수 있습니다. 이 경우, 화물 분배 기능은 먼저 가장 짧은 경로로 화물을 보내고, 그 경로가 포화 상태에 이르면 그 다음으로 짧은 경로를 사용하는 식으로 화물을 분배합니다. 포화도는 경로의 수송 능력과 예정 사용량을 추정하여 계산됩니다. 일단 모든 경로가 포화 상태가 되었는데 아직 수요가 남아있다면, 수송 능력이 높은 경로를 사용하면서 모든 경로를 과부하 상태로 만들게 됩니다. 하지만, 이 알고리즘은 수송량을 대부분 정확히 추정하지는 않습니다. 이 설정을 이용해서, 화물 분배 기능이 짧은 경로의 포화 상태가 몇 퍼센트가 되어야 다음으로 짧은 경로에 화물을 분배할 것인지를 지정할 수 있습니다. 과대평가된 수송량의 경우 너무 붐비는 역이 생기지 않도록 하기 위해서는 이 값을 100%보다 작게 설정하십시오. -STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :속력 단위: {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :속력 단위 (지상): {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :속력 단위 (해상): {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :속력를 표시할 때 선택한 단위를 사용하여 나타냅니다. ###length 5 STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :야드파운드법 (mph) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC :미터법 (km/h) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI :국제표준규격 (m/s) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS :게임 단위 (칸/일) +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :노트 STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :차량의 힘 단위: {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :출력할 차량의 힘 단위를 선택합니다. @@ -4586,6 +4591,7 @@ STR_AI_CONFIG_AILIST_TOOLTIP :{BLACK}다음 STR_AI_CONFIG_HUMAN_PLAYER :사용자 플레이어 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_MOVE_UP :{BLACK}위로 이동 @@ -4599,7 +4605,7 @@ STR_AI_CONFIG_AI :{SILVER}인공 STR_AI_CONFIG_CHANGE_AI :{BLACK}인공지능을 선택하세요 STR_AI_CONFIG_CHANGE_GAMESCRIPT :{BLACK}게임 스크립트 선택 -STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}다른 게임 스크립트를 불러옵니다 +STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}다른 게임 스크립트를 불러옵니다. CTRL + 클릭하면 사용 가능한 모든 버전을 보여줍니다 STR_AI_CONFIG_CONFIGURE :{BLACK}설정 STR_AI_CONFIG_CONFIGURE_TOOLTIP :{BLACK}인공지능의 매개 변수를 설정합니다 diff --git a/src/lang/russian.txt b/src/lang/russian.txt index b48c687b98..eeb5a2d3f9 100644 --- a/src/lang/russian.txt +++ b/src/lang/russian.txt @@ -321,6 +321,7 @@ STR_UNITS_VELOCITY_IMPERIAL :{COMMA}{NBSP}м STR_UNITS_VELOCITY_METRIC :{COMMA}{NBSP}км/ч STR_UNITS_VELOCITY_SI :{COMMA}{NBSP}м/с STR_UNITS_VELOCITY_GAMEUNITS :{DECIMAL}{NBSP}кл./день +STR_UNITS_VELOCITY_KNOTS :{COMMA}{NBSP}уз{P ел ла ов} STR_UNITS_POWER_IMPERIAL :{COMMA}{NBSP}лс STR_UNITS_POWER_METRIC :{COMMA}{NBSP}лс @@ -1958,8 +1959,10 @@ STR_CONFIG_SETTING_ALLOW_SHARES :Разреши STR_CONFIG_SETTING_ALLOW_SHARES_HELPTEXT :Разрешает торговлю акциями транспортных компаний. Акции выпускаются компаниями через некоторое время после основания. STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES :Мин. возраст компании для выпуска акций: {STRING} -STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_HELPTEXT :Минимальный возраст, которого должна достичь компания для начала выпуска акций, которыми смогут торговать другие игроки. +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_HELPTEXT :Минимальный возраст, которого должна достичь компания для начала выпуска акций, которые смогут покупать и продавать другие игроки. +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_VALUE :{COMMA} {P год года лет} ###setting-zero-is-special +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_NO_MIN :без ограничений по возрасту STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE :Процент дохода, начисляемый при частичной перевозке: {STRING} STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE_HELPTEXT :Процент прибыли, начисляемый транспорту за частичную перевозку груза. @@ -2103,13 +2106,15 @@ STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :Установ STR_CONFIG_SETTING_SHORT_PATH_SATURATION :Предел загрузки коротких маршрутов перед использованием вместительных: {STRING} STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :При наличии нескольких маршрутов между станциями алгоритм распределения грузов будет использовать кратчайший маршрут до его загрузки, потом следующий по длине и т.{NBSP}д. При избытке груза маршруты будут перегружаться начиная с самых производительных. Загрузка рассчитывается исходя из оценки пропускной способности (которая может быть неточной) и интенсивности использования. Эта настройка определяет, насколько загружать маршрут перед тем, как начать использовать следующий. Установите значение ниже 100% для того, чтобы избежать задержки груза, если пропускная способность маршрута будет переоценена алгоритмом. -STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Система единиц для скорости: {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Система единиц для скорости (наземная): {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :Система единиц для скорости (морская): {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :Показывать значения скорости в выбранной системе единиц ###length 5 STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :английская (миль/ч) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC :метрическая (км/ч) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI :СИ (м/с) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS :внутриигровая (клетки в день) +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :Узлы STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :Система единиц для мощности: {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :Показывать значения мощности двигателей транспортных средств в выбранной системе единиц From 770df65141ec2fe110002b6d2385026c34e81667 Mon Sep 17 00:00:00 2001 From: Artin Alavi <1361714+Arastais@users.noreply.github.com> Date: Sun, 9 Apr 2023 14:39:41 -0600 Subject: [PATCH 03/16] Update: [Dev] Improve .editorconfig with C++ formatting rules based on OpenTTD code style (#10104) --- .editorconfig | 468 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 468 insertions(+) diff --git a/.editorconfig b/.editorconfig index 787a1c76c1..70ef010920 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,3 +7,471 @@ trim_trailing_whitespace = true [*.{c,cpp,h,hpp}] indent_style = tab charset = utf-8 +#indent_size = +#tab_width = +#end_of_line = + +### C++ specific editor config rules ### +## Visual Studio ## https://learn.microsoft.com/en-us/visualstudio/ide/cpp-editorconfig-properties?view=vs-2019 ## +# Indentation # +# Do not indent braces +cpp_indent_braces = false +# When a new line is typed, it's indented relatively to the innermost open parenthesis +cpp_indent_multi_line_relative_to = innermost_parenthesis +# Indent new lines within parenthesis +cpp_indent_within_parentheses = indent +# In existing code, do not use the setting for alignment of new lines within parentheses +cpp_indent_preserve_within_parentheses = true +# Indent case contents +cpp_indent_case_contents = true +# Indent case labels +cpp_indent_case_labels = true +# Do not indent braces following a case statement +cpp_indent_case_contents_when_block = false +# Do not indent braces of lambdas used as parameters +cpp_indent_lambda_braces_when_parameter = false +# No override for "Position of goto labels" (Unspecified) +#cpp_indent_goto_labels +# Move preprocessor directives to the leftmost column +cpp_indent_preprocessor = leftmost_column +# Do not indent access specifiers +cpp_indent_access_specifiers = false +# Indent namespace contents +cpp_indent_namespace_contents = true +# Preserve indentation of comments +cpp_indent_preserve_comments = true + +# Newline # +# Keep open braces for namespaces on the same line, but add a space before the brace +cpp_new_line_before_open_brace_namespace = same_line +# Keep open braces for types/classes on the same line, but add a space before the brace +cpp_new_line_before_open_brace_type = same_line +# Move open braces for functions to a new line +cpp_new_line_before_open_brace_function = new_line +# Keep open braces for control blocks on the same line, but add a space before the brace +cpp_new_line_before_open_brace_block = same_line +# Keep open braces for lambdas on the same line, but add a space before the brace +cpp_new_line_before_open_brace_lambda = same_line +# Place scope braces on separate lines +cpp_new_line_scope_braces_on_separate_lines = true +# Do not move closing braces to the same line as opening braces for empty types +cpp_new_line_close_brace_same_line_empty_type = false +# Do not move closing braces to the same line as opening braces for empty function bodies +cpp_new_line_close_brace_same_line_empty_function = false +# Do not place 'catch' and similar keywords on a new line +cpp_new_line_before_catch = false +# Do not place 'else' on a new line +cpp_new_line_before_else = false +# Do not place 'while' in a do-while loop on a new line +cpp_new_line_before_while_in_do_while = false + +# Spacing # +# Remove spaces between function names and opening parentheses of argument lists +cpp_space_before_function_open_parenthesis = remove +# Do not insert a space within parentheses of an argument list +cpp_space_within_parameter_list_parentheses = false +# Do not insert a space between parentheses when argument list is empty +cpp_space_between_empty_parameter_list_parentheses = false +# Insert space between keyword and opening parenthesis in control flow statements +cpp_space_after_keywords_in_control_flow_statements = true +# Do not insert a space within parentheses of a control statement +cpp_space_within_control_flow_statement_parentheses = false +# Do not insert a space before opening parenthesis of lambda argument lists +cpp_space_before_lambda_open_parenthesis = false +# Do not insert a space within parentheses of a C-style cast +cpp_space_within_cast_parentheses = false +# Do not insert a space after closing parenthesis of C-style cast +cpp_space_after_cast_close_parenthesis = false +# Do not insert a space within parentheses of a parenthesized expression +cpp_space_within_expression_parentheses = false +# Insert space before opening brace of blocks +cpp_space_before_block_open_brace = true +# Do not insert a space between empty braces +cpp_space_between_empty_braces = false +# Do not insert a space before opening brace of uniform initialization and initializer lists +cpp_space_before_initializer_list_open_brace = false +# No override for "Insert space within braces of uniform initialization and initializer lists" (Spacing for this varies) +#cpp_space_within_initializer_list_braces +# Preserve spaces inside uniform initialization and initializer lists +cpp_space_preserve_in_initializer_list = true +# Do not insert space before opening square brackets +cpp_space_before_open_square_bracket = false +# Do not insert space within square bracket +cpp_space_within_square_brackets = false +# Do not insert space before empty square brackets +cpp_space_before_empty_square_brackets = false +# Do not insert space between empty square brackets +cpp_space_between_empty_square_brackets = false +# Group square brackets for multi-dimensional arrays together +cpp_space_group_square_brackets = true +# Do not insert space within square brackets for lambdas +cpp_space_within_lambda_brackets = false +# Do not insert space between empty lambda brackets +cpp_space_between_empty_lambda_brackets = false +# Do not insert space before commas +cpp_space_before_comma = false +# Insert space after commas +cpp_space_after_comma = true +# Remove spaces before and after member operators +cpp_space_remove_around_member_operators = true +# Insert space before colon for base in type declarations +cpp_space_before_inheritance_colon = true +# Insert space before colon for constructors +cpp_space_before_constructor_colon = true +# Remove space before semicolons +cpp_space_remove_before_semicolon = true +# No override for "Insert space after semicolons" (Depends on if loop is unconditional) +#cpp_space_after_semicolon +# Remove spaces between unary operators and their operands +cpp_space_remove_around_unary_operator = true +# Insert spaces before and after binary operators +cpp_space_around_binary_operator = insert +# Insert spaces around assignment operators +cpp_space_around_assignment_operator = insert +# Align pointer/reference symbol to the right +cpp_space_pointer_reference_alignment = right +# Insert spaces around conditional operators +cpp_space_around_ternary_operator = insert + +# Wrapping # +# Always apply New Lines settings for blocks +cpp_wrap_preserve_blocks = never + + + +## Rider & ReSharper ## https://www.jetbrains.com/help/resharper/EditorConfig_CPP_CppBlankLinesPageScheme.html ## +# Blank Lines # +# No override for "Max blank lines in declarations" (Unspecified; Not consistent across source code) +#cpp_keep_blank_lines_in_declarations +# No override for "Max blank lines in rest of source code" (Unspecified; Not consistent across source code) +#cpp_keep_blank_lines_in_code +# No override for "Number of blank lines around class/struct/enum definition" (Unspecified; Not consistent across source code) +#cpp_blank_lines_around_class_definition +# No override for "Number of blank lines around function declarations" (Unspecified; Not consistent across source code) +#cpp_blank_lines_around_function_declaration +# No override for "Number of blank lines around function definitions" (Unspecified; Not consistent across source code) +#cpp_blank_lines_around_function_definition +# No override for "Number of blank lines around single line function definitions" (Unspecified; Not consistent across source code) +#cpp_blank_lines_around_single_line_function_definition +# No override for "Number of blank lines around namespaces" (Unspecified; Not consistent across source code) +#cpp_blank_lines_around_namespace +# No override for "Number of blank lines around other definitions and declarations" (Unspecified; Not consistent across source code) +#cpp_blank_lines_around_other_declaration + +# Braces Layout # +# Keep open braces for namespace declarations on the same line, but add a space before the brace +cpp_namespace_declaration_braces = end_of_line +# Keep open braces for linkage declarations on the same line, but add a space before the brace +cpp_linkage_specification_braces = end_of_line +# Keep open braces for types/classes on the same line, but add a space before the brace +cpp_type_declaration_braces = end_of_line +# Keep open braces for namespace definitions on the same line (does not modify spacing before the brace) +cpp_place_namespace_definitions_on_same_line = true +# Move open braces for functions to a new line +cpp_invocable_declaration_braces = next_line +# Keep open braces for lambdas on the same line, but add a space before the brace +cpp_anonymous_method_declaration_braces = end_of_line +# Keep open braces for case blocks on the same line, but add a space before the brace +cpp_case_block_braces = end_of_line +# No override for "Requires expression braces" style (requires expressions are a C++20 feature) +#cpp_requires_expression_braces +# Keep open braces for all other blocks on the same line, but add a space before the brace +cpp_other_braces = end_of_line +# Only indent the insides of multi-line expression braces +cpp_expression_braces = inside +# Place the braces of empty blocks together and on the same line +cpp_empty_block_style = together_same_line +# Force line breaks within simple compound statements +cpp_simple_block_style = line_break +# No override for "Regular expression for macros starting a block" (Marco blocks aren't used) +#cpp_macro_block_begin +# No override for "Regular expression for macros ending a block" (Marco blocks aren't used) +#cpp_macro_block_end + +# Tabs and indents # +# Redundant override (Already overriden globally by 'indent_style') +#cpp_indent_style +# Redundant override (Already overriden globally by 'indent_size') +#cpp_indent_size +# Redundant override (Already overriden globally by 'tab_width') +#cpp_tab_width +# Use spaces instead of tabs as indentation for precise alignment +cpp_alignment_tab_fill_style = use_spaces +# Allow alignment even if construct is located too far to the right, more than 2/3 of 'Hard wrap at' limit +cpp_allow_far_alignment = true + +# Indentation and Alignment # +# No override for "Continuous line indent" (Varies throughout source code) +#cpp_continuous_line_indent +# Do not use continuous line indent in function declaration and invocation parentheses +cpp_use_continuous_line_indent_in_method_pars = false +# Do not use continuous line indent in initializer lists +cpp_use_continuous_line_indent_in_expression_braces = false +# Indent namespace members (including nested ones) +cpp_namespace_indentation = all +# No override for "Indent linkage specification block members" (Unspecified) +#cpp_linkage_specification_indentation +# Do not indent access specifier from class +cpp_indent_access_specifiers_from_class = false +# Indent class member from access specifier +cpp_indent_class_members_from_access_specifiers = true +# Do not indent if a function definition or declaration is wrapped after the type +cpp_indent_wrapped_function_names = false +# Indent 'case' labels from 'switch' +cpp_indent_switch_labels = true +# No override for "Indent function declarations' parentheses" (Varies throughout source code) +#cpp_indent_method_decl_pars +# No override for "Indent method calls' parentheses" (Varies throughout source code) +#cpp_indent_invocation_pars +# No override for "Indent statement (if, while, for, etc) parentheses" (Varies throughout source code) +#cpp_indent_statement_pars +# Do not change preprocessor directives indenting +cpp_indent_preprocessor_directives = do_not_change +# No override for "Indent C++/CLI generic constraints" (C++/CLI is not used) +#cpp_indent_type_constraints +# Align/indent comments started at the first column +cpp_indent_comment = true +# Comments that comment out code will use the indentation level of the commented code. +cpp_place_comments_at_first_column = false +# Align multiline declarators in declaration +cpp_align_multiple_declaration = true +# Align multiline function parameters +cpp_align_multiline_parameter = true +# Align multiline call arguments +cpp_align_multiline_argument = true +# Do not align first of multiline call arguments with the opening parentheses +cpp_align_first_arg_by_paren = false +# Align multiline initializer list arguments +cpp_align_multiline_expression_brace = true +# No override for "Align multiline template parameters in template declaration" (Unspecified) +#cpp_align_multiline_type_parameter +# No override for "Align multiline template arguments" (Unspecified) +#cpp_align_multiline_type_argument +# Align multiline base classes in class base clause +cpp_align_multiline_extends_list = true +# Align multiline member initializers in member initializer lists +cpp_align_multiline_ctor_init = true +# Outdent commas placed on new line +cpp_outdent_commas = true +# Do not align multiline ?: operator with first line (since alignment is incorrect) +cpp_align_ternary = none +# Do not indent aligned ?: operator (since indentation varies) +cpp_indent_aligned_ternary = false +# No override for "Align multiline chained method calls" (Unspecified) +#cpp_align_multiline_calls_chain +# No override for "Outdent '.' and '->' in chained method calls on new lines" (Unspecified) +#cpp_outdent_dots +# Do not align multiline chained binary expressions +cpp_align_multiline_binary_expressions_chain = false +# Fix column alignment in adjacent lines +cpp_int_align_fix_in_adjacent = true +# Align assignments with adjacent assignments +cpp_int_align_eq = true +# Do not align declaration names with adjacent declaration names +cpp_int_align_declaration_names = false +# Align end-of-line comments with adjacent end-of-line comments +cpp_int_align_comments = true + +# Spaces # +# Do not put space before ANY commas +cpp_space_before_comma = false +# Put space after ALL commas +cpp_space_after_comma = true +# Put space before ptr in declaration of variable +cpp_space_before_ptr_in_data_member = true +# Do not put space after ptr in declaration of variable +cpp_space_after_ptr_in_data_member = false +# Put space before ptr in declaration of multiple variables +cpp_space_before_ptr_in_data_members = true +# Do not put space after ptr in declaration of multiple variables +cpp_space_after_ptr_in_data_members = false +# Put space before ptr in return type of function +cpp_space_before_ptr_in_method = true +# Do not put space after ptr in return type of function +cpp_space_after_ptr_in_method = false +# Do not put space before ptr in abstract declaration +cpp_space_before_ptr_in_abstract_decl = false +# Put space before ref in declaration of variable +cpp_space_before_ref_in_data_member = true +# Do not put space after ref in declaration of variable +cpp_space_after_ref_in_data_member = false +# Put space before ref in declaration of multiple variables +cpp_space_before_ref_in_data_members = true +# Do not put space after ref in declaration of multiple variables +cpp_space_after_ref_in_data_members = false +# Do not put space before ref in return type of function +cpp_space_before_ref_in_method = false +# Put space after ref in return type of function +cpp_space_after_ref_in_method = true +# Do not put space before ref in abstract declaration +cpp_space_before_ref_in_abstract_decl = false +# Do not put space before parentheses in function parameters +cpp_space_between_method_declaration_name_and_open_parenthesis = false +# Do not put space before parentheses in lambda parameters +cpp_space_before_lambda_parentheses = false +# Do not put space within parentheses in function parameters +cpp_space_between_method_declaration_parameter_list_parentheses = false +# Do not put space within empty parentheses in function parameters +cpp_space_between_method_declaration_empty_parameter_list_parentheses = false +# Do not put space before angle brackets in template parameters +cpp_space_before_template_params = false +# Do not put space within angle brackets in template parameters +cpp_space_within_template_params = false +# Do not put space within empty angle brackets in template parameters +cpp_space_within_empty_template_params = false +# Do not put space before angle brackets in template arguments +cpp_space_before_template_args = false +# Do not put space within angle brackets in template arguments +cpp_space_within_template_args = false +# Do not put space between closing angle brackets in template arguments +cpp_space_between_closing_angle_brackets_in_template_args = false +# Put space around '=' in alias declaration and namespace alias +cpp_space_around_alias_eq = true +# Do not put space around '->' in trailing return types +cpp_space_around_deref_in_trailing_return_type = false +# Put space before base types list colon +cpp_space_before_colon_in_inheritance_clause = true +# Put space after base types list colon +cpp_space_after_colon_in_inheritance_clause = true +# No override for "Before C++/CLI generic constraint colon" (Unspecified) +#cpp_space_before_type_parameter_constraint_colon +# No override for "After C++/CLI generic constraint colon" (Unspecified) +#cpp_space_after_type_parameter_constraint_colon +# Put space before parentheses of control statements +cpp_space_after_keywords_in_control_flow_statements = true +# Do not put space within parentheses of control statements +cpp_space_between_parentheses_of_control_flow_statements = false +# Do not put space before semicolon in 'for' statements +cpp_space_before_semicolon_in_for_statement = false +# Put space after semicolon in 'for' statements +cpp_space_after_semicolon_in_for_statement = true +# Put space before ':' in range-based for loop +cpp_space_before_for_colon = true +# Put space after ':' in range-based for loop +cpp_space_after_for_colon = true +# Do not put space before colon in switch case or label statement +cpp_space_before_colon_in_case = false +# Put space after colon in switch case or label statement +cpp_space_after_colon_in_case = true +# Put space around binary operator +cpp_space_around_binary_operator = true +# Put space around assignment operator +cpp_space_around_assignment_operator = true +# Do not put space around dot, '->', '.*' and '->.' +cpp_space_around_member_access_operator = false +# Do not put space within any parentheses +cpp_space_within_parentheses = false +# Do not put space before array subscript brackets +cpp_space_before_open_square_brackets = false +# Do not put space within array subscript brackets +cpp_space_between_square_brackets = false +# Do not put space before empty parentheses in function call and initialization +cpp_space_between_method_call_name_and_opening_parenthesis = false +# Do not put space within parentheses in cast expressions +cpp_space_between_typecast_parentheses = false +# Do not put space after parentheses in cast expressions +cpp_space_after_cast = false +# Do not put space within parentheses in function call and initialization +cpp_space_between_method_call_parameter_list_parentheses = false +# Do not put space within empty parentheses in function call and initialization +cpp_space_between_method_call_empty_parameter_list_parentheses = false +# Put space in ternary operator '? :' before '?'  +cpp_space_before_ternary_quest = true +# Put space in ternary operator '? :' after '?' +cpp_space_after_ternary_quest = true +# Put space in ternary operator '? :' before ':'  +cpp_space_before_ternary_colon = true +# Put space in ternary operator '? :' after ':' +cpp_space_after_ternary_colon = true +# Do not put space before uniform initialization braces +cpp_space_before_initializer_braces = false +# Do not put space within uniform initialization braces +cpp_space_within_initializer_braces = false +# Do not put space within empty uniform initialization braces +cpp_space_within_empty_initializer_braces = false +# Put space before end of line comment +cpp_space_before_trailing_comment = true +# Preserve spaces before end of line comment +cpp_disable_space_changes_before_trailing_comment = true + +# Line breaks and Wrapping # +# Redundant override (Already overriden globally by 'insert_final_newline') +#cpp_insert_final_newline +# Redundant override (Already overriden earlier in Visual Studio section) +#cpp_new_line_before_else +# Do not place 'while' in a do-while loop on a new line +cpp_new_line_before_while = false +# Redundant override (Already overriden earlier in Visual Studio section) +#cpp_new_line_before_catch +# Do not change the line breaks of single embedded statements +cpp_simple_embedded_statement_style = do_not_change +# Do not change the line breaks of simple 'case' statement +cpp_simple_case_statement_style = do_not_change +# Put member function definition return type on same line +cpp_function_definition_return_type_style = on_single_line +# Put top-level function definition return type on same line +cpp_toplevel_function_definition_return_type_style = on_single_line +# Put member function declaration return type on same line +cpp_function_declaration_return_type_style = on_single_line +# Put top-level function declaration return type on same line +cpp_toplevel_function_declaration_return_type_style = on_single_line +# Force template<...> of a template declaration on new line +cpp_break_template_declaration = line_break +# No override for "Break line before the requires-clause" (requires-clause is a C++20 feature) +#cpp_line_break_before_requires_clause +# Do not change the line break before the colon in member initializer lists +cpp_member_initializer_list_style = do_not_change +# Do not change the line break after the colon in member initializer lists +cpp_line_break_after_colon_in_member_initializer_lists = do_not_change +# No override for "Break line before comma in member initializer lists" (Varies throughout source code) +#cpp_line_break_before_comma_in_member_initializer_lists +# No override for "Break line after comma in member initializer lists" (Varies throughout source code) +#cpp_line_break_after_comma_in_member_initializer_lists +# No override for "Allow C++/CLI generic constraints on the same line" (C++/CLI is not used) +#cpp_place_type_constraints_on_same_line +# No override for "Keep existing line breaks" (Varies throughout source code; depends on developer preference) +#cpp_keep_user_linebreaks +# No override for "Hard wrap at _ characters" (Unspecified) +#cpp_max_line_length +# Do not prefer wrap before ',' +cpp_wrap_before_comma = false +# Do not prefer wrap before ',' in base clause +cpp_wrap_before_comma_in_base_clause = false +# No override for "Wrap ternary expression" (Varies throughout source code) +#cpp_wrap_ternary_expr_style +# No override for "Prefer wrap before '?' and ':' in ternary expressions" (Varies throughout source code) +#cpp_wrap_before_ternary_opsigns +# No override for "Prefer wrap before ':'" (Varies throughout source code) +#cpp_wrap_before_colon +# No override for "Prefer wrap before first C++/CLI generic constraint" (C++/CLI is not used) +#cpp_wrap_before_first_type_parameter_constraint +# No override for "Wrap multiple C++/CLI generic constraints" (C++/CLI is not used) +#cpp_wrap_multiple_type_parameter_constraints_style +# No override for "Wrap enum definition" (Varies throughout source code) +#cpp_wrap_enumeration_style +# No override for "Wrap braced initializer list" (Varies throughout source code) +#cpp_wrap_braced_init_list_style +# No override for "Wrap base classes list" (Varies throughout source code) +#cpp_wrap_base_clause_style +# No override for "Wrap constructor initializer" (Varies throughout source code) +#cpp_wrap_ctor_initializer_style +# No override for "Wrap formal parameters" (Varies throughout source code) +#cpp_wrap_parameters_style +# Do not prefer wrap before '(' in declaration +cpp_wrap_before_declaration_lpar = false +# Prefer wrap after '(' in declaration +cpp_wrap_after_declaration_lpar = true +# Do not prefer wrap before ')' in declaration +cpp_wrap_before_declaration_rpar = false +# No override for "Wrap invocation arguments" (Varies throughout source code) +#cpp_wrap_arguments_style +# Do not prefer wrap before '(' in invocation +cpp_wrap_before_invocation_lpar = false +# Prefer wrap after '(' in invocation +cpp_wrap_after_invocation_lpar = true +# Do not prefer wrap before ')' in invocation +cpp_wrap_before_invocation_rpar = false +# Prefer wrap after '{' in initializer lists +cpp_wrap_after_expression_lbrace = true +# Do not prefer wrap before '}' in initializer lists +cpp_wrap_before_expression_rbrace = false From e2f1cd44dc98fabfee0877e101857f91b7e35503 Mon Sep 17 00:00:00 2001 From: dP Date: Mon, 10 Apr 2023 14:34:28 +0400 Subject: [PATCH 04/16] Change: Increase max cargo age and let min cargo payment approach zero. (#10596) Co-authored-by: Michael Lutz --- src/cargopacket.cpp | 2 +- src/cargopacket.h | 10 +++++----- src/economy.cpp | 24 +++++++++++++++++------- src/economy_func.h | 2 +- src/saveload/cargopacket_sl.cpp | 17 +++++++++-------- src/saveload/saveload.h | 1 + src/script/api/script_cargo.cpp | 2 +- 7 files changed, 35 insertions(+), 23 deletions(-) diff --git a/src/cargopacket.cpp b/src/cargopacket.cpp index e9c6e1aa77..5ac76b50d8 100644 --- a/src/cargopacket.cpp +++ b/src/cargopacket.cpp @@ -383,7 +383,7 @@ void VehicleCargoList::AgeCargo() for (ConstIterator it(this->packets.begin()); it != this->packets.end(); it++) { CargoPacket *cp = *it; /* If we're at the maximum, then we can't increase no more. */ - if (cp->days_in_transit == 0xFF) continue; + if (cp->days_in_transit == UINT16_MAX) continue; cp->days_in_transit++; this->cargo_days_in_transit += cp->count; diff --git a/src/cargopacket.h b/src/cargopacket.h index 0e24bc6233..7cd5a8df93 100644 --- a/src/cargopacket.h +++ b/src/cargopacket.h @@ -44,7 +44,7 @@ struct CargoPacket : CargoPacketPool::PoolItem<&_cargopacket_pool> { private: Money feeder_share; ///< Value of feeder pickup to be paid for on delivery of cargo. uint16 count; ///< The amount of cargo in this packet. - byte days_in_transit; ///< Amount of days this packet has been in transit. + uint16 days_in_transit; ///< Amount of days this packet has been in transit. SourceType source_type; ///< Type of \c source_id. SourceID source_id; ///< Index of source, INVALID_SOURCE if unknown/invalid. StationID source; ///< The station where the cargo came from first. @@ -126,10 +126,10 @@ public: /** * Gets the number of days this cargo has been in transit. * This number isn't really in days, but in 2.5 days (CARGO_AGING_TICKS = 185 ticks) and - * it is capped at 255. + * it is capped at UINT16_MAX. * @return Length this cargo has been in transit. */ - inline byte DaysInTransit() const + inline uint16 DaysInTransit() const { return this->days_in_transit; } @@ -221,8 +221,8 @@ public: }; protected: - uint count; ///< Cache for the number of cargo entities. - uint cargo_days_in_transit; ///< Cache for the sum of number of days in transit of each entity; comparable to man-hours. + uint count; ///< Cache for the number of cargo entities. + uint64 cargo_days_in_transit; ///< Cache for the sum of number of days in transit of each entity; comparable to man-hours. Tcont packets; ///< The cargo packets in this list. diff --git a/src/economy.cpp b/src/economy.cpp index 6d22e69ff3..bf15a9f232 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -975,7 +975,7 @@ Money GetPrice(Price index, uint cost_factor, const GRFFile *grf_file, int shift return cost; } -Money GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, CargoID cargo_type) +Money GetTransportedGoodsIncome(uint num_pieces, uint dist, uint16 transit_days, CargoID cargo_type) { const CargoSpec *cs = CargoSpec::Get(cargo_type); if (!cs->IsValid()) { @@ -985,7 +985,7 @@ Money GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, C /* Use callback to calculate cargo profit, if available */ if (HasBit(cs->callback_mask, CBM_CARGO_PROFIT_CALC)) { - uint32 var18 = std::min(dist, 0xFFFFu) | (std::min(num_pieces, 0xFFu) << 16) | (transit_days << 24); + uint32 var18 = std::min(dist, 0xFFFFu) | (std::min(num_pieces, 0xFFu) << 16) | (std::min(transit_days, 0xFFu) << 24); uint16 callback = GetCargoCallback(CBID_CARGO_PROFIT_CALC, 0, var18, cs); if (callback != CALLBACK_FAILED) { int result = GB(callback, 0, 14); @@ -1002,25 +1002,35 @@ Money GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, C static const int MIN_TIME_FACTOR = 31; static const int MAX_TIME_FACTOR = 255; + static const int TIME_FACTOR_FRAC_BITS = 4; + static const int TIME_FACTOR_FRAC = 1 << TIME_FACTOR_FRAC_BITS; const int days1 = cs->transit_days[0]; const int days2 = cs->transit_days[1]; const int days_over_days1 = std::max( transit_days - days1, 0); const int days_over_days2 = std::max(days_over_days1 - days2, 0); + int days_over_max = MIN_TIME_FACTOR - MAX_TIME_FACTOR; + if (days2 > -days_over_max) days_over_max += transit_days - days1; + else days_over_max += 2 * (transit_days - days1) - days2; /* * The time factor is calculated based on the time it took * (transit_days) compared two cargo-depending values. The - * range is divided into three parts: + * range is divided into four parts: * * - constant for fast transits * - linear decreasing with time with a slope of -1 for medium transports * - linear decreasing with time with a slope of -2 for slow transports + * - after hitting MIN_TIME_FACTOR, the time factor will be asymptotically decreased to a limit of 1 with a scaled 1/(x+1) function. * */ - const int time_factor = std::max(MAX_TIME_FACTOR - days_over_days1 - days_over_days2, MIN_TIME_FACTOR); - - return BigMulS(dist * time_factor * num_pieces, cs->current_payment, 21); + if (days_over_max > 0) { + const int time_factor = std::max(2 * MIN_TIME_FACTOR * TIME_FACTOR_FRAC * TIME_FACTOR_FRAC / (days_over_max + 2 * TIME_FACTOR_FRAC), 1); // MIN_TIME_FACTOR / (x/(2 * TIME_FACTOR_FRAC) + 1) + 1, expressed as fixed point with TIME_FACTOR_FRAC_BITS. + return BigMulS(dist * time_factor * num_pieces, cs->current_payment, 21 + TIME_FACTOR_FRAC_BITS); + } else { + const int time_factor = std::max(MAX_TIME_FACTOR - days_over_days1 - days_over_days2, MIN_TIME_FACTOR); + return BigMulS(dist * time_factor * num_pieces, cs->current_payment, 21); + } } /** The industries we've currently brought cargo to. */ @@ -1094,7 +1104,7 @@ static uint DeliverGoodsToIndustry(const Station *st, CargoID cargo_type, uint n * @return Revenue for delivering cargo * @note The cargo is just added to the stockpile of the industry. It is due to the caller to trigger the industry's production machinery */ -static Money DeliverGoods(int num_pieces, CargoID cargo_type, StationID dest, TileIndex source_tile, byte days_in_transit, Company *company, SourceType src_type, SourceID src) +static Money DeliverGoods(int num_pieces, CargoID cargo_type, StationID dest, TileIndex source_tile, uint16 days_in_transit, Company *company, SourceType src_type, SourceID src) { assert(num_pieces > 0); diff --git a/src/economy_func.h b/src/economy_func.h index 69980b4758..d5bfeae0a2 100644 --- a/src/economy_func.h +++ b/src/economy_func.h @@ -28,7 +28,7 @@ extern Prices _price; int UpdateCompanyRatingAndValue(Company *c, bool update); void StartupIndustryDailyChanges(bool init_counter); -Money GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, CargoID cargo_type); +Money GetTransportedGoodsIncome(uint num_pieces, uint dist, uint16 transit_days, CargoID cargo_type); uint MoveGoodsToStation(CargoID type, uint amount, SourceType source_type, SourceID source_id, const StationList *all_stations, Owner exclusivity = INVALID_OWNER); void PrepareUnload(Vehicle *front_v); diff --git a/src/saveload/cargopacket_sl.cpp b/src/saveload/cargopacket_sl.cpp index 95b9bec6bf..07ed94287c 100644 --- a/src/saveload/cargopacket_sl.cpp +++ b/src/saveload/cargopacket_sl.cpp @@ -88,14 +88,15 @@ SaveLoadTable GetCargoPacketDesc() { static const SaveLoad _cargopacket_desc[] = { - SLE_VAR(CargoPacket, source, SLE_UINT16), - SLE_VAR(CargoPacket, source_xy, SLE_UINT32), - SLE_VAR(CargoPacket, loaded_at_xy, SLE_UINT32), - SLE_VAR(CargoPacket, count, SLE_UINT16), - SLE_VAR(CargoPacket, days_in_transit, SLE_UINT8), - SLE_VAR(CargoPacket, feeder_share, SLE_INT64), - SLE_CONDVAR(CargoPacket, source_type, SLE_UINT8, SLV_125, SL_MAX_VERSION), - SLE_CONDVAR(CargoPacket, source_id, SLE_UINT16, SLV_125, SL_MAX_VERSION), + SLE_VAR(CargoPacket, source, SLE_UINT16), + SLE_VAR(CargoPacket, source_xy, SLE_UINT32), + SLE_VAR(CargoPacket, loaded_at_xy, SLE_UINT32), + SLE_VAR(CargoPacket, count, SLE_UINT16), + SLE_CONDVAR(CargoPacket, days_in_transit, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_MORE_CARGO_AGE), + SLE_CONDVAR(CargoPacket, days_in_transit, SLE_UINT16, SLV_MORE_CARGO_AGE, SL_MAX_VERSION), + SLE_VAR(CargoPacket, feeder_share, SLE_INT64), + SLE_CONDVAR(CargoPacket, source_type, SLE_UINT8, SLV_125, SL_MAX_VERSION), + SLE_CONDVAR(CargoPacket, source_id, SLE_UINT16, SLV_125, SL_MAX_VERSION), }; return _cargopacket_desc; } diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h index 1614dba06f..539992f5bb 100644 --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -349,6 +349,7 @@ enum SaveLoadVersion : uint16 { SLV_VELOCITY_NAUTICAL, ///< 305 PR#10594 Separation of land and nautical velocity (knots!) 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. SL_MAX_VERSION, ///< Highest possible saveload version }; diff --git a/src/script/api/script_cargo.cpp b/src/script/api/script_cargo.cpp index 7354c848c0..aad2425461 100644 --- a/src/script/api/script_cargo.cpp +++ b/src/script/api/script_cargo.cpp @@ -76,7 +76,7 @@ distance = Clamp(distance, 0, UINT32_MAX); - return ::GetTransportedGoodsIncome(1, distance, Clamp(days_in_transit * 2 / 5, 0, 255), cargo_type); + return ::GetTransportedGoodsIncome(1, distance, Clamp(days_in_transit * 2 / 5, 0, UINT16_MAX), cargo_type); } /* static */ ScriptCargo::DistributionType ScriptCargo::GetDistributionType(CargoID cargo_type) From 246ba6f00a04ba63e9f24df05bd3b77d5ab68954 Mon Sep 17 00:00:00 2001 From: PeterN Date: Mon, 10 Apr 2023 16:00:34 +0100 Subject: [PATCH 05/16] Fix 8361cf5a73: Missing bounds check for house specs. (#10625) --- src/newgrf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/newgrf.cpp b/src/newgrf.cpp index bd283fa6d8..108eef1c96 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -5781,7 +5781,7 @@ static void TownHouseMapSpriteGroup(ByteReader *buf, uint8 idcount) if (!IsValidGroupID(groupid, "TownHouseMapSpriteGroup")) return; for (uint i = 0; i < idcount; i++) { - HouseSpec *hs = _cur.grffile->housespec[houses[i]]; + HouseSpec *hs = houses[i] >= NUM_HOUSES_PER_GRF ? nullptr : _cur.grffile->housespec[houses[i]]; if (hs == nullptr) { grfmsg(1, "TownHouseMapSpriteGroup: House %d undefined, skipping.", houses[i]); From 8aea13a85b6cfeb2e11864a1e71bb1021d88631c Mon Sep 17 00:00:00 2001 From: Charles Pigott Date: Mon, 10 Apr 2023 14:32:37 +0100 Subject: [PATCH 06/16] Codechange: Use fmt for SlErrorCorruptFmt --- src/core/pool_func.hpp | 6 +++--- src/saveload/saveload.cpp | 27 +++----------------------- src/saveload/saveload.h | 13 ++++++++++--- src/saveload/saveload_error.hpp | 34 +++++++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 30 deletions(-) create mode 100644 src/saveload/saveload_error.hpp diff --git a/src/core/pool_func.hpp b/src/core/pool_func.hpp index 0857a5142b..ea4b7b860a 100644 --- a/src/core/pool_func.hpp +++ b/src/core/pool_func.hpp @@ -14,7 +14,7 @@ #include "mem_func.hpp" #include "pool_type.hpp" -extern void NORETURN SlErrorCorruptFmt(const char *format, ...) WARN_FORMAT(1, 2); +#include "../saveload/saveload_error.hpp" // SlErrorCorruptFmt /** * Helper for defining the method's signature. @@ -157,13 +157,13 @@ DEFINE_POOL_METHOD(void *)::GetNew(size_t size) DEFINE_POOL_METHOD(void *)::GetNew(size_t size, size_t index) { if (index >= Tmax_size) { - SlErrorCorruptFmt("%s index " PRINTF_SIZE " out of range (" PRINTF_SIZE ")", this->name, index, Tmax_size); + SlErrorCorruptFmt("{} index {} out of range ({})", this->name, index, Tmax_size); } if (index >= this->size) this->ResizeFor(index); if (this->data[index] != nullptr) { - SlErrorCorruptFmt("%s index " PRINTF_SIZE " already in use", this->name, index); + SlErrorCorruptFmt("{} index {} already in use", this->name, index); } return this->AllocateItem(size, index); diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 604c6292e1..5ede15b4ab 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -315,7 +315,7 @@ static void SlNullPointers() _sl_version = SAVEGAME_VERSION; for (const ChunkHandler &ch : ChunkHandlers()) { - Debug(sl, 3, "Nulling pointers for {:c}{:c}{:c}{:c}", ch.id >> 24, ch.id >> 16, ch.id >> 8, ch.id); + Debug(sl, 3, "Nulling pointers for {}", ch.GetName()); ch.FixPointers(); } @@ -367,27 +367,6 @@ void NORETURN SlErrorCorrupt(const char *msg) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, msg); } -void NORETURN SlErrorCorruptFmt(const char *format, ...) WARN_FORMAT(1, 2); - -/** - * Issue an SlErrorCorrupt with a format string. - * @param format format string - * @param ... arguments to format string - * @note This function does never return as it throws an exception to - * break out of all the saveload code. - */ -void NORETURN SlErrorCorruptFmt(const char *format, ...) -{ - va_list ap; - char msg[256]; - - va_start(ap, format); - vseprintf(msg, lastof(msg), format, ap); - va_end(ap); - - SlErrorCorrupt(msg); -} - typedef void (*AsyncSaveFinishProc)(); ///< Callback for when the savegame loading is finished. static std::atomic _async_save_finish; ///< Callback to call when the savegame loading is finished. @@ -2242,7 +2221,7 @@ static void SlSaveChunk(const ChunkHandler &ch) if (ch.type == CH_READONLY) return; SlWriteUint32(ch.id); - Debug(sl, 2, "Saving chunk {:c}{:c}{:c}{:c}", ch.id >> 24, ch.id >> 16, ch.id >> 8, ch.id); + Debug(sl, 2, "Saving chunk {}", ch.GetName()); _sl.block_mode = ch.type; _sl.expect_table_header = (_sl.block_mode == CH_TABLE || _sl.block_mode == CH_SPARSE_TABLE); @@ -2331,7 +2310,7 @@ static void SlFixPointers() _sl.action = SLA_PTRS; for (const ChunkHandler &ch : ChunkHandlers()) { - Debug(sl, 3, "Fixing pointers for {:c}{:c}{:c}{:c}", ch.id >> 24, ch.id >> 16, ch.id >> 8, ch.id); + Debug(sl, 3, "Fixing pointers for {}", ch.GetName()); ch.FixPointers(); } diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h index 539992f5bb..0cc9cbaaa3 100644 --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -10,9 +10,9 @@ #ifndef SAVELOAD_H #define SAVELOAD_H +#include "saveload_error.hpp" #include "../fileio_type.h" #include "../fios.h" -#include "../strings_type.h" #include "../core/span_type.hpp" #include #include @@ -449,6 +449,15 @@ struct ChunkHandler { * @param len Number of bytes to skip. */ virtual void LoadCheck(size_t len = 0) const; + + std::string GetName() const + { + return std::string() + + static_cast(this->id >> 24) + + static_cast(this->id >> 16) + + static_cast(this->id >> 8) + + static_cast(this->id); + } }; /** A reference to ChunkHandler. */ @@ -1164,8 +1173,6 @@ void SlCopy(void *object, size_t length, VarType conv); std::vector SlTableHeader(const SaveLoadTable &slt); std::vector SlCompatTableHeader(const SaveLoadTable &slt, const SaveLoadCompatTable &slct); void SlObject(void *object, const SaveLoadTable &slt); -void NORETURN SlError(StringID string, const char *extra_msg = nullptr); -void NORETURN SlErrorCorrupt(const char *msg); bool SaveloadCrashWithMissingNewGRFs(); diff --git a/src/saveload/saveload_error.hpp b/src/saveload/saveload_error.hpp new file mode 100644 index 0000000000..77025f5a33 --- /dev/null +++ b/src/saveload/saveload_error.hpp @@ -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 saveload.h Functions/types related to errors from savegames. */ + +#ifndef SAVELOAD_ERROR_HPP +#define SAVELOAD_ERROR_HPP + +#include "../3rdparty/fmt/format.h" +#include "../strings_type.h" + +void NORETURN SlError(StringID string, const char *extra_msg = nullptr); +void NORETURN SlErrorCorrupt(const char *msg); + +/** + * Issue an SlErrorCorrupt with a format string. + * @param format_string The formatting string to tell what to do with the remaining arguments. + * @param fmt_args The arguments to be passed to fmt. + * @tparam T The type of formatting parameter. + * @tparam Args The types of the fmt arguments. + * @note This function does never return as it throws an exception to + * break out of all the saveload code. + */ +template +static inline void NORETURN SlErrorCorruptFmt(const T &format, Args&&... fmt_args) +{ + SlErrorCorrupt(fmt::format(format, fmt_args...).c_str()); +} + +#endif /* SAVELOAD_ERROR_HPP */ From ce247095761563fab6e4d8c7074fab561a757092 Mon Sep 17 00:00:00 2001 From: Charles Pigott Date: Mon, 10 Apr 2023 10:32:28 +0100 Subject: [PATCH 07/16] Add: Some additional debugging information when chunk sizes are incorrect --- src/saveload/saveload.cpp | 46 +++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 5ede15b4ab..354ffc6f99 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -651,11 +651,11 @@ static size_t _next_offs; */ int SlIterateArray() { - int index; - /* After reading in the whole array inside the loop * we must have read in all the data, so we must be at end of current block. */ - if (_next_offs != 0 && _sl.reader->GetSize() != _next_offs) SlErrorCorrupt("Invalid chunk size"); + if (_next_offs != 0 && _sl.reader->GetSize() != _next_offs) { + SlErrorCorruptFmt("Invalid chunk size iterating array - expected to be at position {}, actually at {}", _next_offs, _sl.reader->GetSize()); + } for (;;) { uint length = SlReadArrayLength(); @@ -673,6 +673,7 @@ int SlIterateArray() return INT32_MAX; } + int index; switch (_sl.block_mode) { case CH_SPARSE_TABLE: case CH_SPARSE_ARRAY: index = (int)SlReadSparseIndex(); break; @@ -2074,8 +2075,6 @@ void SlGlobList(const SaveLoadTable &slt) */ void SlAutolength(AutolengthProc *proc, void *arg) { - size_t offs; - assert(_sl.action == SLA_SAVE); /* Tell it to calculate the length */ @@ -2087,12 +2086,15 @@ void SlAutolength(AutolengthProc *proc, void *arg) _sl.need_length = NL_WANTLENGTH; SlSetLength(_sl.obj_len); - offs = _sl.dumper->GetSize() + _sl.obj_len; + size_t start_pos = _sl.dumper->GetSize(); + size_t expected_offs = start_pos + _sl.obj_len; /* And write the stuff */ proc(arg); - if (offs != _sl.dumper->GetSize()) SlErrorCorrupt("Invalid chunk size"); + if (expected_offs != _sl.dumper->GetSize()) { + SlErrorCorruptFmt("Invalid chunk size when writing autolength block, expected {}, got {}", _sl.obj_len, _sl.dumper->GetSize() - start_pos); + } } void ChunkHandler::LoadCheck(size_t len) const @@ -2121,8 +2123,6 @@ void ChunkHandler::LoadCheck(size_t len) const static void SlLoadChunk(const ChunkHandler &ch) { byte m = SlReadByte(); - size_t len; - size_t endoffs; _sl.block_mode = m & CH_TYPE_MASK; _sl.obj_len = 0; @@ -2146,15 +2146,20 @@ static void SlLoadChunk(const ChunkHandler &ch) ch.Load(); if (_next_offs != 0) SlErrorCorrupt("Invalid array length"); break; - case CH_RIFF: + case CH_RIFF: { /* Read length */ - len = (SlReadByte() << 16) | ((m >> 4) << 24); + size_t len = (SlReadByte() << 16) | ((m >> 4) << 24); len += SlReadUint16(); _sl.obj_len = len; - endoffs = _sl.reader->GetSize() + len; + size_t start_pos = _sl.reader->GetSize(); + size_t endoffs = start_pos + len; ch.Load(); - if (_sl.reader->GetSize() != endoffs) SlErrorCorrupt("Invalid chunk size"); + + if (_sl.reader->GetSize() != endoffs) { + SlErrorCorruptFmt("Invalid chunk size in RIFF in {} - expected {}, got {}", ch.GetName(), len, _sl.reader->GetSize() - start_pos); + } break; + } default: SlErrorCorrupt("Invalid chunk type"); break; @@ -2171,8 +2176,6 @@ static void SlLoadChunk(const ChunkHandler &ch) static void SlLoadCheckChunk(const ChunkHandler &ch) { byte m = SlReadByte(); - size_t len; - size_t endoffs; _sl.block_mode = m & CH_TYPE_MASK; _sl.obj_len = 0; @@ -2194,15 +2197,20 @@ static void SlLoadCheckChunk(const ChunkHandler &ch) case CH_SPARSE_ARRAY: ch.LoadCheck(); break; - case CH_RIFF: + case CH_RIFF: { /* Read length */ - len = (SlReadByte() << 16) | ((m >> 4) << 24); + size_t len = (SlReadByte() << 16) | ((m >> 4) << 24); len += SlReadUint16(); _sl.obj_len = len; - endoffs = _sl.reader->GetSize() + len; + size_t start_pos = _sl.reader->GetSize(); + size_t endoffs = start_pos + len; ch.LoadCheck(len); - if (_sl.reader->GetSize() != endoffs) SlErrorCorrupt("Invalid chunk size"); + + if (_sl.reader->GetSize() != endoffs) { + SlErrorCorruptFmt("Invalid chunk size in RIFF in {} - expected {}, got {}", ch.GetName(), len, _sl.reader->GetSize() - start_pos); + } break; + } default: SlErrorCorrupt("Invalid chunk type"); break; From ce046f6d1714d39ddc3c336b16c447e448ded193 Mon Sep 17 00:00:00 2001 From: PeterN Date: Mon, 10 Apr 2023 19:23:18 +0100 Subject: [PATCH 08/16] Fix: Abort loading savegame if road vehicle is on invalid road type. (#10622) This can happen if NewGRFs are missing so that engine or road type definitions are wrong. --- src/saveload/vehicle_sl.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp index 86e3d83ada..e0c217d762 100644 --- a/src/saveload/vehicle_sl.cpp +++ b/src/saveload/vehicle_sl.cpp @@ -401,9 +401,11 @@ void AfterLoadVehicles(bool part_of_load) rv->roadtype = Engine::Get(rv->engine_type)->u.road.roadtype; rv->compatible_roadtypes = GetRoadTypeInfo(rv->roadtype)->powered_roadtypes; + RoadTramType rtt = GetRoadTramType(rv->roadtype); for (RoadVehicle *u = rv; u != nullptr; u = u->Next()) { u->roadtype = rv->roadtype; u->compatible_roadtypes = rv->compatible_roadtypes; + if (GetRoadType(u->tile, rtt) == INVALID_ROADTYPE) SlErrorCorrupt("Road vehicle on invalid road type"); } RoadVehUpdateCache(rv); From 9e69556e2f65492897e11f63ca003a474d5043b4 Mon Sep 17 00:00:00 2001 From: translators Date: Mon, 10 Apr 2023 18:39:57 +0000 Subject: [PATCH 09/16] Update: Translations from eints english (au): 13 changes by krysclarke english (us): 15 changes by 2TallTyler russian: 12 changes by Ln-Wolf --- src/lang/english_AU.txt | 21 +++++++++++++-------- src/lang/english_US.txt | 24 +++++++++++++++--------- src/lang/russian.txt | 24 ++++++++++++------------ 3 files changed, 40 insertions(+), 29 deletions(-) diff --git a/src/lang/english_AU.txt b/src/lang/english_AU.txt index 1b47a4928f..17b9cdfa10 100644 --- a/src/lang/english_AU.txt +++ b/src/lang/english_AU.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}tiles/day +STR_UNITS_VELOCITY_KNOTS :{COMMA}{NBSP}knots STR_UNITS_POWER_IMPERIAL :{COMMA}{NBSP}hp STR_UNITS_POWER_METRIC :{COMMA}{NBSP}hp @@ -343,9 +344,9 @@ STR_GOTO_ORDER_VIEW_TOOLTIP :{BLACK}Open the ###length 31 STR_TOOLBAR_TOOLTIP_PAUSE_GAME :{BLACK}Pause game STR_TOOLBAR_TOOLTIP_FORWARD :{BLACK}Fast forward the game -STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Options -STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Save game, abandon game, exit -STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Display map, extra viewport or list of signs +STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Options and settings +STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Save, load or abandon game, exit program +STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Display map, extra viewport, cargo flow or list of signs STR_TOOLBAR_TOOLTIP_DISPLAY_TOWN_DIRECTORY :{BLACK}Display town directory STR_TOOLBAR_TOOLTIP_DISPLAY_SUBSIDIES :{BLACK}Display subsidies STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_STATIONS :{BLACK}Display list of company's stations @@ -353,9 +354,9 @@ STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_FINANCES :{BLACK}Display STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_GENERAL :{BLACK}Display general company information STR_TOOLBAR_TOOLTIP_DISPLAY_STORY_BOOK :{BLACK}Display story book STR_TOOLBAR_TOOLTIP_DISPLAY_GOALS_LIST :{BLACK}Display goal list -STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}Display graphs +STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}Display company graphs and cargo payment rates STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_LEAGUE :{BLACK}Display company league table -STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}Fund construction of new industry or list all industries +STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}Examine industries or fund construction of a new industry STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_TRAINS :{BLACK}Display list of company's trains. Ctrl+Click toggles opening the group/vehicle list STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_ROAD_VEHICLES :{BLACK}Display list of company's road vehicles. Ctrl+Click toggles opening the group/vehicle list STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_SHIPS :{BLACK}Display list of company's ships. Ctrl+Click toggles opening the group/vehicle list @@ -369,8 +370,8 @@ STR_TOOLBAR_TOOLTIP_BUILD_SHIP_DOCKS :{BLACK}Build sh STR_TOOLBAR_TOOLTIP_BUILD_AIRPORTS :{BLACK}Build airports STR_TOOLBAR_TOOLTIP_LANDSCAPING :{BLACK}Open the landscaping toolbar to raise/lower land, plant trees, etc. STR_TOOLBAR_TOOLTIP_SHOW_SOUND_MUSIC_WINDOW :{BLACK}Show sound/music window -STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Show last message/news report, show message options -STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Land area information, console, script debug, screenshots, about OpenTTD +STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Show last message/news report, messages history or delete all messages +STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Land area information, screenshot, about OpenTTD and developer tools STR_TOOLBAR_TOOLTIP_SWITCH_TOOLBAR :{BLACK}Switch toolbars # Extra tooltips for the scenario editor toolbar @@ -1808,7 +1809,9 @@ STR_CONFIG_SETTING_ALLOW_SHARES_HELPTEXT :When enabled, a STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES :Minimum company age to trade shares: {STRING} STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_HELPTEXT :Set the minimum age of a company for others to be able to buy and sell shares from them. +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_VALUE :{COMMA} year{P "" s} ###setting-zero-is-special +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_NO_MIN :No minimum STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE :Percentage of leg profit to pay in feeder systems: {STRING} STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE_HELPTEXT :Percentage of income given to the intermediate legs in feeder systems, giving more control over the income @@ -1952,13 +1955,15 @@ STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :Setting this to STR_CONFIG_SETTING_SHORT_PATH_SATURATION :Saturation of short paths before using high-capacity paths: {STRING} STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :Frequently there are multiple paths between two given stations. Cargodist will saturate the shortest path first, then use the second shortest path until that is saturated and so on. Saturation is determined by an estimation of capacity and planned usage. Once it has saturated all paths, if there is still demand left, it will overload all paths, prefering the ones with high capacity. Most of the time the algorithm will not estimate the capacity accurately, though. This setting allows you to specify up to which percentage a shorter path must be saturated in the first pass before choosing the next longer one. Set it to less than 100% to avoid overcrowded stations in case of overestimated capacity. -STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Speed units: {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Speed units (land): {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :Speed units (nautical): {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :Whenever a speed is shown in the user interface, show it in the selected units ###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 :Game units (tiles/day) +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :Knots STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :Vehicle power units: {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :Whenever a vehicle's power is shown in the user interface, show it in the selected units diff --git a/src/lang/english_US.txt b/src/lang/english_US.txt index 281cc4b93e..fddffa76a3 100644 --- a/src/lang/english_US.txt +++ b/src/lang/english_US.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}tiles/day +STR_UNITS_VELOCITY_KNOTS :{COMMA}{NBSP}knots STR_UNITS_POWER_IMPERIAL :{COMMA}{NBSP}hp STR_UNITS_POWER_METRIC :{COMMA}{NBSP}hp @@ -343,9 +344,9 @@ STR_GOTO_ORDER_VIEW_TOOLTIP :{BLACK}Open the ###length 31 STR_TOOLBAR_TOOLTIP_PAUSE_GAME :{BLACK}Pause game STR_TOOLBAR_TOOLTIP_FORWARD :{BLACK}Fast forward the game -STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Options -STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Save game, abandon game, quit -STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Display map, extra viewport, or list of signs +STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Options and settings +STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Save, load or abandon game, exit program +STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Display map, extra viewport, cargo flow or list of signs STR_TOOLBAR_TOOLTIP_DISPLAY_TOWN_DIRECTORY :{BLACK}Display town directory STR_TOOLBAR_TOOLTIP_DISPLAY_SUBSIDIES :{BLACK}Display subsidies STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_STATIONS :{BLACK}Display list of company's stations @@ -353,9 +354,9 @@ STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_FINANCES :{BLACK}Display STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_GENERAL :{BLACK}Display general company information STR_TOOLBAR_TOOLTIP_DISPLAY_STORY_BOOK :{BLACK}Display story book STR_TOOLBAR_TOOLTIP_DISPLAY_GOALS_LIST :{BLACK}Display goal list -STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}Display graphs +STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}Display company graphs and cargo payment rates STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_LEAGUE :{BLACK}Display company league table -STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}Fund construction of new industry or list all industries +STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}Examine industries or fund construction of a new industry STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_TRAINS :{BLACK}Display list of company's trains. Ctrl+Click toggles opening the group/vehicle list STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_ROAD_VEHICLES :{BLACK}Display list of company's road vehicles. Ctrl+Click toggles opening the group/vehicle list STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_SHIPS :{BLACK}Display list of company's ships. Ctrl+Click toggles opening the group/vehicle list @@ -369,8 +370,8 @@ STR_TOOLBAR_TOOLTIP_BUILD_SHIP_DOCKS :{BLACK}Build sh STR_TOOLBAR_TOOLTIP_BUILD_AIRPORTS :{BLACK}Build airports STR_TOOLBAR_TOOLTIP_LANDSCAPING :{BLACK}Open the landscaping toolbar to raise/lower land, plant trees, etc. STR_TOOLBAR_TOOLTIP_SHOW_SOUND_MUSIC_WINDOW :{BLACK}Show sound/music window -STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Show last message/news report, show message options -STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Land area information, console, script debug, screenshots, about OpenTTD +STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Show last message/news report, messages history or delete all messages +STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Land area information, screenshot, about OpenTTD and developer tools STR_TOOLBAR_TOOLTIP_SWITCH_TOOLBAR :{BLACK}Switch toolbars # Extra tooltips for the scenario editor toolbar @@ -1808,7 +1809,9 @@ STR_CONFIG_SETTING_ALLOW_SHARES_HELPTEXT :When enabled, a STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES :Minimum company age to trade shares: {STRING} STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_HELPTEXT :Set the minimum age of a company for others to be able to buy and sell shares from them. +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_VALUE :{COMMA} year{P "" s} ###setting-zero-is-special +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_NO_MIN :No minimum STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE :Percentage of leg profit to pay in feeder systems: {STRING} STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE_HELPTEXT :Percentage of income given to the intermediate legs in feeder systems, giving more control over the income @@ -1952,13 +1955,15 @@ STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :Setting this to STR_CONFIG_SETTING_SHORT_PATH_SATURATION :Saturation of short paths before using high-capacity paths: {STRING} STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :Frequently there are multiple paths between two given stations. Cargodist will saturate the shortest path first, then use the second shortest path until that is saturated and so on. Saturation is determined by an estimation of capacity and planned usage. Once it has saturated all paths, if there is still demand left, it will overload all paths, preferring the ones with high capacity. Most of the time the algorithm will not estimate the capacity accurately, though. This setting allows you to specify up to which percentage a shorter path must be saturated in the first pass before choosing the next longer one. Set it to less than 100% to avoid overcrowded stations in case of overestimated capacity. -STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Speed units: {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Speed units (land): {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :Speed units (nautical): {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :Whenever a speed is shown in the user interface, show it in the selected units ###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 :Game units (tiles/day) +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :Knots STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :Vehicle power units: {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :Whenever a vehicle's power is shown in the user interface, show it in the selected units @@ -4585,6 +4590,7 @@ STR_AI_CONFIG_AILIST_TOOLTIP :{BLACK}The AIs STR_AI_CONFIG_HUMAN_PLAYER :Human player 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_MOVE_UP :{BLACK}Move Up @@ -4598,7 +4604,7 @@ STR_AI_CONFIG_AI :{SILVER}AIs STR_AI_CONFIG_CHANGE_AI :{BLACK}Select AI STR_AI_CONFIG_CHANGE_GAMESCRIPT :{BLACK}Select Game Script -STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}Load another script +STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}Load another script. Ctrl+Click to show all available versions STR_AI_CONFIG_CONFIGURE :{BLACK}Configure STR_AI_CONFIG_CONFIGURE_TOOLTIP :{BLACK}Configure the parameters of the Script diff --git a/src/lang/russian.txt b/src/lang/russian.txt index eeb5a2d3f9..767c356e90 100644 --- a/src/lang/russian.txt +++ b/src/lang/russian.txt @@ -471,17 +471,17 @@ STR_GOTO_ORDER_VIEW_TOOLTIP :{BLACK}Пока STR_TOOLBAR_TOOLTIP_PAUSE_GAME :{BLACK}Пауза STR_TOOLBAR_TOOLTIP_FORWARD :{BLACK}Ускорить игру STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Настройки -STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Сохранение игры, главное меню, выход -STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Показать карту +STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Сохранение/загрузка игры; главное меню; выход +STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Карта; окна просмотра; грузовые потоки; таблички STR_TOOLBAR_TOOLTIP_DISPLAY_TOWN_DIRECTORY :{BLACK}Список городов -STR_TOOLBAR_TOOLTIP_DISPLAY_SUBSIDIES :{BLACK}Показать субсидии +STR_TOOLBAR_TOOLTIP_DISPLAY_SUBSIDIES :{BLACK}Субсидии STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_STATIONS :{BLACK}Список станций -STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_FINANCES :{BLACK}Показать финансовую информацию компании -STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_GENERAL :{BLACK}Показать основную информацию о компании -STR_TOOLBAR_TOOLTIP_DISPLAY_STORY_BOOK :{BLACK}Показать историю компании -STR_TOOLBAR_TOOLTIP_DISPLAY_GOALS_LIST :{BLACK}Показать список задач -STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}Показать графики -STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_LEAGUE :{BLACK}Показать рейтинги компаний +STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_FINANCES :{BLACK}Информация о финансах компаний +STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_GENERAL :{BLACK}Основная информация о компаниях +STR_TOOLBAR_TOOLTIP_DISPLAY_STORY_BOOK :{BLACK}История компаний +STR_TOOLBAR_TOOLTIP_DISPLAY_GOALS_LIST :{BLACK}Список задач +STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}Графики компаний и оплаты грузоперевозок +STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_LEAGUE :{BLACK}Рейтинги компаний STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}Список существующих предприятий; создание новых STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_TRAINS :{BLACK}Список поездов. Ctrl+щелчок переключает отображение по группам. STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_ROAD_VEHICLES :{BLACK}Список автотранспорта. Ctrl+щелчок переключает отображение по группам. @@ -496,8 +496,8 @@ STR_TOOLBAR_TOOLTIP_BUILD_SHIP_DOCKS :{BLACK}Стро STR_TOOLBAR_TOOLTIP_BUILD_AIRPORTS :{BLACK}Строительство аэропортов STR_TOOLBAR_TOOLTIP_LANDSCAPING :{BLACK}Открыть панель ландшафта для изменения рельефа, посадки деревьев и т.д. STR_TOOLBAR_TOOLTIP_SHOW_SOUND_MUSIC_WINDOW :{BLACK}Настройка звука и музыки -STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Показать последнее сообщение; настройки сообщений -STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Информация о территории, консоль, отладка скриптов, снимки экрана, об игре +STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Показать последнее сообщение; настройки и удаление сообщений +STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Информация о территории, об игре и инструментах разработчика, снимки экрана STR_TOOLBAR_TOOLTIP_SWITCH_TOOLBAR :{BLACK}Переключить панели инструментов # Extra tooltips for the scenario editor toolbar @@ -2114,7 +2114,7 @@ STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :английс STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC :метрическая (км/ч) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI :СИ (м/с) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS :внутриигровая (клетки в день) -STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :Узлы +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :узлы STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :Система единиц для мощности: {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :Показывать значения мощности двигателей транспортных средств в выбранной системе единиц From d7f0c5d6d80ba4c23d5b3717ef67f8a4ff046beb Mon Sep 17 00:00:00 2001 From: translators Date: Tue, 11 Apr 2023 18:42:26 +0000 Subject: [PATCH 10/16] Update: Translations from eints russian: 3 changes by Ln-Wolf finnish: 7 changes by hpiirai polish: 17 changes by pAter-exe --- src/lang/finnish.txt | 14 +++++++------- src/lang/polish.txt | 28 +++++++++++++++++----------- src/lang/russian.txt | 6 +++--- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/lang/finnish.txt b/src/lang/finnish.txt index 81f6f894e7..d46379bc12 100644 --- a/src/lang/finnish.txt +++ b/src/lang/finnish.txt @@ -344,9 +344,9 @@ STR_GOTO_ORDER_VIEW_TOOLTIP :{BLACK}Avaa kä ###length 31 STR_TOOLBAR_TOOLTIP_PAUSE_GAME :{BLACK}Tauko STR_TOOLBAR_TOOLTIP_FORWARD :{BLACK}Nopeuta peliä -STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Asetukset -STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Tallenna peli, hylkää peli, sulje -STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Näytä kartta, lisänäkymä ja kylttilista +STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Valinnat ja asetukset +STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Tallenna, lataa tai hylkää peli, lopeta ohjelma +STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Näytä kartta, lisänäkymä, rahtivirrat tai kylttilista STR_TOOLBAR_TOOLTIP_DISPLAY_TOWN_DIRECTORY :{BLACK}Näytä kuntahakemisto STR_TOOLBAR_TOOLTIP_DISPLAY_SUBSIDIES :{BLACK}Näytä tukitarjoukset STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_STATIONS :{BLACK}Näytä luettelo yhtiön asemista @@ -354,9 +354,9 @@ STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_FINANCES :{BLACK}Näytä STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_GENERAL :{BLACK}Näytä yhtiön yleiset tiedot STR_TOOLBAR_TOOLTIP_DISPLAY_STORY_BOOK :{BLACK}Näytä yhtiöhistoria STR_TOOLBAR_TOOLTIP_DISPLAY_GOALS_LIST :{BLACK}Näytä tavoitteet -STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}Näytä kuvaajat +STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}Näytä yhtiökuvaajat ja rahtitaksat STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_LEAGUE :{BLACK}Näytä yhtiökilpataulukko -STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}Rahoita uuden teollisuuden rakentamista ja näytä teollisuushakemisto +STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}Tutki teollisuuslaitoksia tai rahoita uuden teollisuuden rakentamista STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_TRAINS :{BLACK}Näytä luettelo yhtiön junista. Ctrl+napsautus näyttää luettelon ilman ryhmäluetteloa. STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_ROAD_VEHICLES :{BLACK}Näytä luettelo yhtiön ajoneuvoista. Ctrl+napsautus näyttää luettelon ilman ryhmäluetteloa. STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_SHIPS :{BLACK}Näytä luettelo yhtiön laivoista. Ctrl+napsautus näyttää luettelon ilman ryhmäluetteloa. @@ -370,8 +370,8 @@ STR_TOOLBAR_TOOLTIP_BUILD_SHIP_DOCKS :{BLACK}Rakenna STR_TOOLBAR_TOOLTIP_BUILD_AIRPORTS :{BLACK}Rakenna lentokenttiä STR_TOOLBAR_TOOLTIP_LANDSCAPING :{BLACK}Avaa maastonmuokkaustyökalupalkki maan kohottamiseen/madaltamiseen, puiden istuttamiseen, jne. STR_TOOLBAR_TOOLTIP_SHOW_SOUND_MUSIC_WINDOW :{BLACK}Näytä ääni- ja musiikkiasetukset -STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Näytä viimeisin viesti/uutisraportti, näytä viestiasetukset -STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Maa-aluetiedot, konsoli, skriptin virheenjäljitys, kuvankaappaukset, tietoja OpenTTD:stä +STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Näytä viimeisin viesti/uutisraportti, näytä viestihistoria tai poista kaikki viestit +STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Maa-aluetiedot, kuvakaappaus, tietoja OpenTTD:stä, kehittäjätyökalut STR_TOOLBAR_TOOLTIP_SWITCH_TOOLBAR :{BLACK}Vaihda työkalupalkkeja # Extra tooltips for the scenario editor toolbar diff --git a/src/lang/polish.txt b/src/lang/polish.txt index ace80e15c0..95e4a9c260 100644 --- a/src/lang/polish.txt +++ b/src/lang/polish.txt @@ -574,6 +574,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}p{P ole ola ól}/dzień +STR_UNITS_VELOCITY_KNOTS :{COMMA}{NBSP}w. STR_UNITS_POWER_IMPERIAL :{COMMA}{NBSP}hp STR_UNITS_POWER_METRIC :{COMMA}{NBSP}KM @@ -722,9 +723,9 @@ STR_GOTO_ORDER_VIEW_TOOLTIP :{BLACK}Otwórz ###length 31 STR_TOOLBAR_TOOLTIP_PAUSE_GAME :{BLACK}Pauza STR_TOOLBAR_TOOLTIP_FORWARD :{BLACK}Przyspieszenie czasu w grze -STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Opcje -STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Zapis gry, opuszczenie gry, wyjście -STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Wyświetl mapę, dodatkowy podgląd lub listę napisów +STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Opcje i ustawienia +STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Zapis, wczytanie lub opuszczenie rozgrywki, zamknięcie programu +STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Wyświetl mapę, dodatkowy podgląd, przepływ ładunków lub listę napisów STR_TOOLBAR_TOOLTIP_DISPLAY_TOWN_DIRECTORY :{BLACK}Wyświetl listę miast STR_TOOLBAR_TOOLTIP_DISPLAY_SUBSIDIES :{BLACK}Wyświetl dotacje STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_STATIONS :{BLACK}Wyświetl listę stacji firmy @@ -732,9 +733,9 @@ STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_FINANCES :{BLACK}Wyświet STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_GENERAL :{BLACK}Wyświetl informacje ogólne firmy STR_TOOLBAR_TOOLTIP_DISPLAY_STORY_BOOK :{BLACK}Wyświetl przewodnik STR_TOOLBAR_TOOLTIP_DISPLAY_GOALS_LIST :{BLACK}Wyświetl listę celów -STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}Wyświetl wykresy +STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}Wyświetlanie wykresów firmy i stawek płatności za ładunek STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_LEAGUE :{BLACK}Wyświetl ranking firm -STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}Ufunduj budowę nowego przedsiębiorstwa +STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}Analiza przedsiębiorstw lub fundowanie budowy nowego przedsiębiorstwa STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_TRAINS :{BLACK}Wyświetl listę pociągów firmy. Ctrl+klik przełącza otwieranie listy grup/pojazdów STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_ROAD_VEHICLES :{BLACK}Wyświetl listę pojazdów drogowych firmy. Ctrl+klik przełącza otwieranie listy grup/pojazdów STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_SHIPS :{BLACK}Wyświetl listę statków firmy. Ctrl+klik przełącza otwieranie listy grup/pojazdów @@ -748,8 +749,8 @@ STR_TOOLBAR_TOOLTIP_BUILD_SHIP_DOCKS :{BLACK}Budowa p STR_TOOLBAR_TOOLTIP_BUILD_AIRPORTS :{BLACK}Budowa lotnisk STR_TOOLBAR_TOOLTIP_LANDSCAPING :{BLACK}Zmiana terenu, podwyższanie/obniżanie lądu, sadzenie drzew, itp. STR_TOOLBAR_TOOLTIP_SHOW_SOUND_MUSIC_WINDOW :{BLACK}Wyświetl okno dźwięk/muzyka -STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Wyświetl ostatnią wiadomość/ogłoszenie, wyświetl ustawienia wiadomości -STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Informacje o terenie, konsola, debugowanie skryptów, zrzut ekranu, o grze OpenTTD +STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Wyświetlenie ostatniej wiadomości/ogłoszenia, historii wiadomości lub usunięcie wszystkich wiadomości +STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Informacje o terenie, zrzut ekranu, o grze OpenTTD oraz narzędzia dla deweloperów STR_TOOLBAR_TOOLTIP_SWITCH_TOOLBAR :{BLACK}Przełącz paski narzędzi # Extra tooltips for the scenario editor toolbar @@ -828,7 +829,7 @@ STR_GRAPH_MENU_INCOME_GRAPH :Wykres przychod STR_GRAPH_MENU_DELIVERED_CARGO_GRAPH :Wykres dostarczonego ładunku STR_GRAPH_MENU_PERFORMANCE_HISTORY_GRAPH :Wykres oceny wydajności STR_GRAPH_MENU_COMPANY_VALUE_GRAPH :Wykres wartości firmy -STR_GRAPH_MENU_CARGO_PAYMENT_RATES :Stawki za ładunek +STR_GRAPH_MENU_CARGO_PAYMENT_RATES :Stawki płatności za ładunek # Company league menu ###length 3 @@ -984,7 +985,7 @@ STR_GRAPH_CARGO_DELIVERED_CAPTION :{WHITE}Dostarcz STR_GRAPH_COMPANY_PERFORMANCE_RATINGS_CAPTION :{WHITE}Ocena wydajności firmy (maks. ocena=1000) STR_GRAPH_COMPANY_VALUES_CAPTION :{WHITE}Wartości firm -STR_GRAPH_CARGO_PAYMENT_RATES_CAPTION :{WHITE}Stawki za ładunek +STR_GRAPH_CARGO_PAYMENT_RATES_CAPTION :{WHITE}Stawki płatności za ładunek STR_GRAPH_CARGO_PAYMENT_RATES_X_LABEL :{TINY_FONT}{BLACK}Dni w transporcie STR_GRAPH_CARGO_PAYMENT_RATES_TITLE :{TINY_FONT}{BLACK}Dochód z przewozu 10 jednostek (lub 10,000 litrów) ładunku na odległość 20 pól STR_GRAPH_CARGO_ENABLE_ALL :{TINY_FONT}{BLACK}Włącz wszystko @@ -2188,7 +2189,9 @@ STR_CONFIG_SETTING_ALLOW_SHARES_HELPTEXT :Kiedy włączon STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES :Minimalny wiek firmy pozwalający na handel udziałami: {STRING} STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_HELPTEXT :Ustaw minimalny wiek firmy pozwalający innym kupować i sprzedawać jej akcje. +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_VALUE :{COMMA} {P "rok" "lata" "lat"} ###setting-zero-is-special +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_NO_MIN :Brak minimum STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE :Podział przychodów w przypadku przeładunków: {STRING} STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE_HELPTEXT :Manipulowanie zrównoważeniem podziałów w łańcuchu dowozowym: przy 0% przychód zostanie zaksięgowany na konto wyłącznie ostatniego pojazdu w łańcuchu, wyższa wartość zwiększa zrównoważenie podziału @@ -2332,13 +2335,15 @@ STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :Ustawienie tego STR_CONFIG_SETTING_SHORT_PATH_SATURATION :Nasycenie krótkich tras przed wybraniem tras o dużej przepustowości: {STRING} STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :Często istnieje wiele możliwych tras pomiędzy dwiema danymi stacjami. Mechanizm dystrybucji ładunków najpierw nasyci najkrótszą trasę, następnie użyje drugiej najkrótszej trasy, aż do jej nasycenia itd. Nasycenie jest ustalane na podstawie szacunkowej oceny przepustowości i planowanego wykorzystania. Po nasyceniu wszystkich tras, jeśli nadal istnieje zapotrzebowanie, algorytm przeciąży wszystkie trasy, preferując te o dużej przepustowości. W większości przypadków algorytm nie oszacuje jednak dokładnie przepustowości. To ustawienie pozwala określić, do jakiej wartości procentowej krótsza trasa musi zostać nasycona w pierwszym kroku, zanim zostanie wybrana kolejna, dłuższa trasa. Ustaw wartość mniejszą niż 100%, aby uniknąć przepełnionych stacji w przypadku przeszacowania przepustowości. -STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Jednostki prędkości: {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Jednostki prędkości (lądowe): {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :Jednostki prędkości (morskie): {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :Kiedy prędkość jest pokazywana w interfejsie użytkownika, wyświetl ją w wybranych jednostkach ###length 5 STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :Imperialne (mph) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC :Metryczne (km/h) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI :SI (m/s) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS :Jednostki gry (pola/dzień) +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :Węzły STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :Jednostka mocy pojazdów: {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :Kiedy moc pojazdu jest pokazywana w interfejsie użytkownika, wyświetl ją w wybranych jednostkach @@ -4971,6 +4976,7 @@ STR_AI_CONFIG_AILIST_TOOLTIP :{BLACK}SI, któ STR_AI_CONFIG_HUMAN_PLAYER :Ludzki gracz STR_AI_CONFIG_RANDOM_AI :Losowe SI STR_AI_CONFIG_NONE :(brak) +STR_AI_CONFIG_NAME_VERSION :{STRING} {YELLOW}v{NUM} STR_AI_CONFIG_MAX_COMPETITORS :{LTBLUE}Maksymalna liczba przeciwników: {ORANGE}{COMMA} STR_AI_CONFIG_MOVE_UP :{BLACK}Przesuń w górę @@ -4984,7 +4990,7 @@ STR_AI_CONFIG_AI :{SILVER}SI STR_AI_CONFIG_CHANGE_AI :{BLACK}Wybierz SI STR_AI_CONFIG_CHANGE_GAMESCRIPT :{BLACK}Wybierz Game Script -STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}Wczytaj kolejny skrypt +STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}Wczytaj inny skrypt. Ctrl+klik, aby wyświetlić wszystkie dostępne wersje STR_AI_CONFIG_CONFIGURE :{BLACK}Konfiguruj STR_AI_CONFIG_CONFIGURE_TOOLTIP :{BLACK}Konfiguruj parametry skryptu diff --git a/src/lang/russian.txt b/src/lang/russian.txt index 767c356e90..0a113796ca 100644 --- a/src/lang/russian.txt +++ b/src/lang/russian.txt @@ -321,7 +321,7 @@ STR_UNITS_VELOCITY_IMPERIAL :{COMMA}{NBSP}м STR_UNITS_VELOCITY_METRIC :{COMMA}{NBSP}км/ч STR_UNITS_VELOCITY_SI :{COMMA}{NBSP}м/с STR_UNITS_VELOCITY_GAMEUNITS :{DECIMAL}{NBSP}кл./день -STR_UNITS_VELOCITY_KNOTS :{COMMA}{NBSP}уз{P ел ла ов} +STR_UNITS_VELOCITY_KNOTS :{COMMA}{NBSP}уз{P ел ла лов} STR_UNITS_POWER_IMPERIAL :{COMMA}{NBSP}лс STR_UNITS_POWER_METRIC :{COMMA}{NBSP}лс @@ -2106,8 +2106,8 @@ STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :Установ STR_CONFIG_SETTING_SHORT_PATH_SATURATION :Предел загрузки коротких маршрутов перед использованием вместительных: {STRING} STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :При наличии нескольких маршрутов между станциями алгоритм распределения грузов будет использовать кратчайший маршрут до его загрузки, потом следующий по длине и т.{NBSP}д. При избытке груза маршруты будут перегружаться начиная с самых производительных. Загрузка рассчитывается исходя из оценки пропускной способности (которая может быть неточной) и интенсивности использования. Эта настройка определяет, насколько загружать маршрут перед тем, как начать использовать следующий. Установите значение ниже 100% для того, чтобы избежать задержки груза, если пропускная способность маршрута будет переоценена алгоритмом. -STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Система единиц для скорости (наземная): {STRING} -STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :Система единиц для скорости (морская): {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Система единиц скорости наземных ТС: {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :Система единиц скорости водных и воздушных ТС: {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :Показывать значения скорости в выбранной системе единиц ###length 5 STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :английская (миль/ч) From 3b2eb11fe8505e50b41f31bf0d19093c10d9007f Mon Sep 17 00:00:00 2001 From: PeterN Date: Tue, 11 Apr 2023 21:50:22 +0100 Subject: [PATCH 11/16] Codechange: Use cached name for all station/industry/town name formatting. (#10634) This reuses an existing name caching mechanism to avoid "recalculating" names every time. --- src/strings.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/strings.cpp b/src/strings.cpp index 8aa69bacd7..a143d83dee 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -35,6 +35,7 @@ #include "game/game_text.hpp" #include "network/network_content_gui.h" #include "newgrf_engine.h" +#include "core/backup_type.hpp" #include #include "table/strings.h" @@ -1456,7 +1457,11 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg const Industry *i = Industry::GetIfValid(args->GetInt32(SCC_INDUSTRY_NAME)); if (i == nullptr) break; - if (_scan_for_gender_data) { + static bool use_cache = true; + if (use_cache) { // Use cached version if first call + AutoRestoreBackup cache_backup(use_cache, false); + buff = strecpy(buff, i->GetCachedName(), last); + } else if (_scan_for_gender_data) { /* Gender is defined by the industry type. * STR_FORMAT_INDUSTRY_NAME may have the town first, so it would result in the gender of the town name */ StringParameters tmp_params(nullptr, 0, nullptr); @@ -1501,7 +1506,11 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg break; } - if (!st->name.empty()) { + static bool use_cache = true; + if (use_cache) { // Use cached version if first call + AutoRestoreBackup cache_backup(use_cache, false); + buff = strecpy(buff, st->GetCachedName(), last); + } else if (!st->name.empty()) { int64 args_array[] = {(int64)(size_t)st->name.c_str()}; StringParameters tmp_params(args_array); buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last); @@ -1531,7 +1540,11 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg const Town *t = Town::GetIfValid(args->GetInt32(SCC_TOWN_NAME)); if (t == nullptr) break; - if (!t->name.empty()) { + static bool use_cache = true; + if (use_cache) { // Use cached version if first call + AutoRestoreBackup cache_backup(use_cache, false); + buff = strecpy(buff, t->GetCachedName(), last); + } else if (!t->name.empty()) { int64 args_array[] = {(int64)(size_t)t->name.c_str()}; StringParameters tmp_params(args_array); buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last); From e17420777a6f3eff62e301b1ac1257036cb27010 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Wed, 12 Apr 2023 00:13:39 +0100 Subject: [PATCH 12/16] Fix #10637: Incorrect water infra total when building multi-tile object Wrong tile used in ownership checks --- src/object_cmd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp index d2b0f9a1b7..5b17cb8091 100644 --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -120,7 +120,7 @@ void BuildObject(ObjectType type, TileIndex tile, CompanyID owner, Town *town, u for (TileIndex t : ta) { WaterClass wc = (IsWaterTile(t) ? GetWaterClass(t) : WATER_CLASS_INVALID); /* Update company infrastructure counts for objects build on canals owned by nobody. */ - if (wc == WATER_CLASS_CANAL && owner != OWNER_NONE && (IsTileOwner(tile, OWNER_NONE) || IsTileOwner(tile, OWNER_WATER))) { + if (wc == WATER_CLASS_CANAL && owner != OWNER_NONE && (IsTileOwner(t, OWNER_NONE) || IsTileOwner(t, OWNER_WATER))) { Company::Get(owner)->infrastructure.water++; DirtyCompanyInfrastructureWindows(owner); } From d93f96a442a67d14e5215b881d0c5c20f1983535 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Tue, 11 Apr 2023 18:30:49 +0100 Subject: [PATCH 13/16] Fix: Account for extra dropdown list padding. --- src/widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widget.cpp b/src/widget.cpp index 6f679e2f47..1c590e3d3f 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -2810,7 +2810,7 @@ void NWidgetLeaf::SetupSmallestSize(Window *w, bool init_array) NWidgetLeaf::dropdown_dimension.width += WidgetDimensions::scaled.vscrollbar.Horizontal(); NWidgetLeaf::dropdown_dimension.height += WidgetDimensions::scaled.vscrollbar.Vertical(); } - padding = {WidgetDimensions::scaled.dropdowntext.Horizontal() + NWidgetLeaf::dropdown_dimension.width, WidgetDimensions::scaled.dropdowntext.Vertical()}; + padding = {WidgetDimensions::scaled.dropdowntext.Horizontal() + NWidgetLeaf::dropdown_dimension.width + WidgetDimensions::scaled.fullbevel.Horizontal(), WidgetDimensions::scaled.dropdowntext.Vertical()}; if (this->index >= 0) w->SetStringParameters(this->index); Dimension d2 = GetStringBoundingBox(this->widget_data); d2.width += padding.width; From 06b78a729994cd5dd8aef093378be975798fd266 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Tue, 11 Apr 2023 18:45:42 +0100 Subject: [PATCH 14/16] Fix: Don't double-pad existing size when adding widget padding. UpdateWidgetSize's size parameter already includes padding. --- src/genworld_gui.cpp | 39 +++++++++++++++++++++------------------ src/object_gui.cpp | 3 +-- src/vehicle_gui.cpp | 8 +++++--- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 6bb11658b7..a9dbb63b4c 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -591,62 +591,63 @@ struct GenerateLandscapeWindow : public Window { void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { + Dimension d{0, (uint)FONT_HEIGHT_NORMAL}; const StringID *strs = nullptr; switch (widget) { case WID_GL_HEIGHTMAP_HEIGHT_TEXT: SetDParam(0, MAX_TILE_HEIGHT); - *size = GetStringBoundingBox(STR_JUST_INT); + d = GetStringBoundingBox(STR_JUST_INT); break; case WID_GL_START_DATE_TEXT: SetDParam(0, ConvertYMDToDate(MAX_YEAR, 0, 1)); - *size = maxdim(*size, GetStringBoundingBox(STR_BLACK_DATE_LONG)); + d = GetStringBoundingBox(STR_BLACK_DATE_LONG); break; case WID_GL_MAPSIZE_X_PULLDOWN: case WID_GL_MAPSIZE_Y_PULLDOWN: SetDParamMaxValue(0, MAX_MAP_SIZE); - *size = maxdim(*size, GetStringBoundingBox(STR_JUST_INT)); + d = GetStringBoundingBox(STR_JUST_INT); break; case WID_GL_SNOW_COVERAGE_TEXT: SetDParamMaxValue(0, MAX_TILE_HEIGHT); - *size = maxdim(*size, GetStringBoundingBox(STR_MAPGEN_SNOW_COVERAGE_TEXT)); + d = GetStringBoundingBox(STR_MAPGEN_SNOW_COVERAGE_TEXT); break; case WID_GL_DESERT_COVERAGE_TEXT: SetDParamMaxValue(0, MAX_TILE_HEIGHT); - *size = maxdim(*size, GetStringBoundingBox(STR_MAPGEN_DESERT_COVERAGE_TEXT)); + d = GetStringBoundingBox(STR_MAPGEN_DESERT_COVERAGE_TEXT); break; case WID_GL_HEIGHTMAP_SIZE_TEXT: SetDParam(0, this->x); SetDParam(1, this->y); - *size = maxdim(*size, GetStringBoundingBox(STR_MAPGEN_HEIGHTMAP_SIZE)); + d = GetStringBoundingBox(STR_MAPGEN_HEIGHTMAP_SIZE); break; case WID_GL_TOWN_PULLDOWN: strs = _num_towns; SetDParamMaxValue(0, CUSTOM_TOWN_MAX_NUMBER); - *size = maxdim(*size, GetStringBoundingBox(STR_NUM_CUSTOM_NUMBER)); + d = GetStringBoundingBox(STR_NUM_CUSTOM_NUMBER); break; case WID_GL_INDUSTRY_PULLDOWN: strs = _num_inds; SetDParamMaxValue(0, IndustryPool::MAX_SIZE); - *size = maxdim(*size, GetStringBoundingBox(STR_NUM_CUSTOM_NUMBER)); + d = GetStringBoundingBox(STR_NUM_CUSTOM_NUMBER); break; case WID_GL_TERRAIN_PULLDOWN: strs = _elevations; SetDParamMaxValue(0, MAX_MAP_HEIGHT_LIMIT); - *size = maxdim(*size, GetStringBoundingBox(STR_TERRAIN_TYPE_CUSTOM_VALUE)); + d = GetStringBoundingBox(STR_TERRAIN_TYPE_CUSTOM_VALUE); break; case WID_GL_WATER_PULLDOWN: strs = _sea_lakes; SetDParamMaxValue(0, CUSTOM_SEA_LEVEL_MAX_PERCENTAGE); - *size = maxdim(*size, GetStringBoundingBox(STR_SEA_LEVEL_CUSTOM_PERCENTAGE)); + d = GetStringBoundingBox(STR_SEA_LEVEL_CUSTOM_PERCENTAGE); break; case WID_GL_RIVER_PULLDOWN: strs = _rivers; break; @@ -654,14 +655,14 @@ struct GenerateLandscapeWindow : public Window { case WID_GL_VARIETY_PULLDOWN: strs = _variety; break; case WID_GL_HEIGHTMAP_ROTATION_PULLDOWN: strs = _rotation; break; case WID_GL_BORDERS_RANDOM: - *size = maxdim(GetStringBoundingBox(STR_MAPGEN_BORDER_RANDOMIZE), GetStringBoundingBox(STR_MAPGEN_BORDER_MANUAL)); + d = maxdim(GetStringBoundingBox(STR_MAPGEN_BORDER_RANDOMIZE), GetStringBoundingBox(STR_MAPGEN_BORDER_MANUAL)); break; case WID_GL_WATER_NE: case WID_GL_WATER_NW: case WID_GL_WATER_SE: case WID_GL_WATER_SW: - *size = maxdim(GetStringBoundingBox(STR_MAPGEN_BORDER_RANDOM), maxdim(GetStringBoundingBox(STR_MAPGEN_BORDER_WATER), GetStringBoundingBox(STR_MAPGEN_BORDER_FREEFORM))); + d = maxdim(GetStringBoundingBox(STR_MAPGEN_BORDER_RANDOM), maxdim(GetStringBoundingBox(STR_MAPGEN_BORDER_WATER), GetStringBoundingBox(STR_MAPGEN_BORDER_FREEFORM))); break; case WID_GL_HEIGHTMAP_NAME_TEXT: @@ -673,11 +674,12 @@ struct GenerateLandscapeWindow : public Window { } if (strs != nullptr) { while (*strs != INVALID_STRING_ID) { - *size = maxdim(*size, GetStringBoundingBox(*strs++)); + d = maxdim(d, GetStringBoundingBox(*strs++)); } } - size->width += padding.width; - size->height = std::max(size->height, (uint)(FONT_HEIGHT_NORMAL + padding.height)); + d.width += padding.width; + d.height += padding.height; + *size = maxdim(*size, d); } void OnClick(Point pt, int widget, int click_count) override @@ -1158,9 +1160,10 @@ struct CreateScenarioWindow : public Window default: return; } - *size = maxdim(*size, GetStringBoundingBox(str)); - size->width += padding.width; - size->height += padding.height; + Dimension d = GetStringBoundingBox(str); + d.width += padding.width; + d.height += padding.height; + *size = maxdim(*size, d); } void OnClick(Point pt, int widget, int click_count) override diff --git a/src/object_gui.cpp b/src/object_gui.cpp index ea80d72d8a..db4f14f144 100644 --- a/src/object_gui.cpp +++ b/src/object_gui.cpp @@ -242,9 +242,8 @@ public: for (auto object_class_id : this->object_classes) { ObjectClass *objclass = ObjectClass::Get(object_class_id); if (objclass->GetUISpecCount() == 0) continue; - size->width = std::max(size->width, GetStringBoundingBox(objclass->name).width); + size->width = std::max(size->width, GetStringBoundingBox(objclass->name).width + padding.width); } - size->width += padding.width; this->line_height = FONT_HEIGHT_NORMAL + padding.height; resize->height = this->line_height; size->height = 5 * this->line_height; diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 21cdc20359..5b2195f2c6 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -2413,12 +2413,14 @@ struct VehicleDetailsWindow : Window { break; case WID_VD_SERVICE_INTERVAL_DROPDOWN: { + Dimension d{0, 0}; StringID *strs = _service_interval_dropdown; while (*strs != INVALID_STRING_ID) { - *size = maxdim(*size, GetStringBoundingBox(*strs++)); + d = maxdim(d, GetStringBoundingBox(*strs++)); } - size->width += padding.width; - size->height = FONT_HEIGHT_NORMAL + padding.height; + d.width += padding.width; + d.height += padding.height; + *size = maxdim(*size, d); break; } From a0d8545f6c534fe22807212e21d1508e559d6768 Mon Sep 17 00:00:00 2001 From: translators Date: Wed, 12 Apr 2023 18:42:18 +0000 Subject: [PATCH 15/16] Update: Translations from eints french: 15 changes by glx22 --- src/lang/french.txt | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/lang/french.txt b/src/lang/french.txt index 7dae0cb8aa..f178177477 100644 --- a/src/lang/french.txt +++ b/src/lang/french.txt @@ -196,6 +196,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}cases/jour +STR_UNITS_VELOCITY_KNOTS :{COMMA}{NBSP}nœuds STR_UNITS_POWER_IMPERIAL :{COMMA}{NBSP}hp STR_UNITS_POWER_METRIC :{COMMA}{NBSP}ch @@ -344,9 +345,9 @@ STR_GOTO_ORDER_VIEW_TOOLTIP :{BLACK}Ouvrir l ###length 31 STR_TOOLBAR_TOOLTIP_PAUSE_GAME :{BLACK}Mettre le jeu en pause STR_TOOLBAR_TOOLTIP_FORWARD :{BLACK}Avance rapide du jeu -STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Options -STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Sauvegarder, abandonner, quitter -STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Afficher la mini-carte, vue supplémentaire ou liste des panneaux +STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}Options et paramètres +STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}Sauvegarder, charger ou abandonner une partie, quitter le programme +STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}Afficher la mini-carte, vue supplémentaire, le flux des marchandises ou la liste des panneaux STR_TOOLBAR_TOOLTIP_DISPLAY_TOWN_DIRECTORY :{BLACK}Afficher l'annuaire des villes STR_TOOLBAR_TOOLTIP_DISPLAY_SUBSIDIES :{BLACK}Afficher les subventions STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_STATIONS :{BLACK}Afficher la liste des stations de la compagnie @@ -354,9 +355,9 @@ STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_FINANCES :{BLACK}Afficher STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_GENERAL :{BLACK}Afficher les informations générales STR_TOOLBAR_TOOLTIP_DISPLAY_STORY_BOOK :{BLACK}Afficher le livre d'histoire STR_TOOLBAR_TOOLTIP_DISPLAY_GOALS_LIST :{BLACK}Afficher la liste des objectifs -STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}Afficher les graphiques +STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}Afficher les graphiques de compagnie et les valeurs des marchandises STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_LEAGUE :{BLACK}Afficher le tableau de classement des compagnies -STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}Financer la construction de nouvelles industries ou lister toutes les industries +STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}Examiner les industries ou financer la construction de nouvelles industries STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_TRAINS :{BLACK}Afficher la liste des trains de la compagnie. Ctrl-clic pour ouvrir dans l'autre mode (avancé/normal) STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_ROAD_VEHICLES :{BLACK}Afficher la liste des véhicules routiers de la compagnie. Ctrl-clic pour ouvrir dans l'autre mode (avancé/normal) STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_SHIPS :{BLACK}Afficher la liste des navires de la compagnie. Ctrl-clic pour ouvrir dans l'autre mode (avancé/normal) @@ -370,8 +371,8 @@ STR_TOOLBAR_TOOLTIP_BUILD_SHIP_DOCKS :{BLACK}Construc STR_TOOLBAR_TOOLTIP_BUILD_AIRPORTS :{BLACK}Construction aéronautique STR_TOOLBAR_TOOLTIP_LANDSCAPING :{BLACK}Ouvrir la barre d'outils de terraformation pour relever/abaisser du terrain, planter des arbres, etc. STR_TOOLBAR_TOOLTIP_SHOW_SOUND_MUSIC_WINDOW :{BLACK}Options son et musique -STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Afficher le dernier message/bulletin, afficher les options des messages -STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Outils d'inspection du paysage, console, débogage de script, copies d'écran, à propos d'OpenTTD +STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}Afficher le dernier message/bulletin, l'historique des messages ou supprimer tous les messages +STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}Outils d'inspection du paysage, copies d'écran, à propos d'OpenTTD et outils pour développeurs STR_TOOLBAR_TOOLTIP_SWITCH_TOOLBAR :{BLACK}Changer de barre d'outils # Extra tooltips for the scenario editor toolbar @@ -1809,7 +1810,9 @@ STR_CONFIG_SETTING_ALLOW_SHARES_HELPTEXT :Lorsqu'il est a STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES :Âge minimum de la compagnie pour la vente d'actions{NBSP}: {STRING} STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_HELPTEXT :Définir l'âge minimum qu'une compagnie doit avoir pour que les autres puissent acheter ou vendre ses parts. +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_VALUE :{COMMA} an{P "" s} ###setting-zero-is-special +STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES_NO_MIN :Pas de minimum STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE :Pourcentage du profit de branche à payer dans les systèmes multimodaux{NBSP}: {STRING} STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE_HELPTEXT :Pourcentage du profit donné aux branches intermédiaires dans les systèmes multimodaux, donnant plus de contrôle sur les profits @@ -1953,13 +1956,15 @@ STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :Définir ici un STR_CONFIG_SETTING_SHORT_PATH_SATURATION :Saturation des chemins courts avant utilisation des chemins à forte capacité{NBSP}: {STRING} STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :Il y a souvent plusieurs routes possibles entre deux stations. Cargodist s'efforce d'utiliser d'abord le chemin le plus court jusqu'à saturation, ensuite les chemins un peu moins courts, et ainsi de suite. La saturation est déterminée par une estimation de la capacité et de la fréquentation prévue. Une fois que tous les chemins sont saturés, s'il y a encore une demande, il va surcharger tous les chemins, en privilégiant ceux à plus haute capacité. Mais la plupart du temps, la capacité n'est pas évaluée précisément. Ce réglage permets de spécifier jusqu'à quel pourcentage un chemin court doit être initialement saturé avant de passer au prochain chemin moins court. Il vaut mieux le régler à moins de 100% pour éviter que les stations soient surchargées en cas de surestimation de la capacité. -STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Unité de vitesse{NBSP}: {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :Unité de vitesse (terrestre){NBSP}: {STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :Unité de vitesse (nautique){NBSP}: {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :Quand une vitesse est affichée dans l'interface utilisateur, utiliser l'unité sélectionnée ###length 5 STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :Impérial (mph) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC :Métrique (km/h) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI :SI (m/s) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS :Unités du jeu (cases/jour) +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :Nœuds STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :Unité de puissance de véhicule{NBSP}: {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :Quand une puissance de véhicule est affichée dans l'interface utilisateur, utiliser l'unité sélectionnée @@ -4586,6 +4591,7 @@ STR_AI_CONFIG_AILIST_TOOLTIP :{BLACK}Les IAs STR_AI_CONFIG_HUMAN_PLAYER :Joueur humain 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_MOVE_UP :{BLACK}Déplacer vers le haut @@ -4599,7 +4605,7 @@ STR_AI_CONFIG_AI :{SILVER}IA STR_AI_CONFIG_CHANGE_AI :{BLACK}Sélectionner une IA STR_AI_CONFIG_CHANGE_GAMESCRIPT :{BLACK}Sélectionner le script de jeu -STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}Charger un autre script +STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}Charger un autre script. Ctrl-clic pour afficher toutes les versions disponibles STR_AI_CONFIG_CONFIGURE :{BLACK}Configurer STR_AI_CONFIG_CONFIGURE_TOOLTIP :{BLACK}Configurer les paramètres du script From 97cfd40649abab832315f00e6a07e5b6b9a17e23 Mon Sep 17 00:00:00 2001 From: Tyler Trahan Date: Wed, 12 Apr 2023 14:52:37 -0400 Subject: [PATCH 16/16] Fix #10630: Don't allow shifting service date earlier than 0 (#10643) --- src/vehicle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vehicle.cpp b/src/vehicle.cpp index bf35856f88..a979d4de3f 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -771,7 +771,7 @@ uint32 Vehicle::GetGRFID() const */ void Vehicle::ShiftDates(int interval) { - this->date_of_last_service += interval; + this->date_of_last_service = std::max(this->date_of_last_service + interval, 0); } /**