mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-13 01:29:10 +00:00
Compare commits
89 Commits
37fd69b604
...
release/12
Author | SHA1 | Date | |
---|---|---|---|
|
1893dba8a1 | ||
|
b9816f142b | ||
|
50bfa4fff8 | ||
|
081d242a4c | ||
|
22169eb182 | ||
|
7d26f4c434 | ||
|
3a7d2f32a4 | ||
|
18ef2607f9 | ||
|
9a20c47b42 | ||
|
b076369469 | ||
|
29607d27fa | ||
|
b63b3082ef | ||
|
4a309ebb4d | ||
|
6f6bc66997 | ||
|
45a1036177 | ||
|
8639e222c8 | ||
|
cce665c07b | ||
|
3b6ba45268 | ||
|
429a356e4e | ||
|
46b8382c64 | ||
|
0966f7b3d6 | ||
|
32e2a99dfd | ||
|
bde0de370d | ||
|
c1806bfca1 | ||
|
f24c334770 | ||
|
ea80e46e73 | ||
|
e0ccc58ed1 | ||
|
b185c80cb8 | ||
|
2df71a1752 | ||
|
a81f4cb6fe | ||
|
b8dbca465a | ||
|
24eb8164ba | ||
|
e38c779b52 | ||
|
97f545ba05 | ||
|
8aaed83338 | ||
|
4524acea38 | ||
|
94dfd1df21 | ||
|
a4428a0cbe | ||
|
521287839b | ||
|
5bd95ab7a0 | ||
|
6b12a05cc5 | ||
|
ec816c5746 | ||
|
280f54c0f7 | ||
|
cf4cf63b00 | ||
|
17dfc6e28a | ||
|
14ac0db7af | ||
|
a45f0a4d9b | ||
|
2890a4f9da | ||
|
460a216d69 | ||
|
443e31faab | ||
|
ff2445c6f2 | ||
|
84580a49d2 | ||
|
5a472beaa1 | ||
|
5e1164b093 | ||
|
eb59912c65 | ||
|
cfdfb6dcd7 | ||
|
f03ad12d4d | ||
|
f13052b742 | ||
|
09d881d579 | ||
|
61479fdcdc | ||
|
a652ea23c8 | ||
|
8a250da3bb | ||
|
6c7812636a | ||
|
0ebfae6a8d | ||
|
465a660a7a | ||
|
1b0f8fe2e4 | ||
|
fc7ed25915 | ||
|
3072b1904f | ||
|
7d96a2d993 | ||
|
8eb646dea0 | ||
|
33201896bf | ||
|
0b526fe1f0 | ||
|
06b2fa17e0 | ||
|
faca51686b | ||
|
3d46c6fc4c | ||
|
8d97ff816f | ||
|
4137c2e2e8 | ||
|
1bb94a51e1 | ||
|
ca91e767ed | ||
|
9d3a188e88 | ||
|
c06175cf27 | ||
|
5d5ff3e246 | ||
|
b69c7bd928 | ||
|
9c1f2b384b | ||
|
f10f95034a | ||
|
c369f56320 | ||
|
bd6b0db3c5 | ||
|
36e4ef0578 | ||
|
79dc634d41 |
@@ -8,7 +8,7 @@ notifications:
|
||||
only:
|
||||
- master
|
||||
only-by:
|
||||
- eints-sync\[bot\]
|
||||
- DorpsGek
|
||||
commit-comment:
|
||||
discussion:
|
||||
pull-request:
|
||||
|
468
.editorconfig
468
.editorconfig
@@ -7,471 +7,3 @@ trim_trailing_whitespace = true
|
||||
[*.{c,cpp,h,hpp}]
|
||||
indent_style = tab
|
||||
charset = utf-8
|
||||
#indent_size = <integer>
|
||||
#tab_width = <integer>
|
||||
#end_of_line = <lf, cf, crlf>
|
||||
|
||||
### 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
|
||||
|
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -42,7 +42,7 @@ Some things are not automated, and forgotten often. This list is a reminder for
|
||||
* This PR touches english.txt or translations? Check the [guidelines](https://github.com/OpenTTD/OpenTTD/blob/master/docs/eints.md)
|
||||
* This PR affects the save game format? (label 'savegame upgrade')
|
||||
* This PR affects the GS/AI API? (label 'needs review: Script API')
|
||||
* ai_changelog.hpp, game_changelog.hpp need updating.
|
||||
* ai_changelog.hpp, gs_changelog.hpp need updating.
|
||||
* The compatibility wrappers (compat_*.nut) need updating.
|
||||
* This PR affects the NewGRF API? (label 'needs review: NewGRF')
|
||||
* newgrf_debug_data.h may need updating.
|
||||
|
12
.github/codeql/codeql-config.yml
vendored
12
.github/codeql/codeql-config.yml
vendored
@@ -1,12 +0,0 @@
|
||||
name: openttd
|
||||
queries:
|
||||
- uses: security-and-quality
|
||||
query-filters:
|
||||
- exclude:
|
||||
id:
|
||||
# Only feasible way is to move away from fopen; fopen_s is optional C11 and not implemented on most platforms.
|
||||
- cpp/world-writable-file-creation
|
||||
# Basically OpenTTD's coding style for adding things like ..._INVALID to enumerations
|
||||
- cpp/irregular-enum-init
|
||||
# Our GUI code tends to use switches for OnClick handlers, DrawWidget, and UpdateWidgetSize. Sometimes GUIs just don't have many elements, but we want to keep consistency.
|
||||
- cpp/trivial-switch
|
10
.github/dependabot.yml
vendored
10
.github/dependabot.yml
vendored
@@ -1,10 +0,0 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "monthly"
|
||||
groups:
|
||||
actions:
|
||||
patterns:
|
||||
- "*"
|
71
.github/script-missing-mode-enforcement.py
vendored
71
.github/script-missing-mode-enforcement.py
vendored
@@ -1,71 +0,0 @@
|
||||
"""
|
||||
Script to scan the OpenTTD's script API for functions that miss checks for the
|
||||
function being called from the right mode (deity or company mode).
|
||||
|
||||
When a function calls either ScriptObject::Command or ScriptObject::GetCompany
|
||||
then the function is considered dangerous. When one of the mode enforcement
|
||||
macros from script_error.hpp, i.e. EnforceDeityMode, EnforceCompanyModeValid or
|
||||
EnforceDeityOrCompanyModeValid, are called in the function, then we consider
|
||||
that the function has mode enforcement.
|
||||
|
||||
Any dangerous function for which no enforcement is found are emitted as errors.
|
||||
"""
|
||||
|
||||
import glob
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
def check_mode_enforcement(path):
|
||||
errors = []
|
||||
with open(path, "r") as reader:
|
||||
mode_enforcement_found = False
|
||||
dangerous_function = False
|
||||
for line in reader:
|
||||
# Line does not start with a tab and have <word>::<word>. That looks like the begin of a function, so reset the state.
|
||||
if re.match(r"^[^\t].*\w::\w", line):
|
||||
mode_enforcement_found = False
|
||||
dangerous_function = False
|
||||
currentFunction = line
|
||||
continue
|
||||
|
||||
if re.match(
|
||||
r"\t(EnforceDeityMode|EnforceCompanyModeValid|EnforceCompanyModeValid_Void|EnforceDeityOrCompanyModeValid|EnforceDeityOrCompanyModeValid_Void)\(",
|
||||
line,
|
||||
):
|
||||
# Mode enforcement macro found
|
||||
mode_enforcement_found = True
|
||||
continue
|
||||
|
||||
if re.match(r".*(ScriptObject::Command|ScriptObject::GetCompany).*", line):
|
||||
# Dangerous function found
|
||||
dangerous_function = True
|
||||
continue
|
||||
|
||||
# Line with only a closing bracket. That looks like the end of a function, so check for the dangerous function without mode enforcement
|
||||
if re.match(r"^}$", line) and dangerous_function and not mode_enforcement_found:
|
||||
function_name = currentFunction.rstrip("\n").replace("/* static */ ", "")
|
||||
errors.append(f"{path}: {function_name}")
|
||||
|
||||
return errors
|
||||
|
||||
|
||||
def main():
|
||||
errors = []
|
||||
for path in sorted(glob.glob("src/script/api/*.cpp")):
|
||||
# Skip a number of files that yield only false positives
|
||||
if path.endswith(("script_object.cpp", "script_companymode.cpp", "script_controller.cpp", "script_game.cpp")):
|
||||
continue
|
||||
|
||||
errors.extend(check_mode_enforcement(path))
|
||||
|
||||
if errors:
|
||||
print("Mode enforcement was expected in the following files/functions:")
|
||||
print("\n".join(errors))
|
||||
sys.exit(1)
|
||||
|
||||
print("OK")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
34
.github/stale.yml
vendored
Normal file
34
.github/stale.yml
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
daysUntilClose: 7
|
||||
staleLabel: stale
|
||||
closeComment: false
|
||||
exemptMilestones: true
|
||||
exemptAssignees: true
|
||||
|
||||
issues:
|
||||
daysUntilStale: 60
|
||||
exemptLabels:
|
||||
- pinned
|
||||
- security
|
||||
- "good first issue"
|
||||
- regression
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had any activity in the last two months.
|
||||
|
||||
If you believe the issue is still relevant, please test on the latest nightly and report back.
|
||||
|
||||
It will be closed if no further activity occurs within 7 days.
|
||||
|
||||
Thank you for your contributions.
|
||||
|
||||
pulls:
|
||||
daysUntilStale: 30
|
||||
exemptLabels:
|
||||
- pinned
|
||||
markComment: >
|
||||
This pull request has been automatically marked as stale because it has not had any activity in the last month.
|
||||
|
||||
Please feel free to give a status update now, ping for review, or re-open when it's ready.
|
||||
|
||||
It will be closed if no further activity occurs within 7 days.
|
||||
|
||||
Thank you for your contributions.
|
7
.github/unused-strings.py
vendored
7
.github/unused-strings.py
vendored
@@ -210,10 +210,11 @@ def main():
|
||||
errors.append(f"ERROR: {string} is (possibly) no longer needed.")
|
||||
|
||||
if errors:
|
||||
print("\n".join(errors))
|
||||
for error in errors:
|
||||
print(error)
|
||||
sys.exit(1)
|
||||
|
||||
print("OK")
|
||||
else:
|
||||
print("OK")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
188
.github/workflows/ci-build.yml
vendored
188
.github/workflows/ci-build.yml
vendored
@@ -9,10 +9,6 @@ on:
|
||||
env:
|
||||
CTEST_OUTPUT_ON_FAILURE: 1
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
|
||||
|
||||
jobs:
|
||||
emscripten:
|
||||
name: Emscripten
|
||||
@@ -20,17 +16,17 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
container:
|
||||
# If you change this version, change the number in the cache step too.
|
||||
image: emscripten/emsdk:3.1.42
|
||||
image: emscripten/emsdk:2.0.31
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup cache
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /emsdk/upstream/emscripten/cache
|
||||
key: 3.1.42-${{ runner.os }}
|
||||
key: 2.0.31-${{ runner.os }}
|
||||
|
||||
- name: Patch Emscripten to support LZMA
|
||||
run: |
|
||||
@@ -65,56 +61,37 @@ jobs:
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(nproc) cores"
|
||||
cmake --build . -j $(nproc) --target openttd
|
||||
cmake --build . -j $(nproc)
|
||||
echo "::endgroup::"
|
||||
|
||||
linux:
|
||||
name: Linux
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Clang - Debug
|
||||
compiler: clang-15
|
||||
cxxcompiler: clang++-15
|
||||
libraries: libsdl2-dev
|
||||
- name: Clang - Release
|
||||
compiler: clang-15
|
||||
cxxcompiler: clang++-15
|
||||
libraries: libsdl2-dev
|
||||
extra-cmake-parameters: -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPTION_USE_ASSERTS=OFF
|
||||
- name: GCC - SDL2
|
||||
compiler: gcc
|
||||
- compiler: clang
|
||||
cxxcompiler: clang++
|
||||
libsdl: libsdl2-dev
|
||||
- compiler: gcc
|
||||
cxxcompiler: g++
|
||||
libraries: libsdl2-dev
|
||||
- name: GCC - SDL1.2
|
||||
compiler: gcc
|
||||
libsdl: libsdl2-dev
|
||||
- compiler: gcc
|
||||
cxxcompiler: g++
|
||||
libraries: libsdl1.2-dev
|
||||
- name: GCC - Dedicated
|
||||
compiler: gcc
|
||||
libsdl: libsdl1.2-dev
|
||||
- compiler: gcc
|
||||
cxxcompiler: g++
|
||||
libraries: grfcodec
|
||||
extra-cmake-parameters: -DOPTION_DEDICATED=ON -DCMAKE_CXX_FLAGS_INIT="-DRANDOM_DEBUG" -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON
|
||||
# Compile without SDL / SDL2, as that should compile fine too.
|
||||
extra-cmake-parameters: -DOPTION_DEDICATED=ON -DCMAKE_CXX_FLAGS_INIT="-DRANDOM_DEBUG"
|
||||
|
||||
name: Linux (${{ matrix.name }})
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
CC: ${{ matrix.compiler }}
|
||||
CXX: ${{ matrix.cxxcompiler }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup vcpkg caching
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
|
||||
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
|
||||
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
@@ -125,25 +102,13 @@ jobs:
|
||||
echo "::group::Install dependencies"
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
liballegro4-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libfontconfig-dev \
|
||||
libharfbuzz-dev \
|
||||
libicu-dev \
|
||||
liblzma-dev \
|
||||
liblzo2-dev \
|
||||
${{ matrix.libraries }} \
|
||||
${{ matrix.libsdl }} \
|
||||
zlib1g-dev \
|
||||
# EOF
|
||||
|
||||
echo "::group::Install vcpkg dependencies"
|
||||
|
||||
# Disable vcpkg integration, as we mostly use system libraries.
|
||||
mv vcpkg.json vcpkg-disabled.json
|
||||
|
||||
# We only use breakpad from vcpkg, as its CMake files
|
||||
# are a bit special. So the Ubuntu's variant doesn't work.
|
||||
vcpkg install breakpad
|
||||
|
||||
echo "::endgroup::"
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
@@ -172,7 +137,7 @@ jobs:
|
||||
cd build
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake .. -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake ${{ matrix.extra-cmake-parameters }}
|
||||
cmake .. ${{ matrix.extra-cmake-parameters }}
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
@@ -182,18 +147,12 @@ jobs:
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
(
|
||||
cd build
|
||||
ctest -j $(nproc) --timeout 120
|
||||
)
|
||||
|
||||
# Re-enable vcpkg.
|
||||
mv vcpkg-disabled.json vcpkg.json
|
||||
|
||||
# Check no tracked files have been modified.
|
||||
git diff --exit-code
|
||||
cd build
|
||||
ctest -j $(nproc) --timeout 120
|
||||
|
||||
macos:
|
||||
name: Mac OS
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -201,28 +160,40 @@ jobs:
|
||||
- arch: x64
|
||||
full_arch: x86_64
|
||||
|
||||
name: Mac OS (${{ matrix.arch }})
|
||||
|
||||
runs-on: macos-latest
|
||||
env:
|
||||
MACOSX_DEPLOYMENT_TARGET: 10.13
|
||||
MACOSX_DEPLOYMENT_TARGET: 10.14
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup vcpkg caching
|
||||
uses: actions/github-script@v7
|
||||
- name: Prepare cache key
|
||||
id: key
|
||||
run: |
|
||||
echo "::set-output name=image::$ImageOS-$ImageVersion"
|
||||
|
||||
- name: Enable vcpkg cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
script: |
|
||||
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
|
||||
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
|
||||
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
|
||||
path: /usr/local/share/vcpkg/installed
|
||||
key: ${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }}-0 # Increase the number whenever dependencies are modified
|
||||
restore-keys: |
|
||||
${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }}
|
||||
|
||||
- name: Prepare vcpkg
|
||||
run: |
|
||||
vcpkg install --triplet=${{ matrix.arch }}-osx \
|
||||
liblzma \
|
||||
libpng \
|
||||
lzo \
|
||||
zlib \
|
||||
# EOF
|
||||
|
||||
- name: Install OpenGFX
|
||||
run: |
|
||||
mkdir -p ~/Documents/OpenTTD/baseset
|
||||
cd ~/Documents/OpenTTD/baseset
|
||||
cd ~/Documents//OpenTTD/baseset
|
||||
|
||||
echo "::group::Download OpenGFX"
|
||||
curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip -o opengfx-all.zip
|
||||
@@ -243,7 +214,7 @@ jobs:
|
||||
cd build
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake .. \
|
||||
cmake ${GITHUB_WORKSPACE} \
|
||||
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.full_arch }} \
|
||||
-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-osx \
|
||||
-DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake \
|
||||
@@ -261,27 +232,46 @@ jobs:
|
||||
ctest -j $(sysctl -n hw.logicalcpu) --timeout 120
|
||||
|
||||
windows:
|
||||
name: Windows
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [windows-latest, windows-2019]
|
||||
arch: [x86, x64]
|
||||
|
||||
name: Windows (${{ matrix.os }} / ${{ matrix.arch }})
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup vcpkg caching
|
||||
uses: actions/github-script@v7
|
||||
- name: Prepare cache key
|
||||
id: key
|
||||
shell: powershell
|
||||
run: |
|
||||
# Work around caching failure with GNU tar
|
||||
New-Item -Type Junction -Path vcpkg -Target c:\vcpkg
|
||||
|
||||
Write-Output "::set-output name=image::$env:ImageOS-$env:ImageVersion"
|
||||
|
||||
- name: Enable vcpkg cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
script: |
|
||||
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
|
||||
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
|
||||
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
|
||||
path: vcpkg/installed
|
||||
key: ${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }}-0 # Increase the number whenever dependencies are modified
|
||||
restore-keys: |
|
||||
${{ steps.key.outputs.image }}-vcpkg-${{ matrix.arch }}
|
||||
|
||||
- name: Prepare vcpkg
|
||||
shell: bash
|
||||
run: |
|
||||
vcpkg install --triplet=${{ matrix.arch }}-windows-static \
|
||||
liblzma \
|
||||
libpng \
|
||||
lzo \
|
||||
zlib \
|
||||
# EOF
|
||||
|
||||
- name: Install OpenGFX
|
||||
shell: bash
|
||||
@@ -309,8 +299,6 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
env:
|
||||
NINJA_STATUS: "[%f/%t -- %e] " # [finished_edges/total_edges -- elapsed_time], default value is "[%f/%t] "
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
@@ -330,11 +318,13 @@ jobs:
|
||||
- name: Test
|
||||
shell: bash
|
||||
run: |
|
||||
cd build
|
||||
cd ${GITHUB_WORKSPACE}/build
|
||||
ctest --timeout 120
|
||||
|
||||
|
||||
msys2:
|
||||
name: msys2
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -344,13 +334,11 @@ jobs:
|
||||
- msystem: MINGW32
|
||||
arch: i686
|
||||
|
||||
name: MinGW (${{ matrix.arch }})
|
||||
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup MSYS2
|
||||
uses: msys2/setup-msys2@v2
|
||||
@@ -364,8 +352,6 @@ jobs:
|
||||
mingw-w64-${{ matrix.arch }}-gcc
|
||||
mingw-w64-${{ matrix.arch }}-lzo2
|
||||
mingw-w64-${{ matrix.arch }}-libpng
|
||||
mingw-w64-${{ matrix.arch }}-lld
|
||||
mingw-w64-${{ matrix.arch }}-ninja
|
||||
|
||||
- name: Install OpenGFX
|
||||
shell: bash
|
||||
@@ -388,28 +374,24 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
shell: msys2 {0}
|
||||
env:
|
||||
NINJA_STATUS: "[%f/%t -- %e] " # [finished_edges/total_edges -- elapsed_time], default value is "[%f/%t] "
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake .. \
|
||||
-GNinja \
|
||||
-DCMAKE_CXX_FLAGS="-fuse-ld=lld" \
|
||||
# EOF
|
||||
cmake .. -G"MSYS Makefiles"
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
cmake --build .
|
||||
echo "Running on $(nproc) cores"
|
||||
cmake --build . -j $(nproc)
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Test
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
cd build
|
||||
ctest --timeout 120
|
||||
ctest -j $(nproc) --timeout 120
|
||||
|
||||
check_annotations:
|
||||
name: Check Annotations
|
||||
@@ -426,4 +408,4 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Check annotations
|
||||
uses: OpenTTD/actions/annotation-check@v5
|
||||
uses: OpenTTD/actions/annotation-check@v2
|
||||
|
85
.github/workflows/codeql.yml
vendored
85
.github/workflows/codeql.yml
vendored
@@ -1,85 +0,0 @@
|
||||
name: CodeQL
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches:
|
||||
- master
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
echo "::group::Update apt"
|
||||
sudo apt-get update
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Install dependencies"
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
liballegro4-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libfontconfig-dev \
|
||||
libharfbuzz-dev \
|
||||
libicu-dev \
|
||||
liblzma-dev \
|
||||
liblzo2-dev \
|
||||
libsdl2-dev \
|
||||
zlib1g-dev \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
|
||||
- name: Set number of make jobs
|
||||
run: |
|
||||
echo "MAKEFLAGS=-j$(nproc)" >> $GITHUB_ENV
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: cpp
|
||||
config-file: ./.github/codeql/codeql-config.yml
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
with:
|
||||
category: /language:cpp
|
||||
upload: False
|
||||
output: sarif-results
|
||||
|
||||
- name: Filter out table & generated code
|
||||
uses: advanced-security/filter-sarif@v1
|
||||
with:
|
||||
patterns: |
|
||||
+**/*.*
|
||||
-**/table/*.*
|
||||
-**/generated/**/*.*
|
||||
-**/tests/*.*
|
||||
input: sarif-results/cpp.sarif
|
||||
output: sarif-results/cpp.sarif
|
||||
|
||||
- name: Upload results
|
||||
uses: github/codeql-action/upload-sarif@v3
|
||||
with:
|
||||
sarif_file: sarif-results/cpp.sarif
|
8
.github/workflows/commit-checker.yml
vendored
8
.github/workflows/commit-checker.yml
vendored
@@ -3,10 +3,6 @@ name: Commit checker
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
|
||||
|
||||
jobs:
|
||||
commit-checker:
|
||||
name: Commit checker
|
||||
@@ -14,12 +10,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 4
|
||||
|
||||
- name: Get pull-request commits
|
||||
uses: OpenTTD/actions/checkout-pull-request@v5
|
||||
uses: OpenTTD/actions/checkout-pull-request@v2
|
||||
|
||||
- name: Check commits
|
||||
uses: OpenTTD/OpenTTD-git-hooks@main
|
||||
|
103
.github/workflows/preview-build.yml
vendored
103
.github/workflows/preview-build.yml
vendored
@@ -1,103 +0,0 @@
|
||||
name: Preview build
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
secrets:
|
||||
PREVIEW_CLOUDFLARE_API_TOKEN:
|
||||
description: API token to upload a preview to Cloudflare Pages
|
||||
required: true
|
||||
PREVIEW_CLOUDFLARE_ACCOUNT_ID:
|
||||
description: Account ID to upload a preview to Cloudflare Pages
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
preview:
|
||||
name: Build preview
|
||||
|
||||
environment:
|
||||
name: preview
|
||||
url: https://preview.openttd.org/pr${{ github.event.pull_request.number }}/
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
# If you change this version, change the number in the cache step too.
|
||||
image: emscripten/emsdk:3.1.42
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: Name branch
|
||||
run: |
|
||||
git config --global --add safe.directory ${GITHUB_WORKSPACE}
|
||||
git checkout -b pr${{ github.event.pull_request.number }}
|
||||
|
||||
- name: Setup cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /emsdk/upstream/emscripten/cache
|
||||
key: 3.1.42-${{ runner.os }}
|
||||
|
||||
- name: Patch Emscripten to support LZMA
|
||||
run: |
|
||||
cd /emsdk/upstream/emscripten
|
||||
patch -p1 < ${GITHUB_WORKSPACE}/os/emscripten/emsdk-liblzma.patch
|
||||
|
||||
- name: Build (host tools)
|
||||
run: |
|
||||
mkdir build-host
|
||||
cd build-host
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake .. -DOPTION_TOOLS_ONLY=ON
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(nproc) cores"
|
||||
make -j$(nproc) tools
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Install GCC problem matcher
|
||||
uses: ammaraskar/gcc-problem-matcher@master
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
echo "::group::CMake"
|
||||
emcmake cmake .. \
|
||||
-DHOST_BINARY_DIR=../build-host \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(nproc) cores"
|
||||
cmake --build . -j $(nproc) --target openttd
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Prepare preview
|
||||
run: |
|
||||
mkdir public
|
||||
|
||||
cp build/openttd.data public/
|
||||
cp build/openttd.html public/
|
||||
cp build/openttd.js public/
|
||||
cp build/openttd.wasm public/
|
||||
|
||||
# Ensure we use the latest version of npm; the one we get with current
|
||||
# emscripten doesn't allow running "npx wrangler" as root.
|
||||
# Current emscripten can't install npm>=10.0.0 because node is too old.
|
||||
npm install -g npm@9
|
||||
|
||||
- name: Publish preview
|
||||
uses: cloudflare/pages-action@v1
|
||||
with:
|
||||
apiToken: ${{ secrets.PREVIEW_CLOUDFLARE_API_TOKEN }}
|
||||
accountId: ${{ secrets.PREVIEW_CLOUDFLARE_ACCOUNT_ID }}
|
||||
projectName: ${{ vars.PREVIEW_CLOUDFLARE_PROJECT_NAME }}
|
||||
directory: public
|
||||
branch: pr${{ github.event.pull_request.number }}
|
20
.github/workflows/preview.yml
vendored
20
.github/workflows/preview.yml
vendored
@@ -1,20 +0,0 @@
|
||||
name: Preview
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- labeled
|
||||
- synchronize
|
||||
branches:
|
||||
- master
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
preview:
|
||||
if: ${{ (github.event.action == 'labeled' && github.event.label.name == 'preview') || (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'preview')) }}
|
||||
name: Preview
|
||||
uses: ./.github/workflows/preview-build.yml
|
||||
secrets: inherit
|
133
.github/workflows/preview_build.yml
vendored
Normal file
133
.github/workflows/preview_build.yml
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
name: Preview build
|
||||
|
||||
on:
|
||||
repository_dispatch:
|
||||
types:
|
||||
- Preview*
|
||||
|
||||
jobs:
|
||||
preview:
|
||||
name: Build preview
|
||||
|
||||
runs-on: ubuntu-20.04
|
||||
container:
|
||||
# If you change this version, change the number in the cache step too.
|
||||
image: emscripten/emsdk:2.0.31
|
||||
|
||||
steps:
|
||||
- name: Update deployment status to in progress
|
||||
uses: octokit/request-action@v2.x
|
||||
with:
|
||||
route: POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses
|
||||
mediaType: |
|
||||
previews:
|
||||
- ant-man
|
||||
- flash
|
||||
owner: ${{ github.event.repository.owner.login }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
deployment_id: ${{ github.event.client_payload.deployment_id }}
|
||||
state: in_progress
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: ${{ github.event.client_payload.sha }}
|
||||
|
||||
- name: Name branch
|
||||
run: |
|
||||
name=$(echo "${{ github.event.client_payload.folder }}")
|
||||
git checkout -b ${name}
|
||||
|
||||
- name: Setup cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /emsdk/upstream/emscripten/cache
|
||||
key: 2.0.31-${{ runner.os }}
|
||||
|
||||
- name: Patch Emscripten to support LZMA
|
||||
run: |
|
||||
cd /emsdk/upstream/emscripten
|
||||
patch -p1 < ${GITHUB_WORKSPACE}/os/emscripten/emsdk-liblzma.patch
|
||||
|
||||
- name: Build (host tools)
|
||||
run: |
|
||||
mkdir build-host
|
||||
cd build-host
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake .. -DOPTION_TOOLS_ONLY=ON
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(nproc) cores"
|
||||
make -j$(nproc) tools
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Install GCC problem matcher
|
||||
uses: ammaraskar/gcc-problem-matcher@master
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
echo "::group::CMake"
|
||||
emcmake cmake .. \
|
||||
-DHOST_BINARY_DIR=../build-host \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(nproc) cores"
|
||||
emmake make -j$(nproc)
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Publish preview
|
||||
run: |
|
||||
pip3 install awscli
|
||||
|
||||
aws s3 cp --only-show-errors build/openttd.data s3://${{ secrets.PREVIEW_S3_BUCKET }}/${{ github.event.client_payload.folder }}/
|
||||
aws s3 cp --only-show-errors build/openttd.html s3://${{ secrets.PREVIEW_S3_BUCKET }}/${{ github.event.client_payload.folder }}/
|
||||
aws s3 cp --only-show-errors build/openttd.js s3://${{ secrets.PREVIEW_S3_BUCKET }}/${{ github.event.client_payload.folder }}/
|
||||
aws s3 cp --only-show-errors build/openttd.wasm s3://${{ secrets.PREVIEW_S3_BUCKET }}/${{ github.event.client_payload.folder }}/
|
||||
|
||||
# Invalidate the cache of the CloudFront distribution
|
||||
aws cloudfront create-invalidation --distribution-id ${{ secrets.PREVIEW_CF_DISTRIBUTION_ID }} --paths "/${{ github.event.client_payload.folder }}/*"
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
|
||||
- name: Update deployment status to success
|
||||
uses: octokit/request-action@v2.x
|
||||
with:
|
||||
route: POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses
|
||||
mediaType: |
|
||||
previews:
|
||||
- ant-man
|
||||
- flash
|
||||
owner: ${{ github.event.repository.owner.login }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
deployment_id: ${{ github.event.client_payload.deployment_id }}
|
||||
state: success
|
||||
environment_url: https://preview.openttd.org/${{ github.event.client_payload.folder }}/
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
||||
|
||||
- if: failure()
|
||||
name: Update deployment status to failure
|
||||
uses: octokit/request-action@v2.x
|
||||
with:
|
||||
route: POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses
|
||||
mediaType: |
|
||||
previews:
|
||||
- ant-man
|
||||
- flash
|
||||
owner: ${{ github.event.repository.owner.login }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
deployment_id: ${{ github.event.client_payload.deployment_id }}
|
||||
state: failure
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
66
.github/workflows/preview_label.yml
vendored
Normal file
66
.github/workflows/preview_label.yml
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
name: Preview label
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- labeled
|
||||
|
||||
env:
|
||||
TEAM_CORE_DEVELOPER: core-developers
|
||||
|
||||
jobs:
|
||||
check_preview_label:
|
||||
name: Check for preview label
|
||||
if: github.event.action == 'labeled' && github.event.label.name == 'preview'
|
||||
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Check if label was added by core developer
|
||||
id: core_developer
|
||||
continue-on-error: true
|
||||
uses: octokit/request-action@v2.x
|
||||
with:
|
||||
route: GET /orgs/OpenTTD/teams/${{ env.TEAM_CORE_DEVELOPER }}/memberships/${{ github.event.sender.login }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
||||
|
||||
- if: steps.core_developer.outcome == 'failure'
|
||||
name: Remove preview label if not core developer
|
||||
uses: octokit/request-action@v2.x
|
||||
with:
|
||||
route: DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/preview
|
||||
owner: ${{ github.event.repository.owner.login }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
issue_number: ${{ github.event.number }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
||||
|
||||
- if: steps.core_developer.outcome == 'success'
|
||||
name: Create deployment
|
||||
id: deployment
|
||||
uses: octokit/request-action@v2.x
|
||||
with:
|
||||
route: POST /repos/{owner}/{repo}/deployments
|
||||
mediaType: |
|
||||
previews:
|
||||
- ant-man
|
||||
- flash
|
||||
owner: ${{ github.event.repository.owner.login }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
task: deploy:preview
|
||||
auto_merge: false
|
||||
required_contexts: "[]"
|
||||
environment: preview-pr-${{ github.event.number }}
|
||||
description: "Preview for Pull Request #${{ github.event.number }}"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
||||
|
||||
- if: steps.core_developer.outcome == 'success'
|
||||
name: Trigger 'preview build'
|
||||
uses: peter-evans/repository-dispatch@v1
|
||||
with:
|
||||
token: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
||||
event-type: "Preview build #${{ github.event.number }}"
|
||||
client-payload: '{"folder": "pr${{ github.event.number }}", "sha": "${{ github.event.pull_request.head.sha }}", "deployment_id": "${{ fromJson(steps.deployment.outputs.data).id }}"}'
|
66
.github/workflows/preview_push.yml
vendored
Normal file
66
.github/workflows/preview_push.yml
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
name: Preview push
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- synchronize
|
||||
|
||||
jobs:
|
||||
check_new_preview:
|
||||
name: Check preview needs update
|
||||
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Check if earlier preview exists
|
||||
id: earlier_preview
|
||||
uses: octokit/request-action@v2.x
|
||||
with:
|
||||
route: GET /repos/{owner}/{repo}/deployments
|
||||
owner: ${{ github.event.repository.owner.login }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
environment: preview-pr-${{ github.event.number }}
|
||||
per_page: 1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
||||
|
||||
- if: toJson(fromJson(steps.earlier_preview.outputs.data)) != '[]'
|
||||
name: Check for preview label
|
||||
id: preview_label
|
||||
uses: octokit/request-action@v2.x
|
||||
with:
|
||||
route: GET /repos/{owner}/{repo}/issues/{issue_number}/labels
|
||||
owner: ${{ github.event.repository.owner.login }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
issue_number: ${{ github.event.number }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
||||
|
||||
- if: toJson(fromJson(steps.earlier_preview.outputs.data)) != '[]' && contains(fromJson(steps.preview_label.outputs.data).*.name, 'preview')
|
||||
name: Create deployment
|
||||
id: deployment
|
||||
uses: octokit/request-action@v2.x
|
||||
with:
|
||||
route: POST /repos/{owner}/{repo}/deployments
|
||||
mediaType: |
|
||||
previews:
|
||||
- ant-man
|
||||
- flash
|
||||
owner: ${{ github.event.repository.owner.login }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
task: deploy:preview
|
||||
auto_merge: false
|
||||
required_contexts: "[]"
|
||||
environment: preview-pr-${{ github.event.number }}
|
||||
description: "Preview for Pull Request #${{ github.event.number }}"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
||||
|
||||
- if: toJson(fromJson(steps.earlier_preview.outputs.data)) != '[]' && contains(fromJson(steps.preview_label.outputs.data).*.name, 'preview')
|
||||
name: Trigger 'preview build'
|
||||
uses: peter-evans/repository-dispatch@v1
|
||||
with:
|
||||
token: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
||||
event-type: "Preview build #${{ github.event.number }}"
|
||||
client-payload: '{"folder": "pr${{ github.event.number }}", "sha": "${{ github.event.pull_request.head.sha }}", "deployment_id": "${{ fromJson(steps.deployment.outputs.data).id }}"}'
|
85
.github/workflows/release-docs.yml
vendored
85
.github/workflows/release-docs.yml
vendored
@@ -1,85 +0,0 @@
|
||||
name: Release (Docs)
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
version:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
docs:
|
||||
name: Docs
|
||||
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Download source
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: internal-source
|
||||
|
||||
- name: Unpack source
|
||||
run: |
|
||||
tar -xf source.tar.gz --strip-components=1
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
echo "::group::Update apt"
|
||||
sudo apt-get update
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Install dependencies"
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
doxygen \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir -p ${GITHUB_WORKSPACE}/build
|
||||
cd ${GITHUB_WORKSPACE}/build
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake ${GITHUB_WORKSPACE} \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DOPTION_DOCS_ONLY=ON \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
cmake --build . --target docs
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Create bundles
|
||||
run: |
|
||||
BASENAME=openttd-${{ inputs.version }}
|
||||
|
||||
cd ${GITHUB_WORKSPACE}/build
|
||||
|
||||
mv docs/source ${BASENAME}-docs
|
||||
mv docs/ai-api ${BASENAME}-docs-ai
|
||||
mv docs/gs-api ${BASENAME}-docs-gs
|
||||
|
||||
mkdir -p bundles
|
||||
|
||||
echo "::group::Create docs bundle"
|
||||
tar --xz -cf bundles/${BASENAME}-docs.tar.xz ${BASENAME}-docs
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Create AI API docs bundle"
|
||||
tar --xz -cf bundles/${BASENAME}-docs-ai.tar.xz ${BASENAME}-docs-ai
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Create GameScript API docs bundle"
|
||||
tar --xz -cf bundles/${BASENAME}-docs-gs.tar.xz ${BASENAME}-docs-gs
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Store bundles
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: openttd-docs
|
||||
path: build/bundles/*.tar.xz
|
||||
retention-days: 5
|
182
.github/workflows/release-linux.yml
vendored
182
.github/workflows/release-linux.yml
vendored
@@ -1,182 +0,0 @@
|
||||
name: Release (Linux)
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
survey_key:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
|
||||
jobs:
|
||||
linux:
|
||||
name: Linux (Generic)
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
# manylinux_2_28 is based on AlmaLinux 8, and already has a lot of things
|
||||
# installed and preconfigured. It makes it easier to build OpenTTD.
|
||||
# This distro is based on glibc 2.28, released in 2018.
|
||||
image: quay.io/pypa/manylinux_2_28_x86_64
|
||||
|
||||
steps:
|
||||
- name: Download source
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: internal-source
|
||||
|
||||
- name: Unpack source
|
||||
run: |
|
||||
tar -xf source.tar.gz --strip-components=1
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Enable Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
|
||||
- name: Setup vcpkg caching
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
|
||||
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
|
||||
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
echo "::group::Install system dependencies"
|
||||
# perl-IPC-Cmd, wget, and zip are needed to run vcpkg.
|
||||
# autoconf-archive is needed to build ICU.
|
||||
yum install -y \
|
||||
autoconf-archive \
|
||||
perl-IPC-Cmd \
|
||||
wget \
|
||||
zip \
|
||||
# EOF
|
||||
|
||||
# aclocal looks first in /usr/local/share/aclocal, and if that doesn't
|
||||
# exist only looks in /usr/share/aclocal. We have files in both that
|
||||
# are important. So copy the latter to the first, and we are good to
|
||||
# go.
|
||||
cp /usr/share/aclocal/* /usr/local/share/aclocal/
|
||||
echo "::endgroup::"
|
||||
|
||||
# The yum variant of fluidsynth depends on all possible audio drivers,
|
||||
# like jack, ALSA, pulseaudio, etc. This is not really useful for us,
|
||||
# as we route the output of fluidsynth back via our sound driver, and
|
||||
# as such do not use these audio driver outputs at all.
|
||||
# The vcpkg variant of fluidsynth depends on ALSA. Similar issue here.
|
||||
# So instead, we compile fluidsynth ourselves, with as few
|
||||
# dependencies as possible. We do it before anything else is installed,
|
||||
# to make sure it doesn't pick up on any of the drivers.
|
||||
echo "::group::Install fluidsynth"
|
||||
wget https://github.com/FluidSynth/fluidsynth/archive/v2.3.3.tar.gz
|
||||
tar xf v2.3.3.tar.gz
|
||||
(
|
||||
cd fluidsynth-2.3.3
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr
|
||||
cmake --build . -j $(nproc)
|
||||
cmake --install .
|
||||
)
|
||||
|
||||
echo "::group::Install audio drivers"
|
||||
# These audio libs are to make sure the SDL version of vcpkg adds
|
||||
# sound-support; these libraries are not added to the resulting
|
||||
# binary, but the headers are used to enable them in SDL.
|
||||
yum install -y \
|
||||
alsa-lib-devel \
|
||||
pulseaudio-libs-devel \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Install video drivers"
|
||||
# These video libs are to make sure the SDL version of vcpkg adds
|
||||
# video-support; these libraries are not added to the resulting
|
||||
# binary, but the headers are used to enable them in SDL.
|
||||
yum install -y \
|
||||
libX11-devel \
|
||||
libXcursor-devel \
|
||||
libXext-devel \
|
||||
libXfixes-devel \
|
||||
libXi-devel \
|
||||
libxkbcommon-devel \
|
||||
libXrandr-devel \
|
||||
libXScrnSaver-devel \
|
||||
mesa-libEGL-devel \
|
||||
mesa-libGL-devel \
|
||||
mesa-libGLES-devel \
|
||||
wayland-devel \
|
||||
wayland-protocols-devel \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
# We use vcpkg for our dependencies, to get more up-to-date version.
|
||||
echo "::group::Install vcpkg and dependencies"
|
||||
|
||||
git clone https://github.com/microsoft/vcpkg /vcpkg
|
||||
|
||||
(
|
||||
cd /vcpkg
|
||||
./bootstrap-vcpkg.sh -disableMetrics
|
||||
)
|
||||
|
||||
echo "::group::Install breakpad dependencies"
|
||||
cargo install dump_syms
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Install GCC problem matcher
|
||||
uses: ammaraskar/gcc-problem-matcher@master
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir -p build
|
||||
cd build
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake ${GITHUB_WORKSPACE} \
|
||||
-DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
|
||||
-DOPTION_PACKAGE_DEPENDENCIES=ON \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(nproc) cores"
|
||||
cmake --build . -j $(nproc) --target openttd
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Create breakpad symbols
|
||||
run: |
|
||||
cd build
|
||||
dump_syms ./openttd --inlines --store symbols
|
||||
|
||||
- name: Create bundles
|
||||
run: |
|
||||
cd ${GITHUB_WORKSPACE}/build
|
||||
echo "::group::Run CPack"
|
||||
cpack
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Cleanup"
|
||||
# Remove the sha256 files CPack generates; we will do this ourself at
|
||||
# the end of this workflow.
|
||||
rm -f bundles/*.sha256
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Store bundles
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: openttd-linux-generic
|
||||
path: build/bundles
|
||||
retention-days: 5
|
||||
|
||||
- name: Store symbols
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: symbols-linux-generic
|
||||
path: build/symbols
|
||||
retention-days: 5
|
216
.github/workflows/release-macos.yml
vendored
216
.github/workflows/release-macos.yml
vendored
@@ -1,216 +0,0 @@
|
||||
name: Release (MacOS)
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
survey_key:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
|
||||
jobs:
|
||||
macos:
|
||||
name: MacOS
|
||||
|
||||
runs-on: macos-latest
|
||||
env:
|
||||
MACOSX_DEPLOYMENT_TARGET: 10.13
|
||||
|
||||
steps:
|
||||
- name: Download source
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: internal-source
|
||||
|
||||
- name: Unpack source
|
||||
run: |
|
||||
tar -xf source.tar.gz --strip-components=1
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Enable Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
|
||||
- name: Setup vcpkg caching
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
|
||||
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
|
||||
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
|
||||
|
||||
- name: Install dependencies
|
||||
env:
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
run: |
|
||||
echo "::group::Install brew dependencies"
|
||||
brew install \
|
||||
pandoc \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Install breakpad dependencies"
|
||||
cargo install dump_syms
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Install GCC problem matcher
|
||||
uses: ammaraskar/gcc-problem-matcher@master
|
||||
|
||||
- name: Build tools
|
||||
run: |
|
||||
mkdir build-host
|
||||
cd build-host
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake ${GITHUB_WORKSPACE} \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DOPTION_TOOLS_ONLY=ON \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build tools"
|
||||
echo "Running on $(sysctl -n hw.logicalcpu) cores"
|
||||
cmake --build . -j $(sysctl -n hw.logicalcpu) --target tools
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Import code signing certificates
|
||||
uses: Apple-Actions/import-codesign-certs@v2
|
||||
with:
|
||||
# The certificates in a PKCS12 file encoded as a base64 string
|
||||
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
|
||||
# The password used to import the PKCS12 file.
|
||||
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
|
||||
# If this is run on a fork, there may not be a certificate set up - continue in this case
|
||||
continue-on-error: true
|
||||
|
||||
- name: Build arm64
|
||||
run: |
|
||||
mkdir build-arm64
|
||||
cd build-arm64
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake ${GITHUB_WORKSPACE} \
|
||||
-DCMAKE_OSX_ARCHITECTURES=arm64 \
|
||||
-DVCPKG_TARGET_TRIPLET=arm64-osx \
|
||||
-DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake \
|
||||
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(sysctl -n hw.logicalcpu) cores"
|
||||
cmake --build . -j $(sysctl -n hw.logicalcpu) --target openttd
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Build x64
|
||||
run: |
|
||||
mkdir build-x64
|
||||
cd build-x64
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake ${GITHUB_WORKSPACE} \
|
||||
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
|
||||
-DVCPKG_TARGET_TRIPLET=x64-osx \
|
||||
-DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake \
|
||||
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
|
||||
-DCPACK_BUNDLE_APPLE_CERT_APP=${{ secrets.APPLE_DEVELOPER_CERTIFICATE_ID }} \
|
||||
"-DCPACK_BUNDLE_APPLE_CODESIGN_PARAMETER=--deep -f --options runtime" \
|
||||
-DAPPLE_UNIVERSAL_PACKAGE=1 \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(sysctl -n hw.logicalcpu) cores"
|
||||
cmake --build . -j $(sysctl -n hw.logicalcpu) --target openttd
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Create breakpad symbols
|
||||
run: |
|
||||
cd build-x64
|
||||
mkdir dSYM
|
||||
dsymutil ./openttd -o dSYM/openttd
|
||||
dump_syms ./dSYM/openttd --inlines --store symbols
|
||||
|
||||
cd ../build-arm64
|
||||
mkdir dSYM
|
||||
dsymutil ./openttd -o dSYM/openttd
|
||||
dump_syms ./dSYM/openttd --inlines --store ../build-x64/symbols
|
||||
|
||||
- name: Create bundles
|
||||
run: |
|
||||
cd build-x64
|
||||
|
||||
echo "::group::Create universal binary"
|
||||
# Combine the `openttd` binaries from each build into a single file
|
||||
lipo -create -output openttd-universal ../build-*/openttd
|
||||
mv openttd-universal openttd
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Run CPack"
|
||||
cpack
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Cleanup"
|
||||
# Remove the sha256 files CPack generates; we will do this ourself at
|
||||
# the end of this workflow.
|
||||
rm -f bundles/*.sha256
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Notarize
|
||||
env:
|
||||
AC_USERNAME: ${{ secrets.APPLE_DEVELOPER_APP_USERNAME }}
|
||||
AC_PASSWORD: ${{ secrets.APPLE_DEVELOPER_APP_PASSWORD }}
|
||||
AC_TEAM_ID: ${{ secrets.APPLE_DEVELOPER_TEAM_ID }}
|
||||
run: |
|
||||
if [ -z "${AC_USERNAME}" ]; then
|
||||
# We may be running on a fork that doesn't have notarization secrets set up; skip this step
|
||||
echo No notarization secrets set up, skipping.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
xcrun notarytool store-credentials --apple-id "${AC_USERNAME}" --password "${AC_PASSWORD}" --team-id "${AC_TEAM_ID}" openttd
|
||||
cd build-x64
|
||||
../os/macosx/notarize.sh
|
||||
|
||||
- name: Build zip
|
||||
run: |
|
||||
cd build-x64
|
||||
|
||||
pushd _CPack_Packages/*/Bundle/openttd-*/
|
||||
|
||||
# Remove the Applications symlink from the staging folder
|
||||
rm -f Applications
|
||||
|
||||
# Remove the original dmg built by CPack to avoid a conflict when resolving
|
||||
# the zip_filename variable below
|
||||
rm -f ../*.dmg
|
||||
|
||||
zip_filename=(../openttd-*)
|
||||
|
||||
# Package up the existing, notarised .app into a zip file
|
||||
zip -r -9 ${zip_filename}.zip OpenTTD.app
|
||||
|
||||
popd
|
||||
|
||||
# Now move it into place to be uploaded
|
||||
mv _CPack_Packages/*/Bundle/openttd-*.zip bundles/
|
||||
|
||||
- name: Store bundles
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: openttd-macos-universal
|
||||
path: build-x64/bundles
|
||||
retention-days: 5
|
||||
|
||||
- name: Store symbols
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: symbols-macos-universal
|
||||
path: build-x64/symbols
|
||||
retention-days: 5
|
207
.github/workflows/release-source.yml
vendored
207
.github/workflows/release-source.yml
vendored
@@ -1,207 +0,0 @@
|
||||
name: Release (Source)
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
outputs:
|
||||
version:
|
||||
value: ${{ jobs.source.outputs.version }}
|
||||
is_tag:
|
||||
value: ${{ jobs.source.outputs.is_tag }}
|
||||
trigger_type:
|
||||
value: ${{ jobs.source.outputs.trigger_type }}
|
||||
folder:
|
||||
value: ${{ jobs.source.outputs.folder }}
|
||||
survey_key:
|
||||
value: ${{ jobs.source.outputs.survey_key }}
|
||||
|
||||
jobs:
|
||||
source:
|
||||
name: Source
|
||||
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
outputs:
|
||||
version: ${{ steps.metadata.outputs.version }}
|
||||
is_tag: ${{ steps.metadata.outputs.is_tag }}
|
||||
trigger_type: ${{ steps.metadata.outputs.trigger_type }}
|
||||
folder: ${{ steps.metadata.outputs.folder }}
|
||||
survey_key: ${{ steps.survey_key.outputs.survey_key }}
|
||||
|
||||
steps:
|
||||
- name: Checkout (Release)
|
||||
if: github.event_name == 'release'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# We generate a changelog; for this we need the full git log.
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Checkout (Manual)
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.inputs.ref }}
|
||||
# We generate a changelog; for this we need the full git log.
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Checkout (Trigger)
|
||||
if: github.event_name == 'repository_dispatch'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.client_payload.ref }}
|
||||
# We generate a changelog; for this we need the full git log.
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Check valid branch name
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
REF="${{ github.event.inputs.ref }}"
|
||||
elif [ "${{ github.event_name }}" = "repository_dispatch" ]; then
|
||||
REF="${{ github.event.client_payload.ref }}"
|
||||
else
|
||||
REF="${{ github.ref }}"
|
||||
fi
|
||||
|
||||
# Check if we are a tag.
|
||||
if [ -n "$(git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || false)" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if the checkout caused the branch to be named.
|
||||
if [ "$(git rev-parse --abbrev-ref HEAD)" != "HEAD" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if this was a pull request.
|
||||
if [ -n "$(echo ${REF} | grep '^refs/pull/[0-9]*')" ]; then
|
||||
PULL=$(echo ${REF} | cut -d/ -f3)
|
||||
git checkout -b pr${PULL}
|
||||
fi
|
||||
|
||||
# Are we still in a detached state? Error out.
|
||||
if [ "$(git rev-parse --abbrev-ref HEAD)" == "HEAD" ]; then
|
||||
echo "The 'ref' given resulted in a checkout of a detached HEAD."
|
||||
echo "We cannot detect the version for these checkout accurate."
|
||||
echo ""
|
||||
echo "If you want to build a Pull Request, make sure you use 'refs/pull/NNN/head'."
|
||||
echo ""
|
||||
echo "Cancelling build, as without a version we cannot store the artifacts."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Generate metadata
|
||||
id: metadata
|
||||
run: |
|
||||
echo "::group::Prepare metadata files"
|
||||
cmake -DGENERATE_OTTDREV=1 -P cmake/scripts/FindVersion.cmake
|
||||
./.github/changelog.sh > .changelog
|
||||
TZ='UTC' date +"%Y-%m-%d %H:%M UTC" > .release_date
|
||||
cat .ottdrev | cut -f 1 -d$'\t' > .version
|
||||
|
||||
if [ $(cat .ottdrev | cut -f 5 -d$'\t') = '1' ]; then
|
||||
# Assume that all tags are always releases. Why else make a tag?
|
||||
IS_TAG="true"
|
||||
|
||||
FOLDER="${{ env.FOLDER_RELEASES }}"
|
||||
TRIGGER_TYPE="new-tag"
|
||||
else
|
||||
IS_TAG="false"
|
||||
|
||||
BRANCH=$(git symbolic-ref -q HEAD | sed 's@.*/@@')
|
||||
if [ -z "${BRANCH}" ]; then
|
||||
echo "Internal error: branch name is empty."
|
||||
echo "An earlier step should have prevented this from happening."
|
||||
echo "Cancelling build, as without a branch name we cannot store the artifacts"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${BRANCH}" = "${{ env.NIGHTLIES_BRANCH }}" ]; then
|
||||
# The "master" branch is special, and we call a nightly.
|
||||
FOLDER="${{ env.FOLDER_NIGHTLIES }}/$(date +%Y)"
|
||||
TRIGGER_TYPE="new-master"
|
||||
else
|
||||
# All other branches, which can be builds of Pull Requests, are
|
||||
# put in their own folder.
|
||||
FOLDER="${{ env.FOLDER_BRANCHES }}/${BRANCH}"
|
||||
TRIGGER_TYPE="new-branch"
|
||||
fi
|
||||
fi
|
||||
|
||||
mkdir -p build/bundles
|
||||
cp .changelog build/bundles/changelog.txt
|
||||
cp .release_date build/bundles/released.txt
|
||||
cp README.md build/bundles/README.md
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "Release Date: $(cat .release_date)"
|
||||
echo "Revision: $(cat .ottdrev)"
|
||||
echo "Version: $(cat .version)"
|
||||
echo "Is tag: ${IS_TAG}"
|
||||
echo "Folder on CDN: ${FOLDER}"
|
||||
echo "Workflow trigger: ${TRIGGER_TYPE}"
|
||||
|
||||
echo "version=$(cat .version)" >> $GITHUB_OUTPUT
|
||||
echo "is_tag=${IS_TAG}" >> $GITHUB_OUTPUT
|
||||
echo "folder=${FOLDER}" >> $GITHUB_OUTPUT
|
||||
echo "trigger_type=${TRIGGER_TYPE}" >> $GITHUB_OUTPUT
|
||||
env:
|
||||
NIGHTLIES_BRANCH: master
|
||||
FOLDER_RELEASES: openttd-releases
|
||||
FOLDER_NIGHTLIES: openttd-nightlies
|
||||
FOLDER_BRANCHES: openttd-branches
|
||||
|
||||
- name: Generate survey key
|
||||
id: survey_key
|
||||
run: |
|
||||
if [ -z "${{ vars.SURVEY_TYPE }}" ]; then
|
||||
echo "SURVEY_TYPE variable not found; most likely running in a fork. Skipping step."
|
||||
SURVEY_KEY=""
|
||||
else
|
||||
PAYLOAD='{"version":"${{ steps.metadata.outputs.version }}","type":"${{ vars.SURVEY_TYPE }}"}'
|
||||
|
||||
echo "${{ secrets.SURVEY_SIGNING_KEY }}" > survey_signing_key.pem
|
||||
SIGNATURE=$(echo -n "${PAYLOAD}" | openssl dgst -sha256 -sign survey_signing_key.pem | base64 -w0)
|
||||
rm -f survey_signing_key.pem
|
||||
|
||||
SURVEY_KEY=$(curl -f -s -X POST -d "${PAYLOAD}" -H "Content-Type: application/json" -H "X-Signature: ${SIGNATURE}" https://survey-participate.openttd.org/create-survey-key/${{ vars.SURVEY_TYPE }})
|
||||
fi
|
||||
|
||||
echo "survey_key=${SURVEY_KEY}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Remove VCS information
|
||||
run: |
|
||||
rm -rf .git
|
||||
|
||||
- name: Create bundles
|
||||
run: |
|
||||
FOLDER_NAME=openttd-${{ steps.metadata.outputs.version }}
|
||||
|
||||
# Rename the folder to openttd-NNN
|
||||
mkdir ${FOLDER_NAME}
|
||||
find . -maxdepth 1 -not -name . -not -name build -not -name ${FOLDER_NAME} -exec mv {} ${FOLDER_NAME}/ \;
|
||||
|
||||
echo "::group::Create tarball (xz) bundle"
|
||||
tar --xz -cvf build/bundles/${FOLDER_NAME}-source.tar.xz ${FOLDER_NAME}
|
||||
echo "::endgroup::"
|
||||
|
||||
# This tarball is only to be used within this workflow.
|
||||
echo "::group::Create tarball (gz) bundle"
|
||||
tar --gzip -cvf source.tar.gz ${FOLDER_NAME}
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Create zip bundle"
|
||||
zip -9 -r build/bundles/${FOLDER_NAME}-source.zip ${FOLDER_NAME}
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Store bundles
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: openttd-source
|
||||
path: build/bundles/*
|
||||
retention-days: 5
|
||||
|
||||
- name: Store source (for other jobs)
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: internal-source
|
||||
path: source.tar.gz
|
||||
retention-days: 1
|
192
.github/workflows/release-windows-store.yml
vendored
192
.github/workflows/release-windows-store.yml
vendored
@@ -1,192 +0,0 @@
|
||||
name: Release (Windows Store)
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
version:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
windows-store:
|
||||
name: Windows Store
|
||||
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- name: Download source
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: internal-source
|
||||
|
||||
- name: Unpack source
|
||||
shell: bash
|
||||
run: |
|
||||
tar -xf source.tar.gz --strip-components=1
|
||||
|
||||
- name: Download x86 build
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: openttd-windows-x86
|
||||
|
||||
- name: Download x64 build
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: openttd-windows-x64
|
||||
|
||||
- name: Download arm64 build
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: openttd-windows-arm64
|
||||
|
||||
- name: Unpack builds
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir builds
|
||||
cd builds
|
||||
|
||||
function extract {
|
||||
mkdir $1
|
||||
|
||||
# Extract the zip version of the release
|
||||
unzip ../openttd-*-windows-$2.zip -d $1
|
||||
|
||||
# Remove the extraneous directory
|
||||
mv $1/openttd-*-windows-$2/* $1/
|
||||
rmdir $1/openttd-*-windows-$2
|
||||
|
||||
# Move the openttd.exe to the '{arch}-binaries' folder
|
||||
mkdir $1-binaries
|
||||
mv $1/openttd.exe $1-binaries/
|
||||
}
|
||||
|
||||
extract x86 win32
|
||||
extract x64 win64
|
||||
extract arm64 arm64
|
||||
|
||||
# Use the "x86" folder as the source of the common binaries (lang files, etc) and remove the others
|
||||
mv x86 common-binaries
|
||||
rm -rf x64 arm64
|
||||
|
||||
- name: Install OpenGFX
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p builds/common-binaries/baseset
|
||||
cd builds/common-binaries/baseset
|
||||
|
||||
echo "::group::Download OpenGFX"
|
||||
curl -L https://cdn.openttd.org/opengfx-releases/7.1/opengfx-7.1-all.zip -o opengfx-all.zip
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Unpack OpenGFX"
|
||||
unzip opengfx-all.zip
|
||||
tar xf opengfx-*.tar
|
||||
echo "::endgroup::"
|
||||
|
||||
rm -f opengfx-all.zip opengfx-*.tar
|
||||
|
||||
- name: Install OpenMSX
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p builds/common-binaries/baseset
|
||||
cd builds/common-binaries/baseset
|
||||
|
||||
echo "::group::Download OpenMSX"
|
||||
curl -L https://cdn.openttd.org/openmsx-releases/0.4.2/openmsx-0.4.2-all.zip -o openmsx-all.zip
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Unpack OpenGFX"
|
||||
unzip openmsx-all.zip
|
||||
tar xf openmsx-*.tar
|
||||
echo "::endgroup::"
|
||||
|
||||
rm -f openmsx-all.zip openmsx-*.tar
|
||||
|
||||
- name: Install OpenSFX
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p builds/common-binaries/baseset/opensfx
|
||||
cd builds/common-binaries/baseset/opensfx
|
||||
|
||||
echo "::group::Download OpenSFX"
|
||||
curl -L https://cdn.openttd.org/opensfx-releases/1.0.3/opensfx-1.0.3-all.zip -o opensfx-all.zip
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Unpack OpenSFX"
|
||||
unzip opensfx-all.zip
|
||||
tar xf opensfx-*.tar
|
||||
echo "::endgroup::"
|
||||
|
||||
rm -f opensfx-all.zip opensfx-*.tar
|
||||
|
||||
- name: Generate signing certificate
|
||||
shell: cmd
|
||||
run: |
|
||||
cd builds
|
||||
|
||||
REM We need to provide a signed .appx to the Windows Store, so generate a certificate with password 'password'
|
||||
call ..\os\windows\winstore\generate-key.bat "CN=78024DA8-4BE4-4C77-B12E-547BBF7359D2" password cert.pfx
|
||||
|
||||
- name: Generate assets
|
||||
shell: cmd
|
||||
run: |
|
||||
cd os\windows\winstore
|
||||
call generate-assets.bat
|
||||
|
||||
- name: Prepare manifests
|
||||
shell: cmd
|
||||
run: |
|
||||
cd builds
|
||||
mkdir manifests
|
||||
|
||||
REM Set the version environment variable
|
||||
call ..\os\windows\winstore\set-version.bat x86-binaries\openttd.exe
|
||||
|
||||
call ..\os\windows\winstore\prepare-manifests.bat manifests "CN=78024DA8-4BE4-4C77-B12E-547BBF7359D2" "57420OpenTTDDevelopers.OpenTTDofficial"
|
||||
|
||||
- name: Prepare binaries
|
||||
shell: bash
|
||||
run: |
|
||||
cd builds
|
||||
|
||||
# Copy the Windows Store assets
|
||||
mkdir common-binaries/Assets
|
||||
cp -R ../os/windows/winstore/assets-common/* common-binaries/Assets/
|
||||
|
||||
mkdir Assets
|
||||
cp -R ../os/windows/winstore/assets/* Assets/
|
||||
|
||||
cp manifests/*.xml .
|
||||
|
||||
- name: Build
|
||||
shell: cmd
|
||||
run: |
|
||||
REM Add the Windows SDK tools to the PATH
|
||||
|
||||
echo|set /p="SET VS_INSTALLDIR=" > _vspath.bat
|
||||
vswhere -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath >> _vspath.bat
|
||||
call _vspath.bat
|
||||
call "%VS_INSTALLDIR%\Common7\Tools\VsDevCmd.bat"
|
||||
|
||||
REM Set the version environment variable
|
||||
call os\windows\winstore\set-version.bat builds\x86-binaries\openttd.exe
|
||||
|
||||
cd builds
|
||||
mkdir output
|
||||
|
||||
REM Build and sign the package
|
||||
makeappx build /v /f PackagingLayout.xml /op output\ /bv %OTTD_VERSION% /pv %OTTD_VERSION% /ca
|
||||
SignTool sign /fd sha256 /a /f cert.pfx /p password "output\OpenTTD.appxbundle"
|
||||
|
||||
REM Move resulting files to bundles folder
|
||||
mkdir bundles
|
||||
mkdir bundles\internal
|
||||
move cert.pfx bundles\internal\openttd-${{ inputs.version }}-windows-store.pfx
|
||||
move output\OpenTTD.appxbundle bundles\internal\openttd-${{ inputs.version }}-windows-store.appxbundle
|
||||
|
||||
- name: Store bundles
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: openttd-windows-store
|
||||
path: builds/bundles
|
||||
retention-days: 5
|
216
.github/workflows/release-windows.yml
vendored
216
.github/workflows/release-windows.yml
vendored
@@ -1,216 +0,0 @@
|
||||
name: Release (Windows)
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
survey_key:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
is_tag:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
windows:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- arch: x86
|
||||
host: x86
|
||||
- arch: x64
|
||||
host: x64
|
||||
- arch: arm64
|
||||
host: x64_arm64
|
||||
|
||||
name: Windows (${{ matrix.arch }})
|
||||
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- name: Download source
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: internal-source
|
||||
|
||||
- name: Unpack source
|
||||
shell: bash
|
||||
run: |
|
||||
tar -xf source.tar.gz --strip-components=1
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Enable Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
|
||||
- name: Setup vcpkg caching
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
|
||||
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
|
||||
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
|
||||
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::group::Install choco dependencies"
|
||||
choco install pandoc
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Install breakpad dependencies"
|
||||
cargo install dump_syms
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Install MSVC problem matcher
|
||||
uses: ammaraskar/msvc-problem-matcher@master
|
||||
|
||||
- name: Configure developer command prompt for tools
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: x64
|
||||
|
||||
- name: Build tools
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir build-host
|
||||
cd build-host
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake ${GITHUB_WORKSPACE} \
|
||||
-GNinja \
|
||||
-DOPTION_TOOLS_ONLY=ON \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
cmake --build . --target tools
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Configure developer command prompt for ${{ matrix.arch }}
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: ${{ matrix.host }}
|
||||
|
||||
- name: Import code signing certificate
|
||||
shell: powershell
|
||||
# If this is run on a fork, there may not be a certificate set up - continue in this case
|
||||
continue-on-error: true
|
||||
run: |
|
||||
$tempFile = [System.IO.Path]::GetTempFileName()
|
||||
$bytes = [System.Convert]::FromBase64String($env:WINDOWS_CERTIFICATE_P12)
|
||||
[IO.File]::WriteAllBytes($tempFile, $bytes)
|
||||
$pwd = ConvertTo-SecureString $env:WINDOWS_CERTIFICATE_PASSWORD -AsPlainText -Force
|
||||
Import-PfxCertificate -FilePath $tempFile -CertStoreLocation Cert:\CurrentUser\My -Password $pwd
|
||||
Remove-Item $tempFile
|
||||
env:
|
||||
WINDOWS_CERTIFICATE_P12: ${{ secrets.WINDOWS_CERTIFICATE_P12 }}
|
||||
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
|
||||
|
||||
- name: Build (with installer)
|
||||
if: inputs.is_tag == 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake ${GITHUB_WORKSPACE} \
|
||||
-GNinja \
|
||||
-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \
|
||||
-DCMAKE_TOOLCHAIN_FILE="c:\vcpkg\scripts\buildsystems\vcpkg.cmake" \
|
||||
-DOPTION_USE_NSIS=ON \
|
||||
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
|
||||
-DWINDOWS_CERTIFICATE_COMMON_NAME="${WINDOWS_CERTIFICATE_COMMON_NAME}" \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
cmake --build . --target openttd
|
||||
echo "::endgroup::"
|
||||
env:
|
||||
WINDOWS_CERTIFICATE_COMMON_NAME: ${{ secrets.WINDOWS_CERTIFICATE_COMMON_NAME }}
|
||||
|
||||
- name: Build (without installer)
|
||||
if: inputs.is_tag != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake ${GITHUB_WORKSPACE} \
|
||||
-GNinja \
|
||||
-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \
|
||||
-DCMAKE_TOOLCHAIN_FILE="c:\vcpkg\scripts\buildsystems\vcpkg.cmake" \
|
||||
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
|
||||
-DWINDOWS_CERTIFICATE_COMMON_NAME="${WINDOWS_CERTIFICATE_COMMON_NAME}" \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
cmake --build . --target openttd
|
||||
echo "::endgroup::"
|
||||
env:
|
||||
WINDOWS_CERTIFICATE_COMMON_NAME: ${{ secrets.WINDOWS_CERTIFICATE_COMMON_NAME }}
|
||||
|
||||
- name: Create breakpad symbols
|
||||
shell: bash
|
||||
run: |
|
||||
cd build
|
||||
dump_syms openttd.pdb --inlines --store symbols
|
||||
|
||||
- name: Create bundles
|
||||
shell: bash
|
||||
run: |
|
||||
cd ${GITHUB_WORKSPACE}/build
|
||||
echo "::group::Run CPack"
|
||||
cpack
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Move PDB and exe to symbols"
|
||||
PDB_FOLDER=$(find symbols -mindepth 2 -type d)
|
||||
cp openttd.pdb ${PDB_FOLDER}/
|
||||
|
||||
EXE_FOLDER=symbols/openttd.exe/$(grep "INFO CODE_ID" symbols/*/*/openttd.sym | cut -d\ -f3)
|
||||
mkdir -p ${EXE_FOLDER}
|
||||
cp openttd.exe ${EXE_FOLDER}/
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Cleanup"
|
||||
# Remove the sha256 files CPack generates; we will do this ourself at
|
||||
# the end of this workflow.
|
||||
rm -f bundles/*.sha256
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Sign installer
|
||||
if: inputs.is_tag == 'true'
|
||||
shell: bash
|
||||
# If this is run on a fork, there may not be a certificate set up - continue in this case
|
||||
continue-on-error: true
|
||||
run: |
|
||||
cd ${GITHUB_WORKSPACE}/build/bundles
|
||||
../../os/windows/sign.bat *.exe "${WINDOWS_CERTIFICATE_COMMON_NAME}"
|
||||
env:
|
||||
WINDOWS_CERTIFICATE_COMMON_NAME: ${{ secrets.WINDOWS_CERTIFICATE_COMMON_NAME }}
|
||||
|
||||
- name: Store bundles
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: openttd-windows-${{ matrix.arch }}
|
||||
path: build/bundles
|
||||
retention-days: 5
|
||||
|
||||
- name: Store symbols
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: symbols-windows-${{ matrix.arch }}
|
||||
path: build/symbols
|
||||
retention-days: 5
|
989
.github/workflows/release.yml
vendored
989
.github/workflows/release.yml
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,22 +0,0 @@
|
||||
name: Script missing mode enforcement
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
|
||||
|
||||
jobs:
|
||||
script-missing-mode-enforcement:
|
||||
name: Script missing mode enforcement
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check for finding script functions that require company/deity mode enforcement/checks
|
||||
run: |
|
||||
set -ex
|
||||
python3 .github/script-missing-mode-enforcement.py
|
6
.github/workflows/unused-strings.yml
vendored
6
.github/workflows/unused-strings.yml
vendored
@@ -3,10 +3,6 @@ name: Unused strings
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
|
||||
|
||||
jobs:
|
||||
unused-strings:
|
||||
name: Unused strings
|
||||
@@ -14,7 +10,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Check for unused strings
|
||||
run: |
|
||||
|
138
.github/workflows/upload-cdn.yml
vendored
138
.github/workflows/upload-cdn.yml
vendored
@@ -1,138 +0,0 @@
|
||||
name: Upload (CDN)
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
version:
|
||||
required: true
|
||||
type: string
|
||||
folder:
|
||||
required: true
|
||||
type: string
|
||||
trigger_type:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
prepare:
|
||||
name: Prepare
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Download all bundles
|
||||
uses: actions/download-artifact@v4
|
||||
|
||||
- name: Calculate checksums
|
||||
run: |
|
||||
echo "::group::Move bundles to a single folder"
|
||||
mkdir bundles
|
||||
mv openttd-*/* bundles/
|
||||
echo "::endgroup::"
|
||||
|
||||
cd bundles
|
||||
for i in $(ls openttd-*); do
|
||||
echo "::group::Calculating checksums for ${i}"
|
||||
openssl dgst -r -md5 -hex $i > $i.md5sum
|
||||
openssl dgst -r -sha1 -hex $i > $i.sha1sum
|
||||
openssl dgst -r -sha256 -hex $i > $i.sha256sum
|
||||
echo "::endgroup::"
|
||||
done
|
||||
|
||||
# Some targets generate files that are meant for our-eyes-only.
|
||||
# They are stored in the "internal" folder, and contains bundles
|
||||
# for targets like Windows Store. No user has a benefit of knowing
|
||||
# they exist, hence: internal.
|
||||
if [ -e internal ]; then
|
||||
cd internal
|
||||
for i in $(ls openttd-*); do
|
||||
echo "::group::Calculating checksums for ${i}"
|
||||
openssl dgst -r -md5 -hex $i > $i.md5sum
|
||||
openssl dgst -r -sha1 -hex $i > $i.sha1sum
|
||||
openssl dgst -r -sha256 -hex $i > $i.sha256sum
|
||||
echo "::endgroup::"
|
||||
done
|
||||
fi
|
||||
|
||||
- name: Merge symbols
|
||||
run: |
|
||||
mkdir symbols
|
||||
cp -R symbols-*/* symbols/
|
||||
|
||||
# Compress all files as gzip, to reduce cost of storage on the CDN.
|
||||
for i in $(find symbols -mindepth 2 -type f); do
|
||||
gzip ${i}
|
||||
done
|
||||
|
||||
# Leave a mark in each folder what version actually created the symbol file.
|
||||
for i in $(find symbols -mindepth 2 -type d); do
|
||||
touch ${i}/.${{ inputs.version }}.txt
|
||||
done
|
||||
|
||||
- name: Store bundles
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: cdn-bundles
|
||||
path: bundles/*
|
||||
retention-days: 5
|
||||
|
||||
- name: Store breakpad symbols
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: cdn-symbols
|
||||
path: symbols/*
|
||||
retention-days: 5
|
||||
|
||||
publish-bundles:
|
||||
needs:
|
||||
- prepare
|
||||
|
||||
name: Publish bundles
|
||||
uses: OpenTTD/actions/.github/workflows/rw-cdn-upload.yml@v5
|
||||
secrets:
|
||||
CDN_SIGNING_KEY: ${{ secrets.CDN_SIGNING_KEY }}
|
||||
DEPLOYMENT_APP_ID: ${{ secrets.DEPLOYMENT_APP_ID }}
|
||||
DEPLOYMENT_APP_PRIVATE_KEY: ${{ secrets.DEPLOYMENT_APP_PRIVATE_KEY }}
|
||||
with:
|
||||
artifact-name: cdn-bundles
|
||||
folder: ${{ inputs.folder }}
|
||||
version: ${{ inputs.version }}
|
||||
|
||||
publish-symbols:
|
||||
needs:
|
||||
- prepare
|
||||
|
||||
name: Publish symbols
|
||||
uses: OpenTTD/actions/.github/workflows/rw-symbols-upload.yml@v5
|
||||
secrets:
|
||||
SYMBOLS_SIGNING_KEY: ${{ secrets.SYMBOLS_SIGNING_KEY }}
|
||||
with:
|
||||
artifact-name: cdn-symbols
|
||||
repository: OpenTTD
|
||||
|
||||
docs:
|
||||
if: ${{ inputs.trigger_type == 'new-master' }}
|
||||
needs:
|
||||
- publish-bundles
|
||||
|
||||
name: Publish docs
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Generate access token
|
||||
id: generate_token
|
||||
uses: tibdex/github-app-token@v2
|
||||
with:
|
||||
app_id: ${{ secrets.DEPLOYMENT_APP_ID }}
|
||||
private_key: ${{ secrets.DEPLOYMENT_APP_PRIVATE_KEY }}
|
||||
repositories: >-
|
||||
["OpenTTD/workflows"]
|
||||
|
||||
- name: Trigger 'Publish Docs'
|
||||
uses: peter-evans/repository-dispatch@v3
|
||||
with:
|
||||
token: ${{ steps.generate_token.outputs.token }}
|
||||
repository: OpenTTD/workflows
|
||||
event-type: publish-docs
|
||||
client-payload: '{"version": "${{ inputs.version }}", "folder": "${{ inputs.folder }}"}'
|
151
.github/workflows/upload-gog.yml
vendored
151
.github/workflows/upload-gog.yml
vendored
@@ -1,151 +0,0 @@
|
||||
name: Upload (GOG)
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
version:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
upload:
|
||||
name: Upload (GOG)
|
||||
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Download source
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: internal-source
|
||||
path: internal-source
|
||||
|
||||
- name: Download bundle (Windows x86)
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: openttd-windows-x86
|
||||
path: openttd-windows-x86
|
||||
|
||||
- name: Download bundle (Windows x64)
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: openttd-windows-x64
|
||||
path: openttd-windows-x64
|
||||
|
||||
- name: Download bundle (MacOS)
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: openttd-macos-universal
|
||||
path: openttd-macos-universal
|
||||
|
||||
- name: Download bundle (Linux)
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: openttd-linux-generic
|
||||
path: openttd-linux-generic
|
||||
|
||||
- name: Install GOG Galaxy Build Creator
|
||||
run: |
|
||||
wget https://cdn.gog.com/open/galaxy/pipeline/build_creator/gnu-linux/GOGGalaxyBuildCreator-1.4.0.AppImage
|
||||
7z x GOGGalaxyBuildCreator-1.4.0.AppImage
|
||||
chmod +x ./app/GOGGalaxyPipelineBuilder
|
||||
|
||||
- name: Install OpenGFX
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p gog/opengfx/baseset
|
||||
cd gog/opengfx/baseset
|
||||
|
||||
echo "::group::Download OpenGFX"
|
||||
curl -L https://cdn.openttd.org/opengfx-releases/7.1/opengfx-7.1-all.zip -o opengfx-all.zip
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Unpack OpenGFX"
|
||||
unzip opengfx-all.zip
|
||||
echo "::endgroup::"
|
||||
|
||||
rm -f opengfx-all.zip
|
||||
|
||||
- name: Install OpenMSX
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p gog/openmsx/baseset
|
||||
cd gog/openmsx/baseset
|
||||
|
||||
echo "::group::Download OpenMSX"
|
||||
curl -L https://cdn.openttd.org/openmsx-releases/0.4.2/openmsx-0.4.2-all.zip -o openmsx-all.zip
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Unpack OpenGFX"
|
||||
unzip openmsx-all.zip
|
||||
tar xf openmsx-*.tar
|
||||
echo "::endgroup::"
|
||||
|
||||
rm -f openmsx-all.zip openmsx-*.tar
|
||||
|
||||
- name: Install OpenSFX
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p gog/opensfx/baseset
|
||||
cd gog/opensfx/baseset
|
||||
|
||||
echo "::group::Download OpenSFX"
|
||||
curl -L https://cdn.openttd.org/opensfx-releases/1.0.3/opensfx-1.0.3-all.zip -o opensfx-all.zip
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Unpack OpenSFX"
|
||||
unzip opensfx-all.zip
|
||||
tar xf opensfx-*.tar
|
||||
echo "::endgroup::"
|
||||
|
||||
rm -f opensfx-all.zip opensfx-*.tar
|
||||
|
||||
- name: Upload to GOG
|
||||
run: |
|
||||
echo "::group::Extracting source"
|
||||
mkdir source
|
||||
(
|
||||
cd source
|
||||
tar -xf ../internal-source/source.tar.gz --strip-components=1
|
||||
)
|
||||
echo "::endgroup::"
|
||||
|
||||
(
|
||||
cd gog
|
||||
|
||||
echo "::group::Prepare Win32"
|
||||
unzip ../openttd-windows-x86/openttd-*-windows-win32.zip
|
||||
mv openttd-*-windows-win32 win32
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Prepare Win64"
|
||||
unzip ../openttd-windows-x64/openttd-*-windows-win64.zip
|
||||
mv openttd-*-windows-win64 win64
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Prepare macOS"
|
||||
mkdir macos
|
||||
(
|
||||
cd macos
|
||||
unzip ../../openttd-macos-universal/openttd-*-macos-universal.zip
|
||||
)
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Prepare Linux"
|
||||
tar xvf ../openttd-linux-generic/openttd-*-linux-generic-amd64.tar.xz
|
||||
mv openttd-*-linux-generic-amd64 linux
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Preparing build files"
|
||||
cp ../source/os/gog/*.json .
|
||||
for json in $(ls *.json); do
|
||||
sed -i 's/VERSION/${{ inputs.version }}/g;s/CLIENT_ID/${{ secrets.GOG_CLIENT_ID }}/g;s/CLIENT_SECRET/${{ secrets.GOG_CLIENT_SECRET }}/g' ${json}
|
||||
done
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Upload to GOG"
|
||||
../app/GOGGalaxyPipelineBuilder build-game --username "${{ secrets.GOG_USERNAME }}" --password "${{ secrets.GOG_PASSWORD }}" --branch Testing windows.json
|
||||
../app/GOGGalaxyPipelineBuilder build-game --username "${{ secrets.GOG_USERNAME }}" --password "${{ secrets.GOG_PASSWORD }}" --branch Testing macos.json
|
||||
../app/GOGGalaxyPipelineBuilder build-game --username "${{ secrets.GOG_USERNAME }}" --password "${{ secrets.GOG_PASSWORD }}" --branch Testing linux.json
|
||||
echo "::endgroup::"
|
||||
)
|
109
.github/workflows/upload-steam.yml
vendored
109
.github/workflows/upload-steam.yml
vendored
@@ -1,109 +0,0 @@
|
||||
name: Upload (Steam)
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
version:
|
||||
required: true
|
||||
type: string
|
||||
trigger_type:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
upload:
|
||||
name: Upload (Steam)
|
||||
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Download source
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: internal-source
|
||||
path: internal-source
|
||||
|
||||
- name: Download bundle (Windows x86)
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: openttd-windows-x86
|
||||
path: openttd-windows-x86
|
||||
|
||||
- name: Download bundle (Windows x64)
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: openttd-windows-x64
|
||||
path: openttd-windows-x64
|
||||
|
||||
- name: Download bundle (MacOS)
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: openttd-macos-universal
|
||||
path: openttd-macos-universal
|
||||
|
||||
- name: Download bundle (Linux)
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: openttd-linux-generic
|
||||
path: openttd-linux-generic
|
||||
|
||||
- name: Setup steamcmd
|
||||
uses: CyberAndrii/setup-steamcmd@v1
|
||||
|
||||
- name: Generate Steam auth code
|
||||
id: steam-totp
|
||||
uses: CyberAndrii/steam-totp@v1
|
||||
with:
|
||||
shared_secret: ${{ secrets.STEAM_SHARED_SECRET }}
|
||||
|
||||
- name: Upload to Steam
|
||||
run: |
|
||||
echo "::group::Extracting source"
|
||||
mkdir source
|
||||
(
|
||||
cd source
|
||||
tar -xf ../internal-source/source.tar.gz --strip-components=1
|
||||
)
|
||||
echo "::endgroup::"
|
||||
|
||||
mkdir steam
|
||||
(
|
||||
cd steam
|
||||
|
||||
echo "::group::Prepare Win32"
|
||||
unzip ../openttd-windows-x86/openttd-*-windows-win32.zip
|
||||
mv openttd-*-windows-win32 steam-win32
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Prepare Win64"
|
||||
unzip ../openttd-windows-x64/openttd-*-windows-win64.zip
|
||||
mv openttd-*-windows-win64 steam-win64
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Prepare macOS"
|
||||
mkdir steam-macos
|
||||
(
|
||||
cd steam-macos
|
||||
unzip ../../openttd-macos-universal/openttd-*-macos-universal.zip
|
||||
)
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Prepare Linux"
|
||||
tar xvf ../openttd-linux-generic/openttd-*-linux-generic-amd64.tar.xz
|
||||
mv openttd-*-linux-generic-amd64 steam-linux
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Preparing build file"
|
||||
if [ "${{ inputs.trigger_type }}" = "new-tag" ]; then
|
||||
BRANCH="testing"
|
||||
else
|
||||
BRANCH="nightly"
|
||||
fi
|
||||
cat ../source/os/steam/release.vdf | sed 's/@@DESCRIPTION@@/openttd-${{ inputs.version }}/;s/@@BRANCH@@/'${BRANCH}'/' > release.vdf
|
||||
cat release.vdf
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Upload to Steam"
|
||||
steamcmd +login ${{ secrets.STEAM_USERNAME }} ${{ secrets.STEAM_PASSWORD }} ${{ steps.steam-totp.outputs.code }} +run_app_build $(pwd)/release.vdf +quit
|
||||
echo "::endgroup::"
|
||||
)
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -5,4 +5,3 @@ docs/aidocs/*
|
||||
docs/gamedocs/*
|
||||
docs/source/*
|
||||
/out
|
||||
/vcpkg_installed
|
||||
|
114
CMakeLists.txt
114
CMakeLists.txt
@@ -1,12 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
cmake_minimum_required(VERSION 3.9)
|
||||
|
||||
if(NOT BINARY_NAME)
|
||||
set(BINARY_NAME openttd)
|
||||
endif()
|
||||
|
||||
project(${BINARY_NAME}
|
||||
VERSION 14.0
|
||||
LANGUAGES CXX
|
||||
VERSION 12.2
|
||||
)
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
|
||||
@@ -23,7 +22,7 @@ if (EMSCRIPTEN)
|
||||
endif()
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.14)
|
||||
|
||||
# Use GNUInstallDirs to allow customisation
|
||||
# but set our own default data and bin dir
|
||||
@@ -42,7 +41,7 @@ set_directory_options()
|
||||
include(Static)
|
||||
set_static_if_needed()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
||||
set(CMAKE_CXX_EXTENSIONS NO)
|
||||
|
||||
@@ -125,19 +124,6 @@ find_package(LibLZMA)
|
||||
find_package(LZO)
|
||||
find_package(PNG)
|
||||
|
||||
if(WIN32 OR EMSCRIPTEN)
|
||||
# Windows uses WinHttp for HTTP requests.
|
||||
# Emscripten uses Javascript for HTTP requests.
|
||||
else()
|
||||
# All other targets use libcurl.
|
||||
find_package(CURL)
|
||||
endif()
|
||||
|
||||
# Breakpad doesn't support emscripten.
|
||||
if(NOT EMSCRIPTEN)
|
||||
find_package(unofficial-breakpad)
|
||||
endif()
|
||||
|
||||
if(NOT OPTION_DEDICATED)
|
||||
if(NOT WIN32)
|
||||
find_package(Allegro)
|
||||
@@ -148,17 +134,12 @@ if(NOT OPTION_DEDICATED)
|
||||
find_package(SDL)
|
||||
endif()
|
||||
find_package(Fluidsynth)
|
||||
if(Freetype_FOUND)
|
||||
find_package(Fontconfig)
|
||||
endif()
|
||||
find_package(Harfbuzz)
|
||||
find_package(ICU OPTIONAL_COMPONENTS i18n)
|
||||
find_package(Fontconfig)
|
||||
find_package(ICU OPTIONAL_COMPONENTS i18n lx)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(APPLE)
|
||||
enable_language(OBJCXX)
|
||||
|
||||
find_package(Iconv)
|
||||
|
||||
find_library(AUDIOTOOLBOX_LIBRARY AudioToolbox)
|
||||
@@ -189,12 +170,6 @@ if(UNIX AND NOT APPLE AND NOT OPTION_DEDICATED)
|
||||
if(NOT SDL_FOUND AND NOT SDL2_FOUND AND NOT ALLEGRO_FOUND)
|
||||
message(FATAL_ERROR "SDL, SDL2 or Allegro is required for this platform")
|
||||
endif()
|
||||
if(HARFBUZZ_FOUND AND NOT ICU_i18n_FOUND)
|
||||
message(WARNING "HarfBuzz depends on ICU i18n to function; HarfBuzz will be disabled")
|
||||
endif()
|
||||
if(NOT HARFBUZZ_FOUND)
|
||||
message(WARNING "Without HarfBuzz and ICU i18n the game will not be able to render right-to-left languages correctly")
|
||||
endif()
|
||||
endif()
|
||||
if(APPLE)
|
||||
if(NOT AUDIOTOOLBOX_LIBRARY)
|
||||
@@ -232,7 +207,6 @@ if(OPTION_PACKAGE_DEPENDENCIES)
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
|
||||
endif()
|
||||
|
||||
include(CTest)
|
||||
include(SourceList)
|
||||
|
||||
# Needed by rev.cpp
|
||||
@@ -242,31 +216,15 @@ include_directories(${CMAKE_SOURCE_DIR}/src/3rdparty/squirrel/include)
|
||||
|
||||
include(MSVCFilters)
|
||||
|
||||
add_library(openttd_lib OBJECT ${GENERATED_SOURCE_FILES})
|
||||
add_executable(openttd WIN32)
|
||||
add_executable(openttd_test)
|
||||
add_executable(openttd WIN32 ${GENERATED_SOURCE_FILES})
|
||||
set_target_properties(openttd PROPERTIES OUTPUT_NAME "${BINARY_NAME}")
|
||||
# All other files are added via target_sources()
|
||||
|
||||
if(MSVC)
|
||||
# Add DPI manifest to project; other WIN32 targets get this via ottdres.rc
|
||||
target_sources(openttd PRIVATE "${CMAKE_SOURCE_DIR}/os/windows/openttd.manifest")
|
||||
|
||||
# If target -static is used, switch our project to static (/MT) too.
|
||||
# If the target ends on -static-md, it will remain dynamic (/MD).
|
||||
if(VCPKG_TARGET_TRIPLET MATCHES "-static" AND NOT VCPKG_TARGET_TRIPLET MATCHES "-md")
|
||||
set_property(TARGET openttd_lib PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
set_property(TARGET openttd PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
set_property(TARGET openttd_test PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_precompile_headers(openttd_lib
|
||||
PRIVATE
|
||||
src/stdafx.h
|
||||
src/core/format.hpp
|
||||
)
|
||||
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/bin)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/src)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/media)
|
||||
@@ -274,25 +232,17 @@ add_subdirectory(${CMAKE_SOURCE_DIR}/media)
|
||||
add_dependencies(openttd
|
||||
find_version)
|
||||
|
||||
target_link_libraries(openttd_lib
|
||||
target_link_libraries(openttd
|
||||
openttd::languages
|
||||
openttd::settings
|
||||
openttd::media
|
||||
openttd::basesets
|
||||
openttd::script_api
|
||||
Threads::Threads
|
||||
)
|
||||
|
||||
target_link_libraries(openttd
|
||||
openttd_lib
|
||||
openttd::media
|
||||
openttd::basesets
|
||||
)
|
||||
|
||||
target_link_libraries(openttd_test PRIVATE openttd_lib)
|
||||
include(Catch)
|
||||
catch_discover_tests(openttd_test)
|
||||
|
||||
if(HAIKU)
|
||||
target_link_libraries(openttd_lib "be" "network" "midi")
|
||||
target_link_libraries(openttd "be" "network" "midi")
|
||||
endif()
|
||||
|
||||
if(IPO_FOUND)
|
||||
@@ -309,15 +259,6 @@ link_package(ZLIB TARGET ZLIB::ZLIB ENCOURAGED)
|
||||
link_package(LIBLZMA TARGET LibLZMA::LibLZMA ENCOURAGED)
|
||||
link_package(LZO)
|
||||
|
||||
if(NOT WIN32 AND NOT EMSCRIPTEN)
|
||||
link_package(CURL ENCOURAGED)
|
||||
target_link_libraries(openttd_lib ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
|
||||
if(NOT EMSCRIPTEN)
|
||||
link_package(unofficial-breakpad TARGET unofficial::breakpad::libbreakpad_client ENCOURAGED)
|
||||
endif()
|
||||
|
||||
if(NOT OPTION_DEDICATED)
|
||||
link_package(Fluidsynth)
|
||||
link_package(SDL)
|
||||
@@ -325,7 +266,7 @@ if(NOT OPTION_DEDICATED)
|
||||
link_package(Allegro)
|
||||
link_package(FREETYPE TARGET Freetype::Freetype)
|
||||
link_package(Fontconfig TARGET Fontconfig::Fontconfig)
|
||||
link_package(Harfbuzz TARGET harfbuzz::harfbuzz)
|
||||
link_package(ICU_lx)
|
||||
link_package(ICU_i18n)
|
||||
|
||||
if(SDL2_FOUND AND OPENGL_FOUND AND UNIX)
|
||||
@@ -339,12 +280,10 @@ if(NOT OPTION_DEDICATED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(CheckAtomic)
|
||||
|
||||
if(APPLE)
|
||||
link_package(Iconv TARGET Iconv::Iconv)
|
||||
|
||||
target_link_libraries(openttd_lib
|
||||
target_link_libraries(openttd
|
||||
${AUDIOTOOLBOX_LIBRARY}
|
||||
${AUDIOUNIT_LIBRARY}
|
||||
${COCOA_LIBRARY}
|
||||
@@ -363,7 +302,6 @@ if(EMSCRIPTEN)
|
||||
target_link_libraries(WASM::WASM INTERFACE "-s ALLOW_MEMORY_GROWTH=1")
|
||||
target_link_libraries(WASM::WASM INTERFACE "-s INITIAL_MEMORY=33554432")
|
||||
target_link_libraries(WASM::WASM INTERFACE "-s DISABLE_EXCEPTION_CATCHING=0")
|
||||
target_link_libraries(WASM::WASM INTERFACE "-s WASM_BIGINT")
|
||||
add_definitions(-s DISABLE_EXCEPTION_CATCHING=0)
|
||||
|
||||
# Export functions to Javascript.
|
||||
@@ -379,23 +317,6 @@ if(EMSCRIPTEN)
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_BINARY_DIR}/lang/english.lng@/lang/english.lng")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/bin/ai@/ai")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/bin/game@/game")
|
||||
# Documentation files for the in-game text file viewer
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/README.md@/README.md")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/CREDITS.md@/CREDITS.md")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/CONTRIBUTING.md@/CONTRIBUTING.md")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/COPYING.md@/COPYING.md")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/known-bugs.txt@/known-bugs.txt")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/changelog.txt@/changelog.txt")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/docs/admin_network.md@/docs/admin_network.md")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/docs/debugging_desyncs.md@/docs/debugging_desyncs.md")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/docs/desync.md@/docs/desync.md")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/docs/directory_structure.md@/docs/directory_structure.md")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/docs/eints.md@/docs/eints.md")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/docs/linkgraph.md@/docs/linkgraph.md")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/docs/logging_and_performance_metrics.md@/docs/logging_and_performance_metrics.md")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/docs/multiplayer.md@/docs/multiplayer.md")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/docs/savegame_format.md@/docs/savegame_format.md")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/docs/symbol_server.md@/docs/symbol_server.md")
|
||||
|
||||
# We use IDBFS for persistent storage.
|
||||
target_link_libraries(WASM::WASM INTERFACE "-lidbfs.js")
|
||||
@@ -441,14 +362,12 @@ if(WIN32)
|
||||
-DPSAPI_VERSION=1
|
||||
)
|
||||
|
||||
target_link_libraries(openttd_lib
|
||||
target_link_libraries(openttd
|
||||
ws2_32
|
||||
winmm
|
||||
imm32
|
||||
usp10
|
||||
psapi
|
||||
winhttp
|
||||
bcrypt
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -456,9 +375,8 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
add_definitions(-DPOINTER_IS_64BIT)
|
||||
endif()
|
||||
|
||||
enable_testing()
|
||||
|
||||
add_subdirectory(regression)
|
||||
include(CreateRegression)
|
||||
create_regression()
|
||||
|
||||
if(APPLE OR WIN32)
|
||||
find_package(Pandoc)
|
||||
|
488
CODINGSTYLE.md
488
CODINGSTYLE.md
@@ -1,488 +0,0 @@
|
||||
**Why a set coding style is important** <br>
|
||||
This project is an open source project. To get open source working as intended, many people should be able to comprehend the code. This implies that there is a well documented and uniform flow of code.
|
||||
That does not necessarily mean that a contributor should not write optimised yet cryptic code - one should always care about performance. However, other developers need to understand the code which means complicated parts of code **must** have good documentation.
|
||||
|
||||
**Why we require that EVERYTHING is documented**<br>
|
||||
What is simple to some might appear very complicated to others. Documentation helps these others. Anyone should be able to improve the code. But the main reason is, that when patch contributors want their patches added to the common codebase, the code needs to be reviewed by one or more developers. Documentation makes reviewing much easier.
|
||||
|
||||
## Coding style for OpenTTD
|
||||
### Functions
|
||||
* Function names use [CamelCase](http://www.wikipedia.org/wiki/Camelcase) without underscores.
|
||||
* Opening curly bracket **{** for a function starts on the next line.
|
||||
* Use Foo() instead of Foo(void).
|
||||
```c++
|
||||
void ThisIsAFunction()
|
||||
{
|
||||
}
|
||||
```
|
||||
|
||||
### Variables
|
||||
* Variable names are all lowercase, and use "_" as separator.
|
||||
* Global variables are preceded by an underscore. ("_") Use descriptive names because leading underscores are often used for system / compiler variables.
|
||||
* Own members of classes should always be referenced using "this->"
|
||||
* Pointers and references should have their reference symbol next to the name (compatibility with current code).
|
||||
* Variables that are declared below one another should have their type, name or reference operator, and assignment operator aligned by spaces.
|
||||
* There are set names for many variables. Those are (but not limited to): Vehicle *u, *v, *w; Station *st; Town *t; Window *w; Engine *e.
|
||||
* For multiple instances, use numbers "*t1, *t2" or postfixes "*st_from, *st_to".
|
||||
* Declare variables upon first usage.
|
||||
* Declare iterators in their loop.
|
||||
* There is a space between '*' and 'const' in "const pointers"
|
||||
```c++
|
||||
int number = 10;
|
||||
Vehicle *u_first_wagon = v->next;
|
||||
int value = v->value;
|
||||
|
||||
uint32 _global_variable = 3750;
|
||||
|
||||
static const char * const _global_array[] = {
|
||||
"first string",
|
||||
"second string",
|
||||
"another string",
|
||||
"last string followed by comma",
|
||||
};
|
||||
|
||||
protected:
|
||||
char protected_array[10];
|
||||
|
||||
for (int i = 0;;);
|
||||
```
|
||||
|
||||
* Give the variables expedient names, this increases the readability of the code
|
||||
```c++
|
||||
bool is_maglev_train = true;
|
||||
if (!is_maglev_train) DoSomething();
|
||||
```
|
||||
|
||||
* Some people like to introduce copies of variables to increase readability, which can waste memory. However, in some cases, especially in code pieces which are often called, it makes sense to cache some calculated variables.
|
||||
```c++
|
||||
/* Unoptimized code:
|
||||
* foo is not touched inside the loop!
|
||||
*/
|
||||
for (uint8 i = 0; i < 100000; i++) {
|
||||
/* Do something */
|
||||
if (value_to_check == (foo * 4) % 5 + 6) DoSomething();
|
||||
/* Do something else */
|
||||
}
|
||||
|
||||
/* Better:
|
||||
* The used value of foo is calculated outside the loop.
|
||||
*/
|
||||
const uint32 bar = (foo * 4) % 5 + 6;
|
||||
for (uint8 i = 0; i < 100000; i++) {
|
||||
/* Do something */
|
||||
if (value_to_check == bar) DoSomething();
|
||||
/* Do something else */
|
||||
}
|
||||
```
|
||||
|
||||
### Enumerations / static consts
|
||||
* Enumerations store integers that belong logically together (railtypes, string IDs, etc.).
|
||||
* Enumeration names also use CamelCase.
|
||||
* Unscoped enumerators are all caps with "_" between the words.
|
||||
* Scoped enumerators are use CamelCase.
|
||||
* Enums are not used to store single numbers.
|
||||
* Enums have consecutive numbers OR
|
||||
* Enums have consecutive powers of two. Powers of two (bits) are written in hex or with the shift operator.
|
||||
* Enums may have special enumerators: "_BEGIN", "\_END", and "INVALID\_"). See example.
|
||||
* The invalid always has 0xFF, 0xFFFF, 0xFFFFFFFF as a value.
|
||||
* Other special values are consecutively less than the invalid.
|
||||
* Variables that hold enumerators should have the type of the enumeration.
|
||||
```c++
|
||||
enum DiagDirection {
|
||||
DIAGDIR_BEGIN = 0,
|
||||
DIAGDIR_NE = 0,
|
||||
DIAGDIR_SE = 1,
|
||||
DIAGDIR_SW = 2,
|
||||
DIAGDIR_NW = 3,
|
||||
DIAGDIR_END,
|
||||
INVALID_DIAGDIR = 0xFF,
|
||||
BROKEN_DIAGDIR = 0xFE,
|
||||
};
|
||||
|
||||
enum {
|
||||
DEPOT_SERVICE = (1 << 0),
|
||||
DEPOT_MASS_SEND = (1 << 1),
|
||||
DEPOT_DONT_CANCEL = (1 << 2),
|
||||
DEPOT_LOCATE_HANGAR = (1 << 3),
|
||||
};
|
||||
|
||||
DiagDirection enterdir = DIAGDIR_NE;
|
||||
```
|
||||
|
||||
* Numbers that store single or uncorrelated data are static consts. Those may use the naming conventions of enums.
|
||||
Example:
|
||||
```c++
|
||||
static const int MAXIMUM_STATIONS = 42;
|
||||
```
|
||||
|
||||
* Enums are useful in GUI code: When widgets are enumerated, they are easier to access during many operations. Additionally changes caused by modified widget sequences require less code adapting. If a widget is used like this, its enum name should be present in a comment behind the corresponding widget definition.
|
||||
```c++
|
||||
/** Enum referring to the widgets of the build rail depot window */
|
||||
enum BuildRailDepotWidgets {
|
||||
BRDW_CLOSEBOX = 0,
|
||||
BRDW_CAPTION,
|
||||
BRDW_BACKGROUND,
|
||||
BRDW_DEPOT_NE,
|
||||
BRDW_DEPOT_SE,
|
||||
BRDW_DEPOT_SW,
|
||||
BRDW_DEPOT_NW,
|
||||
};
|
||||
/* ... */
|
||||
/** Widget definition of the build rail depot window */
|
||||
static const Widget _build_depot_widgets[] = {
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_..}, // BRDW_CLOSEBOX
|
||||
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 139, 0, 13, STR_..., STR_...}, // BRDW_CAPTION
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 0, 139, 14, 121, 0x0, STR_NULL}, // BRDW_BACKGROUND
|
||||
{ WWT_PANEL, RESIZE_NONE, 14, 71, 136, 17, 66, 0x0, STR_..}, // BRDW_DEPOT_NE
|
||||
{ WWT_PANEL, RESIZE_NONE, 14, 71, 136, 69, 118, 0x0, STR_..}, // BRDW_DEPOT_SE
|
||||
{ WWT_PANEL, RESIZE_NONE, 14, 3, 68, 69, 118, 0x0, STR_..}, // BRDW_DEPOT_SW
|
||||
{ WWT_PANEL, RESIZE_NONE, 14, 3, 68, 17, 66, 0x0, STR_..}, // BRDW_DEPOT_NW
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
```
|
||||
|
||||
* Comments on the enum values should start with "///<" to enable doxygen documentation
|
||||
```c++
|
||||
enum SomeEnumeration {
|
||||
SE_BEGIN = 0, ///< Begin of the enumeration, used for iterations
|
||||
SE_FOO = 0, ///< Used for xy
|
||||
SE_BAR, ///< Another value of the enumeration
|
||||
SE_SUB, ///< Special case for z
|
||||
SE_END, ///< End of the enumeration, used for iterations
|
||||
};
|
||||
```
|
||||
|
||||
### Control flow
|
||||
* Put a space before the parentheses in **if**, **switch**, **for** and **while** statements.
|
||||
* Use curly braces and put the contained statements on their own lines (e.g., don't put them directly after the **if**).
|
||||
* Opening curly bracket **{** stays on the first line, closing curly bracket **}** gets a line to itself (except for the **}** preceding an **else**, which should be on the same line as the **else**).
|
||||
* When only a single statement is contained, the brackets can be omitted. In this case, put the single statement on the same line as the preceding keyword (**if**, **while**, etc.). Note that this is only allowed for if statements without an **else** clause.
|
||||
* All fall throughs must be documented, using a **FALLTHROUGH** define/macro.
|
||||
* The NOT_REACHED() macro can be used in default constructs that should never be reached.
|
||||
* Unconditional loops are written with **`for (;;) {`**
|
||||
|
||||
```c++
|
||||
if (a == b) {
|
||||
Foo();
|
||||
} else {
|
||||
Bar();
|
||||
}
|
||||
|
||||
if (very_large_checks &&
|
||||
spread_over_two_lines) {
|
||||
Foo();
|
||||
}
|
||||
|
||||
if (a == b) Foo();
|
||||
|
||||
switch (a) {
|
||||
case 0: DoSomethingShort(); break;
|
||||
|
||||
case 1:
|
||||
DoSomething();
|
||||
FALLTHROUGH;
|
||||
|
||||
case 2:
|
||||
DoMore();
|
||||
b = a;
|
||||
break;
|
||||
|
||||
case 3: {
|
||||
int r = 2;
|
||||
|
||||
DoEvenMore(a);
|
||||
FALLTHROUGH;
|
||||
}
|
||||
|
||||
case 4: {
|
||||
int q = 345;
|
||||
|
||||
DoIt();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
NOT_REACHED();
|
||||
}
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
Foo();
|
||||
Bar();
|
||||
}
|
||||
```
|
||||
|
||||
### Classes
|
||||
* Classes names also use CamelCase.
|
||||
* Classes should have "public", "protected", and "private" sections.
|
||||
* Within these section the order is: types, static const members, static members, members, constructors / destructors, static methods, methods.
|
||||
* Deviations from above order are allowed when the code dictates it (e.g. a static const is needed for a typedef)
|
||||
* Methods and members ought to be grouped logically.
|
||||
* All those sorting rules sometimes conflict which one another. Please use common sense what increases legibility of the code in such a case.
|
||||
* The method implementation should indicate if it is virtual or similar by using a comment.
|
||||
* Very short methods can have one-line definition (if defined in the class scope).
|
||||
```c++
|
||||
class ThisIsAClass {
|
||||
public:
|
||||
typedef Titem_ *ItemPtr;
|
||||
private:
|
||||
static const int MAX_SIZE = 500;
|
||||
int size;
|
||||
ItemPtr *items;
|
||||
|
||||
public:
|
||||
explicit ThisIsAClass();
|
||||
~ThisIsAClass();
|
||||
|
||||
int GetSize() { return this->size; }
|
||||
virtual void Method();
|
||||
};
|
||||
|
||||
/*virtual*/ void Class::Method()
|
||||
{
|
||||
this->size *= 2;
|
||||
}
|
||||
```
|
||||
|
||||
### Templates
|
||||
Templates are a very powerful C++ tool, but they can easily confuse beginners. Thus:
|
||||
* Templates are to be documented in a very clear and verbose manner. Never assume anything in the documentation.
|
||||
* the template keyword and the template layout get a separate line. typenames are either "T" or preceded by a "T", integers get a single capital letter or a descriptive name preceded by "T".
|
||||
```c++
|
||||
template <typename T, typename Tsomething, int N, byte Tnumber_of_something>
|
||||
int Func();
|
||||
```
|
||||
|
||||
* If you are writing one or more template class in the dedicated header file, use file.hpp for its name instead of file.h. This will let others know that it is template library (includes also implementation), not just header with declarations.
|
||||
|
||||
### Other important rules
|
||||
* Put a space before and after binary operators: "a + b", "a == b", "a & b", "a <<= b", etc.. Exceptions are ".", "->" and "[]" (no spaces) and "," (just space after it).
|
||||
* Put parenthesis where it improves readability: "*(b++)" instead of "*b++", and "if ((a & b) && c == 2)" instead of "if (a & b && c == 2)".
|
||||
* Do not put external declarations in implementation (i.e. cpp) files.
|
||||
* Use const where possible.
|
||||
* Do not typedef enums and structs.
|
||||
* Don't treat non-flags as flags: use "if (char_pointer != nullptr && *char_pointer != '\0')", not "if (char_pointer && *char_pointer)".
|
||||
* Use "free(p)" instead of "if (p != nullptr) free(p)". "free(nullptr)" doesn't hurt anyone.
|
||||
* No trailing whitespace. The Github workflows will not allow tabs or space on the end of lines.
|
||||
* Only use tabs to indent from the start of the line.
|
||||
* Line length is unlimited. In practice it may be useful to split a long line. When splitting, add two tabs in front of the second part.
|
||||
* The '#' of preprocessor instructions goes into the first column of a line. Indenting is done after the '#' (using tabs again).
|
||||
* Use /* */ for single line comments.
|
||||
* Use // at the end of a command line to indicate comments.
|
||||
** However, use /* */ after # preprocessor statements as // causes warnings in some compilers and/or might have unwanted side effects.
|
||||
* C++ is defined using the ASCII character set. Do not use other character sets, not even in comments.
|
||||
* OpenTTD includes some Objective-C sources (*.mm, used by OSX), which has a special object method invocation syntax: "[ obj doStuff:foo ]". Please use spaces on the inside of the brackets to differentiate from the C array syntax.
|
||||
|
||||
## Documentation
|
||||
We use [Doxygen](http://doxygen.org/) to automatically generate documentation from the source code. It scans the source files for *recognizable* comments.
|
||||
* **Make your comments recognizable.**
|
||||
Doxygen only comments starting with the following style:
|
||||
```c++
|
||||
/**
|
||||
///<
|
||||
```
|
||||
|
||||
Use /** for multi-line comment blocks. Use ///< for single line comments for variables. Use //!< for single-line comments in the NoAI .hpp files.
|
||||
For comments blocks inside a function always use /* */ or //. Use // only if the comment is on the same line as an instruction, otherwise use /* */.
|
||||
|
||||
### Files
|
||||
* Put a @file command in a JavaDoc style comment at the start of the file, followed by a description.
|
||||
```c++
|
||||
/**
|
||||
* @file
|
||||
* This is the brief description.
|
||||
* This is the detailed description here and on the following lines.
|
||||
*/
|
||||
```
|
||||
> ### Warning
|
||||
> If a file lacks a **file comment block** then NO entities in that file will be documented by Doxygen!
|
||||
|
||||
### Functions
|
||||
* The documentation should be as close to the actual code as possible to maximise the chance of staying in sync.
|
||||
* Comments for functions go in the .cpp file.
|
||||
* Comments for inlines go in the .h/.hpp file.
|
||||
* Small inlines can have a short 3 or 4 line JavaDoc style comment.
|
||||
* Completely document larger functions.
|
||||
* Document obvious parameters and return values too!
|
||||
|
||||
```c++
|
||||
/**
|
||||
* A brief explanation of what the function does and/or what purpose it serves.
|
||||
* Then follows a more detailed explanation of the function that can span multiple lines.
|
||||
*
|
||||
* @param foo Explanation of the foo parameter
|
||||
* @param bar Explanation of the bar parameter
|
||||
* @return The sum of foo and bar (@return can be omitted if the return type is void)
|
||||
*
|
||||
* @see SomeOtherFunc()
|
||||
* @see SOME_ENUM
|
||||
*
|
||||
* @bug Some bug description
|
||||
* @bug Another bug description which continues in the next line
|
||||
* and ends with the following blank line
|
||||
*
|
||||
* @todo Some to-do entry
|
||||
*/
|
||||
static int FooBar(int foo, int bar)
|
||||
{
|
||||
return foo + bar;
|
||||
}
|
||||
```
|
||||
|
||||
### Classes
|
||||
* Document structs similarly to functions:
|
||||
```c++
|
||||
/**
|
||||
* A short description of the struct.
|
||||
* More detailed description of the its usage.
|
||||
*
|
||||
* @see [link to anything of interest]
|
||||
*/
|
||||
struct foo {
|
||||
}
|
||||
```
|
||||
|
||||
### JavaDoc structural commands
|
||||
|
||||
This table shows the commands you should use with OpenTTD. The full list is [here](http://www.stack.nl/~dimitri/doxygen/commands.html).
|
||||
|
||||
| Command | Action | Example |
|
||||
| ------- | -------- | ------- |
|
||||
| **@attention** | Starts a paragraph where a message that needs attention may be entered. The paragraph will be indented. | @attention Whales crossing! |
|
||||
| **@brief** | Starts a paragraph that serves as a brief description. For classes and files the brief description will be used in lists and at the start of the documentation page. For class and file members, the brief description will be placed at the declaration of the member and prepended to the detailed description. A brief description may span several lines (although it is advised to keep it brief!). | @brief This is the brief description. |
|
||||
| **@bug** | Starts a paragraph where one or more bugs may be reported. The paragraph will be indented. Multiple adjacent @bug commands will be joined into a single paragraph. Each bug description will start on a new line. Alternatively, one @bug command may mention several bugs. | @bug Memory leak in here? |
|
||||
| **@note** | Starts a paragraph where a note can be entered. The paragraph will be indented. | @note Might be slow |
|
||||
| **@todo** | Starts a paragraph where a TODO item is described. The description will also add an item to a separate TODO list. The two instances of the description will be cross-referenced. Each item in the TODO list will be preceded by a header that indicates the origin of the item. | @todo Better error checking |
|
||||
| **@warning** | Starts a paragraph where one or more warning messages may be entered. The paragraph will be indented. | @warning Not thread safe! |
|
||||
| | <small>**Function related commands**</small> | |
|
||||
| **@return** | Starts a return value description for a function. | @return a character pointer |
|
||||
| **@param** | Starts a parameter description for a function parameter with name <parameter-name>. Followed by a description of the parameter. The existence of the parameter is checked and a warning is given if the documentation of this (or any other) parameter is missing or not present in the function declaration or definition.<br><br>The @param command has an optional attribute specifying the direction of the attribute. Possible values are "in" and "out". | @param n The number of bytes to copy<br>@param[out] dest The memory area to copy to.<br>@param[in] src The memory area to copy from. |
|
||||
| **@see** | Starts a paragraph where one or more cross-references to classes, functions, methods, variables, files or URL may be specified. Two names joined by either :: or # are understood as referring to a class and one of its members. One of several overloaded methods or constructors may be selected by including a parenthesized list of argument types after the method name. [Here](http://www.stack.nl/~dimitri/doxygen/autolink.html) you can find detailed information about this feature. | @see OtherFunc() |
|
||||
| **@b** | Displays the following word using a bold font. Equivalent to <b>word</b>. To put multiple words in bold use <b>multiple words</b>.| ...@b this and @b that... |
|
||||
| **@c / @p** | Displays the parameter <word> using a typewriter font. You can use this command to refer to member function parameters in the running text. To have multiple words in typewriter font use <tt>multiple words</tt>. | ... the @p x and @p y coordinates are used to... |
|
||||
| **@arg / @li** | This command has one argument that continues until the first blank line or until another @arg / @li is encountered. The command can be used to generate a simple, not nested list of arguments. Each argument should start with an @arg / @li command. | @arg @c AlignLeft left alignment.<br>@arg @c AlignCenter center alignment.<br>@arg @c AlignRight right alignment |
|
||||
| **@n** | Forces a new line. Equivalent to and inspired by the printf function. |@n |
|
||||
|
||||
### More on Doxygen and JavaDoc
|
||||
|
||||
Doxygen knows two different kinds of comments:
|
||||
* *Brief descriptions*: one-liners that describe the function roughly ([example](http://docs.openttd.org/annotated.html))
|
||||
* *Detailed descriptions*: as the name suggests, these contain the detailed function/purpose of the entity they describe ([example](http://docs.openttd.org/structBridge.html))
|
||||
|
||||
You can omit either one or put them into different places but there's only one brief and one detailed description allowed for the same entity.
|
||||
|
||||
Doxygen knows three modes for documenting an entity:
|
||||
* Before the entity
|
||||
* After the entity
|
||||
* In a different file
|
||||
|
||||
The latter is a little harder to maintain since the prototype of the entity it describes then is stored in several places (e.g. the .h file and the file with the descriptions). Also while it makes the code easier to read it also makes it easier to omit the important step of updating the description of an entity if it was changed - and we all know why that shouldn't happen ;)<br>
|
||||
Because of those reasons, we will only use the first two documentation schemes.
|
||||
|
||||
|
||||
Doxygen supports both Qt and JavaDoc comment styles:
|
||||
* Qt style example: **int i; //!< The counter for the main loop**
|
||||
* JavaDoc style example: **int i; /*\*< The counter for the main loop \*/**
|
||||
|
||||
It also supports more comment styles but those two are the ones which are standardized. For OTTD we'll be using the JavaDoc style. One of the reasons is that it has a feature that the Qt style doesn't offer: JavaDoc style comment blocks will automatically start a brief description which ends at the first dot followed by a space or new line. Everything after that will also be part of the detailed description.
|
||||
|
||||
The general structure of a JavaDoc style comment is
|
||||
```c++
|
||||
/**
|
||||
* This is the brief description. And this sentence contains some further explanations that will appear in the detailed description only.
|
||||
*/
|
||||
```
|
||||
|
||||
and the resulting descriptions of that block would be:
|
||||
* *Brief description*: This is the brief description.
|
||||
* *Detailed description*: This is the brief description. And this sentence contains some further explanations that will appear in the detailed description only.
|
||||
|
||||
The distinction between the brief and detailed descriptions is made by the dot followed by a space/newline, so if you want to use that inside the brief description you need to escape the space/newline:
|
||||
```c++
|
||||
/**
|
||||
* This is a brief description (e.g.\ using only a few words). Details go here.
|
||||
*/
|
||||
```
|
||||
|
||||
If you're doing a one-line comment, use:
|
||||
```c++
|
||||
int i; ///< This is the description.
|
||||
```
|
||||
|
||||
Also in the comment block you can include so-called structural commands which tell Doxygen what follows. In general, their area of effect begins after the command word and ends when a blank line or some other command is encountered. Also, multiple occurrences of the same structural command within a comment block or the referring entity will be joined in the documentation output usually.
|
||||
|
||||
## Commit message
|
||||
To achieve a coherent whole and to make changelog writing easier, here are some guidelines for commit messages.
|
||||
There is a check-script on the git server (also available for clients, see below) to make sure we all follow those rules.
|
||||
|
||||
The first line of a message must match:
|
||||
```
|
||||
<keyword>( #<issue>| <commit>(, (<keyword> #<issue>|<commit>))*)?: ([<section])? <Details>
|
||||
```
|
||||
Keywords are:
|
||||
* Add, Feature: Adding new stuff. Difference between "Feature" and "Add" is somewhat subjective. "Feature" for user-point-of-view stuff, "Add" for other.
|
||||
* Change: Changing behaviour from user-point-of-view.
|
||||
* Remove: Removing something from user-point-of-view.
|
||||
* Codechange, Cleanup: Changes without intentional change of behaviour from user-point-of-view. Difference between "Codechange" and "Cleanup" is somewhat subjective.
|
||||
* Fix, Revert: Fixing stuff.
|
||||
* Doc, Update: Documentation changes, version increments, translator commits.
|
||||
* Prepare: Preparation for bigger changes. Rarely used.
|
||||
|
||||
If you commit a fix for an [issue](https://github.com/OpenTTD/OpenTTD/issues), add the corresponding issue number in the form of #NNNN. Do it as well if you implement a feature with a matching entry.
|
||||
|
||||
In the case of bugfixes, if you know what revision the bug was introduced (eg regression), please mention that revision as well just after the prefix. Finding the trouble-causing revision is highly encouraged as it makes backporting/branching/releases that much easier.
|
||||
|
||||
To further structure the changelog, you can add sections. Example are:
|
||||
* "Network" for network specific changes
|
||||
* "NewGRF" for NewGRF additions
|
||||
* "YAPP", "NPF", for changes in these features
|
||||
* "OSX", "Debian", "win32", for OS-specific packaging changes
|
||||
|
||||
Further explanations, general bitching, etc. don't go into the first line. Use a new line for those.
|
||||
|
||||
Complete examples:
|
||||
* Fix: [YAPF] Infinite loop in pathfinder.
|
||||
* Fix #5926: [YAPF] Infinite loop in pathfinder.
|
||||
* Fix 80dffae130: Warning about unsigned unary minus.
|
||||
* Fix #6673, 99bb3a95b4: Store the map variety setting in the samegame.
|
||||
* Revert d9065fbfbe, Fix #5922: ClientSizeChanged is only called via WndProcGdi which already has the mutex.
|
||||
* Fix #1264, Fix #2037, Fix #2038, Fix #2110: Rewrite the autoreplace kernel.
|
||||
|
||||
|
||||
## Other tips
|
||||
### Remove trailing whitespace
|
||||
To find out if/where you have trailing whitespace, you can use the following (unix/bash) command:
|
||||
```
|
||||
grep -n -R --include "*.[ch]" '[ ]$' * | grep --invert-match ".diff" | grep --invert-match ".patch"
|
||||
```
|
||||
Automatically removing whitespace is also possible with the following shell script (Note that it only checks .c, .cpp, .h, .hpp and .mm files):
|
||||
```
|
||||
#!/bin/sh
|
||||
IFS='
|
||||
'
|
||||
for i in Makefile `find . -name \*.c -o -name \*.cpp -o -name \*.h -o -name \*.hpp -o -name \*.mm`
|
||||
do
|
||||
(
|
||||
echo '%s/[ ]\{1,\}$/'
|
||||
echo w
|
||||
echo q
|
||||
) | ed $i 2> /dev/null > /dev/null
|
||||
done
|
||||
```
|
||||
|
||||
### Install the client-side git commit hooks
|
||||
|
||||
The client-side hooks perform various checks when you commit changes locally.
|
||||
* Whitespace and indentation checks.
|
||||
* **Coding style** checks.
|
||||
|
||||
Get the hooks:
|
||||
```
|
||||
git clone https://github.com/OpenTTD/OpenTTD-git-hooks.git openttd_hooks
|
||||
```
|
||||
|
||||
Install the hooks, assuming "openttd" is your work tree folder:
|
||||
```
|
||||
cd openttd/.git/hooks
|
||||
ln -s -t . ../../../openttd_hooks/hooks/*
|
||||
```
|
||||
|
16
COMPILING.md
16
COMPILING.md
@@ -4,25 +4,20 @@
|
||||
|
||||
OpenTTD makes use of the following external libraries:
|
||||
|
||||
- (encouraged) breakpad: creates minidumps on crash
|
||||
- (encouraged) zlib: (de)compressing of old (0.3.0-1.0.5) savegames, content downloads,
|
||||
heightmaps
|
||||
- (encouraged) liblzma: (de)compressing of savegames (1.1.0 and later)
|
||||
- (encouraged) libpng: making screenshots and loading heightmaps
|
||||
- (optional) liblzo2: (de)compressing of old (pre 0.3.0) savegames
|
||||
|
||||
For Linux, the following additional libraries are used:
|
||||
For Linux, the following additional libraries are used (for non-dedicated only):
|
||||
|
||||
- (encouraged) libcurl: content downloads
|
||||
- libSDL2: hardware access (video, sound, mouse)
|
||||
- libfreetype: loading generic fonts and rendering them
|
||||
- libfontconfig: searching for fonts, resolving font names to actual fonts
|
||||
- harfbuzz: handling of right-to-left scripts (e.g. Arabic and Persian) (required libicu)
|
||||
- libicu: handling of right-to-left scripts (e.g. Arabic and Persian) and
|
||||
natural sorting of strings
|
||||
|
||||
If you are building a dedicated-server only, you don't need the last four.
|
||||
|
||||
OpenTTD does not require any of the libraries to be present, but without
|
||||
liblzma you cannot open most recent savegames and without zlib you cannot
|
||||
open most older savegames or use the content downloading system.
|
||||
@@ -38,7 +33,7 @@ OpenTTD needs the Platform SDK, if it isn't installed already. This can be
|
||||
done during installing Visual Studio, by selecting
|
||||
`Visual C++ MFC for x86 and x64` (and possibly
|
||||
`Visual C++ ATL for x86 and x64` depending on your version). If not, you
|
||||
can get download it as [MS Windows Platform SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk).
|
||||
can get download it as [MS Windows Platform SDK](https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk).
|
||||
|
||||
Install the SDK by following the instructions as given.
|
||||
|
||||
@@ -50,7 +45,6 @@ by following the `Quick Start` instructions of their
|
||||
After this, you can install the dependencies OpenTTD needs. We advise to use
|
||||
the `static` versions, and OpenTTD currently needs the following dependencies:
|
||||
|
||||
- breakpad
|
||||
- liblzma
|
||||
- libpng
|
||||
- lzo
|
||||
@@ -59,8 +53,8 @@ the `static` versions, and OpenTTD currently needs the following dependencies:
|
||||
To install both the x64 (64bit) and x86 (32bit) variants (though only one is necessary), you can use:
|
||||
|
||||
```ps
|
||||
.\vcpkg install --triplet=x64-windows-static
|
||||
.\vcpkg install --triplet=x86-windows-static
|
||||
.\vcpkg install liblzma:x64-windows-static libpng:x64-windows-static lzo:x64-windows-static zlib:x64-windows-static
|
||||
.\vcpkg install liblzma:x86-windows-static libpng:x86-windows-static lzo:x86-windows-static zlib:x86-windows-static
|
||||
```
|
||||
|
||||
You can open the folder (as a CMake project). CMake will be detected, and you can compile from there.
|
||||
@@ -103,7 +97,7 @@ Via CMake, several options can be influenced to get different types of
|
||||
builds.
|
||||
|
||||
- `-DCMAKE_BUILD_TYPE=RelWithDebInfo`: build a release build. This is
|
||||
significantly faster than a debug build, but has far less useful information
|
||||
significant faster than a debug build, but has far less useful information
|
||||
in case of a crash.
|
||||
- `-DOPTION_DEDICATED=ON`: build OpenTTD without a GUI. Useful if you are
|
||||
running a headless server, as it requires less libraries to operate.
|
||||
|
@@ -14,7 +14,7 @@ In return, they should reciprocate that respect in addressing your issue or asse
|
||||
The [issue tracker](https://github.com/OpenTTD/OpenTTD/issues) is the preferred channel for [bug reports](#bug-reports), but please respect the following restrictions:
|
||||
|
||||
* Please **do not** use the issue tracker for help playing or using OpenTTD.
|
||||
Please try [irc](https://wiki.openttd.org/en/Development/IRC%20channel), [Discord](https://discord.gg/openttd), or the [forums](https://www.tt-forums.net/)
|
||||
Please try [irc](https://wiki.openttd.org/en/Development/IRC%20channel), or the [forums](https://www.tt-forums.net/)
|
||||
|
||||
* Please **do not** derail or troll issues. Keep the discussion on topic and respect the opinions of others.
|
||||
|
||||
@@ -23,7 +23,7 @@ Use [GitHub's "reactions" feature](https://github.com/blog/2119-add-reactions-to
|
||||
We reserve the right to delete comments which violate this rule.
|
||||
|
||||
* Please **do not** open issues or pull requests regarding add-on content in NewGRF, GameScripts, AIs, etc.
|
||||
These are created by third-parties. Please try [irc](https://wiki.openttd.org/en/Development/IRC%20channel), [Discord](https://discord.gg/openttd), or the [forums](https://www.tt-forums.net/) to discuss these.
|
||||
These are created by third-parties. Please try [irc](https://wiki.openttd.org/en/Development/IRC%20channel) or the [forums](https://www.tt-forums.net/) to discuss these.
|
||||
|
||||
* Please use [the web translator](https://translator.openttd.org/) to submit corrections and improvements to translations of the game.
|
||||
|
||||
@@ -94,8 +94,8 @@ Although we really appreciate feedback and ideas, we will close feature requests
|
||||
|
||||
Many of those ideas etc do have a place on the [forums](https://www.tt-forums.net); and if enough people like it, someone will stand up and make it.
|
||||
|
||||
It's usually best to discuss on [Discord](https://discord.gg/openttd) before opening a feature request or working on a large feature in a fork.
|
||||
Discussion can take time, but it can be productive and avoid disappointment. :)
|
||||
It's usually best discuss in [irc](https://wiki.openttd.org/en/Development/IRC%20channel) before opening a feature request or working on a large feature in a fork.
|
||||
Discussion in irc can take time, but it can be productive and avoid disappointment :)
|
||||
|
||||
|
||||
## Pull requests
|
||||
@@ -108,11 +108,11 @@ Pull requests should fit with the [goals of the project](./CONTRIBUTING.md#proje
|
||||
|
||||
Every pull request should have a clear scope, with no unrelated commits.
|
||||
|
||||
[Code style](./CODINGSTYLE.md) must be complied with for pull requests to be accepted; this also includes [commit message format](./CODINGSTYLE.md#commit-message).
|
||||
[Code style](https://wiki.openttd.org/en/Development/Coding%20style) must be complied with for pull requests to be accepted; this also includes [commit message format](https://wiki.openttd.org/en/Development/Coding%20style#commit-message).
|
||||
|
||||
Adhering to the following process is the best way to get your work included in the project:
|
||||
|
||||
1. [Fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo) the project, clone your fork, and configure the remotes:
|
||||
1. [Fork](https://help.github.com/fork-a-repo/) the project, clone your fork, and configure the remotes:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/<your-username>/OpenTTD.git openttd
|
||||
@@ -136,7 +136,7 @@ contain your feature, change, or fix:
|
||||
git checkout upstream/master -b <topic-branch-name>
|
||||
```
|
||||
|
||||
4. Commit your changes in logical chunks. Please adhere to these [git commit message guidelines](./CODINGSTYLE.md#commit-message) or your code is unlikely to be merged into the main project.
|
||||
4. Commit your changes in logical chunks. Please adhere to these [git commit message guidelines](https://wiki.openttd.org/en/Development/Coding%20style#commit-message) or your code is unlikely to be merged into the main project.
|
||||
Use Git's [interactive rebase](https://docs.github.com/en/get-started/using-git/about-git-rebase) feature to tidy up your commits before making them public.
|
||||
|
||||
5. Locally rebase the upstream development branch into your topic branch:
|
||||
@@ -172,7 +172,7 @@ The results of the CI tests will show on your pull request.
|
||||
By clicking on Details you can further zoom in; in case of a failure it will show you why it failed.
|
||||
In case of success it will report how awesome you were.
|
||||
|
||||
Tip: [commit message format](./CODINGSTYLE.md#commit-message) is a common reason for pull requests to fail validation.
|
||||
Tip: [commit message format](https://wiki.openttd.org/en/Development/Coding%20style#commit-message) is a common reason for pull requests to fail validation.
|
||||
|
||||
|
||||
### Are there any development docs?
|
||||
@@ -182,16 +182,6 @@ There is no single source for OpenTTD development docs. It's a complex project w
|
||||
A good entry point is [Development](https://wiki.openttd.org/en/Development/) on the OpenTTD wiki; this provides links to wiki documentation and other sources.
|
||||
|
||||
The GitHub repo also includes some non-comprehensive documentation in [/docs](./docs).
|
||||
These include:
|
||||
- When to [change other languages and when not to](./docs/eints.md).
|
||||
- The [savegame format](./docs/savegame_format.md).
|
||||
- The [release process](./docs/releasing_openttd.md).
|
||||
- Some [notes on the link graph algorithm](./docs/linkgraph.md).
|
||||
- The [network game coordinator](./docs/game_coordinator.md).
|
||||
- How to use [the admin port for network games](./docs/admin_network.md), also useful for multiplayer server hosts.
|
||||
- The [performance metrics and logging features](./docs/logging_and_performance_metrics.md), also useful for add-on developers.
|
||||
- How [symbol server and analysis works](./docs/symbol_server.md).
|
||||
- And several miscellaneous files detailing internal data structures and graphics measurements and palettes.
|
||||
|
||||
You may also want the guide to [compiling OpenTTD](./COMPILING.md).
|
||||
|
||||
@@ -222,8 +212,8 @@ When it comes to gameplay features there are at least these groups of interests:
|
||||
- *Control freak:* micromanagement like conditional orders, refitting and loading etc.
|
||||
- *Casual:* automatisation like cargodist, path based signalling etc.
|
||||
|
||||
To please everyone, the official branch tries to stay close to the original gameplay; after all, that is what brought everyone here.
|
||||
The preferred method to alter and extend the gameplay is via add-ons like NewGRF and GameScripts.
|
||||
To please everyone, the official branch tries to stay close to the original gameplay; after all, that is what everyone brought here.
|
||||
The preferred method to alter and extent the gameplay is via add-ons like NewGRF and GameScripts.
|
||||
|
||||
For a long time, the official branch was also open to features which could be enabled/disabled, but the corner-cases that came with some configurations have rendered some parts of the code very complicated.
|
||||
Today, new features have to work with all the already existing features, which is not only challenging in corner cases, but also requires spending considerable more work than just "making it work in the game mode that I play".
|
||||
@@ -266,7 +256,7 @@ This is inevitable, because it is a main feature of git.
|
||||
If you are concerned about your privacy, we strongly recommend to use "Anonymous <anonymous@openttd.org>" as the git commit author. We might refuse anonymous contributions if malicious intent is suspected.
|
||||
|
||||
Please note that the contributor identity, once given, is used for copyright verification and to provide proof should a malicious commit be made.
|
||||
As such, the [EU GDPR](https://gdpr.eu) "right to be forgotten" does not apply, as this is an overriding legitimate interest.
|
||||
As such, the [EU GDPR](https://www.eugdpr.org/key-changes.html) "right to be forgotten" does not apply, as this is an overriding legitimate interest.
|
||||
|
||||
Please also note that your commit is public and as such will potentially be processed by many third-parties.
|
||||
Git's distributed nature makes it impossible to track where exactly your commit, and thus your personal data, will be stored and be processed.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
This is the license which applies to OpenTTD with the exception of some
|
||||
3rd party modules. See [our readme](./README.md) for details
|
||||
3rd party modules. See [./README.md](./README.md) for details
|
||||
|
||||
GNU General Public License
|
||||
==========================
|
||||
|
28
CREDITS.md
28
CREDITS.md
@@ -1,32 +1,31 @@
|
||||
### The OpenTTD team (in alphabetical order):
|
||||
|
||||
- Grzegorz Duczyński (adf88) - General coding (since 1.7.2)
|
||||
- Albert Hofkamp (Alberth) - GUI expert (since 0.7)
|
||||
- Matthijs Kooijman (blathijs) - Pathfinder-guru, Debian port (since 0.3)
|
||||
- Ulf Hermann (fonsinchen) - Cargo Distribution (since 1.3)
|
||||
- Christoph Elsenhans (frosch) - General coding (since 0.6)
|
||||
- Loïc Guilloux (glx) - General / Windows Expert (since 0.4.5)
|
||||
- Loïc Guilloux (glx) - Windows Expert (since 0.4.5)
|
||||
- Charles Pigott (LordAro) - General / Correctness police (since 1.9)
|
||||
- Michael Lutz (michi_cc) - General / Path based signals (since 0.7)
|
||||
- Michael Lutz (michi_cc) - Path based signals (since 0.7)
|
||||
- Niels Martin Hansen (nielsm) - Music system, general coding (since 1.9)
|
||||
- Owen Rudge (orudge) - Forum host, OS/2 port (since 0.1)
|
||||
- Peter Nelson (peter1138) - Spiritual descendant from newGRF gods (since 0.4.5)
|
||||
- Remko Bijker (Rubidium) - Coder and way more (since 0.4.5)
|
||||
- Patric Stout (TrueBrain) - NoProgrammer (since 0.3), sys op
|
||||
- Tyler Trahan (2TallTyler) - General coding (since 13)
|
||||
- Ingo von Borstel (planetmaker) - General coding, Support (since 1.1)
|
||||
- Remko Bijker (Rubidium) - Lead coder and way more (since 0.4.5)
|
||||
- José Soler (Terkhen) - General coding (since 1.0)
|
||||
|
||||
### Inactive Developers:
|
||||
|
||||
- Grzegorz Duczyński (adf88) - General coding (1.7 - 1.8)
|
||||
- Albert Hofkamp (Alberth) - GUI expert (0.7 - 1.9)
|
||||
- Jean-François Claeys (Belugas) - GUI, newindustries and more (0.4.5 - 1.0)
|
||||
- Bjarni Corfitzen (Bjarni) - macOS port, coder and vehicles (0.3 - 0.7)
|
||||
- Victor Fischer (Celestar) - Programming everywhere you need him to (0.3 - 0.6)
|
||||
- Ulf Hermann (fonsinchen) - Cargo Distribution (1.3 - 1.6)
|
||||
- Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;) (0.4.5 - 0.6)
|
||||
- Jonathan Coome (Maedhros) - High priest of the NewGRF Temple (0.5 - 0.6)
|
||||
- Attila Bán (MiHaMiX) - Developer WebTranslator 1 and 2 (0.3 - 0.5)
|
||||
- Ingo von Borstel (planetmaker) - General coding, Support (1.1 - 1.9)
|
||||
- Attila Bán (MiHaMiX) - WebTranslator 1 and 2 (0.3 - 0.5)
|
||||
- Zdeněk Sojka (SmatZ) - Bug finder and fixer (0.6 - 1.3)
|
||||
- José Soler (Terkhen) - General coding (1.0 - 1.4)
|
||||
- Christoph Mallon (Tron) - Programmer, code correctness police (0.3 - 0.5)
|
||||
- Patric Stout (TrueBrain) - NoProgrammer (0.3 - 1.2), sys op (active)
|
||||
- Thijs Marinussen (Yexo) - AI Framework, General (0.6 - 1.3)
|
||||
- Leif Linse (Zuu) - AI/Game Script (1.2 - 1.6)
|
||||
|
||||
@@ -34,11 +33,11 @@
|
||||
|
||||
- Tamás Faragó (Darkvater) - Ex-Lead coder (0.3 - 0.5)
|
||||
- Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3 - 0.3)
|
||||
- Emil Djupfeld (egladil) - macOS port (0.4.5 - 0.6)
|
||||
- Emil Djupfeld (egladil) - macOS port (0.4 - 0.6)
|
||||
- Simon Sasburg (HackyKid) - Bug fixer (0.4 - 0.4.5)
|
||||
- Ludvig Strigeus (ludde) - Original author of OpenTTD, main coder (0.1 - 0.3)
|
||||
- Cian Duffy (MYOB) - BeOS port / manual writing (0.1 - 0.3)
|
||||
- Petr Baudiš (pasky) - Many patches, newgrf support (0.3 - 0.3)
|
||||
- Petr Baudiš (pasky) - Many patches, newgrf support, etc. (0.3 - 0.3)
|
||||
- Benedikt Brüggemeier (skidd13) - Bug fixer and code reworker (0.6 - 0.7)
|
||||
- Serge Paquet (vurlix) - 2nd contributor after ludde (0.1 - 0.3)
|
||||
|
||||
@@ -53,10 +52,9 @@
|
||||
- Alberto Demichelis - Squirrel scripting language
|
||||
- L. Peter Deutsch - MD5 implementation
|
||||
- Michael Blunck - For revolutionizing TTD with awesome graphics
|
||||
- George - Canal/Lock graphics
|
||||
- George - Canal graphics
|
||||
- Andrew Parkhouse (andythenorth) - River graphics
|
||||
- David Dallaston (Pikka) - Tram tracks
|
||||
- Richard Wheeler (zephyris) - OpenTTD TrueType font
|
||||
- All Translators - For their support to make OpenTTD a truly international game
|
||||
- Bug Reporters - Thanks for all bug reports
|
||||
- Chris Sawyer - For an amazing game!
|
||||
|
@@ -41,6 +41,7 @@ INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 2
|
||||
ALIASES =
|
||||
TCL_SUBST =
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
OPTIMIZE_FOR_FORTRAN = NO
|
||||
@@ -154,6 +155,7 @@ VERBATIM_HEADERS = YES
|
||||
# Configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = NO
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the HTML output
|
||||
@@ -222,7 +224,7 @@ LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
LATEX_FOOTER =
|
||||
@@ -292,8 +294,8 @@ PREDEFINED = WITH_ZLIB \
|
||||
WITH_PNG \
|
||||
WITH_FONTCONFIG \
|
||||
WITH_FREETYPE \
|
||||
WITH_HARFBUZZ \
|
||||
WITH_ICU_I18N \
|
||||
WITH_ICU_LX \
|
||||
UNICODE \
|
||||
_UNICODE \
|
||||
_GNU_SOURCE \
|
||||
|
75
README.md
75
README.md
@@ -11,10 +11,9 @@
|
||||
- 1.6) [OpenTTD directories](#16-openttd-directories)
|
||||
- 1.7) [Compiling OpenTTD](#17-compiling-openttd)
|
||||
- 2.0) [Contact and community](#20-contact-and-community)
|
||||
- 2.1) [Multiplayer games](#21-multiplayer-games)
|
||||
- 2.2) [Contributing to OpenTTD](#22-contributing-to-openttd)
|
||||
- 2.3) [Reporting bugs](#23-reporting-bugs)
|
||||
- 2.4) [Translating](#24-translating)
|
||||
- 2.1) [Contributing to OpenTTD](#21-contributing-to-openttd)
|
||||
- 2.2) [Reporting bugs](#22-reporting-bugs)
|
||||
- 2.3) [Translating](#23-translating)
|
||||
- 3.0) [Licensing](#30-licensing)
|
||||
- 4.0) [Credits](#40-credits)
|
||||
|
||||
@@ -78,9 +77,9 @@ For some platforms, you will need to refer to [the installation guide](https://w
|
||||
The free data files, split into OpenGFX for graphics, OpenSFX for sounds and
|
||||
OpenMSX for music can be found at:
|
||||
|
||||
- [OpenGFX](https://www.openttd.org/downloads/opengfx-releases/latest)
|
||||
- [OpenSFX](https://www.openttd.org/downloads/opensfx-releases/latest)
|
||||
- [OpenMSX](https://www.openttd.org/downloads/openmsx-releases/latest)
|
||||
- https://www.openttd.org/downloads/opengfx-releases/latest for OpenGFX
|
||||
- https://www.openttd.org/downloads/opensfx-releases/latest for OpenSFX
|
||||
- https://www.openttd.org/downloads/openmsx-releases/latest for OpenMSX
|
||||
|
||||
Please follow the readme of these packages about the installation procedure.
|
||||
The Windows installer can optionally download and install these packages.
|
||||
@@ -117,15 +116,35 @@ Most types of add-on content can be downloaded within OpenTTD via the 'Check Onl
|
||||
|
||||
Add-on content can also be installed manually, but that's more complicated; the [OpenTTD wiki](https://wiki.openttd.org/) may offer help with that, or the [OpenTTD directory structure guide](./docs/directory_structure.md).
|
||||
|
||||
### 1.5.1) AI opponents
|
||||
|
||||
### 1.5.1) Social Integration
|
||||
OpenTTD comes without AI opponents, so if you want to play with AIs you have to download them.
|
||||
|
||||
OpenTTD has the ability to load plugins to integrate with Social Platforms like Steam, Discord, etc.
|
||||
The easiest way is via the 'Check Online Content' button in the main menu.
|
||||
|
||||
To enable such integration, the plugin for the specific platform has to be downloaded and stored in the `social_integration` folder.
|
||||
You can select some AIs that you think are compatible with your playing style.
|
||||
|
||||
See [OpenTTD's website](https://www.openttd.org), under Downloads, for what plugins are available.
|
||||
AI help and discussions may also be found in the [AI section of the forum](https://www.tt-forums.net/viewforum.php?f=65).
|
||||
|
||||
### 1.5.2) Scenarios and height maps
|
||||
|
||||
Scenarios and heightmaps can be added via the 'Check Online Content' button in the main menu.
|
||||
|
||||
### 1.5.3) NewGRFs
|
||||
|
||||
A wide range of add-content is available as NewGRFs, including vehicles, industries, stations, landscape objects, town names and more.
|
||||
|
||||
NewGRFs can be added via the 'Check Online Content' button in the main menu.
|
||||
|
||||
See also the wiki [guide to NewGRFs](https://wiki.openttd.org/en/Manual/NewGRF) and [the forum graphics development section](https://www.tt-forums.net/viewforum.php?f=66).
|
||||
|
||||
### 1.5.4) Game scripts
|
||||
|
||||
Game scripts can provide additional challenges or changes to the standard OpenTTD gameplay, for example setting transport goals, or changing town growth behaviour.
|
||||
|
||||
Game scripts can be added via the 'Check Online Content' button in the main menu.
|
||||
|
||||
See also the wiki [guide to game scripts](https://wiki.openttd.org/en/Manual/Game%20script) and [the forum graphics game script section](https://www.tt-forums.net/viewforum.php?f=65).
|
||||
|
||||
### 1.6) OpenTTD directories
|
||||
|
||||
@@ -143,7 +162,6 @@ If you want to compile OpenTTD from source, instructions can be found in [COMPIL
|
||||
'Official' channels
|
||||
|
||||
- [OpenTTD website](https://www.openttd.org)
|
||||
- [OpenTTD official Discord](https://discord.gg/openttd)
|
||||
- IRC chat using #openttd on irc.oftc.net [more info about our irc channel](https://wiki.openttd.org/en/Development/IRC%20channel)
|
||||
- [OpenTTD on Github](https://github.com/OpenTTD/) for code repositories and for reporting issues
|
||||
- [forum.openttd.org](https://forum.openttd.org/) - the primary community forum site for discussing OpenTTD and related games
|
||||
@@ -154,19 +172,12 @@ If you want to compile OpenTTD from source, instructions can be found in [COMPIL
|
||||
- the OpenTTD wiki has a [page listing OpenTTD communities](https://wiki.openttd.org/en/Community/Community) including some in languages other than English
|
||||
|
||||
|
||||
### 2.1) Multiplayer games
|
||||
|
||||
You can play OpenTTD with others, either cooperatively or competitively.
|
||||
|
||||
See the [multiplayer documentation](./docs/multiplayer.md) for more details.
|
||||
|
||||
|
||||
### 2.2) Contributing to OpenTTD
|
||||
### 2.1) Contributing to OpenTTD
|
||||
|
||||
We welcome contributors to OpenTTD. More information for contributors can be found in [CONTRIBUTING.md](./CONTRIBUTING.md)
|
||||
|
||||
|
||||
### 2.3) Reporting bugs
|
||||
### 2.2) Reporting bugs
|
||||
|
||||
Good bug reports are very helpful. We have a [guide to reporting bugs](./CONTRIBUTING.md#bug-reports) to help with this.
|
||||
|
||||
@@ -174,7 +185,7 @@ Desyncs in multiplayer are complex to debug and report (some software developmen
|
||||
Instructions can be found in [debugging and reporting desyncs](./docs/debugging_desyncs.md).
|
||||
|
||||
|
||||
### 2.4) Translating
|
||||
### 2.3) Translating
|
||||
|
||||
OpenTTD is translated into many languages. Translations are added and updated via the [online translation tool](https://translator.openttd.org).
|
||||
|
||||
@@ -191,26 +202,12 @@ See `src/3rdparty/squirrel/COPYRIGHT` for the complete license text.
|
||||
The md5 implementation in `src/3rdparty/md5` is licensed under the Zlib license.
|
||||
See the comments in the source files in `src/3rdparty/md5` for the complete license text.
|
||||
|
||||
The implementations of Posix `getaddrinfo` and `getnameinfo` for OS/2 in `src/3rdparty/os2` are distributed partly under the GNU Lesser General Public License 2.1, and partly under the (3-clause) BSD license.
|
||||
The exact licensing terms can be found in `src/3rdparty/os2/getaddrinfo.c` resp. `src/3rdparty/os2/getnameinfo.c`.
|
||||
|
||||
The fmt implementation in `src/3rdparty/fmt` is licensed under the MIT license.
|
||||
See `src/3rdparty/fmt/LICENSE.rst` for the complete license text.
|
||||
|
||||
The nlohmann json implementation in `src/3rdparty/nlohmann` is licensed under the MIT license.
|
||||
See `src/3rdparty/nlohmann/LICENSE.MIT` for the complete license text.
|
||||
|
||||
The OpenGL API in `src/3rdparty/opengl` is licensed under the MIT license.
|
||||
See `src/3rdparty/opengl/khrplatform.h` for the complete license text.
|
||||
|
||||
The catch2 implementation in `src/3rdparty/catch2` is licensed under the Boost Software License, Version 1.0.
|
||||
See `src/3rdparty/catch2/LICENSE.txt` for the complete license text.
|
||||
|
||||
The icu scriptrun implementation in `src/3rdparty/icu` is licensed under the Unicode license.
|
||||
See `src/3rdparty/icu/LICENSE` for the complete license text.
|
||||
|
||||
The monocypher implementation in `src/3rdparty/monocypher` is licensed under the 2-clause BSD and CC-0 license.
|
||||
See `src/3rdparty/monocypher/LICENSE.md` for the complete license text.
|
||||
|
||||
The OpenTTD Social Integration API in `src/3rdparty/openttd_social_integration_api` is licensed under the MIT license.
|
||||
See `src/3rdparty/openttd_social_integration_api/LICENSE` for the complete license text.
|
||||
|
||||
## 4.0 Credits
|
||||
|
||||
|
@@ -13,8 +13,6 @@ set(AI_COMPAT_SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.10.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.11.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_12.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_13.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_14.nut
|
||||
)
|
||||
|
||||
foreach(AI_COMPAT_SOURCE_FILE IN LISTS AI_COMPAT_SOURCE_FILES)
|
||||
|
@@ -379,16 +379,3 @@ AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -131,16 +131,3 @@ AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -68,16 +68,3 @@ AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -6,16 +6,3 @@
|
||||
*/
|
||||
|
||||
AILog.Info("1.10 API compatibility in effect.");
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -6,16 +6,3 @@
|
||||
*/
|
||||
|
||||
AILog.Info("1.11 API compatibility in effect.");
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -20,16 +20,3 @@ AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -20,16 +20,3 @@ AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -20,16 +20,3 @@ AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -20,16 +20,3 @@ AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -20,16 +20,3 @@ AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -20,16 +20,3 @@ AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -20,16 +20,3 @@ AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -6,16 +6,3 @@
|
||||
*/
|
||||
|
||||
AILog.Info("1.9 API compatibility in effect.");
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -4,18 +4,3 @@
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
AILog.Info("12 API compatibility in effect.");
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -1,8 +0,0 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
AILog.Info("13 API compatibility in effect.");
|
@@ -1,6 +0,0 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
@@ -10,8 +10,6 @@ set(GS_COMPAT_SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.10.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.11.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_12.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_13.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_14.nut
|
||||
)
|
||||
|
||||
foreach(GS_COMPAT_SOURCE_FILE IN LISTS GS_COMPAT_SOURCE_FILES)
|
||||
|
@@ -13,16 +13,3 @@ GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -6,16 +6,3 @@
|
||||
*/
|
||||
|
||||
GSLog.Info("1.11 API compatibility in effect.");
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -35,16 +35,3 @@ GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -35,16 +35,3 @@ GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -28,15 +28,3 @@ GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -20,16 +20,3 @@ GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -20,16 +20,3 @@ GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -20,16 +20,3 @@ GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -20,16 +20,3 @@ GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -13,16 +13,3 @@ GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -4,18 +4,3 @@
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
GSLog.Info("12 API compatibility in effect.");
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -1,8 +0,0 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
GSLog.Info("13 API compatibility in effect.");
|
@@ -1,6 +0,0 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
114
changelog.txt
114
changelog.txt
@@ -1,117 +1,3 @@
|
||||
13.0-beta2 (2022-11-27)
|
||||
------------------------------------------------------------------------
|
||||
Feature: Allow AI/GS to be fully modified in scenario editor (#10152)
|
||||
Feature: Display power-to-weight ratio in ground vehicle details GUI (#10123)
|
||||
Feature: Variable interface scaling (with chunky bevels!) (#10114)
|
||||
Feature: Hotkey to honk a vehicle's horn (#10110)
|
||||
Feature: Split AI/Game Script configuration windows and add them to world gen window (#10058)
|
||||
Feature: [GS] Scriptable league tables (#10001)
|
||||
Feature: Multi-track level crossings (#9931)
|
||||
Feature: Improved local authority action window (#9928)
|
||||
Feature: Automatic console command screenshot numbering with a filename ending in '#' (#9781)
|
||||
Feature: Add buttons to toggle music in the Game Options menu (#9727)
|
||||
Feature: Contextual actions for vehicles grouped by shared orders (#8425)
|
||||
Feature: Add cargo filter support to vehicle list (#8308)
|
||||
Feature: Show the cargoes the vehicles can carry in the vehicle list window (#8304)
|
||||
Change: Allow building canal by area outside editor (#10173)
|
||||
Change: Minor improvements to the new Finance GUI (#10168)
|
||||
Change: Let AI developers edit non-editable AI/Game Script Parameters (#8895)
|
||||
Change: Allow building docks on clearable watered object tiles (#8514)
|
||||
Fix #8770: Center vehicle status bar icon (#10178)
|
||||
Fix: Crash if error message window is too wide for screen. (#10172)
|
||||
Fix #10155: Network games not syncing company settings properly (#10158)
|
||||
Fix #10154: Network game desync related to setting a random company face (#10157)
|
||||
Fix #10011: Incorrect infrastructure totals when overbuilding bay road stop (#10143)
|
||||
Fix #10117: Object burst limit allowed one fewer object than the setting (#10120)
|
||||
Fix #10023: Allow negative input in text fields when needed (#10112)
|
||||
Fix #9908: Fix crash which could occur when a company was deleted when a depot window was open (#9912)
|
||||
|
||||
|
||||
13.0-beta1 (2022-10-31)
|
||||
------------------------------------------------------------------------
|
||||
Feature: Airport construction GUI displays infrastructure cost (#10094)
|
||||
Feature: Purchase land multiple tiles at a time (#10027)
|
||||
Feature: Add sticky pin & shade widgets to Object Selection UI panel (#10019, #10020)
|
||||
Feature: Improved handling of HiDPI and mixed-DPI screens (#9994, #9996, #9997, #10064)
|
||||
Feature: Alternative linkgraph colour schemes (#9866)
|
||||
Feature: Allow Shift+Insert as paste in edit box (#9836)
|
||||
Feature: Setting to make the local town authority rubber-stamp all actions (#9833)
|
||||
Feature: Add/extend console commands to enable screenshot automation (#9771)
|
||||
Feature: [Linkgraph] Show a tooltip with statistics when hovering a link (#9760)
|
||||
Feature: Build objects by area (#9709)
|
||||
Feature: Add setting to hide news about competitors vehicle crash (#9653)
|
||||
Feature: Ctrl-click to remove fully autoreplaced vehicles from list (#9639)
|
||||
Feature: Wide rivers on map generation (#9628)
|
||||
Add: [Script] ScriptCargo::GetWeight to get cargo weights (#9930)
|
||||
Add: Command line option to skip NewGRF scanning (#9879)
|
||||
Add: Show video driver name in Game Options window (#9872)
|
||||
Add: [NewGRF] Map seed as global variable (#9834)
|
||||
Add: [Script] IndustryType::ResolveNewGRFID to resolve industry id from grf_local_id and grfid (#9798)
|
||||
Add: [Script] ObjectType::ResolveNewGRFID to resolve object id from grfid and grf_local_id (#9795)
|
||||
Update: To all the friends we have lost and those we have gained (#10000)
|
||||
Change: Use the Simulation subcategory to openttd.desktop (#10015)
|
||||
Change: Constantly update destination of 'any depot' orders (#9959)
|
||||
Change: Use an indent, not a dash, to list train capacity (#9887)
|
||||
Change: [NewGRF] Increase vehicle sprite stack from 4 layers to 8 (#9863)
|
||||
Change: Don't pay Property Maintenance on stations when Infrastructure Maintenance is disabled (#9828)
|
||||
Change: Improved layout of the finance window (#9827)
|
||||
Change: [Admin] Bump admin port protocol due to command changes (#9754)
|
||||
Change: Suppress vehicle age warnings for stopped vehicles (#9718)
|
||||
Change: Make pf.yapf.rail_firstred_twoway_eol on by default (#9544)
|
||||
Change: Deliver cargo to the closest industry first (#9536)
|
||||
Fix: Lots of fixes to how windows handle resizing (#10040, #10042, #10046, #10051, #10056, #10068, #10070, #10098)
|
||||
Fix: Console commands list_ai output was truncated with a suitably large number of AIs (#10075)
|
||||
Fix #9876: MacBook Touch Bar crash / render issues w/ 32bpp graphics (#10060)
|
||||
Fix: Reduce framerate overhead in Train::Tick (#10055)
|
||||
Fix: Only open scenario editor date query once (#10050)
|
||||
Fix #10048: Don't relocate company HQ on the same exact location (#10049)
|
||||
Fix #10038: Missing upper bounds check when loading custom playlists (#10039)
|
||||
Fix: Wrong string used to determine size of zoomed out station sign (#10036)
|
||||
Fix: Disable "turn around" button for other companies' road vehicles (#10033)
|
||||
Fix: Online Players list mouse hover behaviour (#10031)
|
||||
Fix: [NewGRF] Weirdness of new stations (#10017)
|
||||
Fix #9854: DrawStringMultiLine() could draw beyond its bounding box (#10014)
|
||||
Fix: Incorrect player name in online players window (#10013)
|
||||
Fix #8099: News window zoom level fixes (#10005)
|
||||
Fix: [NewGRF] Upper 16 random bits should be the same for all station tiles in callback 140 (#9992)
|
||||
Fix #9989: £0 Net Profit is neither negative nor positive (#9991)
|
||||
Fix #9804: Only apply sprite_zoom_min setting when sprites available (#9988)
|
||||
Fix #9972: Add missing fill/resize flags on Framerate window widgets (#9982)
|
||||
Fix #9935: Use more selectivity when building SSE specific code (#9980)
|
||||
Fix #9940: Print debuglevel parse errors to console when changed from console (#9979)
|
||||
Fix #9977: Clearing the console with a large number of lines could cause a crash (#9978)
|
||||
Fix #9974: Console command getsysdate did not work due to off-by-one error (#9975)
|
||||
Fix: [NewGRF] Default value of RailVehicleInfo::railveh_type was inconsistent with other default properties (#9967)
|
||||
Fix #8584: Vehicles with shared orders getting invalid or unexpected start dates (#9955)
|
||||
Fix #9951: [NewGRF] Scenario editor random industries button broke NewGRF persistent storage (#9952)
|
||||
Fix: Validation of various internal command parameters that could have allowed a rogue client to crash servers (#9942, #9943, #9944, #9945, #9946, #9947, #9948, #9950)
|
||||
Fix #9937: Station industries_near incorrect after removing part moved sign (#9938)
|
||||
Fix: [Script] ScriptRoad::HasRoadType really check for RoadType (#9934)
|
||||
Fix #9363: Rebuild client list on reinit event (#9929)
|
||||
Fix #9925: Industry tile layout validation for layouts of only one tile (#9926)
|
||||
Fix #9918: Reset industy last production year on scenario start (#9920)
|
||||
Fix #9914: Prevent more useless pathfinder run for blocked vehicles (#9917)
|
||||
Fix: List a max of four share owners instead of three (#9905)
|
||||
Fix: [NewGRF] Industry layouts with zero regular tiles should be invalid (#9902)
|
||||
Fix #9869: Remove docking tile when doing a clear square (#9898)
|
||||
Fix: New player companies use favorite manager face, if saved (#9895)
|
||||
Fix: Towns don't build parallel, redundant bridges (#9891)
|
||||
Fix #9712: Cap town bridge length at original 11-tile limit (#9890)
|
||||
Fix #9883: Show cost/income float over end tile of rail or road construction (#9889)
|
||||
Fix #9870: Don't update infrastructure totals when overbuilding object on canal (#9888)
|
||||
Fix #9877: GS could trigger 'Cost: £0' cost message (#9878)
|
||||
Fix 44f2ef1: [strgen] Allow gender for {CARGO_SHORT} (#9873)
|
||||
Fix #9867: Industry::stations_near not filled at industry creation (#9868)
|
||||
Fix #9853: Incorrect merge of guiflags and flags for osk_activation (#9855)
|
||||
Fix #6544: Don't join AI company when loading network game in singleplayer (#9794)
|
||||
Fix: Company values do not properly account for shares (#9770)
|
||||
Fix #9546: Crash when no industries are present in game (#9726)
|
||||
Fix #9708: [Linkgraph] Don't assume vehicles have a non-zero max speed (#9693)
|
||||
Fix #9665: [Linkgraph] Fix travel times of non-direct journeys (#9693)
|
||||
Fix #8797: Use logical rail length when placing signals (#9652)
|
||||
Cleanup: [NewGRF] Remove unused flag sprites (#10052)
|
||||
|
||||
|
||||
12.2 (2022-04-02)
|
||||
------------------------------------------------------------------------
|
||||
Feature: Remember the last-used signal between games (#9792)
|
||||
|
@@ -1,206 +0,0 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
Catch
|
||||
-----
|
||||
|
||||
This module defines a function to help use the Catch test framework.
|
||||
|
||||
The :command:`catch_discover_tests` discovers tests by asking the compiled test
|
||||
executable to enumerate its tests. This does not require CMake to be re-run
|
||||
when tests change. However, it may not work in a cross-compiling environment,
|
||||
and setting test properties is less convenient.
|
||||
|
||||
This command is intended to replace use of :command:`add_test` to register
|
||||
tests, and will create a separate CTest test for each Catch test case. Note
|
||||
that this is in some cases less efficient, as common set-up and tear-down logic
|
||||
cannot be shared by multiple test cases executing in the same instance.
|
||||
However, it provides more fine-grained pass/fail information to CTest, which is
|
||||
usually considered as more beneficial. By default, the CTest test name is the
|
||||
same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
|
||||
|
||||
.. command:: catch_discover_tests
|
||||
|
||||
Automatically add tests with CTest by querying the compiled test executable
|
||||
for available tests::
|
||||
|
||||
catch_discover_tests(target
|
||||
[TEST_SPEC arg1...]
|
||||
[EXTRA_ARGS arg1...]
|
||||
[WORKING_DIRECTORY dir]
|
||||
[TEST_PREFIX prefix]
|
||||
[TEST_SUFFIX suffix]
|
||||
[PROPERTIES name1 value1...]
|
||||
[TEST_LIST var]
|
||||
[REPORTER reporter]
|
||||
[OUTPUT_DIR dir]
|
||||
[OUTPUT_PREFIX prefix}
|
||||
[OUTPUT_SUFFIX suffix]
|
||||
)
|
||||
|
||||
``catch_discover_tests`` sets up a post-build command on the test executable
|
||||
that generates the list of tests by parsing the output from running the test
|
||||
with the ``--list-test-names-only`` argument. This ensures that the full
|
||||
list of tests is obtained. Since test discovery occurs at build time, it is
|
||||
not necessary to re-run CMake when the list of tests changes.
|
||||
However, it requires that :prop_tgt:`CROSSCOMPILING_EMULATOR` is properly set
|
||||
in order to function in a cross-compiling environment.
|
||||
|
||||
Additionally, setting properties on tests is somewhat less convenient, since
|
||||
the tests are not available at CMake time. Additional test properties may be
|
||||
assigned to the set of tests as a whole using the ``PROPERTIES`` option. If
|
||||
more fine-grained test control is needed, custom content may be provided
|
||||
through an external CTest script using the :prop_dir:`TEST_INCLUDE_FILES`
|
||||
directory property. The set of discovered tests is made accessible to such a
|
||||
script via the ``<target>_TESTS`` variable.
|
||||
|
||||
The options are:
|
||||
|
||||
``target``
|
||||
Specifies the Catch executable, which must be a known CMake executable
|
||||
target. CMake will substitute the location of the built executable when
|
||||
running the test.
|
||||
|
||||
``TEST_SPEC arg1...``
|
||||
Specifies test cases, wildcarded test cases, tags and tag expressions to
|
||||
pass to the Catch executable with the ``--list-test-names-only`` argument.
|
||||
|
||||
``EXTRA_ARGS arg1...``
|
||||
Any extra arguments to pass on the command line to each test case.
|
||||
|
||||
``WORKING_DIRECTORY dir``
|
||||
Specifies the directory in which to run the discovered test cases. If this
|
||||
option is not provided, the current binary directory is used.
|
||||
|
||||
``TEST_PREFIX prefix``
|
||||
Specifies a ``prefix`` to be prepended to the name of each discovered test
|
||||
case. This can be useful when the same test executable is being used in
|
||||
multiple calls to ``catch_discover_tests()`` but with different
|
||||
``TEST_SPEC`` or ``EXTRA_ARGS``.
|
||||
|
||||
``TEST_SUFFIX suffix``
|
||||
Similar to ``TEST_PREFIX`` except the ``suffix`` is appended to the name of
|
||||
every discovered test case. Both ``TEST_PREFIX`` and ``TEST_SUFFIX`` may
|
||||
be specified.
|
||||
|
||||
``PROPERTIES name1 value1...``
|
||||
Specifies additional properties to be set on all tests discovered by this
|
||||
invocation of ``catch_discover_tests``.
|
||||
|
||||
``TEST_LIST var``
|
||||
Make the list of tests available in the variable ``var``, rather than the
|
||||
default ``<target>_TESTS``. This can be useful when the same test
|
||||
executable is being used in multiple calls to ``catch_discover_tests()``.
|
||||
Note that this variable is only available in CTest.
|
||||
|
||||
``REPORTER reporter``
|
||||
Use the specified reporter when running the test case. The reporter will
|
||||
be passed to the Catch executable as ``--reporter reporter``.
|
||||
|
||||
``OUTPUT_DIR dir``
|
||||
If specified, the parameter is passed along as
|
||||
``--out dir/<test_name>`` to Catch executable. The actual file name is the
|
||||
same as the test name. This should be used instead of
|
||||
``EXTRA_ARGS --out foo`` to avoid race conditions writing the result output
|
||||
when using parallel test execution.
|
||||
|
||||
``OUTPUT_PREFIX prefix``
|
||||
May be used in conjunction with ``OUTPUT_DIR``.
|
||||
If specified, ``prefix`` is added to each output file name, like so
|
||||
``--out dir/prefix<test_name>``.
|
||||
|
||||
``OUTPUT_SUFFIX suffix``
|
||||
May be used in conjunction with ``OUTPUT_DIR``.
|
||||
If specified, ``suffix`` is added to each output file name, like so
|
||||
``--out dir/<test_name>suffix``. This can be used to add a file extension to
|
||||
the output e.g. ".xml".
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
function(catch_discover_tests TARGET)
|
||||
cmake_parse_arguments(
|
||||
""
|
||||
""
|
||||
"TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST;REPORTER;OUTPUT_DIR;OUTPUT_PREFIX;OUTPUT_SUFFIX"
|
||||
"TEST_SPEC;EXTRA_ARGS;PROPERTIES"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
if(NOT _WORKING_DIRECTORY)
|
||||
set(_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
endif()
|
||||
if(NOT _TEST_LIST)
|
||||
set(_TEST_LIST ${TARGET}_TESTS)
|
||||
endif()
|
||||
|
||||
## Generate a unique name based on the extra arguments
|
||||
string(SHA1 args_hash "${_TEST_SPEC} ${_EXTRA_ARGS} ${_REPORTER} ${_OUTPUT_DIR} ${_OUTPUT_PREFIX} ${_OUTPUT_SUFFIX}")
|
||||
string(SUBSTRING ${args_hash} 0 7 args_hash)
|
||||
|
||||
# Define rule to generate test list for aforementioned test executable
|
||||
set(ctest_include_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_include-${args_hash}.cmake")
|
||||
set(ctest_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_tests-${args_hash}.cmake")
|
||||
get_property(crosscompiling_emulator
|
||||
TARGET ${TARGET}
|
||||
PROPERTY CROSSCOMPILING_EMULATOR
|
||||
)
|
||||
add_custom_command(
|
||||
TARGET ${TARGET} POST_BUILD
|
||||
BYPRODUCTS "${ctest_tests_file}"
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-D "TEST_TARGET=${TARGET}"
|
||||
-D "TEST_EXECUTABLE=$<TARGET_FILE:${TARGET}>"
|
||||
-D "TEST_EXECUTOR=${crosscompiling_emulator}"
|
||||
-D "TEST_WORKING_DIR=${_WORKING_DIRECTORY}"
|
||||
-D "TEST_SPEC=${_TEST_SPEC}"
|
||||
-D "TEST_EXTRA_ARGS=${_EXTRA_ARGS}"
|
||||
-D "TEST_PROPERTIES=${_PROPERTIES}"
|
||||
-D "TEST_PREFIX=${_TEST_PREFIX}"
|
||||
-D "TEST_SUFFIX=${_TEST_SUFFIX}"
|
||||
-D "TEST_LIST=${_TEST_LIST}"
|
||||
-D "TEST_REPORTER=${_REPORTER}"
|
||||
-D "TEST_OUTPUT_DIR=${_OUTPUT_DIR}"
|
||||
-D "TEST_OUTPUT_PREFIX=${_OUTPUT_PREFIX}"
|
||||
-D "TEST_OUTPUT_SUFFIX=${_OUTPUT_SUFFIX}"
|
||||
-D "CTEST_FILE=${ctest_tests_file}"
|
||||
-P "${_CATCH_DISCOVER_TESTS_SCRIPT}"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
file(WRITE "${ctest_include_file}"
|
||||
"if(EXISTS \"${ctest_tests_file}\")\n"
|
||||
" include(\"${ctest_tests_file}\")\n"
|
||||
"else()\n"
|
||||
" add_test(${TARGET}_NOT_BUILT-${args_hash} ${TARGET}_NOT_BUILT-${args_hash})\n"
|
||||
"endif()\n"
|
||||
)
|
||||
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0")
|
||||
# Add discovered tests to directory TEST_INCLUDE_FILES
|
||||
set_property(DIRECTORY
|
||||
APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}"
|
||||
)
|
||||
else()
|
||||
# Add discovered tests as directory TEST_INCLUDE_FILE if possible
|
||||
get_property(test_include_file_set DIRECTORY PROPERTY TEST_INCLUDE_FILE SET)
|
||||
if (NOT ${test_include_file_set})
|
||||
set_property(DIRECTORY
|
||||
PROPERTY TEST_INCLUDE_FILE "${ctest_include_file}"
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR
|
||||
"Cannot set more than one TEST_INCLUDE_FILE"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
###############################################################################
|
||||
|
||||
set(_CATCH_DISCOVER_TESTS_SCRIPT
|
||||
${CMAKE_CURRENT_LIST_DIR}/CatchAddTests.cmake
|
||||
CACHE INTERNAL "Catch2 full path to CatchAddTests.cmake helper file"
|
||||
)
|
@@ -1,135 +0,0 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
set(prefix "${TEST_PREFIX}")
|
||||
set(suffix "${TEST_SUFFIX}")
|
||||
set(spec ${TEST_SPEC})
|
||||
set(extra_args ${TEST_EXTRA_ARGS})
|
||||
set(properties ${TEST_PROPERTIES})
|
||||
set(reporter ${TEST_REPORTER})
|
||||
set(output_dir ${TEST_OUTPUT_DIR})
|
||||
set(output_prefix ${TEST_OUTPUT_PREFIX})
|
||||
set(output_suffix ${TEST_OUTPUT_SUFFIX})
|
||||
set(script)
|
||||
set(suite)
|
||||
set(tests)
|
||||
|
||||
function(add_command NAME)
|
||||
set(_args "")
|
||||
# use ARGV* instead of ARGN, because ARGN splits arrays into multiple arguments
|
||||
math(EXPR _last_arg ${ARGC}-1)
|
||||
foreach(_n RANGE 1 ${_last_arg})
|
||||
set(_arg "${ARGV${_n}}")
|
||||
if(_arg MATCHES "[^-./:a-zA-Z0-9_]")
|
||||
set(_args "${_args} [==[${_arg}]==]") # form a bracket_argument
|
||||
else()
|
||||
set(_args "${_args} ${_arg}")
|
||||
endif()
|
||||
endforeach()
|
||||
set(script "${script}${NAME}(${_args})\n" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Run test executable to get list of available tests
|
||||
if(NOT EXISTS "${TEST_EXECUTABLE}")
|
||||
message(FATAL_ERROR
|
||||
"Specified test executable '${TEST_EXECUTABLE}' does not exist"
|
||||
)
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-test-names-only
|
||||
OUTPUT_VARIABLE output
|
||||
RESULT_VARIABLE result
|
||||
WORKING_DIRECTORY "${TEST_WORKING_DIR}"
|
||||
)
|
||||
# Catch --list-test-names-only reports the number of tests, so 0 is... surprising
|
||||
if(${result} EQUAL 0)
|
||||
message(WARNING
|
||||
"Test executable '${TEST_EXECUTABLE}' contains no tests!\n"
|
||||
)
|
||||
elseif(${result} LESS 0)
|
||||
message(FATAL_ERROR
|
||||
"Error running test executable '${TEST_EXECUTABLE}':\n"
|
||||
" Result: ${result}\n"
|
||||
" Output: ${output}\n"
|
||||
)
|
||||
endif()
|
||||
|
||||
string(REPLACE "\n" ";" output "${output}")
|
||||
|
||||
# Run test executable to get list of available reporters
|
||||
execute_process(
|
||||
COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-reporters
|
||||
OUTPUT_VARIABLE reporters_output
|
||||
RESULT_VARIABLE reporters_result
|
||||
WORKING_DIRECTORY "${TEST_WORKING_DIR}"
|
||||
)
|
||||
if(${reporters_result} EQUAL 0)
|
||||
message(WARNING
|
||||
"Test executable '${TEST_EXECUTABLE}' contains no reporters!\n"
|
||||
)
|
||||
elseif(${reporters_result} LESS 0)
|
||||
message(FATAL_ERROR
|
||||
"Error running test executable '${TEST_EXECUTABLE}':\n"
|
||||
" Result: ${reporters_result}\n"
|
||||
" Output: ${reporters_output}\n"
|
||||
)
|
||||
endif()
|
||||
string(FIND "${reporters_output}" "${reporter}" reporter_is_valid)
|
||||
if(reporter AND ${reporter_is_valid} EQUAL -1)
|
||||
message(FATAL_ERROR
|
||||
"\"${reporter}\" is not a valid reporter!\n"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Prepare reporter
|
||||
if(reporter)
|
||||
set(reporter_arg "--reporter ${reporter}")
|
||||
endif()
|
||||
|
||||
# Prepare output dir
|
||||
if(output_dir AND NOT IS_ABSOLUTE ${output_dir})
|
||||
set(output_dir "${TEST_WORKING_DIR}/${output_dir}")
|
||||
if(NOT EXISTS ${output_dir})
|
||||
file(MAKE_DIRECTORY ${output_dir})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Parse output
|
||||
foreach(line ${output})
|
||||
set(test ${line})
|
||||
# Escape characters in test case names that would be parsed by Catch2
|
||||
set(test_name ${test})
|
||||
foreach(char , [ ])
|
||||
string(REPLACE ${char} "\\${char}" test_name ${test_name})
|
||||
endforeach(char)
|
||||
# ...add output dir
|
||||
if(output_dir)
|
||||
string(REGEX REPLACE "[^A-Za-z0-9_]" "_" test_name_clean ${test_name})
|
||||
set(output_dir_arg "--out ${output_dir}/${output_prefix}${test_name_clean}${output_suffix}")
|
||||
endif()
|
||||
|
||||
# ...and add to script
|
||||
add_command(add_test
|
||||
"${prefix}${test}${suffix}"
|
||||
${TEST_EXECUTOR}
|
||||
"${TEST_EXECUTABLE}"
|
||||
"${test_name}"
|
||||
${extra_args}
|
||||
"${reporter_arg}"
|
||||
"${output_dir_arg}"
|
||||
)
|
||||
add_command(set_tests_properties
|
||||
"${prefix}${test}${suffix}"
|
||||
PROPERTIES
|
||||
WORKING_DIRECTORY "${TEST_WORKING_DIR}"
|
||||
${properties}
|
||||
)
|
||||
list(APPEND tests "${prefix}${test}${suffix}")
|
||||
endforeach()
|
||||
|
||||
# Create a list of all discovered tests, which users may use to e.g. set
|
||||
# properties on the tests
|
||||
add_command(set ${TEST_LIST} ${tests})
|
||||
|
||||
# Write CTest script
|
||||
file(WRITE "${CTEST_FILE}" "${script}")
|
@@ -1,87 +0,0 @@
|
||||
# atomic builtins are required for threading support.
|
||||
|
||||
INCLUDE(CheckCXXSourceCompiles)
|
||||
INCLUDE(CheckLibraryExists)
|
||||
|
||||
# Sometimes linking against libatomic is required for atomic ops, if
|
||||
# the platform doesn't support lock-free atomics.
|
||||
|
||||
function(check_working_cxx_atomics varname)
|
||||
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++17")
|
||||
check_cxx_source_compiles("
|
||||
#include <atomic>
|
||||
std::atomic<int> x;
|
||||
std::atomic<short> y;
|
||||
std::atomic<char> z;
|
||||
int main() {
|
||||
++z;
|
||||
++y;
|
||||
return ++x;
|
||||
}
|
||||
" ${varname})
|
||||
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
|
||||
endfunction(check_working_cxx_atomics)
|
||||
|
||||
function(check_working_cxx_atomics64 varname)
|
||||
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
set(CMAKE_REQUIRED_FLAGS "-std=c++17 ${CMAKE_REQUIRED_FLAGS}")
|
||||
check_cxx_source_compiles("
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
std::atomic<uint64_t> x (0);
|
||||
int main() {
|
||||
uint64_t i = x.load(std::memory_order_relaxed);
|
||||
(void)i;
|
||||
return 0;
|
||||
}
|
||||
" ${varname})
|
||||
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
|
||||
endfunction(check_working_cxx_atomics64)
|
||||
|
||||
|
||||
# Check for (non-64-bit) atomic operations.
|
||||
if(MSVC)
|
||||
set(HAVE_CXX_ATOMICS_WITHOUT_LIB True)
|
||||
else()
|
||||
# First check if atomics work without the library.
|
||||
check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB)
|
||||
# If not, check if the library exists, and atomics work with it.
|
||||
if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
|
||||
check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC)
|
||||
if(HAVE_LIBATOMIC)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
|
||||
check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB)
|
||||
if (NOT HAVE_CXX_ATOMICS_WITH_LIB)
|
||||
message(FATAL_ERROR "Host compiler must support std::atomic!")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Check for 64 bit atomic operations.
|
||||
if(MSVC)
|
||||
set(HAVE_CXX_ATOMICS64_WITHOUT_LIB True)
|
||||
else()
|
||||
# First check if atomics work without the library.
|
||||
check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB)
|
||||
# If not, check if the library exists, and atomics work with it.
|
||||
if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
|
||||
check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64)
|
||||
if(HAVE_CXX_LIBATOMICS64)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
|
||||
check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITH_LIB)
|
||||
if (NOT HAVE_CXX_ATOMICS64_WITH_LIB)
|
||||
message(FATAL_ERROR "Host compiler must support 64-bit std::atomic!")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Host compiler appears to require libatomic for 64-bit operations, but cannot find it.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(HAVE_CXX_ATOMICS_WITH_LIB OR HAVE_CXX_ATOMICS64_WITH_LIB)
|
||||
target_link_libraries(openttd_lib atomic)
|
||||
endif()
|
@@ -4,6 +4,23 @@
|
||||
#
|
||||
macro(compile_flags)
|
||||
if(MSVC)
|
||||
if(VCPKG_TARGET_TRIPLET MATCHES "-static" AND NOT VCPKG_TARGET_TRIPLET MATCHES "-md")
|
||||
# Switch to MT (static) instead of MD (dynamic) binary
|
||||
|
||||
# For MSVC two generators are available
|
||||
# - a command line generator (Ninja) using CMAKE_BUILD_TYPE to specify the
|
||||
# configuration of the build tree
|
||||
# - an IDE generator (Visual Studio) using CMAKE_CONFIGURATION_TYPES to
|
||||
# specify all configurations that will be available in the generated solution
|
||||
list(APPEND MSVC_CONFIGS "${CMAKE_BUILD_TYPE}" "${CMAKE_CONFIGURATION_TYPES}")
|
||||
|
||||
# Set usage of static runtime for all configurations
|
||||
foreach(MSVC_CONFIG ${MSVC_CONFIGS})
|
||||
string(TOUPPER "CMAKE_CXX_FLAGS_${MSVC_CONFIG}" MSVC_FLAGS)
|
||||
string(REPLACE "/MD" "/MT" ${MSVC_FLAGS} "${${MSVC_FLAGS}}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# "If /Zc:rvalueCast is specified, the compiler follows section 5.4 of the
|
||||
# C++11 standard". We need C++11 for the way we use threads.
|
||||
add_compile_options(/Zc:rvalueCast)
|
||||
@@ -16,13 +33,6 @@ macro(compile_flags)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Our strings are UTF-8.
|
||||
if(MSVC)
|
||||
add_compile_options(/utf-8)
|
||||
else()
|
||||
add_compile_options(-finput-charset=utf-8)
|
||||
endif()
|
||||
|
||||
# Add some -D flags for Debug builds. We cannot use add_definitions(), because
|
||||
# it does not appear to support the $<> tags.
|
||||
add_compile_options(
|
||||
@@ -34,8 +44,8 @@ macro(compile_flags)
|
||||
"$<$<NOT:$<CONFIG:Debug>>:-fstack-protector>" # Prevent undefined references when _FORTIFY_SOURCE > 0
|
||||
)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
add_compile_options(
|
||||
"$<$<CONFIG:Debug>:-Wa,-mbig-obj>" # Switch to pe-bigobj-x86-64 as x64 Debug builds push pe-x86-64 to the limits (linking errors with ASLR, ...)
|
||||
add_link_options(
|
||||
"$<$<CONFIG:Debug>:-Wl,--disable-dynamicbase,--disable-high-entropy-va,--default-image-base-low>" # ASLR somehow breaks linking for x64 Debug builds
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
@@ -45,16 +55,7 @@ macro(compile_flags)
|
||||
set(IS_STABLE_RELEASE "$<AND:$<NOT:$<CONFIG:Debug>>,$<NOT:$<BOOL:${OPTION_USE_ASSERTS}>>>")
|
||||
|
||||
if(MSVC)
|
||||
add_compile_options(
|
||||
/W3
|
||||
/w34100 # 'identifier' : unreferenced formal parameter
|
||||
/w34189 # 'identifier' : local variable is initialized but not referenced
|
||||
)
|
||||
if(MSVC_VERSION GREATER 1929 AND MSVC_VERSION LESS 1937 AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# Starting with version 19.30 (fixed in version 19.37), there is an optimisation bug, see #9966 for details
|
||||
# This flag disables the broken optimisation to work around the bug
|
||||
add_compile_options(/d2ssa-rse-)
|
||||
endif()
|
||||
add_compile_options(/W3)
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
add_compile_options(
|
||||
-W
|
||||
@@ -70,8 +71,9 @@ macro(compile_flags)
|
||||
-Wformat=2
|
||||
-Winit-self
|
||||
-Wnon-virtual-dtor
|
||||
-Wsuggest-override
|
||||
|
||||
# Often parameters are unused, which is fine.
|
||||
-Wno-unused-parameter
|
||||
# We use 'ABCD' multichar for SaveLoad chunks identifiers
|
||||
-Wno-multichar
|
||||
|
||||
@@ -82,6 +84,22 @@ macro(compile_flags)
|
||||
-fno-strict-aliasing
|
||||
)
|
||||
|
||||
# When we are a stable release (Release build + USE_ASSERTS not set),
|
||||
# assertations are off, which trigger a lot of warnings. We disable
|
||||
# these warnings for these releases.
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
add_compile_options(
|
||||
"$<${IS_STABLE_RELEASE}:-Wno-unused-variable>"
|
||||
"$<${IS_STABLE_RELEASE}:-Wno-unused-but-set-parameter>"
|
||||
"$<${IS_STABLE_RELEASE}:-Wno-unused-but-set-variable>"
|
||||
)
|
||||
else()
|
||||
add_compile_options(
|
||||
"$<${IS_STABLE_RELEASE}:-Wno-unused-variable>"
|
||||
"$<${IS_STABLE_RELEASE}:-Wno-unused-parameter>"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Ninja processes the output so the output from the compiler
|
||||
# isn't directly to a terminal; hence, the default is
|
||||
# non-coloured output. We can override this to get nicely
|
||||
@@ -113,10 +131,6 @@ macro(compile_flags)
|
||||
# -flifetime-dse=2 (default since GCC 6) doesn't play
|
||||
# well with our custom pool item allocator
|
||||
"$<$<BOOL:${LIFETIME_DSE_FOUND}>:-flifetime-dse=1>"
|
||||
|
||||
# We have a fight between clang wanting std::move() and gcc not wanting it
|
||||
# and of course they both warn when the other compiler is happy
|
||||
"-Wno-redundant-move"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@@ -1,13 +1,16 @@
|
||||
# Macro which contains all bits and pieces to create a single grf file based
|
||||
# on NFO and PNG files.
|
||||
#
|
||||
# create_grf_command(NFO_SOURCE_FILES nfo_file1 ... PNG_SOURCE_FILES png_file1 ...)
|
||||
# create_grf_command()
|
||||
#
|
||||
function(create_grf_command)
|
||||
cmake_parse_arguments(GRF "" "" "NFO_SOURCE_FILES;PNG_SOURCE_FILES" ${ARGN})
|
||||
set(EXTRA_PNG_SOURCE_FILES ${ARGV})
|
||||
|
||||
get_filename_component(GRF_SOURCE_FOLDER_NAME "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
|
||||
get_filename_component(GRF_BINARY_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../${GRF_SOURCE_FOLDER_NAME}.grf ABSOLUTE)
|
||||
file(GLOB_RECURSE GRF_PNG_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.png)
|
||||
file(GLOB_RECURSE GRF_NFO_SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.nfo)
|
||||
set(GRF_PNG_SOURCE_FILES ${GRF_PNG_SOURCE_FILES} ${EXTRA_PNG_SOURCE_FILES})
|
||||
|
||||
# Copy over all the PNG files to the correct folder
|
||||
foreach(GRF_PNG_SOURCE_FILE IN LISTS GRF_PNG_SOURCE_FILES)
|
||||
@@ -25,13 +28,12 @@ function(create_grf_command)
|
||||
list(APPEND GRF_PNG_BINARY_FILES ${GRF_PNG_BINARY_FILE})
|
||||
endforeach()
|
||||
|
||||
add_custom_command(OUTPUT ${GRF_BINARY_FILE} ${GRF_BINARY_FILE}.hash
|
||||
add_custom_command(OUTPUT ${GRF_BINARY_FILE}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DGRF_SOURCE_FOLDER=${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-DGRF_BINARY_FILE=${GRF_BINARY_FILE}
|
||||
-DNFORENUM_EXECUTABLE=${NFORENUM_EXECUTABLE}
|
||||
-DGRFCODEC_EXECUTABLE=${GRFCODEC_EXECUTABLE}
|
||||
-DGRFID_EXECUTABLE=${GRFID_EXECUTABLE}
|
||||
-P ${CMAKE_SOURCE_DIR}/cmake/scripts/CreateGRF.cmake
|
||||
MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/cmake/scripts/CreateGRF.cmake
|
||||
DEPENDS ${GRF_PNG_BINARY_FILES}
|
||||
|
@@ -3,15 +3,20 @@
|
||||
# 'ctest'. The first is prefered, as it is more verbose, and takes care of
|
||||
# dependencies correctly.
|
||||
#
|
||||
# create_regression(file1 ...)
|
||||
# create_regression()
|
||||
#
|
||||
macro(create_regression)
|
||||
set(REGRESSION_SOURCE_FILES ${ARGN})
|
||||
|
||||
# Find all the files in the regression folder; they need to be copied to the
|
||||
# build folder before we can run the regression
|
||||
file(GLOB_RECURSE REGRESSION_SOURCE_FILES ${CMAKE_SOURCE_DIR}/regression/*)
|
||||
foreach(REGRESSION_SOURCE_FILE IN LISTS REGRESSION_SOURCE_FILES)
|
||||
string(REPLACE "${CMAKE_SOURCE_DIR}/regression/" "" REGRESSION_SOURCE_FILE_NAME "${REGRESSION_SOURCE_FILE}")
|
||||
string(CONCAT REGRESSION_BINARY_FILE "${CMAKE_BINARY_DIR}/ai/" "${REGRESSION_SOURCE_FILE_NAME}")
|
||||
|
||||
if("${REGRESSION_SOURCE_FILE_NAME}" STREQUAL "regression.cfg")
|
||||
continue()
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT ${REGRESSION_BINARY_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${REGRESSION_SOURCE_FILE}
|
||||
@@ -23,36 +28,59 @@ macro(create_regression)
|
||||
list(APPEND REGRESSION_BINARY_FILES ${REGRESSION_BINARY_FILE})
|
||||
endforeach()
|
||||
|
||||
get_filename_component(REGRESSION_TEST_NAME "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
|
||||
# Copy the regression configuration in a special folder, so all autogenerated
|
||||
# folders end up in the same place after running regression.
|
||||
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/regression/regression.cfg
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_SOURCE_DIR}/regression/regression.cfg
|
||||
${CMAKE_BINARY_DIR}/regression/regression.cfg
|
||||
MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/regression/regression.cfg
|
||||
COMMENT "Copying ${REGRESSION_SOURCE_FILE_NAME} regression file"
|
||||
)
|
||||
list(APPEND REGRESSION_BINARY_FILES ${CMAKE_BINARY_DIR}/regression/regression.cfg)
|
||||
|
||||
# Create a new target which copies regression files
|
||||
add_custom_target(regression_${REGRESSION_TEST_NAME}_files
|
||||
# Create a new target which copies all regression files
|
||||
add_custom_target(regression_files
|
||||
ALL # this is needed because 'make test' doesn't resolve dependencies, and otherwise this is never executed
|
||||
DEPENDS
|
||||
${REGRESSION_BINARY_FILES}
|
||||
)
|
||||
|
||||
add_dependencies(regression_files regression_${REGRESSION_TEST_NAME}_files)
|
||||
enable_testing()
|
||||
|
||||
add_custom_target(regression_${REGRESSION_TEST_NAME}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DOPENTTD_EXECUTABLE=$<TARGET_FILE:openttd>
|
||||
-DEDITBIN_EXECUTABLE=${EDITBIN_EXECUTABLE}
|
||||
-DREGRESSION_TEST=${REGRESSION_TEST_NAME}
|
||||
-P "${CMAKE_SOURCE_DIR}/cmake/scripts/Regression.cmake"
|
||||
DEPENDS openttd regression_${REGRESSION_TEST_NAME}_files
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMENT "Running regression test ${REGRESSION_TEST_NAME}"
|
||||
)
|
||||
# Find all the tests we have, and create a target for them
|
||||
file(GLOB REGRESSION_TESTS ${CMAKE_SOURCE_DIR}/regression/*)
|
||||
foreach(REGRESSION_TEST IN LISTS REGRESSION_TESTS)
|
||||
get_filename_component(REGRESSION_TEST_NAME "${REGRESSION_TEST}" NAME)
|
||||
|
||||
# Also make sure that 'make test' runs the regression
|
||||
add_test(NAME regression_${REGRESSION_TEST_NAME}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DOPENTTD_EXECUTABLE=$<TARGET_FILE:openttd>
|
||||
-DEDITBIN_EXECUTABLE=${EDITBIN_EXECUTABLE}
|
||||
-DREGRESSION_TEST=${REGRESSION_TEST_NAME}
|
||||
-P "${CMAKE_SOURCE_DIR}/cmake/scripts/Regression.cmake"
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
if("${REGRESSION_TEST_NAME}" STREQUAL "regression.cfg")
|
||||
continue()
|
||||
endif()
|
||||
|
||||
add_dependencies(regression regression_${REGRESSION_TEST_NAME})
|
||||
add_custom_target(regression_${REGRESSION_TEST_NAME}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DOPENTTD_EXECUTABLE=$<TARGET_FILE:openttd>
|
||||
-DEDITBIN_EXECUTABLE=${EDITBIN_EXECUTABLE}
|
||||
-DREGRESSION_TEST=${REGRESSION_TEST_NAME}
|
||||
-P "${CMAKE_SOURCE_DIR}/cmake/scripts/Regression.cmake"
|
||||
DEPENDS openttd regression_files
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMENT "Running regression test ${REGRESSION_TEST_NAME}"
|
||||
)
|
||||
|
||||
# Also make sure that 'make test' runs the regression
|
||||
add_test(NAME regression_${REGRESSION_TEST_NAME}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DOPENTTD_EXECUTABLE=$<TARGET_FILE:openttd>
|
||||
-DEDITBIN_EXECUTABLE=${EDITBIN_EXECUTABLE}
|
||||
-DREGRESSION_TEST=${REGRESSION_TEST_NAME}
|
||||
-P "${CMAKE_SOURCE_DIR}/cmake/scripts/Regression.cmake"
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
||||
list(APPEND REGRESSION_TARGETS regression_${REGRESSION_TEST_NAME})
|
||||
endforeach()
|
||||
|
||||
# Create a new target which runs the regression
|
||||
add_custom_target(regression
|
||||
DEPENDS ${REGRESSION_TARGETS})
|
||||
endmacro()
|
||||
|
@@ -2,7 +2,6 @@
|
||||
#
|
||||
|
||||
find_program(GRFCODEC_EXECUTABLE grfcodec)
|
||||
find_program(GRFID_EXECUTABLE grfid)
|
||||
find_program(NFORENUM_EXECUTABLE nforenum)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
@@ -10,6 +9,5 @@ find_package_handle_standard_args(Grfcodec
|
||||
FOUND_VAR GRFCODEC_FOUND
|
||||
REQUIRED_VARS
|
||||
GRFCODEC_EXECUTABLE
|
||||
GRFID_EXECUTABLE
|
||||
NFORENUM_EXECUTABLE
|
||||
)
|
||||
|
@@ -1,65 +0,0 @@
|
||||
#[=======================================================================[.rst:
|
||||
FindHarfBuzz
|
||||
-------
|
||||
|
||||
Finds the harfbuzz library.
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This will define the following variables:
|
||||
|
||||
``Harfbuzz_FOUND``
|
||||
True if the system has the harfbuzz library.
|
||||
``Harfbuzz_INCLUDE_DIRS``
|
||||
Include directories needed to use harfbuzz.
|
||||
``Harfbuzz_LIBRARIES``
|
||||
Libraries needed to link to harfbuzz.
|
||||
``Harfbuzz_VERSION``
|
||||
The version of the harfbuzz library which was found.
|
||||
|
||||
Cache Variables
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
The following cache variables may also be set:
|
||||
|
||||
``Harfbuzz_INCLUDE_DIR``
|
||||
The directory containing ``hb.h``.
|
||||
``Harfbuzz_LIBRARY``
|
||||
The path to the harfbuzz library.
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_Harfbuzz QUIET harfbuzz)
|
||||
|
||||
find_path(Harfbuzz_INCLUDE_DIR
|
||||
NAMES hb.h
|
||||
PATHS ${PC_Harfbuzz_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
find_library(Harfbuzz_LIBRARY
|
||||
NAMES harfbuzz
|
||||
PATHS ${PC_Harfbuzz_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
set(Harfbuzz_VERSION ${PC_Harfbuzz_VERSION})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Harfbuzz
|
||||
FOUND_VAR Harfbuzz_FOUND
|
||||
REQUIRED_VARS
|
||||
Harfbuzz_LIBRARY
|
||||
Harfbuzz_INCLUDE_DIR
|
||||
VERSION_VAR Harfbuzz_VERSION
|
||||
)
|
||||
|
||||
if(Harfbuzz_FOUND)
|
||||
set(Harfbuzz_LIBRARIES ${Harfbuzz_LIBRARY})
|
||||
set(Harfbuzz_INCLUDE_DIRS ${Harfbuzz_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
Harfbuzz_INCLUDE_DIR
|
||||
Harfbuzz_LIBRARY
|
||||
)
|
@@ -9,7 +9,7 @@ FindICU
|
||||
|
||||
Finds components of the ICU library.
|
||||
|
||||
Accepted components are: uc, i18n, le, lx, io, data
|
||||
Accepted components are: uc, i18n, le, lx, io
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
@@ -31,7 +31,7 @@ This will define the following variables:
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
|
||||
set(ICU_KNOWN_COMPONENTS "uc" "i18n" "le" "lx" "io" "data")
|
||||
set(ICU_KNOWN_COMPONENTS "uc" "i18n" "le" "lx" "io")
|
||||
|
||||
foreach(MOD_NAME IN LISTS ICU_FIND_COMPONENTS)
|
||||
if(NOT MOD_NAME IN_LIST ICU_KNOWN_COMPONENTS)
|
||||
|
@@ -55,7 +55,7 @@ find_library(LZO_LIBRARY
|
||||
# name as the optimized file. This is not always the case, but so far
|
||||
# experiences has shown that in those case vcpkg CMake files do the right
|
||||
# thing.
|
||||
if(VCPKG_TOOLCHAIN AND LZO_LIBRARY AND LZO_LIBRARY MATCHES "${VCPKG_INSTALLED_DIR}")
|
||||
if(VCPKG_TOOLCHAIN AND LZO_LIBRARY)
|
||||
if(LZO_LIBRARY MATCHES "/debug/")
|
||||
set(LZO_LIBRARY_DEBUG ${LZO_LIBRARY})
|
||||
string(REPLACE "/debug/lib/" "/lib/" LZO_LIBRARY_RELEASE ${LZO_LIBRARY})
|
||||
|
@@ -37,31 +37,12 @@ install(DIRECTORY
|
||||
install(FILES
|
||||
${CMAKE_SOURCE_DIR}/COPYING.md
|
||||
${CMAKE_SOURCE_DIR}/README.md
|
||||
${CMAKE_SOURCE_DIR}/CREDITS.md
|
||||
${CMAKE_SOURCE_DIR}/CONTRIBUTING.md
|
||||
${CMAKE_SOURCE_DIR}/changelog.txt
|
||||
${CMAKE_SOURCE_DIR}/docs/multiplayer.md
|
||||
${CMAKE_SOURCE_DIR}/known-bugs.txt
|
||||
DESTINATION ${DOCS_DESTINATION_DIR}
|
||||
COMPONENT docs)
|
||||
|
||||
install(FILES
|
||||
${CMAKE_SOURCE_DIR}/docs/admin_network.md
|
||||
${CMAKE_SOURCE_DIR}/docs/debugging_desyncs.md
|
||||
${CMAKE_SOURCE_DIR}/docs/desync.md
|
||||
${CMAKE_SOURCE_DIR}/docs/directory_structure.md
|
||||
${CMAKE_SOURCE_DIR}/docs/eints.md
|
||||
${CMAKE_SOURCE_DIR}/docs/game_coordinator.md
|
||||
${CMAKE_SOURCE_DIR}/docs/linkgraph.md
|
||||
${CMAKE_SOURCE_DIR}/docs/logging_and_performance_metrics.md
|
||||
${CMAKE_SOURCE_DIR}/docs/multiplayer.md
|
||||
${CMAKE_SOURCE_DIR}/docs/savegame_format.md
|
||||
${CMAKE_SOURCE_DIR}/docs/symbol_server.md
|
||||
${CMAKE_SOURCE_DIR}/docs/obg_format.txt
|
||||
${CMAKE_SOURCE_DIR}/docs/obm_format.txt
|
||||
${CMAKE_SOURCE_DIR}/docs/obs_format.txt
|
||||
DESTINATION ${DOCS_DESTINATION_DIR}/docs
|
||||
COMPONENT docs)
|
||||
|
||||
# A Linux manual only makes sense when using FHS. Otherwise it is a very odd
|
||||
# file with little context to what it is.
|
||||
if(OPTION_INSTALL_FHS)
|
||||
@@ -141,8 +122,6 @@ set(CPACK_STRIP_FILES YES)
|
||||
set(CPACK_OUTPUT_FILE_PREFIX "bundles")
|
||||
|
||||
if(APPLE)
|
||||
# Stripping would produce unreadable stacktraces.
|
||||
set(CPACK_STRIP_FILES NO)
|
||||
set(CPACK_GENERATOR "Bundle")
|
||||
include(PackageBundle)
|
||||
|
||||
@@ -150,7 +129,7 @@ if(APPLE)
|
||||
set(CPACK_PACKAGE_FILE_NAME "openttd-#CPACK_PACKAGE_VERSION#-macos-universal")
|
||||
else()
|
||||
set(CPACK_PACKAGE_FILE_NAME "openttd-#CPACK_PACKAGE_VERSION#-macos-${CPACK_SYSTEM_NAME}")
|
||||
endif()
|
||||
endif()
|
||||
elseif(WIN32)
|
||||
set(CPACK_GENERATOR "ZIP")
|
||||
if(OPTION_USE_NSIS)
|
||||
@@ -183,7 +162,7 @@ elseif(UNIX)
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(LSB_RELEASE_ID)
|
||||
if(LSB_RELEASE_ID STREQUAL "Ubuntu" OR LSB_RELEASE_ID STREQUAL "Debian" OR LSB_RELEASE_ID STREQUAL "Linuxmint")
|
||||
if(LSB_RELEASE_ID STREQUAL "Ubuntu" OR LSB_RELEASE_ID STREQUAL "Debian")
|
||||
execute_process(COMMAND ${LSB_RELEASE_EXEC} -cs
|
||||
OUTPUT_VARIABLE LSB_RELEASE_CODENAME
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
@@ -192,10 +171,6 @@ elseif(UNIX)
|
||||
|
||||
set(CPACK_GENERATOR "DEB")
|
||||
include(PackageDeb)
|
||||
elseif(LSB_RELEASE_ID STREQUAL "Fedora")
|
||||
set(PLATFORM "fedora")
|
||||
set(CPACK_GENERATOR "RPM")
|
||||
include(PackageRPM)
|
||||
else()
|
||||
set(UNSUPPORTED_PLATFORM_NAME "LSB-based Linux distribution '${LSB_RELEASE_ID}'")
|
||||
endif()
|
||||
@@ -206,10 +181,6 @@ elseif(UNIX)
|
||||
if(DISTRO_ID STREQUAL "arch")
|
||||
set(PLATFORM "arch")
|
||||
set(CPACK_GENERATOR "TXZ")
|
||||
elseif(DISTRO_ID STREQUAL "fedora" OR DISTRO_ID STREQUAL "rhel")
|
||||
set(PLATFORM "fedora")
|
||||
set(CPACK_GENERATOR "RPM")
|
||||
include(PackageRPM)
|
||||
else()
|
||||
set(UNSUPPORTED_PLATFORM_NAME "Linux distribution '${DISTRO_ID}' from /etc/os-release")
|
||||
endif()
|
||||
|
@@ -3,24 +3,21 @@ function(link_package NAME)
|
||||
|
||||
if(${NAME}_FOUND)
|
||||
string(TOUPPER "${NAME}" UCNAME)
|
||||
# Some libraries have a dash, which is not allowed in a preprocessor macro.
|
||||
string(REPLACE "-" "_" UCNAME "${UCNAME}")
|
||||
|
||||
add_definitions(-DWITH_${UCNAME})
|
||||
# Some libraries' cmake packages (looking at you, SDL2) leave trailing whitespace in the link commands,
|
||||
# which (later) cmake considers to be an error. Work around this with by stripping the incoming string.
|
||||
if(LP_TARGET AND TARGET ${LP_TARGET})
|
||||
string(STRIP "${LP_TARGET}" LP_TARGET)
|
||||
target_link_libraries(openttd_lib ${LP_TARGET})
|
||||
target_link_libraries(openttd ${LP_TARGET})
|
||||
message(STATUS "${NAME} found -- -DWITH_${UCNAME} -- ${LP_TARGET}")
|
||||
else()
|
||||
string(STRIP "${${NAME}_LIBRARY}" ${NAME}_LIBRARY)
|
||||
string(STRIP "${${NAME}_LIBRARIES}" ${NAME}_LIBRARIES)
|
||||
include_directories(${${NAME}_INCLUDE_DIRS} ${${NAME}_INCLUDE_DIR})
|
||||
target_link_libraries(openttd_lib ${${NAME}_LIBRARIES} ${${NAME}_LIBRARY})
|
||||
target_link_libraries(openttd ${${NAME}_LIBRARIES} ${${NAME}_LIBRARY})
|
||||
message(STATUS "${NAME} found -- -DWITH_${UCNAME} -- ${${NAME}_INCLUDE_DIRS} ${${NAME}_INCLUDE_DIR} -- ${${NAME}_LIBRARIES} ${${NAME}_LIBRARY}")
|
||||
endif()
|
||||
elseif(LP_ENCOURAGED)
|
||||
message(WARNING "${NAME} not found; compiling OpenTTD without ${NAME} is strongly discouraged")
|
||||
message(WARNING "${NAME} not found; compiling OpenTTD without ${NAME} is strongly disencouraged")
|
||||
endif()
|
||||
endfunction()
|
||||
|
@@ -3,7 +3,6 @@
|
||||
source_group("AI Core" REGULAR_EXPRESSION "src/ai/")
|
||||
source_group("Blitters" REGULAR_EXPRESSION "src/blitter/")
|
||||
source_group("Core Source Code" REGULAR_EXPRESSION "src/core/")
|
||||
source_group("Font Cache" REGULAR_EXPRESSION "src/fontcache/")
|
||||
source_group("Game Core" REGULAR_EXPRESSION "src/game/")
|
||||
source_group("MD5" REGULAR_EXPRESSION "src/3rdparty/md5/")
|
||||
source_group("Misc" REGULAR_EXPRESSION "src/misc/")
|
||||
|
@@ -56,7 +56,7 @@ function(set_options)
|
||||
|
||||
option(OPTION_DEDICATED "Build dedicated server only (no GUI)" OFF)
|
||||
option(OPTION_INSTALL_FHS "Install with Filesystem Hierarchy Standard folders" ${DEFAULT_OPTION_INSTALL_FHS})
|
||||
option(OPTION_USE_ASSERTS "Use assertions; leave enabled for nightlies, betas, and RCs" ON)
|
||||
option(OPTION_USE_ASSERTS "Use assertions; leave enabled for nightlies, betas, and RCs" OFF)
|
||||
if(EMSCRIPTEN)
|
||||
# Although pthreads is supported, it is not in a way yet that is
|
||||
# useful for us.
|
||||
@@ -67,13 +67,10 @@ function(set_options)
|
||||
option(OPTION_USE_NSIS "Use NSIS to create windows installer; enable only for stable releases" OFF)
|
||||
option(OPTION_TOOLS_ONLY "Build only tools target" OFF)
|
||||
option(OPTION_DOCS_ONLY "Build only docs target" OFF)
|
||||
option(OPTION_ALLOW_INVALID_SIGNATURE "Allow loading of content with invalid signatures" OFF)
|
||||
|
||||
if (OPTION_DOCS_ONLY)
|
||||
set(OPTION_TOOLS_ONLY ON PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
option(OPTION_SURVEY_KEY "Survey-key to use for the opt-in survey (empty if you have none)" "")
|
||||
endfunction()
|
||||
|
||||
# Show the values of the generic options.
|
||||
@@ -87,17 +84,6 @@ function(show_options)
|
||||
message(STATUS "Option Use assert - ${OPTION_USE_ASSERTS}")
|
||||
message(STATUS "Option Use threads - ${OPTION_USE_THREADS}")
|
||||
message(STATUS "Option Use NSIS - ${OPTION_USE_NSIS}")
|
||||
|
||||
if(OPTION_SURVEY_KEY)
|
||||
message(STATUS "Option Survey Key - USED")
|
||||
else()
|
||||
message(STATUS "Option Survey Key - NOT USED")
|
||||
endif()
|
||||
|
||||
if(OPTION_ALLOW_INVALID_SIGNATURE)
|
||||
message(STATUS "Option Allow Invalid Signature - USED")
|
||||
message(WARNING "Ignoring invalid signatures is a security risk! Use with care!")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Add the definitions for the options that are selected.
|
||||
@@ -118,12 +104,4 @@ function(add_definitions_based_on_options)
|
||||
else()
|
||||
add_definitions(-DNDEBUG)
|
||||
endif()
|
||||
|
||||
if(OPTION_SURVEY_KEY)
|
||||
add_definitions(-DSURVEY_KEY="${OPTION_SURVEY_KEY}")
|
||||
endif()
|
||||
|
||||
if(OPTION_ALLOW_INVALID_SIGNATURE)
|
||||
add_definitions(-DALLOW_INVALID_SIGNATURE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
@@ -1 +0,0 @@
|
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE "${ARCHITECTURE}")
|
@@ -1,4 +1,12 @@
|
||||
function(_add_files_tgt tgt)
|
||||
# Add a file to be compiled.
|
||||
#
|
||||
# add_files([file1 ...] CONDITION condition [condition ...])
|
||||
#
|
||||
# CONDITION is a complete statement that can be evaluated with if().
|
||||
# If it evaluates true, the source files will be added; otherwise not.
|
||||
# For example: ADD_IF SDL_FOUND AND Allegro_FOUND
|
||||
#
|
||||
function(add_files)
|
||||
cmake_parse_arguments(PARAM "" "" "CONDITION" ${ARGN})
|
||||
set(PARAM_FILES "${PARAM_UNPARSED_ARGUMENTS}")
|
||||
|
||||
@@ -9,44 +17,10 @@ function(_add_files_tgt tgt)
|
||||
endif()
|
||||
|
||||
foreach(FILE IN LISTS PARAM_FILES)
|
||||
# Some IDEs are not happy with duplicated filenames, so we detect that before adding the file.
|
||||
get_target_property(${tgt}_FILES ${tgt} SOURCES)
|
||||
if(${tgt}_FILES MATCHES "/${FILE}(;|$)")
|
||||
string(REGEX REPLACE "(^|.+;)([^;]+/${FILE})(;.+|$)" "\\2" RES "${${tgt}_FILES}")
|
||||
# Ignore header files duplicates in 3rdparty.
|
||||
if(NOT (${FILE} MATCHES "\.h" AND (${RES} MATCHES "3rdparty" OR ${CMAKE_CURRENT_SOURCE_DIR} MATCHES "3rdparty")))
|
||||
message(FATAL_ERROR "${tgt}: ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} filename is a duplicate of ${RES}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_sources(${tgt} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
|
||||
target_sources(openttd PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/${FILE})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# Add a file to be compiled.
|
||||
#
|
||||
# add_files([file1 ...] CONDITION condition [condition ...])
|
||||
#
|
||||
# CONDITION is a complete statement that can be evaluated with if().
|
||||
# If it evaluates true, the source files will be added; otherwise not.
|
||||
# For example: ADD_IF SDL_FOUND AND Allegro_FOUND
|
||||
#
|
||||
function(add_files)
|
||||
_add_files_tgt(openttd_lib ${ARGV})
|
||||
endfunction()
|
||||
|
||||
# Add a test file to be compiled.
|
||||
#
|
||||
# add_test_files([file1 ...] CONDITION condition [condition ...])
|
||||
#
|
||||
# CONDITION is a complete statement that can be evaluated with if().
|
||||
# If it evaluates true, the source files will be added; otherwise not.
|
||||
# For example: ADD_IF SDL_FOUND AND Allegro_FOUND
|
||||
#
|
||||
function(add_test_files)
|
||||
_add_files_tgt(openttd_test ${ARGV})
|
||||
endfunction()
|
||||
|
||||
# This function works around an 'issue' with CMake, where
|
||||
# set_source_files_properties() only works in the scope of the file. We want
|
||||
# to set properties for the source file on a more global level. To solve this,
|
||||
|
@@ -58,7 +58,6 @@ list(SORT ${PLACE_HOLDER})
|
||||
string(REPLACE ";" "\n" ${PLACE_HOLDER} "${${PLACE_HOLDER}}")
|
||||
|
||||
# Get the grf md5
|
||||
file(READ ${BASESET_EXTRAGRF_FILE}.hash ORIG_EXTRA_GRF_MD5)
|
||||
string(STRIP ${ORIG_EXTRA_GRF_MD5} ORIG_EXTRA_GRF_MD5)
|
||||
file(MD5 ${BASESET_EXTRAGRF_FILE} ORIG_EXTRA_GRF_MD5)
|
||||
|
||||
configure_file(${BASESET_SOURCE_FILE} ${BASESET_BINARY_FILE})
|
||||
|
@@ -11,9 +11,6 @@ endif()
|
||||
if(NOT GRFCODEC_EXECUTABLE)
|
||||
message(FATAL_ERROR "Script needs GRFCODEC_EXECUTABLE defined")
|
||||
endif()
|
||||
if(NOT GRFID_EXECUTABLE)
|
||||
message(FATAL_ERROR "Script needs GRFID_EXECUTABLE defined")
|
||||
endif()
|
||||
if(NOT GRF_SOURCE_FOLDER)
|
||||
message(FATAL_ERROR "Script needs GRF_SOURCE_FOLDER defined")
|
||||
endif()
|
||||
@@ -21,9 +18,6 @@ if(NOT GRF_BINARY_FILE)
|
||||
message(FATAL_ERROR "Script needs GRF_BINARY_FILE defined")
|
||||
endif()
|
||||
|
||||
# Remove the existing output so failures never go unnoticed
|
||||
file(REMOVE ${GRF_BINARY_FILE} ${GRF_BINARY_FILE}.hash)
|
||||
|
||||
get_filename_component(GRF_SOURCE_FOLDER_NAME "${GRF_SOURCE_FOLDER}" NAME)
|
||||
|
||||
file(WRITE sprites/${GRF_SOURCE_FOLDER_NAME}.nfo "")
|
||||
@@ -53,7 +47,7 @@ if(RESULT)
|
||||
message(FATAL_ERROR "NFORenum failed")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${GRFCODEC_EXECUTABLE} -n -s -e -g2 -p1 ${GRF_SOURCE_FOLDER_NAME}.grf RESULT_VARIABLE RESULT)
|
||||
execute_process(COMMAND ${GRFCODEC_EXECUTABLE} -n -s -e -p1 ${GRF_SOURCE_FOLDER_NAME}.grf RESULT_VARIABLE RESULT)
|
||||
if(RESULT)
|
||||
if(NOT RESULT MATCHES "^[0-9]*$")
|
||||
message(FATAL_ERROR "Failed to run GRFCodec (${RESULT}), please check GRFCODEC_EXECUTABLE variable")
|
||||
@@ -61,15 +55,4 @@ if(RESULT)
|
||||
message(FATAL_ERROR "GRFCodec failed")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${GRFID_EXECUTABLE} -m ${GRF_SOURCE_FOLDER_NAME}.grf OUTPUT_VARIABLE GRFID_HASH RESULT_VARIABLE RESULT)
|
||||
if(RESULT)
|
||||
if(NOT RESULT MATCHES "^[0-9]*$")
|
||||
message(FATAL_ERROR "Failed to run GRFID (${RESULT}), please check GRFID_EXECUTABLE variable")
|
||||
endif()
|
||||
message(FATAL_ERROR "GRFID failed")
|
||||
endif()
|
||||
|
||||
file(WRITE ${GRF_BINARY_FILE}.hash ${GRFID_HASH})
|
||||
|
||||
# Copy build files back to the source directory.
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${GRF_SOURCE_FOLDER_NAME}.grf ${GRF_BINARY_FILE})
|
||||
|
@@ -13,7 +13,6 @@ cmake_minimum_required(VERSION 3.5)
|
||||
# The parameter "enumname" specifies the enumeration to extract. This can also be a regular expression.
|
||||
# The parameter "filename" specifies the relative path to the file, where the enumeration is extracted from. This can also be a glob expression.
|
||||
#
|
||||
# All files where enumerations are extracted from are automatically added via #include
|
||||
#
|
||||
|
||||
if(NOT GENERATE_SOURCE_FILE)
|
||||
@@ -42,7 +41,6 @@ foreach(ENUM IN LISTS ENUM_LINES)
|
||||
|
||||
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" FILE ${FILE})
|
||||
string(APPEND ${PLACE_HOLDER} "\n${ADD_INDENT}/* automatically generated from ${FILE} */")
|
||||
list(APPEND INCLUDES "#include \"${FILE}\"")
|
||||
|
||||
foreach(LINE IN LISTS SOURCE_LINES)
|
||||
string(REPLACE "${RM_INDENT}" "" LINE "${LINE}")
|
||||
@@ -118,7 +116,4 @@ foreach(ENUM IN LISTS ENUM_LINES)
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
list(REMOVE_DUPLICATES INCLUDES)
|
||||
string(REPLACE ";" "\n" INCLUDES "${INCLUDES}")
|
||||
|
||||
configure_file(${GENERATE_SOURCE_FILE} ${GENERATE_BINARY_FILE})
|
||||
|
@@ -35,7 +35,6 @@ execute_process(COMMAND ${OPENTTD_EXECUTABLE}
|
||||
-vnull:ticks=30000
|
||||
-d script=2
|
||||
-d misc=9
|
||||
-Q
|
||||
OUTPUT_VARIABLE REGRESSION_OUTPUT
|
||||
ERROR_VARIABLE REGRESSION_RESULT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
@@ -54,9 +53,6 @@ string(REPLACE "0x(nil)" "0x00000000" REGRESSION_RESULT "${REGRESSION_RESULT}")
|
||||
string(REPLACE "0x0000000000000000" "0x00000000" REGRESSION_RESULT "${REGRESSION_RESULT}")
|
||||
string(REPLACE "0x0x0" "0x00000000" REGRESSION_RESULT "${REGRESSION_RESULT}")
|
||||
|
||||
# Convert path separators
|
||||
string(REPLACE "\\" "/" REGRESSION_RESULT "${REGRESSION_RESULT}")
|
||||
|
||||
# Remove timestamps if any
|
||||
string(REGEX REPLACE "\[[0-9-]+ [0-9:]+\] " "" REGRESSION_RESULT "${REGRESSION_RESULT}")
|
||||
|
||||
@@ -65,7 +61,6 @@ string(REPLACE "\ndbg: [script]" "\n" REGRESSION_RESULT "${REGRESSION_RESULT}")
|
||||
string(REPLACE "\n " "\nERROR: " REGRESSION_RESULT "${REGRESSION_RESULT}")
|
||||
string(REPLACE "\nERROR: [1] " "\n" REGRESSION_RESULT "${REGRESSION_RESULT}")
|
||||
string(REPLACE "\n[P] " "\n" REGRESSION_RESULT "${REGRESSION_RESULT}")
|
||||
string(REPLACE "\n[S] " "\n" REGRESSION_RESULT "${REGRESSION_RESULT}")
|
||||
string(REGEX REPLACE "dbg: ([^\n]*)\n?" "" REGRESSION_RESULT "${REGRESSION_RESULT}")
|
||||
|
||||
# Read the expected result
|
||||
|
@@ -28,27 +28,25 @@ endmacro()
|
||||
macro(dump_class_templates NAME)
|
||||
string(REGEX REPLACE "^Script" "" REALNAME ${NAME})
|
||||
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> struct Param<${NAME} *> { static inline ${NAME} *Get(HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, nullptr); return (${NAME} *)instance; } };")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> struct Param<${NAME} &> { static inline ${NAME} &Get(HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, nullptr); return *(${NAME} *)instance; } };")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> struct Param<const ${NAME} *> { static inline const ${NAME} *Get(HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, nullptr); return (${NAME} *)instance; } };")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> struct Param<const ${NAME} &> { static inline const ${NAME} &Get(HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, nullptr); return *(${NAME} *)instance; } };")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> inline ${NAME} *GetParam(ForceType<${NAME} *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, nullptr); return (${NAME} *)instance; }")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> inline ${NAME} &GetParam(ForceType<${NAME} &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, nullptr); return *(${NAME} *)instance; }")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> inline const ${NAME} *GetParam(ForceType<const ${NAME} *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, nullptr); return (${NAME} *)instance; }")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> inline const ${NAME} &GetParam(ForceType<const ${NAME} &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, nullptr); return *(${NAME} *)instance; }")
|
||||
if("${NAME}" STREQUAL "ScriptEvent")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> struct Return<${NAME} *> { static inline int Set(HSQUIRRELVM vm, ${NAME} *res) { if (res == nullptr) { sq_pushnull(vm); return 1; } Squirrel::CreateClassInstanceVM(vm, \"${REALNAME}\", res, nullptr, DefSQDestructorCallback<${NAME}>, true); return 1; } };")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> inline int Return<${NAME} *>(HSQUIRRELVM vm, ${NAME} *res) { if (res == nullptr) { sq_pushnull(vm); return 1; } Squirrel::CreateClassInstanceVM(vm, \"${REALNAME}\", res, nullptr, DefSQDestructorCallback<${NAME}>, true); return 1; }")
|
||||
elseif("${NAME}" STREQUAL "ScriptText")
|
||||
string(APPEND SQUIRREL_EXPORT "\n")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> struct Param<Text *> {")
|
||||
string(APPEND SQUIRREL_EXPORT "\n static inline Text *Get(HSQUIRRELVM vm, int index) {")
|
||||
string(APPEND SQUIRREL_EXPORT "\n if (sq_gettype(vm, index) == OT_INSTANCE) {")
|
||||
string(APPEND SQUIRREL_EXPORT "\n return Param<ScriptText *>::Get(vm, index);")
|
||||
string(APPEND SQUIRREL_EXPORT "\n }")
|
||||
string(APPEND SQUIRREL_EXPORT "\n if (sq_gettype(vm, index) == OT_STRING) {")
|
||||
string(APPEND SQUIRREL_EXPORT "\n return new RawText(Param<const std::string &>::Get(vm, index));")
|
||||
string(APPEND SQUIRREL_EXPORT "\n }")
|
||||
string(APPEND SQUIRREL_EXPORT "\n return nullptr;")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> inline Text *GetParam(ForceType<Text *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) {")
|
||||
string(APPEND SQUIRREL_EXPORT "\n if (sq_gettype(vm, index) == OT_INSTANCE) {")
|
||||
string(APPEND SQUIRREL_EXPORT "\n return GetParam(ForceType<ScriptText *>(), vm, index, ptr);")
|
||||
string(APPEND SQUIRREL_EXPORT "\n }")
|
||||
string(APPEND SQUIRREL_EXPORT "\n };")
|
||||
string(APPEND SQUIRREL_EXPORT "\n if (sq_gettype(vm, index) == OT_STRING) {")
|
||||
string(APPEND SQUIRREL_EXPORT "\n return new RawText(GetParam(ForceType<const char *>(), vm, index, ptr));")
|
||||
string(APPEND SQUIRREL_EXPORT "\n }")
|
||||
string(APPEND SQUIRREL_EXPORT "\n return nullptr;")
|
||||
string(APPEND SQUIRREL_EXPORT "\n }")
|
||||
else()
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> struct Return<${NAME} *> { static inline int Set(HSQUIRRELVM vm, ${NAME} *res) { if (res == nullptr) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, \"${REALNAME}\", res, nullptr, DefSQDestructorCallback<${NAME}>, true); return 1; } };")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> inline int Return<${NAME} *>(HSQUIRRELVM vm, ${NAME} *res) { if (res == nullptr) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, \"${REALNAME}\", res, nullptr, DefSQDestructorCallback<${NAME}>, true); return 1; }")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@@ -71,23 +69,13 @@ reset_reader()
|
||||
|
||||
file(STRINGS "${SCRIPT_API_FILE}" SOURCE_LINES)
|
||||
|
||||
set(NUM_LINE 0)
|
||||
macro(doxygen_check)
|
||||
if(NOT "${DOXYGEN_SKIP}" STREQUAL "")
|
||||
message(FATAL_ERROR "${SCRIPT_API_FILE}:${NUM_LINE}: a DOXYGEN_API block was not properly closed")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
foreach(LINE IN LISTS SOURCE_LINES)
|
||||
math(EXPR NUM_LINE "${NUM_LINE} + 1")
|
||||
# Ignore special doxygen blocks
|
||||
if("${LINE}" MATCHES "^#ifndef DOXYGEN_API")
|
||||
doxygen_check()
|
||||
set(DOXYGEN_SKIP "next")
|
||||
continue()
|
||||
endif()
|
||||
if("${LINE}" MATCHES "^#ifdef DOXYGEN_API")
|
||||
doxygen_check()
|
||||
set(DOXYGEN_SKIP "true")
|
||||
continue()
|
||||
endif()
|
||||
@@ -96,10 +84,10 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
continue()
|
||||
endif()
|
||||
if("${LINE}" MATCHES "^#else")
|
||||
if(DOXYGEN_SKIP STREQUAL "next")
|
||||
if("${DOXYGEN_SKIP}" STREQUAL "next")
|
||||
set(DOXYGEN_SKIP "true")
|
||||
elseif(DOXYGEN_SKIP STREQUAL "true")
|
||||
set(DOXYGEN_SKIP "false")
|
||||
else()
|
||||
unset(DOXYGEN_SKIP)
|
||||
endif()
|
||||
continue()
|
||||
endif()
|
||||
@@ -309,8 +297,8 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
endif()
|
||||
string(APPEND SQUIRREL_EXPORT "\n /* Allow enums to be used as Squirrel parameters */")
|
||||
foreach(ENUM IN LISTS ENUMS)
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> struct Param<${ENUM}> { static inline ${ENUM} Get(HSQUIRRELVM vm, int index) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (${ENUM})tmp; } };")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> struct Return<${ENUM}> { static inline int Set(HSQUIRRELVM vm, ${ENUM} res) { sq_pushinteger(vm, res); return 1; } };")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> inline ${ENUM} GetParam(ForceType<${ENUM}>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (${ENUM})tmp; }")
|
||||
string(APPEND SQUIRREL_EXPORT "\n template <> inline int Return<${ENUM}>(HSQUIRRELVM vm, ${ENUM} res) { sq_pushinteger(vm, (int32)res); return 1; }")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
@@ -342,19 +330,19 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
endif()
|
||||
|
||||
string(APPEND SQUIRREL_EXPORT "\n")
|
||||
string(APPEND SQUIRREL_EXPORT "\ntemplate <> const char *GetClassName<${CLS}, ScriptType::${APIUC}>() { return \"${API_CLS}\"; }")
|
||||
string(APPEND SQUIRREL_EXPORT "\ntemplate <> const char *GetClassName<${CLS}, ST_${APIUC}>() { return \"${API_CLS}\"; }")
|
||||
string(APPEND SQUIRREL_EXPORT "\n")
|
||||
|
||||
# Then do the registration functions of the class.
|
||||
string(APPEND SQUIRREL_EXPORT "\nvoid SQ${API_CLS}_Register(Squirrel *engine)")
|
||||
string(APPEND SQUIRREL_EXPORT "\n{")
|
||||
string(APPEND SQUIRREL_EXPORT "\n DefSQClass<${CLS}, ScriptType::${APIUC}> SQ${API_CLS}(\"${API_CLS}\");")
|
||||
string(APPEND SQUIRREL_EXPORT "\n DefSQClass<${CLS}, ST_${APIUC}> SQ${API_CLS}(\"${API_CLS}\");")
|
||||
if("${SUPER_CLS}" STREQUAL "Text" OR "${SUPER_CLS}" STREQUAL "ScriptObject" OR "${SUPER_CLS}" STREQUAL "AIAbstractiveList::Valuator")
|
||||
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.PreRegister(engine);")
|
||||
else()
|
||||
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.PreRegister(engine, \"${API_SUPER_CLS}\");")
|
||||
endif()
|
||||
if(NOT "${SUPER_CLS}" MATCHES "^ScriptEvent")
|
||||
if(NOT "${SUPER_CLS}" STREQUAL "ScriptEvent")
|
||||
if("${CLS_PARAM_2}" STREQUAL "v")
|
||||
string(APPEND SQUIRREL_EXPORT "\n SQ${API_CLS}.AddSQAdvancedConstructor(engine);")
|
||||
else()
|
||||
@@ -637,12 +625,10 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
string(APPEND TYPES "p")
|
||||
elseif("${PARAM}" MATCHES "^Array")
|
||||
string(APPEND TYPES "a")
|
||||
elseif("${PARAM}" MATCHES "^const Array")
|
||||
elseif("${PARAM}" MATCHES "^struct Array")
|
||||
string(APPEND TYPES "a")
|
||||
elseif("${PARAM}" MATCHES "^Text")
|
||||
string(APPEND TYPES ".")
|
||||
elseif("${PARAM}" MATCHES "^std::string")
|
||||
string(APPEND TYPES ".")
|
||||
else()
|
||||
string(APPEND TYPES "x")
|
||||
endif()
|
||||
@@ -678,6 +664,4 @@ foreach(LINE IN LISTS SOURCE_LINES)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
doxygen_check()
|
||||
|
||||
configure_file(${SCRIPT_API_SOURCE_FILE} ${SCRIPT_API_BINARY_FILE})
|
||||
|
@@ -12,11 +12,32 @@ endif()
|
||||
if(NOT APIUC)
|
||||
message(FATAL_ERROR "Script needs APIUC defined")
|
||||
endif()
|
||||
if(NOT API_FILES)
|
||||
message(FATAL_ERROR "Script needs API_FILES defined")
|
||||
endif()
|
||||
|
||||
file(READ "${API_FILES}" SCRIPT_API_BINARY_FILES)
|
||||
set(ARGC 1)
|
||||
set(ARG_READ NO)
|
||||
|
||||
# For MSVC CMake runs this script from a batch file using || to detect errors,
|
||||
# depending on source path it may quote args, and cause cmd to not understand ||
|
||||
# and pass it as argument to ourself.
|
||||
# Read all the arguments given to CMake; we are looking for -- and everything
|
||||
# that follows, until ||. Those are our api files.
|
||||
while(ARGC LESS CMAKE_ARGC)
|
||||
set(ARG ${CMAKE_ARGV${ARGC}})
|
||||
|
||||
if(ARG STREQUAL "||")
|
||||
set(ARG_READ NO)
|
||||
endif()
|
||||
|
||||
if(ARG_READ)
|
||||
list(APPEND SCRIPT_API_BINARY_FILES "${ARG}")
|
||||
endif()
|
||||
|
||||
if(ARG STREQUAL "--")
|
||||
set(ARG_READ YES)
|
||||
endif()
|
||||
|
||||
math(EXPR ARGC "${ARGC} + 1")
|
||||
endwhile()
|
||||
|
||||
foreach(FILE IN LISTS SCRIPT_API_BINARY_FILES)
|
||||
file(STRINGS "${FILE}" LINES REGEX "^void SQ${APIUC}.*_Register\\(Squirrel \\*engine\\)$")
|
||||
|
@@ -53,7 +53,4 @@ Do NOT remove the dmp_cmds savegames of a desync you have reported until the
|
||||
desync has been fixed; if you, by accident, send us the wrong savegames we
|
||||
will not be able to reproduce the desync and thus will be unable to fix it.
|
||||
|
||||
## More information
|
||||
|
||||
You can find more theory on the causes and debugging of desyncs in the
|
||||
[desync documentation](./desync.md).
|
||||
|
@@ -19,14 +19,14 @@ your operating system:
|
||||
- Windows:
|
||||
- `C:\My Documents\OpenTTD` (95, 98, ME)
|
||||
- `C:\Documents and Settings\<username>\My Documents\OpenTTD` (2000, XP)
|
||||
- `C:\Users\<username>\Documents\OpenTTD` (7, 8.1, 10, 11)
|
||||
- `C:\Users\<username>\Documents\OpenTTD` (Vista, 7, 8.1, 10)
|
||||
- macOS: `~/Documents/OpenTTD`
|
||||
- Linux: `$XDG_DATA_HOME/openttd` which is usually `~/.local/share/openttd`
|
||||
when built with XDG base directory support, otherwise `~/.openttd`
|
||||
3. The shared directory
|
||||
- Windows:
|
||||
- `C:\Documents and Settings\All Users\Shared Documents\OpenTTD` (2000, XP)
|
||||
- `C:\Users\Public\Documents\OpenTTD` (7, 8.1, 10, 11)
|
||||
- `C:\Users\Public\Documents\OpenTTD` (Vista, 7, 8.1, 10)
|
||||
- macOS: `/Library/Application Support/OpenTTD`
|
||||
- Linux: not available
|
||||
4. The binary directory (where the OpenTTD executable is)
|
||||
|
@@ -25,10 +25,6 @@ The translators will decide whether, where and how to apply your suggestion.
|
||||
|
||||
Sorry, we don't offer this option.
|
||||
|
||||
Only when there is a consistency problem that needs addressing, this can be done via a PR.
|
||||
We are very strict about this, and in general all PRs making translation changes will be closed.
|
||||
But if it is really needed, and the change is not a revert of any older change, a PR can be created to do mass changes to a translation.
|
||||
|
||||
### I want to change the language definition (plural form, genders, cases) of a translation.
|
||||
|
||||
Please [create an issue](https://github.com/OpenTTD/OpenTTD/issues/new/choose) for this.
|
||||
|
@@ -807,6 +807,8 @@
|
||||
</table>
|
||||
</li>
|
||||
<li>m2 bits 5..4: ground density</li>
|
||||
<li>m2 bits 3..0: update counter, incremented on every periodic processing.<br>
|
||||
on wraparound the growth status is updated (or, if it's <tt>3</tt>, a random action is taken)</li>
|
||||
<li>m3 bits 7..0: type of trees:
|
||||
<table>
|
||||
<tr>
|
||||
@@ -989,17 +991,13 @@
|
||||
</tr>
|
||||
</table>
|
||||
</li>
|
||||
<li>m6 bit 7: rail station / waypoint may have catenary pylons</li>
|
||||
<li>m6 bit 6: rail station / waypoint may have catenary wires</li>
|
||||
<li>m6 bits 5..3: the station type (rail, airport, truck, bus, oilrig, dock, buoy, waypoint)</li>
|
||||
<li>m6 bit 2: pbs reservation state for railway stations/waypoints</li>
|
||||
<li>m6 bit 0: rail station / waypoint is blocked</li>
|
||||
|
||||
<li>m7 bits 4..0: <a href="#OwnershipInfo">owner</a> of road (road stops)</li>
|
||||
<li>m7: animation frame (railway stations/waypoints, airports)</li>
|
||||
<li>m8 bits 11..6: <a href="#TramType">Tramtype</a></li>
|
||||
<li>m8 bits 5..0: <a href="#TrackType">track type</a> for railway stations/waypoints</li>
|
||||
<li>m8 bits 5..0: custom road stop id; 0 means standard graphics</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
|
@@ -188,7 +188,7 @@ the array so you can quickly see what is used and what is not.
|
||||
<td class="bits" rowspan=2><span class="used" title="Random bits">XXXX</span> <span class="free">OOOO</span></td>
|
||||
<td class="bits" rowspan=2><span class="used" title="Custom station specifications ID">XXXX XXXX</span></td>
|
||||
<td class="bits"><span class="used" title="Graphics index">XXXX XXXX</span></td>
|
||||
<td class="bits" rowspan=2><span class="used" title="May have pylons">X</span><span class="used" title="May have wires">X</span><span class="used" title="Station type">XXX</span> <span class="used" title="Reserved track">X</span><span class="free">O</span><span class="used" title="Tile is blocked">X</span></td>
|
||||
<td class="bits" rowspan=2><span class="free">OO</span><span class="used" title="Station type">XXX</span> <span class="used" title="Reserved track">X</span><span class="free">OO</span></td>
|
||||
<td class="bits" rowspan=2><span class="used" title="Animation frame">XXXX XXXX</span></td>
|
||||
<td class="bits" rowspan=2><span class="free">OOOO OOOO OO</span><span class="used" title="Railway type">XX XXXX</span></td>
|
||||
</tr>
|
||||
@@ -203,7 +203,7 @@ the array so you can quickly see what is used and what is not.
|
||||
<td class="bits"><span class="usable" title="Graphics index">OOOO O</span><span class="used" title="Graphics index: 00 (exit towards NE), 01 (exit towards SE), 02 (exit towards SW), 03 (exit towards NW), 04 (drive through X), 05 (drive through Y)">XXX</span></td>
|
||||
<td class="bits" rowspan=5><span class="free">OO</span><span class="used" title="Station type">XX X</span><span class="free">OOO</span></td>
|
||||
<td class="bits"><span class="free">OOO</span><span class="used" title="Owner of road">X XXXX</span></td>
|
||||
<td class="bits"><span class="free">OOOO</span> <span class="used" title="Tram type">XXXX XX</span> <span class="used" title="Custom road stops specifications ID">XXXXXX</span></td>
|
||||
<td class="bits"><span class="free">OOOO</span> <span class="used" title="Tram type">XXXX XX<span class="free">OO OOOO</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">airport</td>
|
||||
|
@@ -193,9 +193,6 @@ If it is, and your server still isn't showing up, start OpenTTD with
|
||||
`-d net=4` as extra argument. This will show debug message related to the
|
||||
network, including communication to/from the Game Coordinator.
|
||||
|
||||
See the [Game Coordinator documentation](./game_coordinator.md) for more
|
||||
technical information about the Game Coordinator service.
|
||||
|
||||
### My server warns a lot about getaddrinfo taking N seconds
|
||||
|
||||
This could be a transient issue with your (local) DNS server, but if the
|
||||
|
@@ -1,6 +1,6 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.Dd August 12, 2023
|
||||
.Dd October 13, 2014
|
||||
.Dt OPENTTD 6
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -8,17 +8,18 @@
|
||||
.Nd open source clone of the Microprose game \(lqTransport Tycoon Deluxe\(rq
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl efhQxX
|
||||
.Op Fl efhx
|
||||
.Op Fl b Ar blitter
|
||||
.Op Fl c Ar config_file
|
||||
.Op Fl d Op Ar level | Ar cat Ns = Ns Ar lvl Ns Op , Ns Ar ...
|
||||
.Op Fl D Oo Ar host Oc Ns Op : Ns Ar port
|
||||
.Op Fl g Op Ar file
|
||||
.Op Fl g Op Ar savegame
|
||||
.Op Fl G Ar seed
|
||||
.Op Fl I Ar graphicsset
|
||||
.Op Fl l Ar host Ns Op : Ns Ar port
|
||||
.Op Fl m Ar driver
|
||||
.Op Fl M Ar musicset
|
||||
.Op Fl n Ar host Ns Oo : Ns Ar port Oc Ns Op # Ns Ar company
|
||||
.Op Fl n Ar host Ns Oo : Ns Ar port Oc Ns Op # Ns Ar player
|
||||
.Op Fl p Ar password
|
||||
.Op Fl P Ar password
|
||||
.Op Fl q Ar savegame
|
||||
@@ -28,7 +29,7 @@
|
||||
.Op Fl t Ar year
|
||||
.Op Fl v Ar driver
|
||||
.Sh OPTIONS
|
||||
.Bl -tag -width "-n host[:port][#company]"
|
||||
.Bl -tag -width "-n host[:port][#player]"
|
||||
.It Fl b Ar blitter
|
||||
Select the blitter
|
||||
.Ar blitter ;
|
||||
@@ -62,11 +63,11 @@ Start in world editor mode.
|
||||
.It Fl f
|
||||
Fork into background (dedicated server only, see
|
||||
.Fl D ) .
|
||||
.It Fl g Op Ar file
|
||||
.It Fl g Op Ar savegame
|
||||
Load
|
||||
.Ar file
|
||||
(can be either a savegame, scenario, or heightmap) at start or start a new game if omitted.
|
||||
.Ar file
|
||||
.Ar savegame
|
||||
at start or start a new game if omitted.
|
||||
.Ar savegame
|
||||
must be either an absolute path or one relative to the current path or one of
|
||||
the search paths.
|
||||
.It Fl G Ar seed
|
||||
@@ -81,6 +82,11 @@ Select the graphics set
|
||||
see
|
||||
.Fl h
|
||||
for a full list.
|
||||
.It Fl l Ar host Ns Op : Ns Ar port
|
||||
Redirect
|
||||
.Fn DEBUG
|
||||
output; see
|
||||
.Fl D .
|
||||
.It Fl m Ar driver
|
||||
Select the music driver
|
||||
.Ar driver ;
|
||||
@@ -93,8 +99,8 @@ Select the music set
|
||||
see
|
||||
.Fl h
|
||||
for a full list.
|
||||
.It Fl n Ar host Ns Oo : Ns Ar port Oc Ns Op # Ns Ar company
|
||||
Join a network game, optionally specifying a port to connect to and company to
|
||||
.It Fl n Ar host Ns Oo : Ns Ar port Oc Ns Op # Ns Ar player
|
||||
Join a network game, optionally specifying a port to connect to and player to
|
||||
play as.
|
||||
.It Fl p Ar password
|
||||
Password used to join server.
|
||||
@@ -106,14 +112,6 @@ Only useful with
|
||||
.Fl n .
|
||||
.It Fl q Ar savegame
|
||||
Write some information about the specified savegame and exit.
|
||||
.It Fl Q
|
||||
Don't scan for/load NewGRF files on startup.
|
||||
.Pp
|
||||
Passing
|
||||
.Fl Q
|
||||
twice (so,
|
||||
.Fl QQ
|
||||
) will disable NewGRF scanning/loading entirely.
|
||||
.It Fl r Ar width Ns x Ns Ar height
|
||||
Set the resolution to
|
||||
.Ar width
|
||||
@@ -143,8 +141,6 @@ see
|
||||
for a full list.
|
||||
.It Fl x
|
||||
Do not automatically save to config file on exit.
|
||||
.It Fl X
|
||||
Do not use global folders to search for files.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Lk https://wiki.openttd.org "Wiki"
|
||||
|
@@ -1,48 +0,0 @@
|
||||
# Releasing OpenTTD
|
||||
|
||||
This guide is for OpenTTD developers/maintainers, to release a new version of OpenTTD.
|
||||
|
||||
## Step 0: Branch or Backport
|
||||
|
||||
* If this is a beta version release, skip this step.
|
||||
|
||||
* If this is an RC1 (first Release Candidate) build, create a new branch `release/nn` where `nn` is the major version number, then apply changes similar to [PR#9573](https://github.com/OpenTTD/OpenTTD/pull/9573). You also need to forwardport the changelog, as in [PR#10113](https://github.com/OpenTTD/OpenTTD/pull/10113).
|
||||
* Update CMakeLists.txt
|
||||
* Add a new (empty) AI compatibility script in bin/ai/
|
||||
* Add the new version to CheckAPIVersion in src/ai/ai_info.cpp + src/game/game_info.cpp
|
||||
* Add the new version to src/script/api/ai_changelog.hpp + src/script/api/game_changelog.hpp
|
||||
* Update the version of regression in bin/ai/regression/regression_info.nut
|
||||
* Add a note to src/saveload/saveload.h about which savegame version is used in the branch.
|
||||
|
||||
* If this is a later RC or release build and the release branch already exists, you'll need to backport fixes and language from master to this branch, which were merged after the branch diverged from master. You can use these two helper scripts: https://github.com/OpenTTD/scripts/tree/main/backport
|
||||
|
||||
## Step 1: Prepare changelog documentation
|
||||
|
||||
1. Update the [changelog](../changelog.txt) with new changes since the last release.
|
||||
* Changelog entries are typically PR titles, but can be edited to be more helpful without context.
|
||||
* Don't include fixes to things which haven't previously been released (like fixes to features which are in the same changelog).
|
||||
* Order the entries by importance: `Feature > Add > Change > Fix`, then numerically by PR number.
|
||||
2. Create a changelog PR, get approval, and merge.
|
||||
* For beta releases, target master, otherwise target the release branch.
|
||||
|
||||
## Step 2: Prepare website release announcement
|
||||
|
||||
1. Go to https://github.com/OpenTTD/website/new/main/_posts and write a new announcement post. See a [previous example](https://github.com/OpenTTD/website/pull/238) for a template.
|
||||
2. Create a new branch for this post and open a PR for it.
|
||||
3. Write announcement text for socials like Forum/Discord/Twitter/Reddit and include it in the PR.
|
||||
4. Create a Steam news image for that post and include it in the PR.
|
||||
5. Check the website post (preview link via checks page) and make corrections. We usually just use the GitHub web interface for this and squash the result later.
|
||||
6. Get this PR approved, but do not merge yet.
|
||||
|
||||
## Step 3: Make the actual OpenTTD release
|
||||
|
||||
1. Go to https://github.com/OpenTTD/OpenTTD/releases/new and create a new tag matching the release number. For the body of the release, see any older release. "Set as a pre-release" for a beta or RC, set as latest for a real release.
|
||||
2. Merge website PR.
|
||||
3. Wait for the OpenTTD release checks to be complete.
|
||||
4. Check that website links to the new release are working and correct, using the [staging website](https://www-staging.openttd.org/).
|
||||
5. If this is a full release, ask orudge to update the Microsoft Store and TrueBrain to move the release from the "testing" to "default" branch on Steam.
|
||||
|
||||
## Step 4: Tell the world
|
||||
|
||||
1. Tag and create a website release to trigger the actions that update the website.
|
||||
2. After the website is live, make announcements on social media. You may need to coordinate with other developers who can make posts on Twitter, Reddit, Steam, and GOG.
|
@@ -1,34 +0,0 @@
|
||||
# OpenTTD's Symbol Server
|
||||
|
||||
For all official releases, OpenTTD collects the Breakpad Symbols (SYM-files) and Microsoft's Symbols (PDB-files), and publishes them on our own Symbol Server (https://symbols.openttd.org).
|
||||
|
||||
These symbol files are needed to analyze `crash.dmp` files as attached to issues by users.
|
||||
A `crash.dmp` is created on Windows, Linux, and MacOS when a crash happens.
|
||||
This combined with the `crash.log` should give a pretty good indication what was going on at the moment the game crashed.
|
||||
|
||||
## Analyzing a crash.dmp
|
||||
|
||||
### MSVC
|
||||
|
||||
In MSVC you can add the above URL as Symbol Server (and please enable MSVC's for all other libraries), allowing you to analyze `crash.dmp`.
|
||||
|
||||
Now simply open up the `crash.dmp`, and start debugging.
|
||||
|
||||
### All other platforms
|
||||
|
||||
The best tool to use is `minidump-stackwalk` as published in the Rust's cargo index:
|
||||
|
||||
```bash
|
||||
cargo install minidump-stackwalk
|
||||
```
|
||||
|
||||
For how to install Rust, please see [here](https://doc.rust-lang.org/cargo/getting-started/installation.html).
|
||||
|
||||
Now run the tool like:
|
||||
|
||||
```bash
|
||||
minidump-stackwalk <crash.dmp> --symbols-url https://symbols.openttd.org
|
||||
```
|
||||
|
||||
For convenience, the above Symbol Server also check with Mozilla's Symbol Server in case any other library but OpenTTD is requested.
|
||||
This means files like `libc`, `kernel32.dll`, etc are all available on the above mentioned Symbol Server.
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user