mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-13 09:39:10 +00:00
Compare commits
1 Commits
98e9506205
...
0.6.0-beta
Author | SHA1 | Date | |
---|---|---|---|
|
70aba01686 |
@@ -1,20 +0,0 @@
|
||||
notifications:
|
||||
global:
|
||||
irc:
|
||||
- openttd
|
||||
- openttd.notice
|
||||
|
||||
push:
|
||||
only:
|
||||
- master
|
||||
only-by:
|
||||
- eints-sync\[bot\]
|
||||
commit-comment:
|
||||
discussion:
|
||||
pull-request:
|
||||
issue:
|
||||
tag-created:
|
||||
workflow-run:
|
||||
only:
|
||||
- .github/workflows/release.yml
|
||||
- .github/workflows/ci-nightly.yml
|
477
.editorconfig
477
.editorconfig
@@ -1,477 +0,0 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
insert_final_newline = true
|
||||
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
|
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
@@ -1 +0,0 @@
|
||||
custom: https://www.openttd.org/donate.html
|
41
.github/ISSUE_TEMPLATE/bug.yaml
vendored
41
.github/ISSUE_TEMPLATE/bug.yaml
vendored
@@ -1,41 +0,0 @@
|
||||
name: Bug Report
|
||||
description: Found a bug in OpenTTD?
|
||||
title: "[Bug]: "
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this bug report!
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: Version of OpenTTD
|
||||
description: Fill in below what version of OpenTTD you are using, including your OS.
|
||||
placeholder: ex. 1.11.2, Windows 10
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
label: Expected result
|
||||
description: Describe in a few words what you expected to happen.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: actual
|
||||
attributes:
|
||||
label: Actual result
|
||||
description: Describe in a few words what actually happens.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduce
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: As detailed as possible, please tell us how we can reproduce this. Feel free to attach a savegame (zip it first) to make it more clear.
|
||||
placeholder: |
|
||||
1. Loaded the attached savegame.
|
||||
2. Click on the button left of that other icon.
|
||||
3. The window doesn't open.
|
||||
validations:
|
||||
required: true
|
5
.github/ISSUE_TEMPLATE/config.yml
vendored
5
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,5 +0,0 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Suggestions and ideas?
|
||||
url: https://www.tt-forums.net/viewforum.php?f=32
|
||||
about: Have a suggestion or an idea for a cool new feature? Post them on our forum!
|
37
.github/ISSUE_TEMPLATE/crash.yaml
vendored
37
.github/ISSUE_TEMPLATE/crash.yaml
vendored
@@ -1,37 +0,0 @@
|
||||
name: Crash
|
||||
description: Did OpenTTD crash?
|
||||
title: "[Crash]: "
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this crash report!
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: Version of OpenTTD
|
||||
description: Fill in below what version of OpenTTD you are using, including your OS.
|
||||
placeholder: ex. 1.11.2, Windows 10
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduce
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: Please spend a few words if you can reproduce this problem.
|
||||
placeholder: |
|
||||
1. Bought a new train.
|
||||
2. The game crashed.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: crashlogs
|
||||
attributes:
|
||||
label: Upload crash files
|
||||
description: With the `crash.log`, `crash.dmp`, and `crash.sav` we can analyze the crash in detail; this way you allow us to easier triage and fix the problem.
|
||||
placeholder: |
|
||||
1. Zip the `crash.log`, `crash.dmp` and `crash.sav`.
|
||||
2. Click on this field.
|
||||
3. Drag and drop the zip file in here.
|
||||
validations:
|
||||
required: true
|
58
.github/PULL_REQUEST_TEMPLATE.md
vendored
58
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,58 +0,0 @@
|
||||
<!--
|
||||
Commit message:
|
||||
|
||||
- Please use Feature / Add / Change / Fix for player-facing changes. E.g.: "Feature: My cool new feature".
|
||||
- Please use Feature / Add / Change / Fix followed by "[NewGRF]" or "[Script]" for moddable changes. E.g.: "Feature: [NewGRF] My cool new NewGRF addition".
|
||||
- Please use Codechange / Codefix for developer-facing changes. E.g.: "Codefix #1234: Validate against nullptr properly".
|
||||
|
||||
See https://github.com/OpenTTD/OpenTTD/blob/master/CODINGSTYLE.md#commit-message for more details.
|
||||
-->
|
||||
|
||||
## Motivation / Problem
|
||||
|
||||
<!--
|
||||
Describe here shortly
|
||||
* For bug fixes:
|
||||
* What problem does this solve?
|
||||
* If there is already an issue, link the issue, otherwise describe the problem here.
|
||||
* For features or gameplay changes:
|
||||
* What was the motivation to develop this feature?
|
||||
* Does this address any problem with the gameplay or interface?
|
||||
* Which group of players do you think would enjoy this feature?
|
||||
-->
|
||||
|
||||
|
||||
## Description
|
||||
|
||||
<!--
|
||||
Describe here shortly
|
||||
* For bug fixes:
|
||||
* How is the problem solved?
|
||||
* For features or gameplay changes:
|
||||
* What does this feature do?
|
||||
* How does it improve/solve the situation described under 'motivation'.
|
||||
-->
|
||||
|
||||
|
||||
## Limitations
|
||||
|
||||
<!--
|
||||
Describe here
|
||||
* Is the problem solved in all scenarios?
|
||||
* Is this feature complete? Are there things that could be added in the future?
|
||||
* Are there things that are intentionally left out?
|
||||
* Do you know of a bug or corner case that does not work?
|
||||
-->
|
||||
|
||||
|
||||
## Checklist for review
|
||||
|
||||
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.
|
||||
* The bug fix is important enough to be backported? (label: 'backport requested')
|
||||
* This PR touches english.txt or translations? Check the [guidelines](https://github.com/OpenTTD/OpenTTD/blob/master/docs/eints.md)
|
||||
* This PR affects the GS/AI API? (label 'needs review: Script API')
|
||||
* ai_changelog.hpp, game_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.
|
||||
* [PR must be added to API tracker](https://wiki.openttd.org/en/Development/NewGRF/Specification%20Status)
|
36
.github/changelog.py
vendored
36
.github/changelog.py
vendored
@@ -1,36 +0,0 @@
|
||||
import sys
|
||||
|
||||
"""
|
||||
This script assumes changelogs use the following format:
|
||||
## <major>.x (eg. "## 15.x") to indicate a major version series
|
||||
### <major>.<minor>[-<suffix>] <date etc> (eg. "## 15.0 (2025-04-01)", "### 15.1-beta1 (2024-12-25)") to indicate an individual version
|
||||
"""
|
||||
|
||||
def main():
|
||||
current_version = sys.argv[1]
|
||||
stable_version = current_version.split("-")[0]
|
||||
major_version = current_version.split(".")[0]
|
||||
# set when current version is found
|
||||
current_found = False
|
||||
|
||||
with open("changelog.md", "r") as file:
|
||||
for line in file:
|
||||
if line.startswith("### "):
|
||||
if not line.startswith(f"### {current_version} ") and not current_found:
|
||||
# First version in changelog should be the current one
|
||||
sys.stderr.write(f"Changelog doesn't start with current version ({current_version})\n")
|
||||
sys.exit(1)
|
||||
if not line.startswith(f"### {stable_version}"):
|
||||
# Reached a previous stable version
|
||||
break
|
||||
if line.startswith(f"### {current_version} "):
|
||||
current_found = True
|
||||
elif line.startswith("## "):
|
||||
if not line.startswith(f"## {major_version}.x"):
|
||||
# Reached a previous major version
|
||||
break
|
||||
|
||||
print(line.rstrip())
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
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()
|
208
.github/unused-strings.py
vendored
208
.github/unused-strings.py
vendored
@@ -1,208 +0,0 @@
|
||||
"""
|
||||
Script to scan the OpenTTD source-tree for STR_ entries that are defined but
|
||||
no longer used.
|
||||
|
||||
This is not completely trivial, as OpenTTD references a lot of strings in
|
||||
relation to another string. The most obvious example of this is a list. OpenTTD
|
||||
only references the first entry in the list, and does "+ <var>" to get to the
|
||||
correct string.
|
||||
|
||||
There are other ways OpenTTD does use relative values. This script tries to
|
||||
account for all of them, to give the best approximation we have for "this
|
||||
string is unused".
|
||||
"""
|
||||
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from enum import Enum
|
||||
|
||||
LENGTH_NAME_LOOKUP = {
|
||||
"VEHICLE_TYPES": 4,
|
||||
}
|
||||
|
||||
|
||||
class SkipType(Enum):
|
||||
NONE = 1
|
||||
LENGTH = 2
|
||||
EXTERNAL = 3
|
||||
ZERO_IS_SPECIAL = 4
|
||||
EXPECT_NEWLINE = 5
|
||||
|
||||
|
||||
def read_language_file(filename, strings_found, errors):
|
||||
strings_defined = []
|
||||
|
||||
skip = SkipType.NONE
|
||||
length = 0
|
||||
common_prefix = ""
|
||||
|
||||
with open(filename) as fp:
|
||||
for line in fp.readlines():
|
||||
if not line.strip():
|
||||
if skip == SkipType.EXPECT_NEWLINE:
|
||||
skip = SkipType.NONE
|
||||
continue
|
||||
|
||||
line = line.strip()
|
||||
|
||||
if skip == SkipType.EXPECT_NEWLINE:
|
||||
# The only thing allowed after a list, is this next marker, or a newline.
|
||||
if line == "###next-name-looks-similar":
|
||||
# "###next-name-looks-similar"
|
||||
# Indicates the common prefix of the last list has a very
|
||||
# similar name to the next entry, but isn't part of the
|
||||
# list. So do not emit a warning about them looking very
|
||||
# similar.
|
||||
|
||||
if length != 0:
|
||||
errors.append(f"ERROR: list around {name} is shorted than indicated by ###length")
|
||||
|
||||
common_prefix = ""
|
||||
else:
|
||||
errors.append(f"ERROR: expected a newline after a list, but didn't find any around {name}. Did you add an entry to the list without increasing the length?")
|
||||
|
||||
skip = SkipType.NONE
|
||||
|
||||
if line[0] == "#":
|
||||
if line.startswith("###length "):
|
||||
# "###length <count>"
|
||||
# Indicates the next few entries are part of a list. Only
|
||||
# the first entry is possibly referenced, and the rest are
|
||||
# indirectly.
|
||||
|
||||
if length != 0:
|
||||
errors.append(f"ERROR: list around {name} is shorted than indicated by ###length")
|
||||
|
||||
length = line.split(" ")[1].strip()
|
||||
|
||||
if length.isnumeric():
|
||||
length = int(length)
|
||||
else:
|
||||
length = LENGTH_NAME_LOOKUP[length]
|
||||
|
||||
skip = SkipType.LENGTH
|
||||
elif line.startswith("###external "):
|
||||
# "###external <count>"
|
||||
# Indicates the next few entries are used outside the
|
||||
# source and will not be referenced.
|
||||
|
||||
if length != 0:
|
||||
errors.append(f"ERROR: list around {name} is shorted than indicated by ###length")
|
||||
|
||||
length = line.split(" ")[1].strip()
|
||||
length = int(length)
|
||||
|
||||
skip = SkipType.EXTERNAL
|
||||
elif line.startswith("###setting-zero-is-special"):
|
||||
# "###setting-zero-is-special"
|
||||
# Indicates the next entry is part of the "zero is special"
|
||||
# flag of settings. These entries are not referenced
|
||||
# directly in the code.
|
||||
|
||||
if length != 0:
|
||||
errors.append(f"ERROR: list around {name} is shorted than indicated by ###length")
|
||||
|
||||
skip = SkipType.ZERO_IS_SPECIAL
|
||||
|
||||
continue
|
||||
|
||||
name = line.split(":")[0].strip()
|
||||
strings_defined.append(name)
|
||||
|
||||
if skip == SkipType.EXTERNAL:
|
||||
strings_found.add(name)
|
||||
skip = SkipType.LENGTH
|
||||
|
||||
if skip == SkipType.LENGTH:
|
||||
skip = SkipType.NONE
|
||||
length -= 1
|
||||
common_prefix = name
|
||||
elif skip == SkipType.ZERO_IS_SPECIAL:
|
||||
strings_found.add(name)
|
||||
elif length > 0:
|
||||
strings_found.add(name)
|
||||
length -= 1
|
||||
|
||||
# Find the common prefix of these strings
|
||||
for i in range(len(common_prefix)):
|
||||
if common_prefix[0 : i + 1] != name[0 : i + 1]:
|
||||
common_prefix = common_prefix[0:i]
|
||||
break
|
||||
|
||||
if length == 0:
|
||||
skip = SkipType.EXPECT_NEWLINE
|
||||
|
||||
if len(common_prefix) < 6:
|
||||
errors.append(f"ERROR: common prefix of block including {name} was reduced to {common_prefix}. This means the names in the list are not consistent.")
|
||||
elif common_prefix:
|
||||
if name.startswith(common_prefix):
|
||||
errors.append(f"ERROR: {name} looks a lot like block above with prefix {common_prefix}. This mostly means that the list length was too short. Use '###next-name-looks-similar' if it is not.")
|
||||
common_prefix = ""
|
||||
|
||||
return strings_defined
|
||||
|
||||
|
||||
def scan_source_files(path, strings_found):
|
||||
for new_path in glob.glob(f"{path}/*"):
|
||||
if os.path.isdir(new_path):
|
||||
scan_source_files(new_path, strings_found)
|
||||
continue
|
||||
|
||||
if not new_path.endswith((".c", ".h", ".cpp", ".hpp", ".ini")):
|
||||
continue
|
||||
|
||||
# Most files we can just open, but some use magic, that requires the
|
||||
# G++ preprocessor before we can make sense out of it.
|
||||
if new_path == "src/table/cargo_const.h":
|
||||
p = subprocess.run(["g++", "-E", "-DCHECK_UNUSED_STRINGS", new_path], stdout=subprocess.PIPE)
|
||||
output = p.stdout.decode()
|
||||
else:
|
||||
with open(new_path) as fp:
|
||||
output = fp.read()
|
||||
|
||||
# Find all the string references.
|
||||
matches = re.findall(r"[^A-Z_](STR_[A-Z0-9_]*)", output)
|
||||
strings_found.update(matches)
|
||||
|
||||
|
||||
def main():
|
||||
strings_found = set()
|
||||
errors = []
|
||||
|
||||
scan_source_files("src", strings_found)
|
||||
strings_defined = read_language_file("src/lang/english.txt", strings_found, errors)
|
||||
|
||||
# STR_LAST_STRINGID is special, and not really a string.
|
||||
strings_found.remove("STR_LAST_STRINGID")
|
||||
# These are mentioned in comments, not really a string.
|
||||
strings_found.remove("STR_XXX")
|
||||
strings_found.remove("STR_NEWS")
|
||||
strings_found.remove("STR_CONTENT_TYPE_")
|
||||
|
||||
# This string is added for completion, but never used.
|
||||
strings_defined.remove("STR_JUST_DATE_SHORT")
|
||||
|
||||
strings_defined = sorted(strings_defined)
|
||||
strings_found = sorted(list(strings_found))
|
||||
|
||||
for string in strings_found:
|
||||
if string not in strings_defined:
|
||||
errors.append(f"ERROR: {string} found but never defined.")
|
||||
|
||||
for string in strings_defined:
|
||||
if string not in strings_found:
|
||||
errors.append(f"ERROR: {string} is (possibly) no longer needed.")
|
||||
|
||||
if errors:
|
||||
print("\n".join(errors))
|
||||
sys.exit(1)
|
||||
|
||||
print("OK")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
108
.github/workflows/ci-build.yml
vendored
108
.github/workflows/ci-build.yml
vendored
@@ -1,108 +0,0 @@
|
||||
name: CI - Build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
CTEST_OUTPUT_ON_FAILURE: 1
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
|
||||
|
||||
jobs:
|
||||
emscripten:
|
||||
name: Emscripten
|
||||
|
||||
uses: ./.github/workflows/ci-emscripten.yml
|
||||
secrets: inherit
|
||||
|
||||
linux:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Clang
|
||||
compiler: clang
|
||||
cxxcompiler: clang++
|
||||
libraries: libsdl2-dev
|
||||
- name: GCC - SDL2
|
||||
compiler: gcc
|
||||
cxxcompiler: g++
|
||||
libraries: libsdl2-dev
|
||||
- name: GCC - Dedicated
|
||||
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.
|
||||
|
||||
name: Linux (${{ matrix.name }})
|
||||
|
||||
uses: ./.github/workflows/ci-linux.yml
|
||||
secrets: inherit
|
||||
|
||||
with:
|
||||
compiler: ${{ matrix.compiler }}
|
||||
cxxcompiler: ${{ matrix.cxxcompiler }}
|
||||
libraries: ${{ matrix.libraries }}
|
||||
extra-cmake-parameters: ${{ matrix.extra-cmake-parameters }}
|
||||
|
||||
macos:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: arm64 - Debug
|
||||
arch: arm64
|
||||
full_arch: arm64
|
||||
extra-cmake-parameters: -DCMAKE_BUILD_TYPE=Debug
|
||||
- name: arm64 - Release
|
||||
arch: arm64
|
||||
full_arch: arm64
|
||||
extra-cmake-parameters: -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPTION_USE_ASSERTS=OFF
|
||||
|
||||
name: Mac OS (${{ matrix.name }})
|
||||
|
||||
uses: ./.github/workflows/ci-macos.yml
|
||||
secrets: inherit
|
||||
|
||||
with:
|
||||
arch: ${{ matrix.arch }}
|
||||
full_arch: ${{ matrix.full_arch }}
|
||||
extra-cmake-parameters: ${{ matrix.extra-cmake-parameters }}
|
||||
|
||||
windows:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- arch: x86
|
||||
- arch: x64
|
||||
|
||||
name: Windows (${{ matrix.arch }})
|
||||
|
||||
uses: ./.github/workflows/ci-windows.yml
|
||||
secrets: inherit
|
||||
|
||||
with:
|
||||
arch: ${{ matrix.arch }}
|
||||
|
||||
check_annotations:
|
||||
name: Check Annotations
|
||||
needs:
|
||||
- emscripten
|
||||
- linux
|
||||
- macos
|
||||
- windows
|
||||
|
||||
if: always() && github.event_name == 'pull_request'
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check annotations
|
||||
uses: OpenTTD/actions/annotation-check@v5
|
75
.github/workflows/ci-emscripten.yml
vendored
75
.github/workflows/ci-emscripten.yml
vendored
@@ -1,75 +0,0 @@
|
||||
name: CI (Emscripten)
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
env:
|
||||
CTEST_OUTPUT_ON_FAILURE: 1
|
||||
|
||||
jobs:
|
||||
emscripten:
|
||||
name: CI
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
# If you change this version, change the numbers in the cache step,
|
||||
# .github/workflows/preview-build.yml (2x) and os/emscripten/Dockerfile too.
|
||||
image: emscripten/emsdk:3.1.57
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Fix dubious ownership
|
||||
run: |
|
||||
git config --global --add safe.directory ${GITHUB_WORKSPACE}
|
||||
|
||||
- name: Update to modern GCC
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y gcc-12 g++-12
|
||||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100
|
||||
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100
|
||||
|
||||
- name: Setup cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
# If you change this version, change the numbers in the image configuration step,
|
||||
# .github/workflows/preview-build.yml (2x) and os/emscripten/Dockerfile too.
|
||||
path: /emsdk/upstream/emscripten/cache
|
||||
key: 3.1.57-${{ runner.os }}
|
||||
|
||||
- name: Add liblzma support
|
||||
run: |
|
||||
cp ${GITHUB_WORKSPACE}/os/emscripten/ports/liblzma.py /emsdk/upstream/emscripten/tools/ports/contrib/
|
||||
|
||||
- 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"
|
||||
cmake --build . -j $(nproc) --target 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
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(nproc) cores"
|
||||
cmake --build . -j $(nproc) --target openttd
|
||||
echo "::endgroup::"
|
126
.github/workflows/ci-linux.yml
vendored
126
.github/workflows/ci-linux.yml
vendored
@@ -1,126 +0,0 @@
|
||||
name: CI (Linux)
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
compiler:
|
||||
required: true
|
||||
type: string
|
||||
cxxcompiler:
|
||||
required: true
|
||||
type: string
|
||||
libraries:
|
||||
required: true
|
||||
type: string
|
||||
extra-cmake-parameters:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
env:
|
||||
CTEST_OUTPUT_ON_FAILURE: 1
|
||||
|
||||
jobs:
|
||||
linux:
|
||||
name: CI
|
||||
|
||||
runs-on: ubuntu-24.04
|
||||
env:
|
||||
CC: ${{ inputs.compiler }}
|
||||
CXX: ${{ inputs.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')
|
||||
|
||||
- name: Install vcpkg
|
||||
run: |
|
||||
git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}/vcpkg
|
||||
${{ runner.temp }}/vcpkg/bootstrap-vcpkg.sh -disableMetrics
|
||||
|
||||
- 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 \
|
||||
libogg-dev \
|
||||
libopus-dev \
|
||||
libopusfile-dev \
|
||||
${{ inputs.libraries }} \
|
||||
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.
|
||||
${{ runner.temp }}/vcpkg/vcpkg install breakpad
|
||||
|
||||
echo "::endgroup::"
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
|
||||
- name: Get OpenGFX
|
||||
run: |
|
||||
mkdir -p ~/.local/share/openttd/baseset
|
||||
cd ~/.local/share/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
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Unpack OpenGFX"
|
||||
unzip opengfx-all.zip
|
||||
echo "::endgroup::"
|
||||
|
||||
rm -f opengfx-all.zip
|
||||
|
||||
- name: Install GCC problem matcher
|
||||
uses: ammaraskar/gcc-problem-matcher@master
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake .. -DCMAKE_TOOLCHAIN_FILE=${{ runner.temp }}/vcpkg/scripts/buildsystems/vcpkg.cmake ${{ inputs.extra-cmake-parameters }}
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(nproc) cores"
|
||||
cmake --build . -j $(nproc)
|
||||
echo "::endgroup::"
|
||||
|
||||
- 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
|
90
.github/workflows/ci-macos.yml
vendored
90
.github/workflows/ci-macos.yml
vendored
@@ -1,90 +0,0 @@
|
||||
name: CI (MacOS)
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
arch:
|
||||
required: true
|
||||
type: string
|
||||
full_arch:
|
||||
required: true
|
||||
type: string
|
||||
extra-cmake-parameters:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
|
||||
env:
|
||||
CTEST_OUTPUT_ON_FAILURE: 1
|
||||
|
||||
jobs:
|
||||
macos:
|
||||
name: CI
|
||||
|
||||
runs-on: macos-latest
|
||||
env:
|
||||
MACOSX_DEPLOYMENT_TARGET: 10.13
|
||||
|
||||
steps:
|
||||
- name: Setup Xcode version
|
||||
uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: latest-stable
|
||||
|
||||
- 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')
|
||||
|
||||
- name: Install vcpkg
|
||||
run: |
|
||||
git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}/vcpkg
|
||||
${{ runner.temp }}/vcpkg/bootstrap-vcpkg.sh -disableMetrics
|
||||
|
||||
- name: Install OpenGFX
|
||||
run: |
|
||||
mkdir -p ~/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
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Unpack OpenGFX"
|
||||
unzip opengfx-all.zip
|
||||
echo "::endgroup::"
|
||||
|
||||
rm -f opengfx-all.zip
|
||||
|
||||
- name: Install GCC problem matcher
|
||||
uses: ammaraskar/gcc-problem-matcher@master
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake .. \
|
||||
-DCMAKE_OSX_ARCHITECTURES=${{ inputs.full_arch }} \
|
||||
-DVCPKG_TARGET_TRIPLET=${{ inputs.arch }}-osx \
|
||||
-DCMAKE_TOOLCHAIN_FILE=${{ runner.temp }}/vcpkg/scripts/buildsystems/vcpkg.cmake \
|
||||
${{ inputs.extra-cmake-parameters }} \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(sysctl -n hw.logicalcpu) cores"
|
||||
cmake --build . -j $(sysctl -n hw.logicalcpu)
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
cd build
|
||||
ctest -j $(sysctl -n hw.logicalcpu) --timeout 120
|
86
.github/workflows/ci-mingw.yml
vendored
86
.github/workflows/ci-mingw.yml
vendored
@@ -1,86 +0,0 @@
|
||||
name: CI (MinGW)
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
arch:
|
||||
required: true
|
||||
type: string
|
||||
msystem:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
env:
|
||||
CTEST_OUTPUT_ON_FAILURE: 1
|
||||
|
||||
jobs:
|
||||
mingw:
|
||||
name: CI
|
||||
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup MSYS2
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: ${{ inputs.msystem }}
|
||||
release: false
|
||||
install: >-
|
||||
git
|
||||
make
|
||||
mingw-w64-${{ inputs.arch }}-cmake
|
||||
mingw-w64-${{ inputs.arch }}-gcc
|
||||
mingw-w64-${{ inputs.arch }}-lzo2
|
||||
mingw-w64-${{ inputs.arch }}-libpng
|
||||
mingw-w64-${{ inputs.arch }}-lld
|
||||
mingw-w64-${{ inputs.arch }}-ninja
|
||||
mingw-w64-${{ inputs.arch }}-libogg
|
||||
mingw-w64-${{ inputs.arch }}-opus
|
||||
mingw-w64-${{ inputs.arch }}-opusfile
|
||||
|
||||
- name: Install OpenGFX
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p "C:/Users/Public/Documents/OpenTTD/baseset"
|
||||
cd "C:/Users/Public/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
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Unpack OpenGFX"
|
||||
unzip opengfx-all.zip
|
||||
echo "::endgroup::"
|
||||
|
||||
rm -f opengfx-all.zip
|
||||
|
||||
- name: Install GCC problem matcher
|
||||
uses: ammaraskar/gcc-problem-matcher@master
|
||||
|
||||
- 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
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
cmake --build .
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Test
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
cd build
|
||||
ctest --timeout 120
|
60
.github/workflows/ci-nightly.yml
vendored
60
.github/workflows/ci-nightly.yml
vendored
@@ -1,60 +0,0 @@
|
||||
name: CI - Nightly
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 3 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
CTEST_OUTPUT_ON_FAILURE: 1
|
||||
|
||||
jobs:
|
||||
macos:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- arch: x64
|
||||
full_arch: x86_64
|
||||
|
||||
name: Mac OS (${{ matrix.arch }})
|
||||
|
||||
uses: ./.github/workflows/ci-macos.yml
|
||||
secrets: inherit
|
||||
|
||||
with:
|
||||
arch: ${{ matrix.arch }}
|
||||
full_arch: ${{ matrix.full_arch }}
|
||||
|
||||
mingw:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- msystem: MINGW64
|
||||
arch: x86_64
|
||||
- msystem: MINGW32
|
||||
arch: i686
|
||||
|
||||
name: MinGW (${{ matrix.arch }})
|
||||
|
||||
uses: ./.github/workflows/ci-mingw.yml
|
||||
secrets: inherit
|
||||
|
||||
with:
|
||||
msystem: ${{ matrix.msystem }}
|
||||
arch: ${{ matrix.arch }}
|
||||
|
||||
check_annotations:
|
||||
name: Check Annotations
|
||||
needs:
|
||||
- macos
|
||||
- mingw
|
||||
|
||||
if: always()
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check annotations
|
||||
uses: OpenTTD/actions/annotation-check@v5
|
84
.github/workflows/ci-windows.yml
vendored
84
.github/workflows/ci-windows.yml
vendored
@@ -1,84 +0,0 @@
|
||||
name: CI (Windows)
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
arch:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
env:
|
||||
CTEST_OUTPUT_ON_FAILURE: 1
|
||||
|
||||
jobs:
|
||||
windows:
|
||||
name: CI
|
||||
|
||||
runs-on: windows-latest
|
||||
|
||||
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')
|
||||
|
||||
- name: Install vcpkg
|
||||
run: |
|
||||
git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}\vcpkg
|
||||
${{ runner.temp }}\vcpkg\bootstrap-vcpkg.bat -disableMetrics
|
||||
|
||||
- name: Install OpenGFX
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p "C:/Users/Public/Documents/OpenTTD/baseset"
|
||||
cd "C:/Users/Public/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
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Unpack OpenGFX"
|
||||
unzip opengfx-all.zip
|
||||
echo "::endgroup::"
|
||||
|
||||
rm -f opengfx-all.zip
|
||||
|
||||
- name: Install MSVC problem matcher
|
||||
uses: ammaraskar/msvc-problem-matcher@master
|
||||
|
||||
- name: Configure developer command prompt for ${{ inputs.arch }}
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: ${{ inputs.arch }}
|
||||
|
||||
- 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
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake .. \
|
||||
-GNinja \
|
||||
-DVCPKG_TARGET_TRIPLET=${{ inputs.arch }}-windows-static \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${{ runner.temp }}\vcpkg\scripts\buildsystems\vcpkg.cmake" \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
cmake --build .
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Test
|
||||
shell: bash
|
||||
run: |
|
||||
cd build
|
||||
ctest --timeout 120
|
122
.github/workflows/codeql.yml
vendored
122
.github/workflows/codeql.yml
vendored
@@ -1,122 +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: 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 vcpkg
|
||||
run: |
|
||||
git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}/vcpkg
|
||||
${{ runner.temp }}/vcpkg/bootstrap-vcpkg.sh -disableMetrics
|
||||
|
||||
- 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 \
|
||||
libopus-dev \
|
||||
libopusfile-dev \
|
||||
libsdl2-dev \
|
||||
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.
|
||||
${{ runner.temp }}/vcpkg/vcpkg install breakpad
|
||||
|
||||
echo "::endgroup::"
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
|
||||
- name: Prepare build
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
echo "::group::CMake"
|
||||
cmake .. -DCMAKE_TOOLCHAIN_FILE=${{ runner.temp }}/vcpkg/scripts/buildsystems/vcpkg.cmake
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: cpp
|
||||
config-file: ./.github/codeql/codeql-config.yml
|
||||
trap-caching: false
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cd build
|
||||
|
||||
echo "::group::Build"
|
||||
echo "Running on $(nproc) cores"
|
||||
cmake --build . -j $(nproc)
|
||||
echo "::endgroup::"
|
||||
|
||||
- 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
|
25
.github/workflows/commit-checker.yml
vendored
25
.github/workflows/commit-checker.yml
vendored
@@ -1,25 +0,0 @@
|
||||
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
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 4
|
||||
|
||||
- name: Get pull-request commits
|
||||
uses: OpenTTD/actions/checkout-pull-request@v5
|
||||
|
||||
- name: Check commits
|
||||
uses: OpenTTD/OpenTTD-git-hooks@main
|
112
.github/workflows/preview-build.yml
vendored
112
.github/workflows/preview-build.yml
vendored
@@ -1,112 +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 numbers in the cache step,
|
||||
# .github/workflows/ci-emscripten.yml (2x) and os/emscripten/Dockerfile too.
|
||||
image: emscripten/emsdk:3.1.57
|
||||
|
||||
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: Update to modern GCC
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y gcc-12 g++-12
|
||||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100
|
||||
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100
|
||||
|
||||
- name: Setup cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /emsdk/upstream/emscripten/cache
|
||||
# If you change this version, change the numbers in the image configuration step,
|
||||
# .github/workflows/ci-emscripten.yml (2x) and os/emscripten/Dockerfile too.
|
||||
key: 3.1.57-${{ runner.os }}
|
||||
|
||||
- name: Add liblzma support
|
||||
run: |
|
||||
cp ${GITHUB_WORKSPACE}/os/emscripten/ports/liblzma.py /emsdk/upstream/emscripten/tools/ports/contrib/
|
||||
|
||||
- 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 }}
|
21
.github/workflows/preview.yml
vendored
21
.github/workflows/preview.yml
vendored
@@ -1,21 +0,0 @@
|
||||
name: Preview
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- labeled
|
||||
- synchronize
|
||||
branches:
|
||||
- master
|
||||
- release/**
|
||||
|
||||
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
|
19
.github/workflows/rebase-checker.yml
vendored
19
.github/workflows/rebase-checker.yml
vendored
@@ -1,19 +0,0 @@
|
||||
name: "Update 'work: needs rebase' label status"
|
||||
on:
|
||||
# So that PRs touching the same files as the push are updated
|
||||
push:
|
||||
# So that the `dirtyLabel` is removed if conflicts are resolve
|
||||
# We recommend `pull_request_target` so that github secrets are available.
|
||||
# In `pull_request` we wouldn't be able to change labels of fork PRs
|
||||
pull_request_target:
|
||||
types: [synchronize]
|
||||
|
||||
jobs:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: check if prs are in need of a rebase
|
||||
uses: eps1lon/actions-label-merge-conflict@v3
|
||||
with:
|
||||
dirtyLabel: "work: needs rebase"
|
||||
repoToken: "${{ secrets.GITHUB_TOKEN }}"
|
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-latest
|
||||
|
||||
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.4.4.tar.gz
|
||||
tar xf v2.4.4.tar.gz
|
||||
(
|
||||
cd fluidsynth-2.4.4
|
||||
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 --locked 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
|
226
.github/workflows/release-macos.yml
vendored
226
.github/workflows/release-macos.yml
vendored
@@ -1,226 +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: Setup Xcode version
|
||||
uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: latest-stable
|
||||
|
||||
- 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 vcpkg
|
||||
run: |
|
||||
git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}/vcpkg
|
||||
${{ runner.temp }}/vcpkg/bootstrap-vcpkg.sh -disableMetrics
|
||||
|
||||
- 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 --locked 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@v5
|
||||
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=${{ runner.temp }}/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=${{ runner.temp }}/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
|
216
.github/workflows/release-source.yml
vendored
216
.github/workflows/release-source.yml
vendored
@@ -1,216 +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-latest
|
||||
|
||||
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
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::group::Prepare metadata files"
|
||||
cmake -DGENERATE_OTTDREV=1 -P cmake/scripts/FindVersion.cmake
|
||||
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"
|
||||
|
||||
python3 ./.github/changelog.py "$(cat .version)" > .changelog
|
||||
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
|
||||
|
||||
# For nightlies / branches, use the git log of the last 7 days as changelog.
|
||||
revdate=$(git log -1 --pretty=format:"%ci")
|
||||
last_week=$(date -d "$revdate -7days" +"%Y-%m-%d %H:%M")
|
||||
echo "## Version $(cat .version) - changes since ${last_week}" > .changelog
|
||||
echo "" >> .changelog
|
||||
git log --oneline --after="${last_week}" >> .changelog
|
||||
fi
|
||||
|
||||
mkdir -p build/bundles
|
||||
cp .changelog build/bundles/changelog.md
|
||||
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 vcpkg
|
||||
run: |
|
||||
git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}\vcpkg
|
||||
${{ runner.temp }}\vcpkg\bootstrap-vcpkg.bat -disableMetrics
|
||||
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::group::Install choco dependencies"
|
||||
choco install pandoc
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Install breakpad dependencies"
|
||||
cargo install --locked 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: 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="${{ runner.temp }}\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 }} \
|
||||
# EOF
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::Build"
|
||||
cmake --build . --target openttd
|
||||
echo "::endgroup::"
|
||||
env:
|
||||
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
|
||||
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
|
||||
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
|
||||
AZURE_CODESIGN_ACCOUNT_NAME: ${{ secrets.AZURE_CODESIGN_ACCOUNT_NAME }}
|
||||
AZURE_CODESIGN_ENDPOINT: ${{ secrets.AZURE_CODESIGN_ENDPOINT }}
|
||||
AZURE_CODESIGN_PROFILE_NAME: ${{ secrets.AZURE_CODESIGN_PROFILE_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="${{ runner.temp }}\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"
|
||||
cmake --build . --target openttd
|
||||
echo "::endgroup::"
|
||||
env:
|
||||
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
|
||||
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
|
||||
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
|
||||
AZURE_CODESIGN_ACCOUNT_NAME: ${{ secrets.AZURE_CODESIGN_ACCOUNT_NAME }}
|
||||
AZURE_CODESIGN_ENDPOINT: ${{ secrets.AZURE_CODESIGN_ENDPOINT }}
|
||||
AZURE_CODESIGN_PROFILE_NAME: ${{ secrets.AZURE_CODESIGN_PROFILE_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
|
||||
run: |
|
||||
${GITHUB_WORKSPACE}/os/windows/sign.bat "${GITHUB_WORKSPACE}/build/bundles"
|
||||
env:
|
||||
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
|
||||
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
|
||||
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
|
||||
AZURE_CODESIGN_ACCOUNT_NAME: ${{ secrets.AZURE_CODESIGN_ACCOUNT_NAME }}
|
||||
AZURE_CODESIGN_ENDPOINT: ${{ secrets.AZURE_CODESIGN_ENDPOINT }}
|
||||
AZURE_CODESIGN_PROFILE_NAME: ${{ secrets.AZURE_CODESIGN_PROFILE_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
|
155
.github/workflows/release.yml
vendored
155
.github/workflows/release.yml
vendored
@@ -1,155 +0,0 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
ref:
|
||||
description: 'Ref to build (for Pull Requests, use refs/pull/NNN/head)'
|
||||
required: true
|
||||
repository_dispatch:
|
||||
# client_payload should be the same as the inputs for workflow_dispatch.
|
||||
types:
|
||||
- Build*
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
|
||||
jobs:
|
||||
source:
|
||||
name: Source
|
||||
|
||||
uses: ./.github/workflows/release-source.yml
|
||||
secrets: inherit
|
||||
|
||||
docs:
|
||||
name: Docs
|
||||
needs: source
|
||||
|
||||
uses: ./.github/workflows/release-docs.yml
|
||||
secrets: inherit
|
||||
|
||||
with:
|
||||
version: ${{ needs.source.outputs.version }}
|
||||
|
||||
linux:
|
||||
name: Linux (Generic)
|
||||
needs: source
|
||||
|
||||
uses: ./.github/workflows/release-linux.yml
|
||||
secrets: inherit
|
||||
|
||||
with:
|
||||
survey_key: ${{ needs.source.outputs.survey_key }}
|
||||
|
||||
macos:
|
||||
name: MacOS
|
||||
needs: source
|
||||
|
||||
uses: ./.github/workflows/release-macos.yml
|
||||
secrets: inherit
|
||||
|
||||
with:
|
||||
survey_key: ${{ needs.source.outputs.survey_key }}
|
||||
|
||||
windows:
|
||||
name: Windows
|
||||
needs: source
|
||||
|
||||
uses: ./.github/workflows/release-windows.yml
|
||||
secrets: inherit
|
||||
|
||||
with:
|
||||
is_tag: ${{ needs.source.outputs.is_tag }}
|
||||
survey_key: ${{ needs.source.outputs.survey_key }}
|
||||
|
||||
windows-store:
|
||||
name: Windows Store
|
||||
needs:
|
||||
- source
|
||||
- windows
|
||||
|
||||
if: needs.source.outputs.is_tag == 'true'
|
||||
|
||||
uses: ./.github/workflows/release-windows-store.yml
|
||||
secrets: inherit
|
||||
|
||||
with:
|
||||
version: ${{ needs.source.outputs.version }}
|
||||
|
||||
upload:
|
||||
name: Upload
|
||||
needs:
|
||||
- source
|
||||
- docs
|
||||
- linux
|
||||
- macos
|
||||
- windows
|
||||
- windows-store
|
||||
|
||||
# As windows-store is condition, we need to check ourselves if we need to run.
|
||||
# The always() makes sure the rest is always evaluated.
|
||||
if: always() && needs.source.result == 'success' && needs.docs.result == 'success' && needs.linux.result == 'success' && needs.macos.result == 'success' && needs.windows.result == 'success' && (needs.windows-store.result == 'success' || needs.windows-store.result == 'skipped')
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# This job is empty, but ensures no upload job starts before all targets finished and are successful.
|
||||
steps:
|
||||
- name: Build completed
|
||||
run: |
|
||||
true
|
||||
|
||||
upload-cdn:
|
||||
name: Upload (CDN)
|
||||
needs:
|
||||
- source
|
||||
- upload
|
||||
|
||||
# As windows-store is condition, we need to check ourselves if we need to run.
|
||||
# The always() makes sure the rest is always evaluated.
|
||||
# Yes, you even need to do this if you yourself don't depend on the condition.
|
||||
if: always() && needs.source.result == 'success' && needs.upload.result == 'success'
|
||||
|
||||
uses: ./.github/workflows/upload-cdn.yml
|
||||
secrets: inherit
|
||||
|
||||
with:
|
||||
version: ${{ needs.source.outputs.version }}
|
||||
folder: ${{ needs.source.outputs.folder }}
|
||||
trigger_type: ${{ needs.source.outputs.trigger_type }}
|
||||
|
||||
upload-steam:
|
||||
name: Upload (Steam)
|
||||
needs:
|
||||
- source
|
||||
- upload
|
||||
|
||||
# As windows-store is condition, we need to check ourselves if we need to run.
|
||||
# The always() makes sure the rest is always evaluated.
|
||||
# Yes, you even need to do this if you yourself don't depend on the condition.
|
||||
# Additionally, only nightlies and releases go to Steam; not PRs.
|
||||
if: always() && needs.source.result == 'success' && needs.upload.result == 'success' && (needs.source.outputs.trigger_type == 'new-master' || needs.source.outputs.trigger_type == 'new-tag')
|
||||
|
||||
uses: ./.github/workflows/upload-steam.yml
|
||||
secrets: inherit
|
||||
|
||||
with:
|
||||
version: ${{ needs.source.outputs.version }}
|
||||
trigger_type: ${{ needs.source.outputs.trigger_type }}
|
||||
|
||||
upload-gog:
|
||||
name: Upload (GOG)
|
||||
needs:
|
||||
- source
|
||||
- upload
|
||||
|
||||
# As windows-store is condition, we need to check ourselves if we need to run.
|
||||
# The always() makes sure the rest is always evaluated.
|
||||
# Yes, you even need to do this if you yourself don't depend on the condition.
|
||||
# Additionally, only releases go to GOG; not nightlies or PRs.
|
||||
if: always() && needs.source.result == 'success' && needs.upload.result == 'success' && needs.source.outputs.trigger_type == 'new-tag'
|
||||
|
||||
uses: ./.github/workflows/upload-gog.yml
|
||||
secrets: inherit
|
||||
|
||||
with:
|
||||
version: ${{ needs.source.outputs.version }}
|
@@ -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
|
22
.github/workflows/unused-strings.yml
vendored
22
.github/workflows/unused-strings.yml
vendored
@@ -1,22 +0,0 @@
|
||||
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
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check for unused strings
|
||||
run: |
|
||||
set -ex
|
||||
python3 .github/unused-strings.py
|
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 }}
|
||||
installation_retrieval_mode: "repository"
|
||||
installation_retrieval_payload: "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 }}"}'
|
152
.github/workflows/upload-gog.yml
vendored
152
.github/workflows/upload-gog.yml
vendored
@@ -1,152 +0,0 @@
|
||||
name: Upload (GOG)
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
version:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
upload:
|
||||
name: Upload (GOG)
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
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
|
||||
tar xf opengfx-*.tar
|
||||
echo "::endgroup::"
|
||||
|
||||
rm -f opengfx-all.zip opengfx-*.tar
|
||||
|
||||
- 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 OpenMSX"
|
||||
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-latest
|
||||
|
||||
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::"
|
||||
)
|
8
.gitignore
vendored
8
.gitignore
vendored
@@ -1,8 +0,0 @@
|
||||
/.vs
|
||||
/build*
|
||||
CMakeSettings.json
|
||||
docs/aidocs/*
|
||||
docs/gamedocs/*
|
||||
docs/source/*
|
||||
/out
|
||||
/vcpkg_installed
|
12
BUGS
Normal file
12
BUGS
Normal file
@@ -0,0 +1,12 @@
|
||||
/* $Id$ */
|
||||
|
||||
KNOWN BUGS / PROBLEMS:
|
||||
|
||||
bridges:
|
||||
- Clearing tiles which may not have a bridge above can cause random bridge pieces to appear, which leads to crash in the long run
|
||||
|
||||
electrified rails:
|
||||
Normal and elrail depots look the same. Use 'X' (transparent buildings)
|
||||
to distinguish between them
|
||||
Missing curors / icons for construction (currently using the conventional ones)
|
||||
|
467
CMakeLists.txt
467
CMakeLists.txt
@@ -1,467 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
|
||||
if(NOT BINARY_NAME)
|
||||
set(BINARY_NAME openttd)
|
||||
endif()
|
||||
|
||||
project(${BINARY_NAME}
|
||||
VERSION 15.0
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
|
||||
message(FATAL_ERROR "In-source builds not allowed. Please run \"cmake ..\" from the build directory. You may need to delete \"${CMAKE_SOURCE_DIR}/CMakeCache.txt\" first.")
|
||||
endif()
|
||||
|
||||
# Debug mode by default.
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
endif()
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/os/emscripten/cmake")
|
||||
endif()
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)
|
||||
|
||||
# Use GNUInstallDirs to allow customisation
|
||||
# but set our own default data and bin dir
|
||||
if(NOT CMAKE_INSTALL_DATADIR)
|
||||
set(CMAKE_INSTALL_DATADIR "share/games")
|
||||
endif()
|
||||
if(NOT CMAKE_INSTALL_BINDIR)
|
||||
set(CMAKE_INSTALL_BINDIR "games")
|
||||
endif()
|
||||
include(GNUInstallDirs)
|
||||
|
||||
include(Options)
|
||||
set_options()
|
||||
set_directory_options()
|
||||
|
||||
include(Static)
|
||||
set_static_if_needed()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
||||
set(CMAKE_CXX_EXTENSIONS NO)
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS YES)
|
||||
|
||||
# An empty target for the tools
|
||||
add_custom_target(tools)
|
||||
|
||||
include(CompileFlags)
|
||||
compile_flags()
|
||||
|
||||
if(APPLE OR UNIX)
|
||||
add_definitions(-DUNIX)
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(Doxygen)
|
||||
endif()
|
||||
|
||||
list(APPEND GENERATED_SOURCE_FILES "${CMAKE_BINARY_DIR}/generated/rev.cpp")
|
||||
if(WIN32)
|
||||
list(APPEND GENERATED_SOURCE_FILES "${CMAKE_BINARY_DIR}/generated/ottdres.rc")
|
||||
endif()
|
||||
|
||||
# Generate a target to determine version, which is execute every 'make' run
|
||||
add_custom_target(find_version
|
||||
${CMAKE_COMMAND}
|
||||
-DFIND_VERSION_BINARY_DIR=${CMAKE_BINARY_DIR}/generated
|
||||
-DCPACK_BINARY_DIR=${CMAKE_BINARY_DIR}
|
||||
-DREV_MAJOR=${PROJECT_VERSION_MAJOR}
|
||||
-DREV_MINOR=${PROJECT_VERSION_MINOR}
|
||||
-DWINDOWS=${WIN32}
|
||||
-P "${CMAKE_SOURCE_DIR}/cmake/scripts/FindVersion.cmake"
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
BYPRODUCTS ${GENERATED_SOURCE_FILES}
|
||||
)
|
||||
|
||||
# Documentation
|
||||
if(DOXYGEN_EXECUTABLE)
|
||||
add_custom_target(docs)
|
||||
add_custom_target(docs_source
|
||||
${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/docs
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMENT "Generating documentation for source"
|
||||
)
|
||||
add_dependencies(docs_source
|
||||
find_version
|
||||
)
|
||||
add_dependencies(docs
|
||||
docs_source
|
||||
)
|
||||
endif()
|
||||
|
||||
include(AddCustomXXXTimestamp)
|
||||
|
||||
if(OPTION_TOOLS_ONLY)
|
||||
if(HOST_BINARY_DIR)
|
||||
unset(HOST_BINARY_DIR CACHE)
|
||||
endif()
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/src)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
# Avoid searching for headers in Frameworks, and libraries in LIBDIR.
|
||||
set(CMAKE_FIND_FRAMEWORK LAST)
|
||||
endif()
|
||||
|
||||
# Prefer -pthread over -lpthread, which is often the better option of the two.
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD YES)
|
||||
# Make sure we have Threads available.
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
find_package(ZLIB)
|
||||
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 NO_MODULE)
|
||||
endif()
|
||||
|
||||
if(NOT OPTION_DEDICATED)
|
||||
if(WIN32)
|
||||
find_package(Xaudio2)
|
||||
else()
|
||||
find_package(Allegro)
|
||||
if(NOT APPLE)
|
||||
find_package(Freetype)
|
||||
find_package(SDL2)
|
||||
find_package(Fluidsynth)
|
||||
if(Freetype_FOUND)
|
||||
find_package(Fontconfig)
|
||||
endif()
|
||||
find_package(Harfbuzz)
|
||||
find_package(ICU OPTIONAL_COMPONENTS i18n uc)
|
||||
endif()
|
||||
endif()
|
||||
find_package(OpusFile)
|
||||
endif()
|
||||
if(APPLE)
|
||||
enable_language(OBJCXX)
|
||||
|
||||
find_package(Iconv)
|
||||
|
||||
find_library(AUDIOTOOLBOX_LIBRARY AudioToolbox)
|
||||
find_library(AUDIOUNIT_LIBRARY AudioUnit)
|
||||
find_library(COCOA_LIBRARY Cocoa)
|
||||
find_library(QUARTZCORE_LIBRARY QuartzCore)
|
||||
endif()
|
||||
|
||||
if(NOT EMSCRIPTEN AND NOT OPTION_DEDICATED)
|
||||
find_package(OpenGL COMPONENTS OpenGL)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
find_package(Editbin REQUIRED)
|
||||
endif()
|
||||
|
||||
find_package(SSE)
|
||||
|
||||
find_package(Grfcodec)
|
||||
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT IPO_FOUND)
|
||||
|
||||
show_options()
|
||||
|
||||
if(UNIX AND NOT APPLE AND NOT OPTION_DEDICATED)
|
||||
if(NOT SDL2_FOUND AND NOT ALLEGRO_FOUND)
|
||||
message(FATAL_ERROR "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)
|
||||
message(FATAL_ERROR "AudioToolbox is required for this platform")
|
||||
endif()
|
||||
if(NOT AUDIOUNIT_LIBRARY)
|
||||
message(FATAL_ERROR "AudioUnit is required for this platform")
|
||||
endif()
|
||||
if(NOT COCOA_LIBRARY)
|
||||
message(FATAL_ERROR "Cocoa is required for this platform")
|
||||
endif()
|
||||
if(NOT QUARTZCORE_LIBRARY)
|
||||
message(FATAL_ERROR "QuartzCore is required for this platform")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(OPTION_PACKAGE_DEPENDENCIES)
|
||||
if(NOT UNIX)
|
||||
message(FATAL_ERROR "Can only package dependencies on Linux")
|
||||
endif()
|
||||
if(OPTION_INSTALL_FHS)
|
||||
message(FATAL_ERROR "Cannot install in FHS folders when we are packaging dependencies")
|
||||
endif()
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.16.0")
|
||||
message(FATAL_ERROR "OPTION_PACKAGE_DEPENDENCIES can only work with CMake 3.16+; you are using ${CMAKE_VERSION}")
|
||||
endif()
|
||||
|
||||
# If we are packaging dependencies, we do two things:
|
||||
# 1) set the RPATH to include $ORIGIN/lib; $ORIGIN (that literal string)
|
||||
# is a Linux indicator for "path where application is". In CMake, we
|
||||
# have to do this before add_executable() is executed.
|
||||
# 2) copy the libraries that we compile against to the "lib" folder.
|
||||
# This is done in InstallAndPackage.cmake.
|
||||
set(CMAKE_INSTALL_RPATH "\$ORIGIN/lib")
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
|
||||
endif()
|
||||
|
||||
include(CTest)
|
||||
include(SourceList)
|
||||
|
||||
# Needed by everything that uses Squirrel
|
||||
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)
|
||||
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
|
||||
)
|
||||
set_source_files_properties(src/3rdparty/fmt/format.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
|
||||
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/bin)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/src)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/media)
|
||||
|
||||
add_dependencies(openttd
|
||||
find_version)
|
||||
|
||||
target_link_libraries(openttd_lib
|
||||
openttd::languages
|
||||
openttd::settings
|
||||
openttd::script_api
|
||||
Threads::Threads
|
||||
)
|
||||
|
||||
target_link_libraries(openttd
|
||||
openttd_lib
|
||||
openttd::media
|
||||
openttd::basesets
|
||||
)
|
||||
|
||||
target_link_libraries(openttd_test PRIVATE openttd_lib)
|
||||
if(ANDROID)
|
||||
target_link_libraries(openttd_test PRIVATE log)
|
||||
endif()
|
||||
|
||||
include(Catch)
|
||||
catch_discover_tests(openttd_test)
|
||||
|
||||
if(HAIKU)
|
||||
target_link_libraries(openttd_lib "be" "network" "midi")
|
||||
endif()
|
||||
|
||||
if(IPO_FOUND)
|
||||
set_target_properties(openttd PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE True)
|
||||
set_target_properties(openttd PROPERTIES INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL True)
|
||||
set_target_properties(openttd PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO True)
|
||||
endif()
|
||||
set_target_properties(openttd PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
|
||||
include(LinkPackage)
|
||||
link_package(PNG TARGET PNG::PNG ENCOURAGED)
|
||||
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)
|
||||
endif()
|
||||
|
||||
if(NOT OPTION_DEDICATED)
|
||||
link_package(Fluidsynth)
|
||||
link_package(SDL2 TARGET SDL2::SDL2)
|
||||
link_package(Allegro)
|
||||
link_package(FREETYPE TARGET Freetype::Freetype)
|
||||
link_package(Fontconfig TARGET Fontconfig::Fontconfig)
|
||||
link_package(Harfbuzz TARGET harfbuzz::harfbuzz)
|
||||
link_package(ICU_i18n)
|
||||
link_package(ICU_uc)
|
||||
link_package(OpusFile TARGET OpusFile::opusfile)
|
||||
|
||||
if(SDL2_FOUND AND OPENGL_FOUND AND UNIX)
|
||||
# SDL2 dynamically loads OpenGL if needed, so do not link to OpenGL when
|
||||
# on Linux. For Windows, we need to link to OpenGL as we also have a win32
|
||||
# driver using it.
|
||||
add_definitions(-DWITH_OPENGL)
|
||||
message(STATUS "OpenGL found -- -DWITH_OPENGL -- (via SDL2)")
|
||||
else()
|
||||
link_package(OpenGL TARGET OpenGL::GL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(3rdparty/llvm/CheckAtomic)
|
||||
|
||||
if(APPLE)
|
||||
link_package(Iconv TARGET Iconv::Iconv)
|
||||
|
||||
target_link_libraries(openttd_lib
|
||||
${AUDIOTOOLBOX_LIBRARY}
|
||||
${AUDIOUNIT_LIBRARY}
|
||||
${COCOA_LIBRARY}
|
||||
${QUARTZCORE_LIBRARY}
|
||||
)
|
||||
|
||||
add_definitions(
|
||||
-DWITH_COCOA
|
||||
)
|
||||
endif()
|
||||
|
||||
if(EMSCRIPTEN)
|
||||
add_library(WASM::WASM INTERFACE IMPORTED)
|
||||
|
||||
# Allow heap-growth, and start with a bigger memory size.
|
||||
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.
|
||||
target_link_libraries(WASM::WASM INTERFACE "-s EXPORTED_FUNCTIONS='[\"_main\", \"_em_openttd_add_server\"]' -s EXPORTED_RUNTIME_METHODS='[\"cwrap\"]'")
|
||||
|
||||
# Preload all the files we generate during build.
|
||||
# As we do not compile with FreeType / FontConfig, we also have no way to
|
||||
# render several languages (like Chinese, ..), so where do you draw the
|
||||
# line what languages to include and which not? In the end, especially as
|
||||
# the more languages you add the slower downloading becomes, we decided to
|
||||
# only ship the English language.
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_BINARY_DIR}/baseset@/baseset")
|
||||
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.md@/known-bugs.md")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--preload-file ${CMAKE_SOURCE_DIR}/changelog.md@/changelog.md")
|
||||
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/fonts.md@/docs/fonts.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")
|
||||
|
||||
# Use custom pre-js and shell.html.
|
||||
target_link_libraries(WASM::WASM INTERFACE "--pre-js ${CMAKE_SOURCE_DIR}/os/emscripten/pre.js")
|
||||
target_link_libraries(WASM::WASM INTERFACE "--shell-file ${CMAKE_SOURCE_DIR}/os/emscripten/shell.html")
|
||||
|
||||
# Build the .html (which builds the .js, .wasm, and .data too).
|
||||
set_target_properties(openttd PROPERTIES SUFFIX ".html")
|
||||
target_link_libraries(openttd WASM::WASM)
|
||||
endif()
|
||||
|
||||
if(NOT PERSONAL_DIR STREQUAL "(not set)")
|
||||
add_definitions(
|
||||
-DWITH_PERSONAL_DIR
|
||||
-DPERSONAL_DIR="${PERSONAL_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT SHARED_DIR STREQUAL "(not set)")
|
||||
add_definitions(
|
||||
-DWITH_SHARED_DIR
|
||||
-DSHARED_DIR="${SHARED_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT GLOBAL_DIR STREQUAL "(not set)")
|
||||
add_definitions(
|
||||
-DGLOBAL_DATA_DIR="${GLOBAL_DIR}"
|
||||
)
|
||||
endif()
|
||||
|
||||
link_package(SSE)
|
||||
|
||||
add_definitions_based_on_options()
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(
|
||||
-DUNICODE
|
||||
-D_UNICODE
|
||||
-DWITH_UNISCRIBE
|
||||
-DPSAPI_VERSION=1
|
||||
)
|
||||
|
||||
target_link_libraries(openttd_lib
|
||||
ws2_32
|
||||
winmm
|
||||
imm32
|
||||
usp10
|
||||
psapi
|
||||
winhttp
|
||||
bcrypt
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
add_definitions(-DPOINTER_IS_64BIT)
|
||||
endif()
|
||||
|
||||
enable_testing()
|
||||
|
||||
add_subdirectory(regression)
|
||||
|
||||
if(APPLE OR WIN32)
|
||||
find_package(Pandoc)
|
||||
endif()
|
||||
|
||||
include(InstallAndPackage)
|
544
CODINGSTYLE.md
544
CODINGSTYLE.md
@@ -1,544 +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).
|
||||
* Prefer using "const" for reference and compound parameters when appropriate.
|
||||
* If a member function can be a const function, make it so.
|
||||
```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.
|
||||
* Non-trivial fall throughs must be documented, using a `[[fallthrough]]` attribute.
|
||||
* 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, uint8_t 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.
|
||||
|
||||
### Code Comment Vertical Alignment
|
||||
|
||||
When adding code or comments to an existing formatted section, follow the existing style if possible without editing the preexisting lines.
|
||||
|
||||
If your addition cannot be aligned with existing code, do not align the comments with anything and use only a single space between the code and the comment.
|
||||
|
||||
Good:
|
||||
|
||||
```c++
|
||||
enum Vehicle {
|
||||
BUS, ///< Take the bus.
|
||||
+ CAR, ///< Drive your car.
|
||||
BIKE, ///< Ride your bike
|
||||
+ TRAIN, ///< Catch the train.
|
||||
}
|
||||
```
|
||||
|
||||
"Car" is shorter than Bike which allows you to easily align the new comment. "Train" is longer. It is *NOT* desirable to change the vertical comment alignment of this enum.
|
||||
|
||||
Bad:
|
||||
|
||||
```c++
|
||||
enum Vehicle {
|
||||
- BUS, ///< Take the bus.
|
||||
- BIKE, ///< Ride your bike
|
||||
+ BUS, ///< Take the bus.
|
||||
+ CAR, ///< Drive your car.
|
||||
+ BIKE, ///< Ride your bike
|
||||
+ TRAIN, ///< Catch the train.
|
||||
}
|
||||
```
|
||||
|
||||
OpenTTD used to vertically-align inline Doxygen comments as shown above. OpenTTD has since stopped strictly following this rule to keep diffs smaller and reduce pollution to the git blame history for non-functional changes.
|
||||
|
||||
### 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.
|
||||
* 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>(, (#<issue>|<commit>))*)?: ([<component>])? <details>
|
||||
```
|
||||
|
||||
Keywords can either be player-facing, NewGRF / Script author-facing, or developer-facing.
|
||||
|
||||
For player-facing changes, we have these keywords:
|
||||
* Feature: Adding a significant new functionality to the game. This can be small in code-size, but is meant for the bigger things from a player perspective.
|
||||
* Add: Similar to Feature, but for small functionalities.
|
||||
* Change: Changing existing behaviour to an extent the player needs to know about it.
|
||||
* Fix: Fixing an issue with the game (as seen by the player).
|
||||
* Remove: Completely removing a functionality.
|
||||
* Revert: Reverting an earlier Feature / Add / Change / Fix / Remove.
|
||||
* Doc: Update to (player-facing) documentation, like in the `docs/` folder etc.
|
||||
* Update: Translator commits.
|
||||
|
||||
For NewGRF / Script author-facing changes, we use the same keywords as player-facing changes, followed by `[NewGRF]` / `[Script]` component.
|
||||
This also means the commit is aimed (and worded) towards the NewGRF / Script authors, rather than players.
|
||||
|
||||
For developer-facing changes, we have these keywords:
|
||||
* Codechange: Changes to the code the player is not going to notice. Refactors, modernization, etc.
|
||||
* Cleanup: Similar to Codechange, but when it is more about removing old code, rather than an actual change.
|
||||
* Codefix: Fixing problems in earlier commits that the player is not actually going to notice. Wrong comments, missing files, CI changes.
|
||||
|
||||
If you commit a `Fix` for an [issue](https://github.com/OpenTTD/OpenTTD/issues), add the corresponding issue number in the form of #NNNNN.
|
||||
|
||||
In the case of `Fix`es, if you know the hash of the commit in which the bug was introduced (eg regression), please mention that hash (the first 7 characters) as well just after the keyword (or, if present, after the issue number).
|
||||
Finding the trouble-causing commit is highly encouraged as it makes backporting / branching / releases that much easier.
|
||||
|
||||
Do not mention two keywords; if two apply, pick one that best represents the commit (for example, "Fix #123" is mostly always better than "Revert", even if both are true).
|
||||
|
||||
The `<details>` part starts with a capital and does not end with a dot.
|
||||
Try to be descriptive to what the player will notice, not to what is actually being changed in the code.
|
||||
See `changelog.md` for inspiration.
|
||||
|
||||
To further structure the changelog, you can add components. Example are:
|
||||
* "Network" for network specific changes.
|
||||
* "NewGRF" for NewGRF additions.
|
||||
* "Script" for AI / GS additions.
|
||||
* "YAPF", "NPF", for changes in these features.
|
||||
* "MacOS", "Linux", "Windows", for OS-specific changes.
|
||||
* "CI", "CMake", for changes to the (build) infrastructure.
|
||||
|
||||
Further explanations, more details, 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`
|
||||
* `Codefix 80dffae: Warning about unsigned unary minus`
|
||||
* `Fix #6673, 99bb3a9: Store the map variety setting in the savegame`
|
||||
* `Codefix #5922: ClientSizeChanged is only called via WndProcGdi which already has the mutex`
|
||||
* `Codechange #1264, #2037, #2038, #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/*
|
||||
```
|
||||
|
153
COMPILING.md
153
COMPILING.md
@@ -1,153 +0,0 @@
|
||||
# Compiling OpenTTD
|
||||
|
||||
## Required/optional libraries
|
||||
|
||||
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:
|
||||
|
||||
- (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.
|
||||
|
||||
## Windows
|
||||
|
||||
You need Microsoft Visual Studio 2022 or more recent.
|
||||
|
||||
You can download the free Visual Studio Community Edition from Microsoft at
|
||||
https://visualstudio.microsoft.com/vs/community/.
|
||||
|
||||
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).
|
||||
|
||||
Install the SDK by following the instructions as given.
|
||||
|
||||
Dependencies for OpenTTD on Windows are handled via
|
||||
[vcpkg](https://github.com/Microsoft/vcpkg/). First you need to install vcpkg
|
||||
by following the `Quick Start` instructions of their
|
||||
[README](https://github.com/Microsoft/vcpkg/blob/master/README.md).
|
||||
|
||||
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
|
||||
- zlib
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
You can open the folder (as a CMake project). CMake will be detected, and you can compile from there.
|
||||
If libraries are installed but not found, you need to set VCPKG_TARGET_TRIPLET in CMake parameters.
|
||||
For Visual Studio 2022 you also need to set CMAKE_TOOLCHAIN_FILE.
|
||||
(Typical values are shown in the MSVC project file command line example)
|
||||
|
||||
Alternatively, you can create a MSVC project file via CMake. For this
|
||||
either download CMake from https://cmake.org/download/ or use the version
|
||||
that comes with vcpkg. After that, you can run something similar to this:
|
||||
|
||||
```powershell
|
||||
mkdir build
|
||||
cd build
|
||||
cmake.exe .. -G"Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="<location of vcpkg>\vcpkg\scripts\buildsystems\vcpkg.cmake" -DVCPKG_TARGET_TRIPLET="x64-windows-static"
|
||||
```
|
||||
|
||||
Change `<location of vcpkg>` to where you have installed vcpkg. After this
|
||||
in the build folder are MSVC project files. MSVC can rebuild the project
|
||||
files himself via the `ZERO_CHECK` project.
|
||||
|
||||
## All other platforms
|
||||
Minimum required version of CMake is 3.16.
|
||||
By default this produces a Debug build with assertations enabled.
|
||||
This is a far slower build than release builds.
|
||||
|
||||
```bash
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
```
|
||||
|
||||
For more information on how to use CMake (including how to make Release builds),
|
||||
we urge you to read [their excellent manual](https://cmake.org/cmake/help/latest/guide/user-interaction/index.html).
|
||||
|
||||
## CMake Options
|
||||
|
||||
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
|
||||
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.
|
||||
- `-DOPTION_USE_ASSERTS=OFF`: disable asserts. Use with care, as assert
|
||||
statements capture early signs of trouble. Release builds have them
|
||||
disabled by default.
|
||||
- `-DOPTION_TOOLS_ONLY=ON`: only build tools like `strgen`. Does not build
|
||||
the game itself. Useful for cross-compiling.
|
||||
|
||||
## Supported compilers
|
||||
|
||||
Every compiler that is supported by CMake and supports C++20, should be
|
||||
able to compile OpenTTD. As the exact list of compilers changes constantly,
|
||||
we refer to the compiler manual to see if it supports C++20, and to CMake
|
||||
to see if it supports your compiler.
|
||||
|
||||
## Compilation of base sets
|
||||
|
||||
To recompile the extra graphics needed to play with the original Transport
|
||||
Tycoon Deluxe graphics you need GRFCodec (which includes NFORenum) as well.
|
||||
GRFCodec can be found at
|
||||
https://www.openttd.org/downloads/grfcodec-releases/latest.html.
|
||||
|
||||
Having GRFCodec installed can cause regeneration of the `.grf` files, which
|
||||
are written in the source directory. This can leave your repository in a
|
||||
modified state, as different GRFCodec versions can cause binary differences
|
||||
in the resulting `.grf` files. Also translations might have been added for
|
||||
the base sets which are not yet included in the base set information files.
|
||||
To avoid this behaviour, disable GRFCodec (and NFORenum) in CMake cache
|
||||
(`GRFCODEC_EXECUTABLE` and `NFORENUM_EXECUTABLE`).
|
||||
|
||||
## Developers settings
|
||||
|
||||
You can control some flags directly via `CXXFLAGS` (any combination
|
||||
of these flags will work fine too):
|
||||
|
||||
- `-DRANDOM_DEBUG`: this helps with debugging desyncs.
|
||||
- `-fno-inline`: this avoids creating inline functions; this can make
|
||||
debugging a lot easier.
|
||||
- `-O0`: this disables all optimizations; this can make debugging a
|
||||
lot easier.
|
||||
- `-p`: this enables profiling.
|
||||
|
||||
Always use a clean buildfolder if you changing `CXXFLAGS`, as this
|
||||
value is otherwise cached. Example use:
|
||||
|
||||
`CXXFLAGS="-fno-inline" cmake ..`
|
279
CONTRIBUTING.md
279
CONTRIBUTING.md
@@ -1,279 +0,0 @@
|
||||
|
||||
# Contributing to OpenTTD
|
||||
|
||||
Looking to contribute something to OpenTTD? **Here's how you can help.**
|
||||
|
||||
Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved.
|
||||
|
||||
Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project.
|
||||
In return, they should reciprocate that respect in addressing your issue or assessing patches and features.
|
||||
|
||||
|
||||
## Using the issue tracker
|
||||
|
||||
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 **do not** derail or troll issues. Keep the discussion on topic and respect the opinions of others.
|
||||
|
||||
* Please **do not** post comments consisting solely of "+1" or ":thumbsup:".
|
||||
Use [GitHub's "reactions" feature](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments) instead.
|
||||
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.
|
||||
|
||||
* Please use [the web translator](https://translator.openttd.org/) to submit corrections and improvements to translations of the game.
|
||||
|
||||
|
||||
## Bug reports
|
||||
|
||||
A bug is a _demonstrable problem_ that is caused by the code in the repository.
|
||||
Good bug reports are extremely helpful, so thanks!
|
||||
|
||||
Guidelines for bug reports:
|
||||
|
||||
0. Please don't report issues with games where you changed NewGRFs mid-game. (This can be verified with the `gamelog` console command in-game.)
|
||||
|
||||
1. Please don't report issues with modified versions of OpenTTD (patchpacks, unofficial ports, and similar).
|
||||
|
||||
2. **Use the GitHub issue search** — check if the issue has already been
|
||||
reported.
|
||||
|
||||
3. **Check if the issue has been fixed** — try to reproduce it using the latest `nightly` build of OpenTTD, available from https://www.openttd.org
|
||||
|
||||
4. **Isolate the problem** — ideally create reproducible steps with an attached savegame and screenshots. Try to use few or no NewGRFs, AIs etc if possible.
|
||||
|
||||
A good bug report shouldn't leave others needing to chase you up for more information.
|
||||
Please try to be as detailed as possible in your report.
|
||||
|
||||
* What is your environment?
|
||||
* What steps will reproduce the issue?
|
||||
* Which operating system(s) experience the problem?
|
||||
* What would you expect to be the outcome?
|
||||
|
||||
All these details will help people to fix any potential bugs.
|
||||
|
||||
Example:
|
||||
|
||||
> Short and descriptive example bug report title
|
||||
>
|
||||
> A summary of the issue and the OS environment in which it occurs. If
|
||||
> suitable, include the steps required to reproduce the bug.
|
||||
>
|
||||
> 1. This is the first step
|
||||
> 2. This is the second step
|
||||
> 3. Further steps, etc.
|
||||
>
|
||||
> Attached savegame
|
||||
> Attached screenshots showing the issue
|
||||
> Crashlogs if the bug causes a crash
|
||||
>
|
||||
> Any other information you want to share that is relevant to the issue being
|
||||
> reported. This might include the lines of code that you have identified as
|
||||
> causing the bug, and potential solutions (and your opinions on their
|
||||
> merits).
|
||||
|
||||
|
||||
## Feature requests
|
||||
|
||||
Before opening a feature request, please take a moment to find out whether your idea fits with the [scope and goals](./CONTRIBUTING.md#project-goals) of the project.
|
||||
|
||||
It's up to *you* to make a strong case to convince the project's developers of the merits of this feature.
|
||||
|
||||
Please provide as much detail and context as possible.
|
||||
This means don't request for a solution, but describe the problem you see and how/why you think it should be fixed.
|
||||
|
||||
For feature request we have a strict policy.
|
||||
|
||||
Keeping issues around with "a good idea" or "not really a bug but we should maybe fix it" turns out to have the reversed effect: nobody looks at it anymore.
|
||||
|
||||
Although we really appreciate feedback and ideas, we will close feature requests that we don't expect to fulfill in the next year.
|
||||
|
||||
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. :)
|
||||
|
||||
|
||||
## Pull requests
|
||||
|
||||
Good pull requests—patches, improvements, new features—are a fantastic help.
|
||||
|
||||
Pull requests should fit with the [goals of the project](./CONTRIBUTING.md#project-goals).
|
||||
|
||||
**Please do ask first** before embarking on any significant pull request (e.g. implementing features, refactoring code, porting to a different language), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project.
|
||||
|
||||
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).
|
||||
|
||||
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:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/<your-username>/OpenTTD.git openttd
|
||||
git clone https://github.com/OpenTTD/OpenTTD-git-hooks.git openttd_hooks
|
||||
cd openttd
|
||||
git remote add upstream https://github.com/OpenTTD/OpenTTD.git
|
||||
cd .git/hooks
|
||||
ln -s ../../../openttd_hooks/hooks/* .
|
||||
```
|
||||
|
||||
2. If you cloned a while ago, get the latest changes from upstream:
|
||||
|
||||
```bash
|
||||
git fetch upstream
|
||||
```
|
||||
|
||||
3. Create a new topic branch (off the main project development branch) to
|
||||
contain your feature, change, or fix:
|
||||
|
||||
```bash
|
||||
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.
|
||||
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:
|
||||
|
||||
```bash
|
||||
git fetch upstream
|
||||
git rebase upstream/master
|
||||
```
|
||||
|
||||
6. Push your topic branch up to your fork the first time:
|
||||
|
||||
```bash
|
||||
git push --set-upstream origin <topic-branch-name>
|
||||
```
|
||||
|
||||
And any time after that:
|
||||
|
||||
```bash
|
||||
git push
|
||||
```
|
||||
|
||||
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) with a clear title and description against the `master` branch.
|
||||
|
||||
**IMPORTANT**: By submitting a pull request or patch, you agree to the [License](#license) and the [Privacy Notice](CONTRIBUTING.md#privacy-notice).
|
||||
|
||||
|
||||
### Pull request validation
|
||||
|
||||
Continuous integration (CI) tools monitor pull requests, and help us identify build and code quality issues.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
### Are there any development docs?
|
||||
|
||||
There is no single source for OpenTTD development docs. It's a complex project with a long history, and multiple APIs.
|
||||
|
||||
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).
|
||||
|
||||
|
||||
## Project goals
|
||||
|
||||
### What are the goals of the official branch?
|
||||
|
||||
The main goals of the official branch are:
|
||||
|
||||
- Stay faithful to the original gameplay from Transport Tycoon Deluxe
|
||||
- Improve the user interface
|
||||
- Allow extending the gameplay with add-ons / mods via supported content APIs
|
||||
- Provide a (relatively) stable core for both players of the official branch, and for authors of add-ons and maintainers of patchpacks
|
||||
|
||||
In contrast, extending or altering the gameplay of the base game is not encouraged.
|
||||
|
||||
The rationale behind these goals is that people have different opinions about what OpenTTD is and what it should be.
|
||||
When it comes to gameplay, there are at least these groups of people:
|
||||
|
||||
- *Model railway (mostly singleplayer)*: build "realistic" landscapes, roleplay a world, or even replicate historical scenarios
|
||||
- *Economical challenge (mostly singleplayer)*: run a business with economical challenges
|
||||
- *Transport challenge (singleplayer or cooperative multiplayer)*: build efficient track layouts with high cargo throughput and tons of vehicles
|
||||
- *Competitive speed run (competitive multiplayer)*: maximize some goal in some limited amount of time
|
||||
|
||||
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.
|
||||
|
||||
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".
|
||||
|
||||
The preferred method to introduce new gameplay features is to extend the content APIs, supporting ever more add-on content / mods.
|
||||
|
||||
This moves conflict-solving away from the codebase to content authors / players.
|
||||
It is more accepted for add-ons not working together than the base game not working with certain setting combinations.
|
||||
|
||||
In general the game should allow anything that doesn't violate basic rules, but it should warn players if they take potentially dangerous or "stupid" actions.
|
||||
|
||||
For example, players are not prevented from starting vehicles without orders, but will receive a warning about vehicles having too few orders.
|
||||
This lack of limitation has led to players challenging themselves to create networks where all vehicles have no orders, increasing gameplay possibilities.
|
||||
|
||||
### I do not agree with the goals of the official branch, what can I do instead?
|
||||
|
||||
Fork! There is a rich history of experimental patches for OpenTTD.
|
||||
|
||||
Many of these will never be accepted for core, but are creative and interesting ways to modify OpenTTD.
|
||||
|
||||
Sometimes patches are combined into long-running patchpacks, modified OpenTTD versions which can be downloaded by anyone, or modified OpenTTD clients for dedicated multiplayer servers.
|
||||
|
||||
One of the reasons to keep core relatively stable is to make life easier for patch authors and patchpack maintainers where possible.
|
||||
|
||||
Patchpack discussions and related topics may be found in community sites such as [TT-Forums development section](https://www.tt-forums.net/viewforum.php?f=33).
|
||||
|
||||
|
||||
## Legal stuff
|
||||
|
||||
### License
|
||||
|
||||
By contributing your code, you agree to license your contribution under the [GPL v2](https://github.com/OpenTTD/OpenTTD/blob/master/COPYING.md).
|
||||
|
||||
|
||||
### Privacy Notice
|
||||
|
||||
We would like to make you aware that contributing to OpenTTD via git will permanently store the name and email address you provide as well as the actual changes and the time and date you made it inside git's version history.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
If you would not like to accept this risk, please do either commit anonymously or refrain from contributing to the OpenTTD project.
|
||||
|
||||
|
||||
### Attribution of this Contributing Guide
|
||||
|
||||
This contributing guide is adapted from [Bootstrap](https://github.com/twbs/bootstrap/blob/main/.github/CONTRIBUTING.md) under the [Creative Commons Attribution 3.0 Unported License](https://creativecommons.org/licenses/by/3.0/) terms for Bootstrap documentation.
|
||||
The GDPR notice is adapted from [rsyslog](https://github.com/rsyslog/rsyslog/blob/master/CONTRIBUTING.md) under the [GNU General Public License](https://github.com/rsyslog/rsyslog/blob/master/COPYING).
|
@@ -1,19 +1,14 @@
|
||||
This is the license which applies to OpenTTD with the exception of some
|
||||
3rd party modules. See [our readme](./README.md) for details
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
GNU General Public License
|
||||
==========================
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
_Version 2, June 1991_
|
||||
_Copyright © 1989, 1991 Free Software Foundation, Inc.,_
|
||||
_51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA_
|
||||
Preamble
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
### Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
@@ -23,47 +18,48 @@ using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: **(1)** copyright the software, and
|
||||
**(2)** offer you this license which gives you legal permission to copy,
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
### TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
**0.** This License applies to any program or other work which contains
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
@@ -80,7 +76,7 @@ is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
**1.** You may copy and distribute verbatim copies of the Program's
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
@@ -91,27 +87,29 @@ along with the Program.
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
**2.** You may modify your copy or copies of the Program or any portion
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
* **a)** You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
* **b)** You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
* **c)** If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
@@ -133,24 +131,26 @@ with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
**3.** You may copy and distribute the Program (or a work based on it,
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
* **a)** Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
* **b)** Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
* **c)** Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
@@ -169,7 +169,7 @@ access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
**4.** You may not copy, modify, sublicense, or distribute the Program
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
@@ -177,7 +177,7 @@ However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
**5.** You are not required to accept this License, since you have not
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
@@ -186,7 +186,7 @@ Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
**6.** Each time you redistribute the Program (or any work based on the
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
@@ -194,7 +194,7 @@ restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
**7.** If, as a consequence of a court judgment or allegation of patent
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
@@ -226,7 +226,7 @@ impose that choice.
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
**8.** If the distribution and/or use of the Program is restricted in
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
@@ -234,7 +234,7 @@ those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
**9.** The Free Software Foundation may publish revised and/or new versions
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
@@ -247,7 +247,7 @@ Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
**10.** If you wish to incorporate parts of the Program into other free
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
@@ -255,9 +255,9 @@ make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
### NO WARRANTY
|
||||
NO WARRANTY
|
||||
|
||||
**11.** BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
@@ -267,7 +267,7 @@ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
**12.** IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
@@ -277,15 +277,15 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
### How to Apply These Terms to Your New Programs
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
@@ -317,20 +317,20 @@ when it starts in an interactive mode:
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w` and `show c` should show the appropriate
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w` and `show c`; they could even be
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
@@ -1,12 +0,0 @@
|
||||
# Make the current version available to CPack
|
||||
set(CPACK_PACKAGE_VERSION "@REV_VERSION@")
|
||||
|
||||
# Name the output file with the correct version
|
||||
string(REPLACE "#CPACK_PACKAGE_VERSION#" "@REV_VERSION@" CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}")
|
||||
|
||||
if (CPACK_BUNDLE_PLIST_SOURCE)
|
||||
# Rewrite the Info.plist.in to contain the correct version
|
||||
file(READ ${CPACK_BUNDLE_PLIST_SOURCE} INFO_PLIST_CONTENT)
|
||||
string(REPLACE "#CPACK_PACKAGE_VERSION#" "@REV_VERSION@" INFO_PLIST_CONTENT "${INFO_PLIST_CONTENT}")
|
||||
file(WRITE ${CPACK_BUNDLE_PLIST} "${INFO_PLIST_CONTENT}")
|
||||
endif (CPACK_BUNDLE_PLIST_SOURCE)
|
64
CREDITS.md
64
CREDITS.md
@@ -1,64 +0,0 @@
|
||||
### The OpenTTD team (in alphabetical order):
|
||||
|
||||
- Matthijs Kooijman (blathijs) - Pathfinder-guru, Debian port (since 0.3)
|
||||
- Christoph Elsenhans (frosch) - General coding (since 0.6)
|
||||
- Loïc Guilloux (glx) - General / Windows Expert (since 0.4.5)
|
||||
- Koen Bussemaker (Kuhnovic) - General / Ship pathfinder (since 14)
|
||||
- Charles Pigott (LordAro) - General / Correctness police (since 1.9)
|
||||
- Michael Lutz (michi_cc) - General / 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 / Time Lord (since 13)
|
||||
- Richard Wheeler (zephyris) - Precision pixel production (since 15)
|
||||
|
||||
### 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)
|
||||
- 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)
|
||||
- Thijs Marinussen (Yexo) - AI Framework, General (0.6 - 1.3)
|
||||
- Leif Linse (Zuu) - AI/Game Script (1.2 - 1.6)
|
||||
|
||||
### Retired Developers:
|
||||
|
||||
- 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)
|
||||
- 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)
|
||||
- Benedikt Brüggemeier (skidd13) - Bug fixer and code reworker (0.6 - 0.7)
|
||||
- Serge Paquet (vurlix) - 2nd contributor after ludde (0.1 - 0.3)
|
||||
|
||||
### Thanks to:
|
||||
|
||||
- Josef Drexler - For his great work on TTDPatch.
|
||||
- Marcin Grzegorczyk - For his TTDPatch work and documentation of Transport Tycoon Deluxe internals and track foundations
|
||||
- Stefan Meißner (sign_de) - For his work on the console
|
||||
- Mike Ragsdale - OpenTTD installer
|
||||
- Christian Rosentreter (tokai) - MorphOS / AmigaOS port
|
||||
- Richard Kempton (RichK67) - Additional airports, initial TGP implementation
|
||||
- Alberto Demichelis - Squirrel scripting language
|
||||
- L. Peter Deutsch - MD5 implementation
|
||||
- Michael Blunck - For revolutionizing TTD with awesome graphics
|
||||
- George - Canal/Lock 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!
|
@@ -1,22 +1,9 @@
|
||||
# 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/>.
|
||||
|
||||
# Doxyfile 1.9.4
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = "OpenTTD Source"
|
||||
PROJECT_NUMBER = ${REV_VERSION}
|
||||
PROJECT_BRIEF =
|
||||
PROJECT_LOGO =
|
||||
OUTPUT_DIRECTORY = ${CPACK_BINARY_DIR}/docs/source/
|
||||
CREATE_SUBDIRS = YES
|
||||
CREATE_SUBDIRS_LEVEL = 8
|
||||
ALLOW_UNICODE_NAMES = NO
|
||||
PROJECT_NAME = openttd
|
||||
OUTPUT_DIRECTORY = docs/source/
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
@@ -38,47 +25,23 @@ STRIP_FROM_PATH = ./
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
JAVADOC_BANNER = NO
|
||||
QT_AUTOBRIEF = NO
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
PYTHON_DOCSTRING = YES
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
TAB_SIZE = 2
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
OPTIMIZE_FOR_FORTRAN = NO
|
||||
OPTIMIZE_OUTPUT_VHDL = NO
|
||||
OPTIMIZE_OUTPUT_SLICE = NO
|
||||
EXTENSION_MAPPING =
|
||||
MARKDOWN_SUPPORT = YES
|
||||
TOC_INCLUDE_HEADINGS = 0
|
||||
AUTOLINK_SUPPORT = YES
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
CPP_CLI_SUPPORT = NO
|
||||
SIP_SUPPORT = NO
|
||||
IDL_PROPERTY_SUPPORT = YES
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
GROUP_NESTED_COMPOUNDS = NO
|
||||
SUBGROUPING = YES
|
||||
INLINE_GROUPED_CLASSES = NO
|
||||
INLINE_SIMPLE_STRUCTS = NO
|
||||
TYPEDEF_HIDES_STRUCT = NO
|
||||
LOOKUP_CACHE_SIZE = 0
|
||||
NUM_PROC_THREADS = 1
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = NO
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_PRIV_VIRTUAL = NO
|
||||
EXTRACT_PACKAGE = NO
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = YES
|
||||
EXTRACT_ANON_NSPACES = YES
|
||||
RESOLVE_UNNAMED_PARAMS = YES
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
@@ -86,18 +49,11 @@ HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
HIDE_COMPOUND_REFERENCE= NO
|
||||
SHOW_HEADERFILE = YES
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
SHOW_GROUPED_MEMB_INC = NO
|
||||
FORCE_LOCAL_INCLUDES = NO
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_MEMBERS_CTORS_1ST = NO
|
||||
SORT_GROUP_NAMES = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
STRICT_PROTO_MATCHING = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
@@ -105,74 +61,58 @@ GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_FILES = YES
|
||||
SHOW_NAMESPACES = YES
|
||||
SHOW_DIRECTORIES = YES
|
||||
FILE_VERSION_FILTER =
|
||||
LAYOUT_FILE =
|
||||
CITE_BIB_FILES =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to warning and progress messages
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_IF_INCOMPLETE_DOC = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_AS_ERROR = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LINE_FORMAT = "at line $line of file $file"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the input files
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = ./src/
|
||||
INPUT_ENCODING = UTF-8
|
||||
INPUT = ./
|
||||
FILE_PATTERNS = *.c \
|
||||
*.cc \
|
||||
*.cxx \
|
||||
*.cpp \
|
||||
*.c++ \
|
||||
*.h \
|
||||
*.hpp
|
||||
*.hpp \
|
||||
table/*.h
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS = */3rdparty \
|
||||
*/script/api
|
||||
EXCLUDE_SYMBOLS =
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH = ./docs/
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
FILTER_SOURCE_PATTERNS =
|
||||
USE_MDFILE_AS_MAINPAGE =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to source browsing
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
SOURCE_TOOLTIPS = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
CLANG_ASSISTED_PARSING = NO
|
||||
CLANG_ADD_INC_PATHS = YES
|
||||
CLANG_OPTIONS =
|
||||
CLANG_DATABASE_PATH =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the alphabetical class index
|
||||
# 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
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
@@ -180,86 +120,34 @@ HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_EXTRA_STYLESHEET =
|
||||
HTML_EXTRA_FILES =
|
||||
HTML_COLORSTYLE_HUE = 220
|
||||
HTML_COLORSTYLE_SAT = 100
|
||||
HTML_COLORSTYLE_GAMMA = 80
|
||||
HTML_TIMESTAMP = NO
|
||||
HTML_DYNAMIC_MENUS = YES
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
HTML_INDEX_NUM_ENTRIES = 100
|
||||
GENERATE_DOCSET = NO
|
||||
DOCSET_FEEDNAME = "Doxygen generated docs"
|
||||
DOCSET_FEEDURL =
|
||||
DOCSET_BUNDLE_ID = org.doxygen.Project
|
||||
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
|
||||
DOCSET_PUBLISHER_NAME = Publisher
|
||||
GENERATE_HTMLHELP = NO
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = YES
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
CHM_INDEX_ENCODING =
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = YES
|
||||
GENERATE_QHP = NO
|
||||
QCH_FILE =
|
||||
QHP_NAMESPACE = org.doxygen.Project
|
||||
QHP_VIRTUAL_FOLDER = doc
|
||||
QHP_CUST_FILTER_NAME =
|
||||
QHP_CUST_FILTER_ATTRS =
|
||||
QHP_SECT_FILTER_ATTRS =
|
||||
QHG_LOCATION =
|
||||
GENERATE_ECLIPSEHELP = NO
|
||||
ECLIPSE_DOC_ID = org.doxygen.Project
|
||||
DISABLE_INDEX = NO
|
||||
GENERATE_TREEVIEW = YES
|
||||
FULL_SIDEBAR = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
EXT_LINKS_IN_WINDOW = NO
|
||||
OBFUSCATE_EMAILS = YES
|
||||
HTML_FORMULA_FORMAT = png
|
||||
FORMULA_FONTSIZE = 10
|
||||
FORMULA_TRANSPARENT = YES
|
||||
FORMULA_MACROFILE =
|
||||
USE_MATHJAX = NO
|
||||
MATHJAX_VERSION = MathJax_2
|
||||
MATHJAX_FORMAT = HTML-CSS
|
||||
MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/
|
||||
MATHJAX_EXTENSIONS =
|
||||
MATHJAX_CODEFILE =
|
||||
SEARCHENGINE = NO
|
||||
SERVER_BASED_SEARCH = NO
|
||||
EXTERNAL_SEARCH = NO
|
||||
SEARCHENGINE_URL =
|
||||
SEARCHDATA_FILE = searchdata.xml
|
||||
EXTERNAL_SEARCH_ID =
|
||||
EXTRA_SEARCH_MAPPINGS =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the LaTeX output
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = NO
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
LATEX_MAKEINDEX_CMD = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
LATEX_FOOTER =
|
||||
LATEX_EXTRA_STYLESHEET =
|
||||
LATEX_EXTRA_FILES =
|
||||
PDF_HYPERLINKS = NO
|
||||
USE_PDFLATEX = NO
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
LATEX_BIB_STYLE = plain
|
||||
LATEX_TIMESTAMP = NO
|
||||
LATEX_EMOJI_DIRECTORY =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the RTF output
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
@@ -268,31 +156,26 @@ RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the man page output
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
GENERATE_MAN = YES
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_SUBDIR =
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the XML output
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
XML_NS_MEMB_FILE_SCOPE = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the DOCBOOK output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_DOCBOOK = NO
|
||||
DOCBOOK_OUTPUT = docbook
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options for the AutoGen Definitions output
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the Perl module output
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
@@ -307,66 +190,42 @@ EXPAND_ONLY_PREDEF = YES
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED = WITH_ZLIB \
|
||||
WITH_LZO \
|
||||
WITH_LIBLZMA \
|
||||
WITH_SDL2 \
|
||||
WITH_PNG \
|
||||
WITH_FONTCONFIG \
|
||||
WITH_FREETYPE \
|
||||
WITH_HARFBUZZ \
|
||||
WITH_ICU_I18N \
|
||||
UNICODE \
|
||||
_UNICODE \
|
||||
_GNU_SOURCE \
|
||||
FINAL=
|
||||
EXPAND_AS_DEFINED =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED = DEF_COMMAND
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to external references
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE = ${CPACK_BINARY_DIR}/docs/openttd.tag
|
||||
GENERATE_TAGFILE = openttd.tag
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
EXTERNAL_PAGES = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
DIA_PATH =
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
DOT_NUM_THREADS = 0
|
||||
DOT_FONTNAME = Helvetica
|
||||
DOT_FONTSIZE = 10
|
||||
DOT_FONTPATH =
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
UML_LIMIT_NUM_FIELDS = 10
|
||||
DOT_UML_DETAILS = NO
|
||||
DOT_WRAP_THRESHOLD = 17
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DIR_GRAPH_MAX_DEPTH = 1
|
||||
DOT_IMAGE_FORMAT = png
|
||||
INTERACTIVE_SVG = NO
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MSCFILE_DIRS =
|
||||
DIAFILE_DIRS =
|
||||
PLANTUML_JAR_PATH =
|
||||
PLANTUML_CFG_FILE =
|
||||
PLANTUML_INCLUDE_PATH =
|
||||
DOT_GRAPH_MAX_NODES = 50
|
||||
MAX_DOT_GRAPH_DEPTH = 1000
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = NO
|
280
Makefile.in
Normal file
280
Makefile.in
Normal file
@@ -0,0 +1,280 @@
|
||||
# Auto-generated file -- DO NOT EDIT
|
||||
|
||||
# Check if we want to show what we are doing
|
||||
ifdef VERBOSE
|
||||
Q =
|
||||
else
|
||||
Q = @
|
||||
endif
|
||||
|
||||
include Makefile.am
|
||||
|
||||
SOURCE_LIST = !!SOURCE_LIST!!
|
||||
CONFIG_CACHE_SOURCE_LIST = !!CONFIG_CACHE_SOURCE_LIST!!
|
||||
CONFIGURE_FILES = !!CONFIGURE_FILES!!
|
||||
LIPO = !!LIPO!!
|
||||
BIN_DIR = !!BIN_DIR!!
|
||||
SRC_DIR = !!SRC_DIR!!
|
||||
ROOT_DIR = !!ROOT_DIR!!
|
||||
BUNDLE_DIR = "$(ROOT_DIR)/bundle"
|
||||
BUNDLES_DIR = "$(ROOT_DIR)/bundles"
|
||||
INSTALL_DIR = !!INSTALL_DIR!!
|
||||
INSTALL_BINARY_DIR = "$(INSTALL_DIR)/"!!BINARY_DIR!!
|
||||
INSTALL_ICON_DIR = "$(INSTALL_DIR)/"!!ICON_DIR!!
|
||||
INSTALL_DATA_DIR = "$(INSTALL_DIR)/"!!DATA_DIR!!
|
||||
INSTALL_PERSONAL_DIR = !!PERSONAL_DIR!!
|
||||
TTD = !!TTD!!
|
||||
TTDS = $(SRC_DIRS:%=%/$(TTD))
|
||||
OS = !!OS!!
|
||||
OSXAPP = !!OSXAPP!!
|
||||
REVISION = !!REVISION!!
|
||||
AWK = !!AWK!!
|
||||
DISTCC = !!DISTCC!!
|
||||
|
||||
RES := $(shell if ! [ -f $(CONFIG_CACHE_SOURCE_LIST) ] || [ -n "`cmp $(CONFIG_CACHE_SOURCE_LIST) $(SOURCE_LIST)`" ]; then cp $(SOURCE_LIST) $(CONFIG_CACHE_SOURCE_LIST); fi )
|
||||
|
||||
all: config.cache
|
||||
ifdef DISTCC
|
||||
@if [ -z "`echo '$(MFLAGS)' | grep '\-j'`" ]; then echo; echo "WARNING: you enabled distcc support, but you don't seem to be using the -jN paramter"; echo; fi
|
||||
endif
|
||||
@for dir in $(DIRS); do \
|
||||
$(MAKE) -C $$dir all; \
|
||||
done
|
||||
ifdef LIPO
|
||||
# Lipo is an OSX thing. If it is defined, it means we are building for universal,
|
||||
# and so we have have to combine the binaries into one big binary
|
||||
|
||||
# Remove the last binary made by the last compiled target
|
||||
$(Q)rm -f $(BIN_DIR)/$(TTD)
|
||||
# Make all the binaries into one
|
||||
$(Q)$(LIPO) -create -output $(BIN_DIR)/$(TTD) $(TTDS)
|
||||
endif
|
||||
|
||||
help:
|
||||
@echo "Available make commands:"
|
||||
@echo ""
|
||||
@echo "Compilation:"
|
||||
@echo " all compile the executable and the lang files"
|
||||
@echo " lang compile the lang files only"
|
||||
@echo "Clean up:"
|
||||
@echo " clean remove the files generated during compilation"
|
||||
@echo " mrproper remove the files generated during configuration and compilation"
|
||||
@echo "Run after compilation:"
|
||||
@echo " run execute openttd after the compilation"
|
||||
@echo " run-gdb execute openttd in debug mode after the compilation"
|
||||
@echo " run-prof execute openttd in profiling mode after the compilation"
|
||||
@echo "Installation:"
|
||||
@echo " install install the compiled files and the data-files after the compilation"
|
||||
@echo " bundle create the base for an installation bundle"
|
||||
@echo " bundle_zip create the zip installation bundle"
|
||||
@echo " bundle_gzip create the gzip installation bundle"
|
||||
@echo " bundle_bzip2 create the bzip2 installation bundle"
|
||||
@echo " bundle_lha create the lha installation bundle"
|
||||
@echo " bundle_dmg create the dmg installation bundle"
|
||||
|
||||
config.cache: $(CONFIG_CACHE_SOURCE_LIST) $(CONFIGURE_FILES)
|
||||
ifeq ($(shell if test -f config.cache; then echo 1; fi), 1)
|
||||
@echo "----------------"
|
||||
@echo "The system detected that source.list or any configure file is altered."
|
||||
@echo " Going to reconfigure with last known settings..."
|
||||
@echo "----------------"
|
||||
# Make sure we don't lock config.cache
|
||||
@$(shell cat config.cache) || exit 1
|
||||
@echo "----------------"
|
||||
@echo "Reconfig done. Now compiling..."
|
||||
@echo "----------------"
|
||||
else
|
||||
@echo "----------------"
|
||||
@echo "Have not found a configuration, please run configure first."
|
||||
@echo "----------------"
|
||||
@exit 1
|
||||
endif
|
||||
|
||||
clean:
|
||||
@for dir in $(DIRS); do \
|
||||
$(MAKE) -C $$dir clean; \
|
||||
done
|
||||
$(Q)rm -rf $(BUNDLE_TARGET)
|
||||
|
||||
lang:
|
||||
@for dir in $(LANG_DIRS); do \
|
||||
$(MAKE) -C $$dir all; \
|
||||
done
|
||||
|
||||
mrproper:
|
||||
@for dir in $(DIRS); do \
|
||||
$(MAKE) -C $$dir mrproper; \
|
||||
rm -f $$dir/Makefile; \
|
||||
done
|
||||
$(Q)rm -rf objs
|
||||
$(Q)rm -f Makefile Makefile.am
|
||||
$(Q)rm -f $(CONFIG_CACHE_SOURCE_LIST) config.cache config.log
|
||||
$(Q)rm -rf $(BUNDLE_DIR)
|
||||
$(Q)rm -rf $(BUNDLES_DIR)
|
||||
|
||||
depend:
|
||||
@for dir in $(SRC_DIRS); do \
|
||||
$(MAKE) -C $$dir depend; \
|
||||
done
|
||||
|
||||
run: all
|
||||
$(Q)cd !!BIN_DIR!! && ./!!TTD!! $(OPENTTD_ARGS)
|
||||
|
||||
run-gdb: all
|
||||
$(Q)cd !!BIN_DIR!! && gdb --ex run --args ./!!TTD!! $(OPENTTD_ARGS)
|
||||
|
||||
run-prof: all
|
||||
$(Q)cd !!BIN_DIR!! && ./!!TTD!! $(OPENTTD_ARGS) && gprof !!TTD!! | less
|
||||
|
||||
%.o:
|
||||
@for dir in $(SRC_DIRS); do \
|
||||
$(MAKE) -C $$dir $(@:src/%=%); \
|
||||
done
|
||||
|
||||
%.lng:
|
||||
@for dir in $(LANG_DIRS); do \
|
||||
$(MAKE) -C $$dir $@; \
|
||||
done
|
||||
|
||||
#
|
||||
# Creation of bundles
|
||||
#
|
||||
|
||||
# The revision is needed for the bundle name and creating an OSX application bundle.
|
||||
ifdef REVISION
|
||||
REV := $(REVISION)
|
||||
else
|
||||
# Are we a SVN dir?
|
||||
ifeq ($(shell if test -d $(SRC_DIR)/.svn; then echo 1; fi), 1)
|
||||
# Find if the local source if modified
|
||||
REV_MODIFIED := $(shell svnversion $(SRC_DIR) | sed -n 's/.*\(M\).*/\1/p' )
|
||||
# Find the revision like: rXXXX-branch
|
||||
REV := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^URL:.*branches/ { split($$2, a, "/"); BRANCH="-"a[5] } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }')
|
||||
endif
|
||||
endif
|
||||
# Make sure we have something in REV
|
||||
ifeq ($(REV),)
|
||||
REV := norev000
|
||||
endif
|
||||
|
||||
ifndef BUNDLE_NAME
|
||||
BUNDLE_NAME = OTTD-$(OS)-custom-$(REV)
|
||||
endif
|
||||
|
||||
# An OSX application bundle needs the data files, lang files and openttd executable in a different location.
|
||||
ifdef OSXAPP
|
||||
DATA_DIR = $(BUNDLE_DIR)/$(OSXAPP)/Contents/Resources/data
|
||||
LANG_DIR = $(BUNDLE_DIR)/$(OSXAPP)/Contents/Resources/lang
|
||||
TTD_DIR = $(BUNDLE_DIR)/$(OSXAPP)/Contents/MacOS
|
||||
else
|
||||
DATA_DIR = $(BUNDLE_DIR)/data
|
||||
LANG_DIR = $(BUNDLE_DIR)/lang
|
||||
TTD_DIR = $(BUNDLE_DIR)
|
||||
endif
|
||||
|
||||
bundle: all
|
||||
@echo '[BUNDLE] Constructing bundle'
|
||||
$(Q)rm -rf "${BUNDLE_DIR}"
|
||||
$(Q)mkdir -p "${BUNDLE_DIR}"
|
||||
$(Q)mkdir -p "$(BUNDLE_DIR)/docs"
|
||||
$(Q)mkdir -p "$(BUNDLE_DIR)/scenario"
|
||||
$(Q)mkdir -p "$(BUNDLE_DIR)/scenario/heightmap"
|
||||
$(Q)mkdir -p "$(BUNDLE_DIR)/media"
|
||||
$(Q)mkdir -p "$(TTD_DIR)"
|
||||
$(Q)mkdir -p "$(DATA_DIR)"
|
||||
$(Q)mkdir -p "$(LANG_DIR)"
|
||||
ifdef OSXAPP
|
||||
$(Q)mkdir -p "$(BUNDLE_DIR)/$(OSXAPP)/Contents/Resources"
|
||||
$(Q)echo "APPL????" > "$(BUNDLE_DIR)/$(OSXAPP)/Contents/PkgInfo"
|
||||
$(Q)cp "$(ROOT_DIR)/os/macosx/openttd.icns" "$(BUNDLE_DIR)/$(OSXAPP)/Contents/Resources/openttd.icns"
|
||||
$(Q)$(ROOT_DIR)/os/macosx/plistgen.sh "${BUNDLE_DIR}/$(OSXAPP)" "$(REV)"
|
||||
$(Q)cp "$(ROOT_DIR)/docs/OSX_install_instructions.txt" "$(BUNDLE_DIR)/docs/"
|
||||
$(Q)cp "$(ROOT_DIR)/os/macosx/splash.png" "$(DATA_DIR)"
|
||||
endif
|
||||
$(Q)cp "$(BIN_DIR)/$(TTD)" "$(TTD_DIR)/"
|
||||
$(Q)cp "$(BIN_DIR)/data/"*.grf "$(DATA_DIR)/"
|
||||
$(Q)cp "$(BIN_DIR)/data/opntitle.dat" "$(DATA_DIR)/"
|
||||
$(Q)cp "$(BIN_DIR)/lang/"*.lng "$(LANG_DIR)/"
|
||||
$(Q)cp "$(ROOT_DIR)/readme.txt" "$(BUNDLE_DIR)/"
|
||||
$(Q)cp "$(ROOT_DIR)/COPYING" "$(BUNDLE_DIR)/"
|
||||
$(Q)cp "$(ROOT_DIR)/known-bugs.txt" "$(BUNDLE_DIR)/docs/"
|
||||
$(Q)cp "$(ROOT_DIR)/docs/multiplayer.txt" "$(BUNDLE_DIR)/docs/"
|
||||
$(Q)cp "$(ROOT_DIR)/docs/32bpp.txt" "$(BUNDLE_DIR)/docs/"
|
||||
$(Q)cp "$(ROOT_DIR)/changelog.txt" "$(BUNDLE_DIR)/docs/"
|
||||
$(Q)cp "$(ROOT_DIR)/media/openttd.64.png" "$(BUNDLE_DIR)/media/"
|
||||
$(Q)cp "$(ROOT_DIR)/media/openttd.32.xpm" "$(BUNDLE_DIR)/media/"
|
||||
$(Q)cp "$(ROOT_DIR)/media/openttd.32.bmp" "$(BUNDLE_DIR)/media/"
|
||||
ifeq ($(shell if test -n "`ls -l \"$(BIN_DIR)/scenario/\"*.scn 2> /dev/null`"; then echo 1; fi), 1)
|
||||
$(Q)cp "$(BIN_DIR)/scenario/"*.scn "$(BUNDLE_DIR)/scenario/"
|
||||
endif
|
||||
ifeq ($(shell if test -n "`ls -l \"$(BIN_DIR)/scenario/heightmaps/\"* 2>/dev/null`"; then echo 1; fi), 1)
|
||||
$(Q)cp "$(BIN_DIR)/scenario/heightmaps/"* "$(BUNDLE_DIR)/scenario/heightmap/"
|
||||
endif
|
||||
ifeq ($(TTD), openttd.exe)
|
||||
$(Q)unix2dos "$(BUNDLE_DIR)/docs/"* "$(BUNDLE_DIR)/readme.txt" "$(BUNDLE_DIR)/COPYING"
|
||||
endif
|
||||
|
||||
### Packing the current bundle into several compressed file formats ###
|
||||
#
|
||||
# Zips & dmgs do not contain a root folder, i.e. they have files in the root of the zip/dmg.
|
||||
# gzip, bzip2 and lha archives have a root folder, with the same name as the bundle.
|
||||
#
|
||||
# One can supply a custom name by adding BUNDLE_NAME:=<name> to the make command.
|
||||
#
|
||||
bundle_zip: bundle
|
||||
@echo '[BUNDLE] Creating $(BUNDLE_NAME).zip'
|
||||
$(Q)mkdir -p "$(BUNDLES_DIR)"
|
||||
$(Q)cd "$(BUNDLE_DIR)" && zip -r $(shell if test -z "$(VERBOSE)"; then echo '-q'; fi) "$(BUNDLES_DIR)/$(BUNDLE_NAME).zip" .
|
||||
|
||||
bundle_gzip: bundle
|
||||
@echo '[BUNDLE] Creating $(BUNDLE_NAME).tar.gz'
|
||||
$(Q)mkdir -p "$(BUNDLES_DIR)/.gzip/$(BUNDLE_NAME)"
|
||||
$(Q)cp -R "$(BUNDLE_DIR)/"* "$(BUNDLES_DIR)/.gzip/$(BUNDLE_NAME)/"
|
||||
$(Q)cd "$(BUNDLES_DIR)/.gzip" && tar -zc$(shell if test -n "$(VERBOSE)"; then echo 'v'; fi)f "$(BUNDLES_DIR)/$(BUNDLE_NAME).tar.gz" "$(BUNDLE_NAME)"
|
||||
$(Q)rm -rf "$(BUNDLES_DIR)/.gzip"
|
||||
|
||||
bundle_bzip2: bundle
|
||||
@echo '[BUNDLE] Creating $(BUNDLE_NAME).tar.bz2'
|
||||
$(Q)mkdir -p "$(BUNDLES_DIR)/.bzip2/$(BUNDLE_NAME)"
|
||||
$(Q)cp -R "$(BUNDLE_DIR)/"* "$(BUNDLES_DIR)/.bzip2/$(BUNDLE_NAME)/"
|
||||
$(Q)cd "$(BUNDLES_DIR)/.bzip2" && tar -jc$(shell if test -n "$(VERBOSE)"; then echo 'v'; fi)f "$(BUNDLES_DIR)/$(BUNDLE_NAME).tar.bz2" "$(BUNDLE_NAME)"
|
||||
$(Q)rm -rf "$(BUNDLES_DIR)/.bzip2"
|
||||
|
||||
bundle_lha: bundle
|
||||
@echo '[BUNDLE] Creating $(BUNDLE_NAME).lha'
|
||||
$(Q)mkdir -p "$(BUNDLES_DIR)/.lha/$(BUNDLE_NAME)"
|
||||
$(Q)cp -R "$(BUNDLE_DIR)/"* "$(BUNDLES_DIR)/.lha/$(BUNDLE_NAME)/"
|
||||
$(Q)cd "$(BUNDLES_DIR)/.lha" && lha ao6 "$(BUNDLES_DIR)/$(BUNDLE_NAME).lha" "$(BUNDLE_NAME)"
|
||||
$(Q)rm -rf "$(BUNDLES_DIR)/.lha"
|
||||
|
||||
bundle_dmg: bundle
|
||||
@echo '[BUNDLE] Creating $(BUNDLE_NAME).dmg'
|
||||
$(Q)mkdir -p "$(BUNDLES_DIR)/OpenTTD $(REV)"
|
||||
$(Q)cp -R "$(BUNDLE_DIR)/" "$(BUNDLES_DIR)/OpenTTD $(REV)"
|
||||
$(Q)hdiutil create -ov -format UDZO -srcfolder "$(BUNDLES_DIR)/OpenTTD $(REV)" "$(BUNDLES_DIR)/$(BUNDLE_NAME).dmg"
|
||||
$(Q)rm -fr "$(BUNDLES_DIR)/OpenTTD $(REV)"
|
||||
|
||||
ifdef OSXAPP
|
||||
install:
|
||||
@echo '[INSTALL] Cannot install the OSX Application Bundle'
|
||||
else
|
||||
install: bundle
|
||||
@echo '[INSTALL] Installing OpenTTD'
|
||||
$(Q)install -d "$(INSTALL_BINARY_DIR)"
|
||||
$(Q)install -d "$(INSTALL_ICON_DIR)"
|
||||
$(Q)install -d "$(INSTALL_DATA_DIR)/gm"
|
||||
$(Q)install -d "$(INSTALL_DATA_DIR)/data"
|
||||
$(Q)install -d "$(INSTALL_DATA_DIR)/lang"
|
||||
$(Q)install -d "$(INSTALL_DATA_DIR)/docs"
|
||||
$(Q)install -m 755 "$(BUNDLE_DIR)/$(TTD)" "$(INSTALL_BINARY_DIR)"
|
||||
$(Q)install -m 644 "$(BUNDLE_DIR)/lang/"* "$(INSTALL_DATA_DIR)/lang"
|
||||
$(Q)install -m 644 "$(BUNDLE_DIR)/data/"* "$(INSTALL_DATA_DIR)/data"
|
||||
$(Q)install -m 644 "$(BUNDLE_DIR)/docs/"* "$(INSTALL_DATA_DIR)/docs"
|
||||
$(Q)install -m 644 "$(BUNDLE_DIR)/media/"* "$(INSTALL_ICON_DIR)"
|
||||
ifdef INSTALL_PERSONAL_DIR
|
||||
$(Q)mkdir -p ~/"$(INSTALL_PERSONAL_DIR)"
|
||||
$(Q)cp -R "$(BUNDLE_DIR)/scenario" ~/"$(INSTALL_PERSONAL_DIR)"
|
||||
else
|
||||
$(Q)cp -R "$(BUNDLE_DIR)/scenario" "$(INSTALL_DATA_DIR)"
|
||||
endif # INSTALL_PERSONAL_DIR
|
||||
endif # OSXAPP
|
85
Makefile.lang.in
Normal file
85
Makefile.lang.in
Normal file
@@ -0,0 +1,85 @@
|
||||
# Auto-generated file -- DO NOT EDIT
|
||||
|
||||
STRGEN = !!STRGEN!!
|
||||
ENDIAN_CHECK = !!ENDIAN_CHECK!!
|
||||
SRC_DIR = !!SRC_DIR!!
|
||||
LANG_DIR = !!LANG_DIR!!
|
||||
BIN_DIR = !!BIN_DIR!!
|
||||
LANGS_SRC = $(shell ls $(LANG_DIR)/*.txt)
|
||||
LANGS = $(LANGS_SRC:$(LANG_DIR)/%.txt=%.lng)
|
||||
CXX_BUILD = !!CXX_BUILD!!
|
||||
CFLAGS_BUILD = !!CFLAGS_BUILD!!
|
||||
STRGEN_FLAGS = !!STRGEN_FLAGS!!
|
||||
STAGE = !!STAGE!!
|
||||
LANG_SUPPRESS= !!LANG_SUPPRESS!!
|
||||
LANG_OBJS_DIR= !!LANG_OBJS_DIR!!
|
||||
|
||||
ifeq ($(LANG_SUPPRESS), yes)
|
||||
LANG_ERRORS = >/dev/null 2>&1
|
||||
endif
|
||||
|
||||
# Make sure endian_host.h is reasable as if it was in the src/ dir
|
||||
CFLAGS_BUILD += -I $(LANG_OBJS_DIR)
|
||||
|
||||
ENDIAN_TARGETS := endian_host.h endian_target.h $(ENDIAN_CHECK)
|
||||
|
||||
# Check if we want to show what we are doing
|
||||
ifdef VERBOSE
|
||||
Q =
|
||||
E = @true
|
||||
else
|
||||
Q = @
|
||||
E = @echo
|
||||
endif
|
||||
|
||||
RES := $(shell mkdir -p $(BIN_DIR)/lang )
|
||||
|
||||
all: table/strings.h $(LANGS)
|
||||
|
||||
strgen.o: $(SRC_DIR)/strgen/strgen.cpp endian_host.h
|
||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $<
|
||||
|
||||
string.o: $(SRC_DIR)/string.cpp endian_host.h
|
||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $<
|
||||
|
||||
lang/english.txt: $(LANG_DIR)/english.txt
|
||||
$(Q)mkdir -p lang
|
||||
$(Q)cp $(LANG_DIR)/english.txt lang/english.txt
|
||||
|
||||
$(STRGEN): string.o strgen.o
|
||||
$(E) '$(STAGE) Compiling and Linking $@'
|
||||
$(Q)$(CXX_BUILD) string.o strgen.o -o $@
|
||||
|
||||
table/strings.h: lang/english.txt $(STRGEN)
|
||||
$(E) '$(STAGE) Generating $@'
|
||||
@mkdir -p table
|
||||
$(Q)./$(STRGEN) -s $(LANG_DIR) -d table
|
||||
|
||||
$(LANGS): %.lng: $(LANG_DIR)/%.txt $(STRGEN) lang/english.txt
|
||||
$(E) '$(STAGE) Compiling language $(*F)'
|
||||
$(Q)./$(STRGEN) $(STRGEN_FLAGS) -s $(LANG_DIR) -d $(LANG_OBJS_DIR) $< $(LANG_ERRORS) && cp $@ $(BIN_DIR)/lang || true # Do not fail all languages when one fails
|
||||
|
||||
# The targets to compile the endian-code
|
||||
|
||||
endian_host.h: $(ENDIAN_CHECK)
|
||||
$(E) '$(STAGE) Testing endianness for host'
|
||||
$(Q)./$(ENDIAN_CHECK) > $@
|
||||
|
||||
$(ENDIAN_CHECK): $(SRC_DIR)/endian_check.cpp
|
||||
$(E) '$(STAGE) Compiling and Linking $@'
|
||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $< -o $@
|
||||
|
||||
depend:
|
||||
|
||||
clean:
|
||||
$(E) '$(STAGE) Cleaning up language files'
|
||||
$(Q)rm -f strgen.o string.o table/strings.h $(STRGEN) $(LANGS) $(LANGS:%=$(BIN_DIR)/lang/%) lang/english.* $(ENDIAN_TARGETS)
|
||||
|
||||
mrproper: clean
|
||||
|
||||
%.lng:
|
||||
@echo '$(STAGE) No such language: $(@:%.lng=%)'
|
||||
|
||||
.PHONY: all mrproper depend clean
|
309
Makefile.src.in
Normal file
309
Makefile.src.in
Normal file
@@ -0,0 +1,309 @@
|
||||
# Auto-generated file -- DO NOT EDIT
|
||||
|
||||
CC_HOST = !!CC_HOST!!
|
||||
CXX_HOST = !!CXX_HOST!!
|
||||
CC_BUILD = !!CC_BUILD!!
|
||||
CXX_BUILD = !!CXX_BUILD!!
|
||||
WINDRES = !!WINDRES!!
|
||||
STRIP = !!STRIP!!
|
||||
CC_CFLAGS = !!CC_CFLAGS!!
|
||||
CFLAGS = !!CFLAGS!!
|
||||
CFLAGS_BUILD = !!CFLAGS_BUILD!!
|
||||
LIBS = !!LIBS!!
|
||||
LDFLAGS = !!LDFLAGS!!
|
||||
BIN_DIR = !!BIN_DIR!!
|
||||
LANG_DIR = !!LANG_DIR!!
|
||||
SRC_OBJS_DIR = !!SRC_OBJS_DIR!!
|
||||
LANG_OBJS_DIR= !!LANG_OBJS_DIR!!
|
||||
SRC_DIR = !!SRC_DIR!!
|
||||
MEDIA_DIR = !!MEDIA_DIR!!
|
||||
TTD = !!TTD!!
|
||||
STRGEN = !!STRGEN!!
|
||||
ENDIAN_CHECK = !!ENDIAN_CHECK!!
|
||||
ENDIAN_FORCE = !!ENDIAN_FORCE!!
|
||||
OS = !!OS!!
|
||||
STAGE = !!STAGE!!
|
||||
MAKEDEPEND = !!MAKEDEPEND!!
|
||||
CFLAGS_MAKEDEP= !!CFLAGS_MAKEDEP!!
|
||||
SORT = !!SORT!!
|
||||
REVISION = !!REVISION!!
|
||||
AWK = !!AWK!!
|
||||
GCC295 = !!GCC295!!
|
||||
CONFIG_CACHE_COMPILER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_COMPILER!!
|
||||
CONFIG_CACHE_LINKER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_LINKER!!
|
||||
CONFIG_CACHE_ENDIAN = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_ENDIAN!!
|
||||
CONFIG_CACHE_SOURCE = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_SOURCE!!
|
||||
CONFIG_CACHE_VERSION = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_VERSION!!
|
||||
|
||||
OBJS_C := !!OBJS_C!!
|
||||
OBJS_CPP := !!OBJS_CPP!!
|
||||
OBJS_MM := !!OBJS_MM!!
|
||||
OBJS_RC := !!OBJS_RC!!
|
||||
OBJS := $(OBJS_C) $(OBJS_CPP) $(OBJS_MM) $(OBJS_RC)
|
||||
SRCS := !!SRCS!!
|
||||
|
||||
# All C-files depend on those 3 files
|
||||
FILE_DEP := $(CONFIG_CACHE_COMPILER) $(LANG_OBJS_DIR)/table/strings.h endian_target.h
|
||||
# Create all dirs and subdirs
|
||||
RES := $(shell mkdir -p $(BIN_DIR) $(sort $(dir $(OBJS))))
|
||||
|
||||
# Make sure endian_target.h is reasable as if it was in the src/ dir
|
||||
CFLAGS += -I $(SRC_OBJS_DIR) -I $(LANG_OBJS_DIR)
|
||||
|
||||
ENDIAN_TARGETS := endian_target.h $(ENDIAN_CHECK)
|
||||
|
||||
# This 'sed' basicly just removes 'const' from the line if it is a 2+D array
|
||||
# For more information, please check:
|
||||
# http://maillist.openttd.org/pipermail/devs/2007-April/000284.html
|
||||
# http://maillist.openttd.org/pipermail/devs/2007-February/000248.html
|
||||
GCC295_FIX=sed -r 's/^(\t*)(.*)( const )([A-Za-z0-9_ ]+(\[.*\]){2,})(( = \{)|(;))(.*)$$/\1\2 \4\6\8\9/g'
|
||||
# This 'sed' removes the 3rd '4' in the # lines of the -E output of
|
||||
# gcc 2.95.3 and lower, as it should indicate that it is a C-linkage, but the
|
||||
# compiler can't handle that information (just don't ask). So we remove it
|
||||
# and then it compiles happily and without bitching :)
|
||||
# Furthermore gcc 2.95 has some trouble with protected and private when
|
||||
# accessing the protected/private stuff of the enclosing class (or the
|
||||
# super class of the enclosing class).
|
||||
GCC295_FIX_2=sed -e 's|\(^\# [0-9][0-9]* "[^"]*"[ 0-9]*\) 4$$|\1|g;s|private:|public:|g;s|protected:|public:|g'
|
||||
|
||||
# Check if we want to show what we are doing
|
||||
ifdef VERBOSE
|
||||
Q =
|
||||
E = @true
|
||||
else
|
||||
Q = @
|
||||
E = @echo
|
||||
endif
|
||||
|
||||
# Our default target
|
||||
all: $(BIN_DIR)/$(TTD)
|
||||
|
||||
# This are 2 rules that are pointing back to STRGEN stuff.
|
||||
# There is not really a need to have them here, but in case
|
||||
# some weirdo wants to run 'make' in the 'src' dir and expects
|
||||
# the languages to be recompiled, this catches that case and
|
||||
# takes care of it nicely.
|
||||
$(LANG_OBJS_DIR)/$(STRGEN):
|
||||
$(MAKE) -C $(LANG_OBJS_DIR) $(STRGEN)
|
||||
|
||||
$(LANG_OBJS_DIR)/table/strings.h: $(LANG_DIR)/english.txt $(LANG_OBJS_DIR)/$(STRGEN)
|
||||
$(MAKE) -C $(LANG_OBJS_DIR) table/strings.h
|
||||
|
||||
# Make the revision number
|
||||
ifdef REVISION
|
||||
REV := $(REVISION)
|
||||
REV_NR := $(shell echo $(REVISION) | sed "s/[^0-9]//g")
|
||||
else
|
||||
# Are we a SVN dir?
|
||||
ifeq ($(shell if test -d $(SRC_DIR)/.svn; then echo 1; fi), 1)
|
||||
# Find if the local source if modified
|
||||
REV_MODIFIED := $(shell svnversion $(SRC_DIR) | sed -n 's/.*\(M\).*/\1/p' )
|
||||
# Find the revision like: rXXXX-branch
|
||||
REV := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^URL:.*branch/ { split($$2, a, "/"); BRANCH="-"a[5] } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }')
|
||||
REV_NR := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^Last Changed Rev:/ { print $$4 }')
|
||||
else
|
||||
# Are we a git dir?
|
||||
ifeq ($(shell if test -d $(SRC_DIR)/../.git; then echo 1; fi), 1)
|
||||
# Find the revision like: gXXXXM-branch
|
||||
REV := g$(shell if head=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null`; then echo "$$head" | cut -c1-8; fi)$(shell if git diff-index HEAD | read dummy; then echo M; fi)$(shell git branch|grep '[*]' | sed 's/\* /-/;s/^-master$$//')
|
||||
REV_NR := $(shell echo `LC_ALL=C cd "$(SRC_DIR)/.." && git log --pretty=format:%s src | grep "^(svn r[0-9]*)" | head -n 1 | sed "s/.*(svn r\([0-9]*\)).*/\1/"` )
|
||||
else
|
||||
# Are we a hg (Mercurial) dir?
|
||||
ifeq ($(shell if test -d $(SRC_DIR)/../.hg; then echo 1; fi), 1)
|
||||
# Find the revision like: hXXXXM-branch
|
||||
REV := h$(shell if head=`LC_ALL=C hg tip 2>/dev/null`; then echo "$$head" | head -n 1 | cut -c19-26; fi)$(shell if hg status $(SRC_DIR) | grep -v '^?' | read dummy; then echo M; fi)$(shell hg branch | sed 's/^/-/;s/^-default$$//')
|
||||
REV_NR := $(shell LC_ALL=C hg log -k "svn" -l 1 --template "{desc}\n" $(SRC_DIR) | grep "^(svn r[0-9]*)" | head -n 1 | sed "s/.*(svn r\([0-9]*\)).*/\1/" )
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Make sure we have something in REV
|
||||
ifeq ($(REV),)
|
||||
REV := norev000
|
||||
REV_NR := 0
|
||||
endif
|
||||
|
||||
# This helps to recompile if flags change
|
||||
RES := $(shell if [ "`cat $(CONFIG_CACHE_COMPILER) 2>/dev/null`" != "$(CC_CFLAGS) $(CFLAGS)" ]; then echo "$(CC_CFLAGS) $(CFLAGS)" > $(CONFIG_CACHE_COMPILER); fi )
|
||||
RES := $(shell if [ "`cat $(CONFIG_CACHE_LINKER) 2>/dev/null`" != "$(LDFLAGS) $(LIBS)" ]; then echo "$(LDFLAGS) $(LIBS)" > $(CONFIG_CACHE_LINKER); fi )
|
||||
RES := $(shell if [ "`cat $(CONFIG_CACHE_ENDIAN) 2>/dev/null`" != "$(ENDIAN_FORCE)" ]; then echo "$(ENDIAN_FORCE)" > $(CONFIG_CACHE_ENDIAN); fi )
|
||||
|
||||
# If there is a change in the source-file-list, make sure we recheck the deps
|
||||
RES := $(shell if [ "`cat $(CONFIG_CACHE_SOURCE) 2>/dev/null`" != "$(SRCS)" ]; then echo "$(SRCS)" > $(CONFIG_CACHE_SOURCE); fi )
|
||||
# If there is a change in the revision, make sure we recompile rev.cpp
|
||||
RES := $(shell if [ "`cat $(CONFIG_CACHE_VERSION) 2>/dev/null`" != "$(REV)" ]; then echo "$(REV)" > $(CONFIG_CACHE_VERSION); fi )
|
||||
|
||||
ifndef MAKEDEPEND
|
||||
# The slow, but always correct, dep-check
|
||||
DEP_MASK := %.d
|
||||
DEPS := $(OBJS:%.o=%.d)
|
||||
|
||||
# Only include the deps if we are compiling everything
|
||||
ifeq ($(filter $(ENDIAN_TARGETS) %.o clean mrproper, $(MAKECMDGOALS)),)
|
||||
-include $(DEPS)
|
||||
else
|
||||
# In case we want to compile a single target, include the .d file for it
|
||||
ifneq ($(filter %.o, $(MAKECMDGOALS)),)
|
||||
SINGLE_DEP := $(filter %.o, $(MAKECMDGOALS))
|
||||
-include $(SINGLE_DEP:%.o=%.d)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Find the deps via GCC. Rarely wrong, but a bit slow
|
||||
|
||||
$(OBJS_C:%.o=%.d): %.d: $(SRC_DIR)/%.c $(FILE_DEP)
|
||||
$(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.c=%.c)'
|
||||
$(Q)$(CC_HOST) $(CC_CFLAGS) $(CFLAGS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:%.d=%.o):#' > $@
|
||||
|
||||
$(OBJS_CPP:%.o=%.d): %.d: $(SRC_DIR)/%.cpp $(FILE_DEP)
|
||||
$(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
||||
$(Q)$(CXX_HOST) $(CFLAGS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:%.d=%.o):#' > $@
|
||||
|
||||
$(OBJS_MM:%.o=%.d): %.d: $(SRC_DIR)/%.mm $(FILE_DEP)
|
||||
$(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.mm=%.mm)'
|
||||
$(Q)$(CC_HOST) $(CFLAGS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:%.d=%.o):#' > $@
|
||||
|
||||
$(OBJS_RC:%.o=%.d): %.d: $(SRC_DIR)/%.rc $(FILE_DEP)
|
||||
$(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.mm=%.mm)'
|
||||
$(Q)touch $@
|
||||
|
||||
else
|
||||
# The much faster, but can be wrong, dep-check
|
||||
DEP_MASK :=
|
||||
DEPS := Makefile.dep
|
||||
|
||||
# Only include the deps if we are not cleaning
|
||||
ifeq ($(filter $(ENDIAN_TARGETS) depend clean mrproper, $(MAKECMDGOALS)),)
|
||||
-include Makefile.dep
|
||||
endif
|
||||
|
||||
# Make sure that only 'make depend' ALWAYS triggers a recheck
|
||||
ifeq ($(filter depend, $(MAKECMDGOALS)),)
|
||||
Makefile.dep: $(FILE_DEP) $(SRCS:%=$(SRC_DIR)/%) $(CONFIG_CACHE_SOURCE)
|
||||
else
|
||||
Makefile.dep: FORCE
|
||||
endif
|
||||
$(E) '$(STAGE) DEP CHECK (all files)'
|
||||
$(Q)rm -f Makefile.dep.tmp
|
||||
$(Q)touch Makefile.dep.tmp
|
||||
|
||||
# Calculate the deps via makedepend
|
||||
$(Q)$(MAKEDEPEND) -f$(SRC_OBJS_DIR)/Makefile.dep.tmp -o.o -Y -v -- $(CFLAGS_MAKEDEP) -- $(SRCS:%=$(SRC_DIR)/%) 2>/dev/null
|
||||
|
||||
# Convert x:/... paths to /x/... for mingw
|
||||
ifeq ($(OS), MINGW)
|
||||
@cat Makefile.dep.tmp | sed 's@\([a-zA-Z]\):\/@\/\1\/@g' > Makefile.dep.tmp.mingw
|
||||
@cp Makefile.dep.tmp.mingw Makefile.dep.tmp
|
||||
@rm -f Makefile.dep.tmp.mingw
|
||||
endif
|
||||
|
||||
# Remove all comments and includes that don't start with $(SRC_DIR)
|
||||
# Remove $(SRC_DIR) from object-file-name
|
||||
@$(AWK) ' \
|
||||
/^# DO NOT/ { print $$0 ; next} \
|
||||
/^#/ {next} \
|
||||
/:/ { \
|
||||
left = NF - 1; \
|
||||
for (n = 2; n <= NF; n++) { \
|
||||
if (match($$n, "^$(SRC_DIR)") == 0) { \
|
||||
$$n = ""; \
|
||||
left--; \
|
||||
} \
|
||||
} \
|
||||
gsub("$(SRC_DIR)/", "", $$1); \
|
||||
if (left > 0) { \
|
||||
print $$0; \
|
||||
$$1 = "Makefile.dep:"; \
|
||||
print $$0; \
|
||||
} \
|
||||
next \
|
||||
} \
|
||||
{ \
|
||||
print $$0 \
|
||||
} \
|
||||
' < Makefile.dep.tmp | sed 's/ */ /g;s/ $$//' | $(SORT) > Makefile.dep
|
||||
|
||||
$(Q)rm -f Makefile.dep.tmp Makefile.dep.tmp.bak
|
||||
|
||||
endif
|
||||
|
||||
# Avoid problems with deps if a .h/.hpp file is deleted without the deps
|
||||
# being updated. Now the Makefile continues, the deps are recreated
|
||||
# and all will be fine.
|
||||
%.h %.hpp:
|
||||
@true
|
||||
|
||||
|
||||
# Compile all the files according to the targets
|
||||
|
||||
$(OBJS_C): %.o: $(SRC_DIR)/%.c $(DEP_MASK) $(FILE_DEP)
|
||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.c=%.c)'
|
||||
$(Q)$(CC_HOST) $(CC_CFLAGS) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
$(OBJS_CPP): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
|
||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
||||
ifeq ($(GCC295), 1)
|
||||
$(Q)$(CXX_HOST) -E $(CFLAGS) $< | $(GCC295_FIX) | $(GCC295_FIX_2) | $(CXX_HOST) $(CFLAGS) -c -o $@ -x c++ -
|
||||
else
|
||||
$(Q)$(CXX_HOST) $(CFLAGS) -c -o $@ $<
|
||||
endif
|
||||
|
||||
$(OBJS_MM): %.o: $(SRC_DIR)/%.mm $(DEP_MASK) $(FILE_DEP)
|
||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.mm=%.mm)'
|
||||
$(Q)$(CC_HOST) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
$(OBJS_RC): %.o: $(SRC_DIR)/%.rc $(FILE_DEP)
|
||||
$(E) '$(STAGE) Compiling resource $(<:$(SRC_DIR)/%.rc=%.rc)'
|
||||
$(Q)$(WINDRES) -o $@ -I $(MEDIA_DIR) $<
|
||||
|
||||
$(BIN_DIR)/$(TTD): $(TTD)
|
||||
$(Q)cp $< $@
|
||||
|
||||
$(TTD): $(OBJS) $(CONFIG_CACHE_LINKER)
|
||||
$(E) '$(STAGE) Linking $@'
|
||||
ifeq ($(OS), PSP)
|
||||
# Because of a bug in the PSP GCC tools, linking via CXX results
|
||||
# in total chaos and more problems then you can handle. So we need
|
||||
# CC to link OpenTTD for PSP
|
||||
$(Q)$(CC_HOST) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
|
||||
else
|
||||
$(Q)$(CXX_HOST) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
|
||||
endif
|
||||
ifdef STRIP
|
||||
$(Q)$(STRIP) $@
|
||||
endif
|
||||
|
||||
# The targets to compile the endian-code
|
||||
|
||||
endian_target.h: $(ENDIAN_CHECK) $(CONFIG_CACHE_ENDIAN)
|
||||
$(E) '$(STAGE) Testing endianness for target'
|
||||
$(Q)./$(ENDIAN_CHECK) $(ENDIAN_FORCE) > $@
|
||||
|
||||
$(ENDIAN_CHECK): $(SRC_DIR)/endian_check.cpp
|
||||
$(E) '$(STAGE) Compiling and Linking $@'
|
||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $< -o $@
|
||||
|
||||
# Revision files
|
||||
|
||||
$(SRC_DIR)/rev.cpp: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/rev.cpp.in
|
||||
$(Q)cat $(SRC_DIR)/rev.cpp.in | sed "s#@@REVISION@@#$(REV_NR)#g;s#@@VERSION@@#$(REV)#g;s#@@DATE@@#`date +%d.%m.%y`#g" > $(SRC_DIR)/rev.cpp
|
||||
|
||||
$(SRC_DIR)/ottdres.rc: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/ottdres.rc.in
|
||||
$(Q)cat $(SRC_DIR)/ottdres.rc.in | sed "s#@@REVISION@@#$(REV_NR)#g;s#@@VERSION@@#$(REV)#g;s#@@DATE@@#`date +%d.%m.%y`#g" > $(SRC_DIR)/ottdres.rc
|
||||
|
||||
FORCE:
|
||||
|
||||
depend: $(DEPS)
|
||||
|
||||
clean:
|
||||
$(E) '$(STAGE) Cleaning up object files'
|
||||
$(Q)rm -f $(DEPS) $(OBJS) $(TTD) $(TTD:%=$(BIN_DIR)/%) $(CONFIG_CACHE_COMPILER) $(CONFIG_CACHE_LINKER) $(CONFIG_CACHE_ENDIAN) $(CONFIG_CACHE_SOURCE) $(ENDIAN_TARGETS)
|
||||
|
||||
mrproper: clean
|
||||
$(Q)rm -f $(SRC_DIR)/rev.cpp $(SRC_DIR)/ottdres.rc
|
||||
|
||||
%.o:
|
||||
@echo '$(STAGE) No such source-file: $(@:%.o=%).[c|cpp|mm|rc]'
|
||||
|
||||
.PHONY: all mrproper depend clean FORCE
|
208
README.md
208
README.md
@@ -1,208 +0,0 @@
|
||||
# OpenTTD
|
||||
|
||||
## Table of contents
|
||||
|
||||
- 1.0) [About](#10-about)
|
||||
- 1.1) [Downloading OpenTTD](#11-downloading-openttd)
|
||||
- 1.2) [OpenTTD gameplay manual](#12-openttd-gameplay-manual)
|
||||
- 1.3) [Supported platforms](#13-supported-platforms)
|
||||
- 1.4) [Installing and running OpenTTD](#14-installing-and-running-openttd)
|
||||
- 1.5) [Add-on content / mods](#15-add-on-content--mods)
|
||||
- 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)
|
||||
- 3.0) [Licensing](#30-licensing)
|
||||
- 4.0) [Credits](#40-credits)
|
||||
|
||||
## 1.0) About
|
||||
|
||||
OpenTTD is a transport simulation game based upon the popular game Transport Tycoon Deluxe, written by Chris Sawyer.
|
||||
It attempts to mimic the original game as closely as possible while extending it with new features.
|
||||
|
||||
OpenTTD is licensed under the GNU General Public License version 2.0, but includes some 3rd party software under different licenses.
|
||||
See the section ["Licensing"](#30-licensing) below for details.
|
||||
|
||||
## 1.1) Downloading OpenTTD
|
||||
|
||||
OpenTTD can be downloaded from the [official OpenTTD website](https://www.openttd.org/).
|
||||
|
||||
Both 'stable' and 'nightly' versions are available for download:
|
||||
|
||||
- most people should choose the 'stable' version, as this has been more extensively tested
|
||||
- the 'nightly' version includes the latest changes and features, but may sometimes be less reliable
|
||||
|
||||
OpenTTD is also available for free on [Steam](https://store.steampowered.com/app/1536610/OpenTTD/), [GOG.com](https://www.gog.com/game/openttd), and the [Microsoft Store](https://www.microsoft.com/p/openttd-official/9ncjg5rvrr1c). On some platforms OpenTTD will be available via your OS package manager or a similar service.
|
||||
|
||||
## 1.2) OpenTTD gameplay manual
|
||||
|
||||
OpenTTD has a [community-maintained wiki](https://wiki.openttd.org/), including a gameplay manual and tips.
|
||||
|
||||
## 1.3) Supported platforms
|
||||
|
||||
OpenTTD has been ported to several platforms and operating systems.
|
||||
|
||||
The currently supported platforms are:
|
||||
|
||||
- Linux (SDL (OpenGL and non-OpenGL))
|
||||
- macOS (universal) (Cocoa)
|
||||
- Windows (Win32 GDI / OpenGL)
|
||||
|
||||
Other platforms may also work (in particular various BSD systems), but we don't actively test or maintain these.
|
||||
|
||||
### 1.3.1) Legacy support
|
||||
|
||||
Platforms, languages and compilers change.
|
||||
We'll keep support going on old platforms as long as someone is interested in supporting them, except where it means the project can't move forward to keep up with language and compiler features.
|
||||
|
||||
We guarantee that every revision of OpenTTD will be able to load savegames from every older revision (excepting where the savegame is corrupt).
|
||||
Please report a bug if you find a save that doesn't load.
|
||||
|
||||
## 1.4) Installing and running OpenTTD
|
||||
|
||||
OpenTTD is usually straightforward to install, but for more help the wiki [includes an installation guide](https://wiki.openttd.org/en/Manual/Installation).
|
||||
|
||||
OpenTTD needs some additional graphics and sound files to run.
|
||||
|
||||
For some platforms these will be downloaded during the installation process if required.
|
||||
|
||||
For some platforms, you will need to refer to [the installation guide](https://wiki.openttd.org/en/Manual/Installation).
|
||||
|
||||
### 1.4.1) Free graphics and sound files
|
||||
|
||||
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)
|
||||
|
||||
Please follow the readme of these packages about the installation procedure.
|
||||
The Windows installer can optionally download and install these packages.
|
||||
|
||||
### 1.4.2) Original Transport Tycoon Deluxe graphics and sound files
|
||||
|
||||
If you want to play with the original Transport Tycoon Deluxe data files you have to copy the data files from the CD-ROM into the baseset/ directory.
|
||||
It does not matter whether you copy them from the DOS or Windows version of Transport Tycoon Deluxe.
|
||||
The Windows install can optionally copy these files.
|
||||
|
||||
You need to copy the following files:
|
||||
- sample.cat
|
||||
- trg1r.grf or TRG1.GRF
|
||||
- trgcr.grf or TRGC.GRF
|
||||
- trghr.grf or TRGH.GRF
|
||||
- trgir.grf or TRGI.GRF
|
||||
- trgtr.grf or TRGT.GRF
|
||||
|
||||
### 1.4.3) Original Transport Tycoon Deluxe music
|
||||
|
||||
If you want the Transport Tycoon Deluxe music, copy the appropriate files from the original game into the baseset folder.
|
||||
- TTD for Windows: All files in the gm/ folder (gm_tt00.gm up to gm_tt21.gm)
|
||||
- TTD for DOS: The GM.CAT file
|
||||
- Transport Tycoon Original: The GM.CAT file, but rename it to GM-TTO.CAT
|
||||
|
||||
## 1.5) Add-on content / mods
|
||||
|
||||
OpenTTD features multiple types of add-on content, which modify gameplay in different ways.
|
||||
|
||||
Most types of add-on content can be downloaded within OpenTTD via the 'Check Online Content' button in the main menu.
|
||||
|
||||
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) Social Integration
|
||||
|
||||
OpenTTD has the ability to load plugins to integrate with Social Platforms like Steam, Discord, etc.
|
||||
|
||||
To enable such integration, the plugin for the specific platform has to be downloaded and stored in the `social_integration` folder.
|
||||
|
||||
See [OpenTTD's website](https://www.openttd.org), under Downloads, for what plugins are available.
|
||||
|
||||
### 1.6) OpenTTD directories
|
||||
|
||||
OpenTTD uses its own directory structure to store game data, add-on content etc.
|
||||
|
||||
For more information, see the [directory structure guide](./docs/directory_structure.md).
|
||||
|
||||
### 1.7) Compiling OpenTTD
|
||||
|
||||
If you want to compile OpenTTD from source, instructions can be found in [COMPILING.md](./COMPILING.md).
|
||||
|
||||
## 2.0) Contact and Community
|
||||
|
||||
'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
|
||||
- [OpenTTD wiki](https://wiki.openttd.org/) community-maintained wiki, including topics like gameplay guide, detailed explanation of some game mechanics, how to use add-on content (mods) and much more
|
||||
|
||||
'Unofficial' channels
|
||||
|
||||
- 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
|
||||
|
||||
We welcome contributors to OpenTTD. More information for contributors can be found in [CONTRIBUTING.md](./CONTRIBUTING.md)
|
||||
|
||||
### 2.3) Reporting bugs
|
||||
|
||||
Good bug reports are very helpful. We have a [guide to reporting bugs](./CONTRIBUTING.md#bug-reports) to help with this.
|
||||
|
||||
Desyncs in multiplayer are complex to debug and report (some software development skils are required).
|
||||
Instructions can be found in [debugging and reporting desyncs](./docs/debugging_desyncs.md).
|
||||
|
||||
### 2.4) Translating
|
||||
|
||||
OpenTTD is translated into many languages. Translations are added and updated via the [online translation tool](https://translator.openttd.org).
|
||||
|
||||
## 3.0) Licensing
|
||||
|
||||
OpenTTD is licensed under the GNU General Public License version 2.0.
|
||||
For the complete license text, see the file '[COPYING.md](./COPYING.md)'.
|
||||
This license applies to all files in this distribution, except as noted below.
|
||||
|
||||
The squirrel implementation in `src/3rdparty/squirrel` is licensed under the Zlib license.
|
||||
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 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.
|
||||
|
||||
The atomic datatype support detection in `cmake/3rdparty/llvm/CheckAtomic.cmake` is licensed under the Apache 2.0 license.
|
||||
See `cmake/3rdparty/llvm/LICENSE.txt` for the complete license text.
|
||||
|
||||
## 4.0) Credits
|
||||
|
||||
See [CREDITS.md](./CREDITS.md)
|
@@ -1,2 +0,0 @@
|
||||
add_subdirectory(ai)
|
||||
add_subdirectory(game)
|
@@ -1,42 +0,0 @@
|
||||
set(AI_COMPAT_SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_0.7.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.0.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.1.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.2.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.3.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.4.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.5.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.6.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.7.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.8.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.9.nut
|
||||
${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)
|
||||
string(REPLACE "${CMAKE_SOURCE_DIR}/bin/" "" AI_COMPAT_SOURCE_FILE_NAME "${AI_COMPAT_SOURCE_FILE}")
|
||||
string(CONCAT AI_COMPAT_BINARY_FILE "${CMAKE_BINARY_DIR}/" "${AI_COMPAT_SOURCE_FILE_NAME}")
|
||||
|
||||
add_custom_command(OUTPUT ${AI_COMPAT_BINARY_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${AI_COMPAT_SOURCE_FILE}
|
||||
${AI_COMPAT_BINARY_FILE}
|
||||
MAIN_DEPENDENCY ${AI_COMPAT_SOURCE_FILE}
|
||||
COMMENT "Copying ${AI_COMPAT_SOURCE_FILE_NAME}"
|
||||
)
|
||||
|
||||
list(APPEND AI_COMPAT_BINARY_FILES ${AI_COMPAT_BINARY_FILE})
|
||||
endforeach()
|
||||
|
||||
# Create a new target which copies all compat files
|
||||
add_custom_target(ai_compat_files
|
||||
DEPENDS ${AI_COMPAT_BINARY_FILES}
|
||||
)
|
||||
|
||||
add_dependencies(openttd
|
||||
ai_compat_files
|
||||
)
|
@@ -1,259 +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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.0 to 0.7. */
|
||||
|
||||
AILog.Info(" - AITown::GetLastMonthProduction's behaviour has slightly changed.");
|
||||
AILog.Info(" - AISubsidy::GetDestination returns STATION_INVALID for awarded subsidies.");
|
||||
AILog.Info(" - AISubsidy::GetSource returns STATION_INVALID for awarded subsidies.");
|
||||
|
||||
AISign.GetMaxSignID <- function()
|
||||
{
|
||||
local list = AISignList();
|
||||
local max_id = 0;
|
||||
foreach (id, d in list) {
|
||||
if (id > max_id) max_id = id;
|
||||
}
|
||||
return max_id;
|
||||
}
|
||||
|
||||
AITile.GetHeight <- function(tile)
|
||||
{
|
||||
if (!AIMap.IsValidTile(tile)) return -1;
|
||||
|
||||
return AITile.GetCornerHeight(tile, AITile.CORNER_N);
|
||||
}
|
||||
|
||||
AIOrder.ChangeOrder <- function(vehicle_id, order_position, order_flags)
|
||||
{
|
||||
return AIOrder.SetOrderFlags(vehicle_id, order_position, order_flags);
|
||||
}
|
||||
|
||||
AIWaypoint.WAYPOINT_INVALID <- 0xFFFF;
|
||||
|
||||
AISubsidy.SourceIsTown <- function(subsidy_id)
|
||||
{
|
||||
if (!AISubsidy.IsValidSubsidy(subsidy_id) || AISubsidy.IsAwarded(subsidy_id)) return false;
|
||||
|
||||
return AISubsidy.GetSourceType(subsidy_id) == AISubsidy.SPT_TOWN;
|
||||
}
|
||||
|
||||
AISubsidy.GetSource <- function(subsidy_id)
|
||||
{
|
||||
if (!AISubsidy.IsValidSubsidy(subsidy_id)) return AIBaseStation.STATION_INVALID;
|
||||
|
||||
if (AISubsidy.IsAwarded(subsidy_id)) {
|
||||
return AIBaseStation.STATION_INVALID;
|
||||
}
|
||||
|
||||
return AISubsidy.GetSourceIndex(subsidy_id);
|
||||
}
|
||||
|
||||
AISubsidy.DestinationIsTown <- function(subsidy_id)
|
||||
{
|
||||
if (!AISubsidy.IsValidSubsidy(subsidy_id) || AISubsidy.IsAwarded(subsidy_id)) return false;
|
||||
|
||||
return AISubsidy.GetDestinationType(subsidy_id) == AISubsidy.SPT_TOWN;
|
||||
}
|
||||
|
||||
AISubsidy.GetDestination <- function(subsidy_id)
|
||||
{
|
||||
if (!AISubsidy.IsValidSubsidy(subsidy_id)) return AIBaseStation.STATION_INVALID;
|
||||
|
||||
if (AISubsidy.IsAwarded(subsidy_id)) {
|
||||
return AIBaseStation.STATION_INVALID;
|
||||
}
|
||||
|
||||
return AISubsidy.GetDestinationIndex(subsidy_id);
|
||||
}
|
||||
|
||||
AITown.GetMaxProduction <- function(town_id, cargo_id)
|
||||
{
|
||||
return AITown.GetLastMonthProduction(town_id, cargo_id);
|
||||
}
|
||||
|
||||
AIRail.RemoveRailWaypoint <- function(tile)
|
||||
{
|
||||
return AIRail.RemoveRailWaypointTileRect(tile, tile, true);
|
||||
}
|
||||
|
||||
AIRail.RemoveRailStationTileRect <- function(tile, tile2)
|
||||
{
|
||||
return AIRail.RemoveRailStationTileRectangle(tile, tile2, false);
|
||||
}
|
||||
|
||||
AIVehicle.SkipToVehicleOrder <- function(vehicle_id, order_position)
|
||||
{
|
||||
return AIOrder.SkipToOrder(vehicle_id, order_position);
|
||||
}
|
||||
|
||||
AIEngine.IsValidEngine <- function(engine_id)
|
||||
{
|
||||
return AIEngine.IsBuildable(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetNameCompat0_7 <- AIEngine.GetName;
|
||||
AIEngine.GetName <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return null;
|
||||
return AIEngine.GetNameCompat0_7(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetCargoTypeCompat0_7 <- AIEngine.GetCargoType;
|
||||
AIEngine.GetCargoType <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return 255;
|
||||
return AIEngine.GetCargoTypeCompat0_7(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.CanRefitCargoCompat0_7 <- AIEngine.CanRefitCargo;
|
||||
AIEngine.CanRefitCargo <- function(engine_id, cargo_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return false;
|
||||
return AIEngine.CanRefitCargoCompat0_7(engine_id, cargo_id);
|
||||
}
|
||||
|
||||
AIEngine.CanPullCargoCompat0_7 <- AIEngine.CanPullCargo;
|
||||
AIEngine.CanPullCargo <- function(engine_id, cargo_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return false;
|
||||
return AIEngine.CanPullCargoCompat0_7(engine_id, cargo_id);
|
||||
}
|
||||
|
||||
AIEngine.GetCapacityCompat0_7 <- AIEngine.GetCapacity;
|
||||
AIEngine.GetCapacity <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetCapacityCompat0_7(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetReliabilityCompat0_7 <- AIEngine.GetReliability;
|
||||
AIEngine.GetReliability <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetReliabilityCompat0_7(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetMaxSpeedCompat0_7 <- AIEngine.GetMaxSpeed;
|
||||
AIEngine.GetMaxSpeed <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetMaxSpeedCompat0_7(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetPriceCompat0_7 <- AIEngine.GetPrice;
|
||||
AIEngine.GetPrice <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetPriceCompat0_7(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetMaxAgeCompat0_7 <- AIEngine.GetMaxAge;
|
||||
AIEngine.GetMaxAge <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetMaxAgeCompat0_7(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetRunningCostCompat0_7 <- AIEngine.GetRunningCost;
|
||||
AIEngine.GetRunningCost <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetRunningCostCompat0_7(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetPowerCompat0_7 <- AIEngine.GetPower;
|
||||
AIEngine.GetPower <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetPowerCompat0_7(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetWeightCompat0_7 <- AIEngine.GetWeight;
|
||||
AIEngine.GetWeight <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetWeightCompat0_7(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetMaxTractiveEffortCompat0_7 <- AIEngine.GetMaxTractiveEffort;
|
||||
AIEngine.GetMaxTractiveEffort <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetMaxTractiveEffortCompat0_7(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetDesignDateCompat0_7 <- AIEngine.GetDesignDate;
|
||||
AIEngine.GetDesignDate <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetDesignDateCompat0_7(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetVehicleTypeCompat0_7 <- AIEngine.GetVehicleType;
|
||||
AIEngine.GetVehicleType <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return AIVehicle.VT_INVALID;
|
||||
return AIEngine.GetVehicleTypeCompat0_7(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.IsWagonCompat0_7 <- AIEngine.IsWagon;
|
||||
AIEngine.IsWagon <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return false;
|
||||
return AIEngine.IsWagonCompat0_7(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.CanRunOnRailCompat0_7 <- AIEngine.CanRunOnRail;
|
||||
AIEngine.CanRunOnRail <- function(engine_id, track_rail_type)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return false;
|
||||
return AIEngine.CanRunOnRailCompat0_7(engine_id, track_rail_type);
|
||||
}
|
||||
|
||||
AIEngine.HasPowerOnRailCompat0_7 <- AIEngine.HasPowerOnRail;
|
||||
AIEngine.HasPowerOnRail <- function(engine_id, track_rail_type)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return false;
|
||||
return AIEngine.HasPowerOnRailCompat0_7(engine_id, track_rail_type);
|
||||
}
|
||||
|
||||
AIEngine.GetRoadTypeCompat0_7 <- AIEngine.GetRoadType;
|
||||
AIEngine.GetRoadType <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return AIRoad.ROADTYPE_INVALID;
|
||||
return AIEngine.GetRoadTypeCompat0_7(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetRailTypeCompat0_7 <- AIEngine.GetRailType;
|
||||
AIEngine.GetRailType <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return AIRail.RAILTYPE_INVALID;
|
||||
return AIEngine.GetRailTypeCompat0_7(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.IsArticulatedCompat0_7 <- AIEngine.IsArticulated;
|
||||
AIEngine.IsArticulated <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return false;
|
||||
return AIEngine.IsArticulatedCompat0_7(engine_id);
|
||||
}
|
||||
|
||||
AIEngine.GetPlaneTypeCompat0_7 <- AIEngine.GetPlaneType;
|
||||
AIEngine.GetPlaneType <- function(engine_id)
|
||||
{
|
||||
if (!AIEngine.IsBuildable(engine_id)) return -1;
|
||||
return AIEngine.GetPlaneTypeCompat0_7(engine_id);
|
||||
}
|
||||
|
||||
_AIWaypointList <- AIWaypointList;
|
||||
class AIWaypointList extends _AIWaypointList {
|
||||
constructor()
|
||||
{
|
||||
::_AIWaypointList.constructor(AIWaypoint.WAYPOINT_RAIL);
|
||||
}
|
||||
}
|
@@ -1,72 +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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.1 to 1.0. */
|
||||
|
||||
AIRoad.BuildRoadStationCompat1_0 <- AIRoad.BuildRoadStation;
|
||||
AIRoad.BuildRoadStation <- function(tile, front, road_veh_type, station_id)
|
||||
{
|
||||
if (AIRoad.IsRoadStationTile(tile) && AICompany.IsMine(AITile.GetOwner(tile))) return false;
|
||||
|
||||
return AIRoad.BuildRoadStationCompat1_0(tile, front, road_veh_type, station_id);
|
||||
}
|
||||
|
||||
AIRoad.BuildDriveThroughRoadStationCompat1_0 <- AIRoad.BuildDriveThroughRoadStation;
|
||||
AIRoad.BuildDriveThroughRoadStation <- function(tile, front, road_veh_type, station_id)
|
||||
{
|
||||
if (AIRoad.IsRoadStationTile(tile) && AICompany.IsMine(AITile.GetOwner(tile))) return false;
|
||||
|
||||
return AIRoad.BuildDriveThroughRoadStationCompat1_0(tile, front, road_veh_type, station_id);
|
||||
}
|
||||
|
||||
AIBridgeList.HasNext <-
|
||||
AIBridgeList_Length.HasNext <-
|
||||
AICargoList.HasNext <-
|
||||
AICargoList_IndustryAccepting.HasNext <-
|
||||
AICargoList_IndustryProducing.HasNext <-
|
||||
AIDepotList.HasNext <-
|
||||
AIEngineList.HasNext <-
|
||||
AIGroupList.HasNext <-
|
||||
AIIndustryList.HasNext <-
|
||||
AIIndustryList_CargoAccepting.HasNext <-
|
||||
AIIndustryList_CargoProducing.HasNext <-
|
||||
AIIndustryTypeList.HasNext <-
|
||||
AIList.HasNext <-
|
||||
AIRailTypeList.HasNext <-
|
||||
AISignList.HasNext <-
|
||||
AIStationList.HasNext <-
|
||||
AIStationList_Vehicle.HasNext <-
|
||||
AISubsidyList.HasNext <-
|
||||
AITileList.HasNext <-
|
||||
AITileList_IndustryAccepting.HasNext <-
|
||||
AITileList_IndustryProducing.HasNext <-
|
||||
AITileList_StationType.HasNext <-
|
||||
AITownList.HasNext <-
|
||||
AIVehicleList.HasNext <-
|
||||
AIVehicleList_DefaultGroup.HasNext <-
|
||||
AIVehicleList_Depot.HasNext <-
|
||||
AIVehicleList_Group.HasNext <-
|
||||
AIVehicleList_SharedOrders.HasNext <-
|
||||
AIVehicleList_Station.HasNext <-
|
||||
AIWaypointList.HasNext <-
|
||||
AIWaypointList_Vehicle.HasNext <-
|
||||
function()
|
||||
{
|
||||
return !this.IsEnd();
|
||||
}
|
||||
|
||||
AIIndustry.IsCargoAcceptedCompat1_0 <- AIIndustry.IsCargoAccepted;
|
||||
AIIndustry.IsCargoAccepted <- function(industry_id, cargo_id)
|
||||
{
|
||||
return AIIndustry.IsCargoAcceptedCompat1_0(industry_id, cargo_id) != AIIndustry.CAS_NOT_ACCEPTED;
|
||||
}
|
||||
|
||||
AIAbstractList <- AIList;
|
||||
|
||||
AIList.ChangeItem <- AIList.SetValue;
|
||||
|
||||
AIRail.ERR_NONUNIFORM_STATIONS_DISABLED <- 0xFFFF;
|
@@ -1,56 +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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.2 to 1.1. */
|
||||
|
||||
AICompany.GetCompanyValue <- function(company)
|
||||
{
|
||||
return AICompany.GetQuarterlyCompanyValue(company, AICompany.CURRENT_QUARTER);
|
||||
}
|
||||
|
||||
AITown.GetLastMonthTransported <- AITown.GetLastMonthSupplied;
|
||||
|
||||
AIEvent.AI_ET_INVALID <- AIEvent.ET_INVALID;
|
||||
AIEvent.AI_ET_TEST <- AIEvent.ET_TEST;
|
||||
AIEvent.AI_ET_SUBSIDY_OFFER <- AIEvent.ET_SUBSIDY_OFFER;
|
||||
AIEvent.AI_ET_SUBSIDY_OFFER_EXPIRED <- AIEvent.ET_SUBSIDY_OFFER_EXPIRED;
|
||||
AIEvent.AI_ET_SUBSIDY_AWARDED <- AIEvent.ET_SUBSIDY_AWARDED;
|
||||
AIEvent.AI_ET_SUBSIDY_EXPIRED <- AIEvent.ET_SUBSIDY_EXPIRED;
|
||||
AIEvent.AI_ET_ENGINE_PREVIEW <- AIEvent.ET_ENGINE_PREVIEW;
|
||||
AIEvent.AI_ET_COMPANY_NEW <- AIEvent.ET_COMPANY_NEW;
|
||||
AIEvent.AI_ET_COMPANY_IN_TROUBLE <- AIEvent.ET_COMPANY_IN_TROUBLE;
|
||||
AIEvent.AI_ET_COMPANY_ASK_MERGER <- AIEvent.ET_COMPANY_ASK_MERGER;
|
||||
AIEvent.AI_ET_COMPANY_MERGER <- AIEvent.ET_COMPANY_MERGER;
|
||||
AIEvent.AI_ET_COMPANY_BANKRUPT <- AIEvent.ET_COMPANY_BANKRUPT;
|
||||
AIEvent.AI_ET_VEHICLE_CRASHED <- AIEvent.ET_VEHICLE_CRASHED;
|
||||
AIEvent.AI_ET_VEHICLE_LOST <- AIEvent.ET_VEHICLE_LOST;
|
||||
AIEvent.AI_ET_VEHICLE_WAITING_IN_DEPOT <- AIEvent.ET_VEHICLE_WAITING_IN_DEPOT;
|
||||
AIEvent.AI_ET_VEHICLE_UNPROFITABLE <- AIEvent.ET_VEHICLE_UNPROFITABLE;
|
||||
AIEvent.AI_ET_INDUSTRY_OPEN <- AIEvent.ET_INDUSTRY_OPEN;
|
||||
AIEvent.AI_ET_INDUSTRY_CLOSE <- AIEvent.ET_INDUSTRY_CLOSE;
|
||||
AIEvent.AI_ET_ENGINE_AVAILABLE <- AIEvent.ET_ENGINE_AVAILABLE;
|
||||
AIEvent.AI_ET_STATION_FIRST_VEHICLE <- AIEvent.ET_STATION_FIRST_VEHICLE;
|
||||
AIEvent.AI_ET_DISASTER_ZEPPELINER_CRASHED <- AIEvent.ET_DISASTER_ZEPPELINER_CRASHED;
|
||||
AIEvent.AI_ET_DISASTER_ZEPPELINER_CLEARED <- AIEvent.ET_DISASTER_ZEPPELINER_CLEARED;
|
||||
AIEvent.AI_ET_TOWN_FOUNDED <- AIEvent.ET_TOWN_FOUNDED;
|
||||
AIOrder.AIOF_NONE <- AIOrder.OF_NONE
|
||||
AIOrder.AIOF_NON_STOP_INTERMEDIATE <- AIOrder.OF_NON_STOP_INTERMEDIATE
|
||||
AIOrder.AIOF_NON_STOP_DESTINATION <- AIOrder.OF_NON_STOP_DESTINATION
|
||||
AIOrder.AIOF_UNLOAD <- AIOrder.OF_UNLOAD
|
||||
AIOrder.AIOF_TRANSFER <- AIOrder.OF_TRANSFER
|
||||
AIOrder.AIOF_NO_UNLOAD <- AIOrder.OF_NO_UNLOAD
|
||||
AIOrder.AIOF_FULL_LOAD <- AIOrder.OF_FULL_LOAD
|
||||
AIOrder.AIOF_FULL_LOAD_ANY <- AIOrder.OF_FULL_LOAD_ANY
|
||||
AIOrder.AIOF_NO_LOAD <- AIOrder.OF_NO_LOAD
|
||||
AIOrder.AIOF_SERVICE_IF_NEEDED <- AIOrder.OF_SERVICE_IF_NEEDED
|
||||
AIOrder.AIOF_STOP_IN_DEPOT <- AIOrder.OF_STOP_IN_DEPOT
|
||||
AIOrder.AIOF_GOTO_NEAREST_DEPOT <- AIOrder.OF_GOTO_NEAREST_DEPOT
|
||||
AIOrder.AIOF_NON_STOP_FLAGS <- AIOrder.OF_NON_STOP_FLAGS
|
||||
AIOrder.AIOF_UNLOAD_FLAGS <- AIOrder.OF_UNLOAD_FLAGS
|
||||
AIOrder.AIOF_LOAD_FLAGS <- AIOrder.OF_LOAD_FLAGS
|
||||
AIOrder.AIOF_DEPOT_FLAGS <- AIOrder.OF_DEPOT_FLAGS
|
||||
AIOrder.AIOF_INVALID <- AIOrder.OF_INVALID
|
@@ -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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.11 to 1.10. */
|
@@ -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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 12 to 1.11. */
|
@@ -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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.3 to 1.2. */
|
@@ -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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.4 to 1.3. */
|
@@ -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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.5 to 1.4. */
|
@@ -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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.6 to 1.5. */
|
@@ -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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.7 to 1.6. */
|
@@ -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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.8 to 1.7. */
|
@@ -1,20 +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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.9 to 1.8. */
|
||||
|
||||
AIBridge.GetNameCompat1_8 <- AIBridge.GetName;
|
||||
AIBridge.GetName <- function(bridge_id)
|
||||
{
|
||||
return AIBridge.GetNameCompat1_8(bridge_id, AIVehicle.VT_RAIL);
|
||||
}
|
||||
|
||||
AIGroup.CreateGroupCompat1_8 <- AIGroup.CreateGroup;
|
||||
AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup.CreateGroupCompat1_8(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
@@ -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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.10 to 1.9. */
|
@@ -1,20 +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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 13 to 12. */
|
||||
|
||||
AIRoad.HasRoadTypeCompat12 <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad.HasRoadTypeCompat12(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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 14 to 13. */
|
@@ -1,46 +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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 15 to 14. */
|
||||
|
||||
AIBridge.GetBridgeID <- AIBridge.GetBridgeType;
|
||||
|
||||
class AICompat14 {
|
||||
function Text(text)
|
||||
{
|
||||
if (typeof text == "string") return text;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
AIBaseStation.SetNameCompat14 <- AIBaseStation.SetName;
|
||||
AIBaseStation.SetName <- function(id, name) { return AIBaseStation.SetNameCompat14(id, AICompat14.Text(name)); }
|
||||
|
||||
AICompany.SetNameCompat14 <- AICompany.SetName;
|
||||
AICompany.SetName <- function(name) { return AICompany.SetNameCompat14(AICompat14.Text(name)); }
|
||||
AICompany.SetPresidentNameCompat14 <- AICompany.SetPresidentName;
|
||||
AICompany.SetPresidentName <- function(name) { return AICompany.SetPresidentNameCompat14(AICompat14.Text(name)); }
|
||||
|
||||
AIGroup.SetNameCompat14 <- AIGroup.SetName;
|
||||
AIGroup.SetName <- function(id, name) { return AIGroup.SetNameCompat14(id, AICompat14.Text(name)); }
|
||||
|
||||
AISign.BuildSignCompat14 <- AISign.BuildSign;
|
||||
AISign.BuildSign <- function(id, name) { return AISign.BuildSignCompat14(id, AICompat14.Text(name)); }
|
||||
|
||||
AITown.FoundTownCompat14 <- AITown.FoundTown;
|
||||
AITown.FoundTown <- function(tile, size, city, layout, name) { return AITown.FoundTownCompat14(tile, size, city, layout, AICompat14.Text(name)); }
|
||||
|
||||
AIVehicle.SetNameCompat14 <- AIVehicle.SetName;
|
||||
AIVehicle.SetName <- function(id, name) { return AIVehicle.SetNameCompat14(id, AICompat14.Text(name)); }
|
||||
|
||||
AIObject.constructorCompat14 <- AIObject.constructor;
|
||||
foreach(name, object in CompatScriptRootTable) {
|
||||
if (type(object) != "class") continue;
|
||||
if (!object.rawin("constructor")) continue;
|
||||
if (object.constructor != AIObject.constructorCompat14) continue;
|
||||
object.constructor <- function() : (name) { AILog.Error("'" + name + "' is not instantiable"); }
|
||||
}
|
BIN
bin/data/chars.grf
Normal file
BIN
bin/data/chars.grf
Normal file
Binary file not shown.
BIN
bin/data/openttdd.grf
Normal file
BIN
bin/data/openttdd.grf
Normal file
Binary file not shown.
BIN
bin/data/openttdw.grf
Normal file
BIN
bin/data/openttdw.grf
Normal file
Binary file not shown.
BIN
bin/data/opntitle.dat
Normal file
BIN
bin/data/opntitle.dat
Normal file
Binary file not shown.
@@ -1,39 +0,0 @@
|
||||
set(GS_COMPAT_SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.2.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.3.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.4.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.5.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.6.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.7.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.8.nut
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compat_1.9.nut
|
||||
${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)
|
||||
string(REPLACE "${CMAKE_SOURCE_DIR}/bin/" "" GS_COMPAT_SOURCE_FILE_NAME "${GS_COMPAT_SOURCE_FILE}")
|
||||
string(CONCAT GS_COMPAT_BINARY_FILE "${CMAKE_BINARY_DIR}/" "${GS_COMPAT_SOURCE_FILE_NAME}")
|
||||
|
||||
add_custom_command(OUTPUT ${GS_COMPAT_BINARY_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${GS_COMPAT_SOURCE_FILE}
|
||||
${GS_COMPAT_BINARY_FILE}
|
||||
MAIN_DEPENDENCY ${GS_COMPAT_SOURCE_FILE}
|
||||
COMMENT "Copying ${GS_COMPAT_SOURCE_FILE_NAME}"
|
||||
)
|
||||
|
||||
list(APPEND GS_COMPAT_BINARY_FILES ${GS_COMPAT_BINARY_FILE})
|
||||
endforeach()
|
||||
|
||||
# Create a new target which copies all compat files
|
||||
add_custom_target(gs_compat_files
|
||||
DEPENDS ${GS_COMPAT_BINARY_FILES}
|
||||
)
|
||||
|
||||
add_dependencies(openttd
|
||||
gs_compat_files
|
||||
)
|
@@ -1,14 +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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.11 to 1.10. */
|
||||
|
||||
GSCompany.ChangeBankBalanceCompat1_10 <- GSCompany.ChangeBankBalance;
|
||||
GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany.ChangeBankBalanceCompat1_10(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
@@ -1,9 +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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 12 to 1.11. */
|
||||
|
@@ -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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.3 to 1.2. */
|
@@ -1,16 +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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.4 to 1.3. */
|
||||
|
||||
GSTown.SetGrowthRateCompat1_3 <- GSTown.SetGrowthRate;
|
||||
GSTown.SetGrowthRate <- function(town_id, days_between_town_growth)
|
||||
{
|
||||
/* Growth rate 0 caused resetting the custom growth rate. While this was undocumented, it was used nevertheless (ofc). */
|
||||
if (days_between_town_growth == 0) days_between_town_growth = GSTown.TOWN_GROWTH_NORMAL;
|
||||
return GSTown.SetGrowthRateCompat1_3(town_id, days_between_town_growth);
|
||||
}
|
@@ -1,14 +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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.5 to 1.4 */
|
||||
|
||||
GSNews.CreateCompat1_4 <- GSNews.Create;
|
||||
GSNews.Create <- function(type, text, company)
|
||||
{
|
||||
return GSNews.CreateCompat1_4(type, text, company, GSNews.NR_NONE, 0);
|
||||
}
|
@@ -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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.6 to 1.5. */
|
@@ -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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.7 to 1.6. */
|
@@ -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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.8 to 1.7. */
|
@@ -1,14 +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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.9 to 1.8. */
|
||||
|
||||
GSBridge.GetNameCompat1_8 <- GSBridge.GetName;
|
||||
GSBridge.GetName <- function(bridge_id)
|
||||
{
|
||||
return GSBridge.GetNameCompat1_8(bridge_id, GSVehicle.VT_RAIL);
|
||||
}
|
@@ -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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 1.10 to 1.9. */
|
@@ -1,20 +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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 13 to 12. */
|
||||
|
||||
GSRoad.HasRoadTypeCompat12 <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad.HasRoadTypeCompat12(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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 14 to 13. */
|
@@ -1,91 +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/>.
|
||||
*/
|
||||
|
||||
/* This file contains code to downgrade the API from 15 to 14. */
|
||||
|
||||
GSBridge.GetBridgeID <- GSBridge.GetBridgeType;
|
||||
|
||||
/* Emulate old GSText parameter padding behaviour */
|
||||
GSText.SCRIPT_TEXT_MAX_PARAMETERS <- 20;
|
||||
|
||||
class GSCompat14 {
|
||||
function Text(text)
|
||||
{
|
||||
if (typeof text == "string") return text;
|
||||
if (typeof text == "instance" && text instanceof GSText) return text;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
GSBaseStation.SetNameCompat14 <- GSBaseStation.SetName;
|
||||
GSBaseStation.SetName <- function(id, name) { return GSBaseStation.SetNameCompat14(id, GSCompat14.Text(name)); }
|
||||
|
||||
GSCompany.SetNameCompat14 <- GSCompany.SetName;
|
||||
GSCompany.SetName <- function(name) { return GSCompany.SetNameCompat14(GSCompat14.Text(name)); }
|
||||
GSCompany.SetPresidentNameCompat14 <- GSCompany.SetPresidentName;
|
||||
GSCompany.SetPresidentName <- function(name) { return GSCompany.SetPresidentNameCompat14(GSCompat14.Text(name)); }
|
||||
|
||||
GSGoal.NewCompat14 <- GSGoal.New;
|
||||
GSGoal.New <- function(company, goal, type, dest) { return GSGoal.NewCompat14(company, GSCompat14.Text(goal), type, dest); }
|
||||
GSGoal.SetTextCompat14 <- GSGoal.SetText;
|
||||
GSGoal.SetText <- function(id, goal) { return GSGoal.SetTextCompat14(id, GSCompat14.Text(goal)); }
|
||||
GSGoal.SetProgressCompat14 <- GSGoal.SetProgress;
|
||||
GSGoal.SetProgress <- function(id, progress) { return GSGoal.SetProgressCompat14(id, GSCompat14.Text(progress)); }
|
||||
GSGoal.QuestionCompat14 <- GSGoal.Question;
|
||||
GSGoal.Question <- function(id, company, question, type, buttons) { return GSGoal.QuestionCompat14(id, company, GSCompat14.Text(question), type, buttons); }
|
||||
GSGoal.QuestionClientCompat14 <- GSGoal.QuestionClient;
|
||||
GSGoal.QuestionClient <- function(id, target, is_client, question, type, buttons) { return GSGoal.QuestionClientCompat14(id, target, is_client, GSCompat14.Text(question), type, buttons); }
|
||||
|
||||
GSGroup.SetNameCompat14 <- GSGroup.SetName;
|
||||
GSGroup.SetName <- function(id, name) { return GSGroup.SetNameCompat14(id, GSCompat14.Text(name)); }
|
||||
|
||||
GSIndustry.SetTextCompat14 <- GSIndustry.SetText;
|
||||
GSIndustry.SetText <- function(id, text) { return GSIndustry.SetTextCompat14(id, GSCompat14.Text(text)); }
|
||||
GSIndustry.SetProductionLevelCompat14 <- GSIndustry.SetProductionLevel;
|
||||
GSIndustry.SetProductionLevel <- function(id, level, news, text) { return GSIndustry.SetProductionLevelCompat14(id, level, news, GSCompat14.Text(text)); }
|
||||
|
||||
GSLeagueTable.NewCompat14 <- GSLeagueTable.New;
|
||||
GSLeagueTable.New <- function(title, header, footer) { return GSLeagueTable.NewCompat14(GSCompat14.Text(title), GSCompat14.Text(header), GSCompat14.Text(footer)); }
|
||||
GSLeagueTable.NewElementCompat14 <- GSLeagueTable.NewElement;
|
||||
GSLeagueTable.NewElement <- function(table, rating, company, text, score, type, target) { return GSLeagueTable.NewElementCompat14(table, rating, company, GSCompat14.Text(text), GSCompat14.Text(score), type, target); }
|
||||
GSLeagueTable.UpdateElementDataCompat14 <- GSLeagueTable.UpdateElementData;
|
||||
GSLeagueTable.UpdateElementData <- function(element, company, text, type, target) { return GSLeagueTable.UpdateElementDataCompat14(element, company, GSCompat14.Text(text), type, target); }
|
||||
GSLeagueTable.UpdateElementScoreCompat14 <- GSLeagueTable.UpdateElementScore;
|
||||
GSLeagueTable.UpdateElementScore <- function(element, rating, score) { return GSLeagueTable.UpdateElementScoreCompat14(element, rating, GSCompat14.Text(score)); }
|
||||
|
||||
GSNews.CreateCompat14 <- GSNews.Create;
|
||||
GSNews.Create <- function(type, text, company, ref_type, ref) { return GSNews.CreateCompat14(type, GSCompat14.Text(text), company, ref_type, ref); }
|
||||
|
||||
GSSign.BuildSignCompat14 <- GSSign.BuildSign;
|
||||
GSSign.BuildSign <- function(id, name) { return GSSign.BuildSignCompat14(id, GSCompat14.Text(name)); }
|
||||
|
||||
GSStoryPage.NewCompat14 <- GSStoryPage.New;
|
||||
GSStoryPage.New <- function(company, title) { return GSStoryPage.NewCompat14(company, GSCompat14.Text(title)); }
|
||||
GSStoryPage.NewElementCompat14 <- GSStoryPage.NewElement;
|
||||
GSStoryPage.NewElement <- function(page, type, ref, text) { return GSStoryPage.NewElementCompat14(page, type, ref, GSCompat14.Text(text)); }
|
||||
GSStoryPage.UpdateElementCompat14 <- GSStoryPage.UpdateElement;
|
||||
GSStoryPage.UpdateElement <- function(id, ref, text) { return GSStoryPage.UpdateElementCompat14(id, ref, GSCompat14.Text(text)); }
|
||||
GSStoryPage.SetTitleCompat14 <- GSStoryPage.SetTitle;
|
||||
GSStoryPage.SetTitle <- function(page, tile) { return GSStoryPage.SetTitleCompat14(page, GSCompat14.Text(title)); }
|
||||
|
||||
GSTown.SetNameCompat14 <- GSTown.SetName;
|
||||
GSTown.SetName <- function(id, name) { return GSTown.SetNameCompat14(id, GSCompat14.Text(name)); }
|
||||
GSTown.SetTextCompat14 <- GSTown.SetText;
|
||||
GSTown.SetText <- function(id, text) { return GSTown.SetTextCompat14(id, GSCompat14.Text(text)); }
|
||||
GSTown.FoundTownCompat14 <- GSTown.FoundTown;
|
||||
GSTown.FoundTown <- function(tile, size, city, layout, name) { return GSTown.FoundTownCompat14(tile, size, city, layout, GSCompat14.Text(name)); }
|
||||
|
||||
GSVehicle.SetNameCompat14 <- GSVehicle.SetName;
|
||||
GSVehicle.SetName <- function(id, name) { return GSVehicle.SetNameCompat14(id, GSCompat14.Text(name)); }
|
||||
|
||||
GSObject.constructorCompat14 <- GSObject.constructor;
|
||||
foreach(name, object in CompatScriptRootTable) {
|
||||
if (type(object) != "class") continue;
|
||||
if (!object.rawin("constructor")) continue;
|
||||
if (object.constructor != GSObject.constructorCompat14) continue;
|
||||
object.constructor <- function() : (name) { GSLog.Error("'" + name + "' is not instantiable"); }
|
||||
}
|
4
bin/scenario/README
Normal file
4
bin/scenario/README
Normal file
@@ -0,0 +1,4 @@
|
||||
You can place you scenarios in this dir.
|
||||
|
||||
This file is really here to make the Makefile happy, it should be modified to
|
||||
properly handle scenarios (or maybe even not at all...).
|
@@ -1,2 +0,0 @@
|
||||
start_ai MyAI
|
||||
|
@@ -1,2 +0,0 @@
|
||||
# Show a MOTD
|
||||
say "Welcome..."
|
@@ -10,8 +10,6 @@ local scripts:
|
||||
should be used to set client optimization settings:
|
||||
- 'on_client.scr' is executed when you join a server [all clients]
|
||||
|
||||
- 'on_server_connect.scr' is executed on the server when a client has joined (MOTD)
|
||||
|
||||
should be used to set the servers port/ip and/or server optimization settings/patches:
|
||||
- 'pre_server.scr' is executed before the servers tcp stack is started [in-game only]
|
||||
- 'pre_dedicated.scr' is executed before the servers tcp stack is started [dedicated only]
|
||||
|
7505
changelog.md
7505
changelog.md
File diff suppressed because it is too large
Load Diff
1810
changelog.txt
Normal file
1810
changelog.txt
Normal file
File diff suppressed because it is too large
Load Diff
99
cmake/3rdparty/llvm/CheckAtomic.cmake
vendored
99
cmake/3rdparty/llvm/CheckAtomic.cmake
vendored
@@ -1,99 +0,0 @@
|
||||
#
|
||||
# This was originally part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
# See (https://llvm.org/)LICENSE.txt for license information.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
#
|
||||
# Modifications have been made to suit building OpenTTD.
|
||||
#
|
||||
|
||||
# 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 requires the C-compiler as the atomic functions are built-in declared.
|
||||
enable_language(C)
|
||||
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 requires the C-compiler as the atomic functions are built-in declared.
|
||||
enable_language(C)
|
||||
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()
|
279
cmake/3rdparty/llvm/LICENSE.txt
vendored
279
cmake/3rdparty/llvm/LICENSE.txt
vendored
@@ -1,279 +0,0 @@
|
||||
==============================================================================
|
||||
The LLVM Project is under the Apache License v2.0 with LLVM Exceptions:
|
||||
==============================================================================
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
---- LLVM Exceptions to the Apache 2.0 License ----
|
||||
|
||||
As an exception, if, as a result of your compiling your source code, portions
|
||||
of this Software are embedded into an Object form of such source code, you
|
||||
may redistribute such embedded portions in such Object form without complying
|
||||
with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
|
||||
|
||||
In addition, if you combine or link compiled forms of this Software with
|
||||
software that is licensed under the GPLv2 ("Combined Software") and if a
|
||||
court of competent jurisdiction determines that the patent provision (Section
|
||||
3), the indemnity provision (Section 9) or other Section of the License
|
||||
conflicts with the conditions of the GPLv2, you may retroactively and
|
||||
prospectively choose to deem waived or otherwise exclude such Section(s) of
|
||||
the License, but only in their entirety and only with respect to the Combined
|
||||
Software.
|
||||
|
||||
==============================================================================
|
||||
Software from third parties included in the LLVM Project:
|
||||
==============================================================================
|
||||
The LLVM Project contains third party software which is under different license
|
||||
terms. All such code will be identified clearly using at least one of two
|
||||
mechanisms:
|
||||
1) It will be in a separate directory tree with its own `LICENSE.txt` or
|
||||
`LICENSE` file at the top containing the specific license and restrictions
|
||||
which apply to that software, or
|
||||
2) It will contain specific license and restriction terms at the top of every
|
||||
file.
|
||||
|
||||
==============================================================================
|
||||
Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy):
|
||||
==============================================================================
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
|
||||
Copyright (c) 2003-2019 University of Illinois at Urbana-Champaign.
|
||||
All rights reserved.
|
||||
|
||||
Developed by:
|
||||
|
||||
LLVM Team
|
||||
|
||||
University of Illinois at Urbana-Champaign
|
||||
|
||||
http://llvm.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal with
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimers.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimers in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the names of the LLVM Team, University of Illinois at
|
||||
Urbana-Champaign, nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this Software without specific
|
||||
prior written permission.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
||||
SOFTWARE.
|
||||
|
@@ -1,145 +0,0 @@
|
||||
macro(_parse_arguments_with_multi_hack ORIGINAL_COMMAND_LINE)
|
||||
# cmake_parse_arguments() put all the MULTIS in a single variable; you
|
||||
# lose the ability to see for example multiple COMMANDs. To be able to
|
||||
# passthrough multiple MULTIS, we add a marker after every MULTI. This
|
||||
# allows us to reassemble the correct amount again before giving it to
|
||||
# the wrapped command with _reassemble_command_line().
|
||||
|
||||
set(COMMAND_LINE "${ORIGINAL_COMMAND_LINE}")
|
||||
|
||||
foreach(MULTI IN LISTS MULTIS)
|
||||
string(REPLACE "${MULTI}" "${MULTI};:::" COMMAND_LINE "${COMMAND_LINE}")
|
||||
endforeach()
|
||||
|
||||
cmake_parse_arguments(PARAM "${OPTIONS}" "${SINGLES}" "${MULTIS}" ${COMMAND_LINE})
|
||||
endmacro()
|
||||
|
||||
macro(_reassemble_command_line)
|
||||
# Reassemble the command line as we original got it.
|
||||
set(NEW_COMMAND_LINE ${PARAM_UNPARSED_ARGUMENTS})
|
||||
|
||||
foreach(OPTION IN LISTS OPTIONS)
|
||||
if(PARAM_${OPTION})
|
||||
list(APPEND NEW_COMMAND_LINE "${OPTION}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach(SINGLE IN LISTS SINGLES)
|
||||
if(PARAM_${SINGLE})
|
||||
list(APPEND NEW_COMMAND_LINE "${SINGLE}" "${PARAM_${SINGLE}}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach(MULTI IN LISTS MULTIS)
|
||||
if(PARAM_${MULTI})
|
||||
# Replace our special marker with the name of the MULTI again. This
|
||||
# restores for example multiple COMMANDs again.
|
||||
string(REPLACE ":::" "${MULTI}" PARAM_${MULTI} "${PARAM_${MULTI}}")
|
||||
list(APPEND NEW_COMMAND_LINE "${PARAM_${MULTI}}")
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# Generated files can be older than their dependencies, causing useless
|
||||
# regenerations. This function replaces each file in OUTPUT with a .timestamp
|
||||
# file, adds a command to touch it and move the original file in BYPRODUCTS,
|
||||
# before calling add_custom_command().
|
||||
#
|
||||
# Note: Any add_custom_target() depending on files in original OUTPUT must use
|
||||
# add_custom_target_timestamp() instead to have the correct dependencies.
|
||||
#
|
||||
# add_custom_command_timestamp(OUTPUT output1 [output2 ...]
|
||||
# COMMAND command1 [ARGS] [args1...]
|
||||
# [COMMAND command2 [ARGS] [args2...] ...]
|
||||
# [MAIN_DEPENDENCY depend]
|
||||
# [DEPENDS [depends...]]
|
||||
# [BYPRODUCTS [files...]]
|
||||
# [IMPLICIT_DEPENDS <lang1> depend1
|
||||
# [<lang2> depend2] ...]
|
||||
# [WORKING_DIRECTORY dir]
|
||||
# [COMMENT comment]
|
||||
# [VERBATIM] [APPEND] [USES_TERMINAL])
|
||||
function(add_custom_command_timestamp)
|
||||
set(OPTIONS VERBATIM APPEND USES_TERMINAL)
|
||||
set(SINGLES MAIN_DEPENDENCY WORKING_DIRECTORY COMMENT)
|
||||
set(MULTIS OUTPUT COMMAND DEPENDS BYPRODUCTS IMPLICIT_DEPENDS)
|
||||
|
||||
_parse_arguments_with_multi_hack("${ARGN}")
|
||||
|
||||
# Create a list of all the OUTPUTs (by removing our magic marker)
|
||||
string(REPLACE ":::;" "" OUTPUTS "${PARAM_OUTPUT}")
|
||||
|
||||
# Reset the OUTPUT and BYPRODUCTS as an empty list (if needed).
|
||||
# Because they are MULTIS, we need to add our special marker here.
|
||||
set(PARAM_OUTPUT ":::")
|
||||
if(NOT PARAM_BYPRODUCTS)
|
||||
set(PARAM_BYPRODUCTS ":::")
|
||||
endif()
|
||||
|
||||
foreach(OUTPUT IN LISTS OUTPUTS)
|
||||
# For every output, we add a 'cmake -E touch' entry to update the
|
||||
# timestamp on each run.
|
||||
get_filename_component(OUTPUT_FILENAME ${OUTPUT} NAME)
|
||||
string(APPEND PARAM_COMMAND ";:::;${CMAKE_COMMAND};-E;touch;${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILENAME}.timestamp")
|
||||
|
||||
# We change the OUTPUT to a '.timestamp' variant, and make the real
|
||||
# output a byproduct.
|
||||
list(APPEND PARAM_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILENAME}.timestamp)
|
||||
list(APPEND PARAM_BYPRODUCTS ${OUTPUT})
|
||||
|
||||
# Mark this file as being a byproduct; we use this again with
|
||||
# add_custom_target_timestamp() to know if we should point to the
|
||||
# '.timestamp' variant or not.
|
||||
set_source_files_properties(${OUTPUT} PROPERTIES BYPRODUCT ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILENAME}.timestamp)
|
||||
endforeach()
|
||||
|
||||
# Reassemble and call the wrapped command
|
||||
_reassemble_command_line()
|
||||
add_custom_command(${NEW_COMMAND_LINE})
|
||||
endfunction()
|
||||
|
||||
# Generated files can be older than their dependencies, causing useless
|
||||
# regenerations. This function adds a .timestamp file for each file in DEPENDS
|
||||
# replaced by add_custom_command_timestamp(), before calling add_custom_target().
|
||||
#
|
||||
# add_custom_target_timestamp(Name [ALL] [command1 [args1...]]
|
||||
# [COMMAND command2 [args2...] ...]
|
||||
# [DEPENDS depend depend depend ... ]
|
||||
# [BYPRODUCTS [files...]]
|
||||
# [WORKING_DIRECTORY dir]
|
||||
# [COMMENT comment]
|
||||
# [VERBATIM] [USES_TERMINAL]
|
||||
# [SOURCES src1 [src2...]])
|
||||
function(add_custom_target_timestamp)
|
||||
set(OPTIONS VERBATIM USES_TERMINAL)
|
||||
set(SINGLES WORKING_DIRECTORY COMMENT)
|
||||
set(MULTIS COMMAND DEPENDS BYPRODUCTS SOURCES)
|
||||
# ALL is missing, as the order is important here. It will be picked up
|
||||
# by ${PARAM_UNPARSED_ARGUMENTS} when reassembling the command line.
|
||||
|
||||
_parse_arguments_with_multi_hack("${ARGN}")
|
||||
|
||||
# Create a list of all the DEPENDs (by removing our magic marker)
|
||||
string(REPLACE ":::;" "" DEPENDS "${PARAM_DEPENDS}")
|
||||
|
||||
# Reset the DEPEND as an empty list.
|
||||
# Because it is a MULTI, we need to add our special marker here.
|
||||
set(PARAM_DEPENDS ":::")
|
||||
|
||||
foreach(DEPEND IN LISTS DEPENDS)
|
||||
# Check if the output is produced by add_custom_command_timestamp()
|
||||
get_source_file_property(BYPRODUCT ${DEPEND} BYPRODUCT)
|
||||
|
||||
if(BYPRODUCT STREQUAL "NOTFOUND")
|
||||
# If it is not, just keep it as DEPEND
|
||||
list(APPEND PARAM_DEPENDS "${DEPEND}")
|
||||
else()
|
||||
# If it is, the BYPRODUCT property points to the timestamp we want to depend on
|
||||
list(APPEND PARAM_DEPENDS "${BYPRODUCT}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Reassemble and call the wrapped command
|
||||
_reassemble_command_line()
|
||||
add_custom_target(${NEW_COMMAND_LINE})
|
||||
endfunction()
|
@@ -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,156 +0,0 @@
|
||||
# Macro which contains all bits to setup the compile flags correctly.
|
||||
#
|
||||
# compile_flags()
|
||||
#
|
||||
macro(compile_flags)
|
||||
if(MSVC)
|
||||
# "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)
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
add_compile_options(
|
||||
/Zc:preprocessor # Needed for __VA_OPT__() in macros.
|
||||
/MP # Enable multi-threaded compilation.
|
||||
/FC # Display the full path of source code files passed to the compiler in diagnostics.
|
||||
)
|
||||
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(
|
||||
"$<$<CONFIG:Debug>:-D_DEBUG>"
|
||||
"$<$<NOT:$<CONFIG:Debug>>:-D_FORTIFY_SOURCE=2>" # FORTIFY_SOURCE should only be used in non-debug builds (requires -O1+)
|
||||
)
|
||||
if(MINGW)
|
||||
add_link_options(
|
||||
"$<$<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, ...)
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Prepare a generator that checks if we are not a debug, and don't have asserts
|
||||
# on. We need this later on to set some compile options for stable releases.
|
||||
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()
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
add_compile_options(
|
||||
-Wno-multichar
|
||||
)
|
||||
endif()
|
||||
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
|
||||
-Wall
|
||||
-Wcast-qual
|
||||
-Wextra
|
||||
-Wsign-compare
|
||||
-Wundef
|
||||
-Wpointer-arith
|
||||
-Wwrite-strings
|
||||
-Wredundant-decls
|
||||
-Wformat-security
|
||||
-Wformat=2
|
||||
-Winit-self
|
||||
-Wnon-virtual-dtor
|
||||
-Wsuggest-override
|
||||
|
||||
# We use 'ABCD' multichar for SaveLoad chunks identifiers
|
||||
-Wno-multichar
|
||||
|
||||
# Prevent optimisation supposing enums are in a range specified by the standard
|
||||
# For details, see http://gcc.gnu.org/PR43680 and PR#5246.
|
||||
-fno-strict-enums
|
||||
)
|
||||
|
||||
# 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
|
||||
# coloured output, but since that might yield odd results with
|
||||
# IDEs, we extract it to an option.
|
||||
if(OPTION_FORCE_COLORED_OUTPUT)
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
add_compile_options (-fdiagnostics-color=always)
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
add_compile_options (-fcolor-diagnostics)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
include(CheckCXXCompilerFlag)
|
||||
check_cxx_compiler_flag("-flifetime-dse=1" LIFETIME_DSE_FOUND)
|
||||
|
||||
add_compile_options(
|
||||
# GCC 4.2+ automatically assumes that signed overflows do
|
||||
# not occur in signed arithmetics, whereas we are not
|
||||
# sure that they will not happen. It furthermore complains
|
||||
# about its own optimized code in some places.
|
||||
"-fno-strict-overflow"
|
||||
|
||||
# -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()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
if (NOT CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
|
||||
include(CheckCXXCompilerFlag)
|
||||
check_cxx_compiler_flag("-mno-sse4" NO_SSE4_FOUND)
|
||||
|
||||
if(NO_SSE4_FOUND)
|
||||
add_compile_options(
|
||||
# Don't use SSE4 for general sources to increase compatibility.
|
||||
-mno-sse4
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||
add_compile_options(
|
||||
-Wall
|
||||
# warning #873: function ... ::operator new ... has no corresponding operator delete ...
|
||||
-wd873
|
||||
# warning #1292: unknown attribute "fallthrough"
|
||||
-wd1292
|
||||
# warning #1899: multicharacter character literal (potential portability problem)
|
||||
-wd1899
|
||||
# warning #2160: anonymous union qualifier is ignored
|
||||
-wd2160
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR "No warning flags are set for this compiler yet; please consider creating a Pull Request to add support for this compiler.")
|
||||
endif()
|
||||
|
||||
if(NOT WIN32 AND NOT HAIKU)
|
||||
# rdynamic is used to get useful stack traces from crash reports.
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic")
|
||||
endif()
|
||||
endmacro()
|
@@ -1,48 +0,0 @@
|
||||
# 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 ...)
|
||||
#
|
||||
function(create_grf_command)
|
||||
cmake_parse_arguments(GRF "" "" "NFO_SOURCE_FILES;PNG_SOURCE_FILES" ${ARGN})
|
||||
|
||||
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)
|
||||
|
||||
# Copy over all the PNG files to the correct folder
|
||||
foreach(GRF_PNG_SOURCE_FILE IN LISTS GRF_PNG_SOURCE_FILES)
|
||||
get_filename_component(GRF_PNG_SOURCE_FILE_NAME "${GRF_PNG_SOURCE_FILE}" NAME)
|
||||
set(GRF_PNG_BINARY_FILE "${CMAKE_CURRENT_BINARY_DIR}/sprites/${GRF_PNG_SOURCE_FILE_NAME}")
|
||||
|
||||
add_custom_command(OUTPUT ${GRF_PNG_BINARY_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${GRF_PNG_SOURCE_FILE}
|
||||
${GRF_PNG_BINARY_FILE}
|
||||
MAIN_DEPENDENCY ${GRF_PNG_SOURCE_FILE}
|
||||
COMMENT "Copying ${GRF_PNG_SOURCE_FILE_NAME} sprite file"
|
||||
)
|
||||
|
||||
list(APPEND GRF_PNG_BINARY_FILES ${GRF_PNG_BINARY_FILE})
|
||||
endforeach()
|
||||
|
||||
add_custom_command(OUTPUT ${GRF_BINARY_FILE} ${GRF_BINARY_FILE}.hash
|
||||
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}
|
||||
${GRF_NFO_SOURCE_FILES}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Generating ${GRF_SOURCE_FOLDER_NAME}.grf"
|
||||
)
|
||||
|
||||
# For conviance, if you want to only test building the GRF
|
||||
add_custom_target(${GRF_SOURCE_FOLDER_NAME}.grf
|
||||
DEPENDS
|
||||
${GRF_BINARY_FILE}
|
||||
)
|
||||
endfunction()
|
@@ -1,58 +0,0 @@
|
||||
# Macro which contains all bits and pieces to create the regression tests.
|
||||
# This creates both a standalone target 'regression', and it integrates with
|
||||
# 'ctest'. The first is prefered, as it is more verbose, and takes care of
|
||||
# dependencies correctly.
|
||||
#
|
||||
# create_regression(file1 ...)
|
||||
#
|
||||
macro(create_regression)
|
||||
set(REGRESSION_SOURCE_FILES ${ARGN})
|
||||
|
||||
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}")
|
||||
|
||||
add_custom_command(OUTPUT ${REGRESSION_BINARY_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${REGRESSION_SOURCE_FILE}
|
||||
${REGRESSION_BINARY_FILE}
|
||||
MAIN_DEPENDENCY ${REGRESSION_SOURCE_FILE}
|
||||
COMMENT "Copying ${REGRESSION_SOURCE_FILE_NAME} regression file"
|
||||
)
|
||||
|
||||
list(APPEND REGRESSION_BINARY_FILES ${REGRESSION_BINARY_FILE})
|
||||
endforeach()
|
||||
|
||||
get_filename_component(REGRESSION_TEST_NAME "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
|
||||
|
||||
# Create a new target which copies regression files
|
||||
add_custom_target(regression_${REGRESSION_TEST_NAME}_files
|
||||
DEPENDS
|
||||
${REGRESSION_BINARY_FILES}
|
||||
)
|
||||
|
||||
add_dependencies(regression_files regression_${REGRESSION_TEST_NAME}_files)
|
||||
|
||||
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}"
|
||||
)
|
||||
|
||||
# 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}
|
||||
)
|
||||
|
||||
add_dependencies(regression regression_${REGRESSION_TEST_NAME})
|
||||
endmacro()
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user