From 7b000d1c4da6b324eead10bb9cfddf72e48b005c Mon Sep 17 00:00:00 2001 From: Spartan322 Date: Sun, 22 Dec 2024 23:26:14 -0500 Subject: [PATCH] Add pre-commit configuration file Add typos checks and corrections Add static check github action Add clang-tidy corrections Use optional initialization for PROPERTY macros --- .clang-tidy | 19 ++ .github/ISSUE_TEMPLATE/1-bug-report.yml | 2 +- ...pency.yml => 2-victoria-2-discrepancy.yml} | 22 +- .../3-gameplay-feature-request.yml | 4 +- .../ISSUE_TEMPLATE/4-mod-feature-request.yml | 2 +- .github/workflows/builds.yml | 40 ++- .pre-commit-config.yaml | 73 +++++ docs/contribution/cloning.md | 2 +- docs/contribution/rebasing.md | 2 +- docs/dataloading-architecture.md | 2 +- docs/simulation/calculations.yaml | 2 +- docs/styleguide-cpp.md | 6 +- extension/deps/openvic-simulation | 2 +- extension/doc_classes/GameSingleton.xml | 18 +- extension/doc_tools/class.xsd | 310 ++++++++++++++++++ extension/doc_tools/make_rst.py | 4 +- extension/doc_tools/patches/make_rst.patch | 4 +- .../classes/GFXButtonStateTexture.cpp | 6 +- .../classes/GFXButtonStateTexture.hpp | 2 +- .../classes/GFXMaskedFlagTexture.cpp | 2 +- .../classes/GFXMaskedFlagTexture.hpp | 6 +- .../classes/GFXPieChartTexture.cpp | 2 +- .../classes/GFXPieChartTexture.hpp | 6 +- .../classes/GFXSpriteTexture.cpp | 3 +- .../classes/GFXSpriteTexture.hpp | 8 +- .../openvic-extension/classes/GUIButton.cpp | 2 +- .../openvic-extension/classes/GUILabel.cpp | 27 +- .../openvic-extension/classes/GUILabel.hpp | 10 +- .../openvic-extension/classes/GUIListBox.cpp | 4 +- .../openvic-extension/classes/GUIListBox.hpp | 4 +- .../classes/GUIOverlappingElementsBox.cpp | 3 +- .../classes/GUIOverlappingElementsBox.hpp | 6 +- .../openvic-extension/classes/GUIPieChart.cpp | 2 +- .../openvic-extension/classes/GUIPieChart.hpp | 2 +- .../classes/GUIProgressBar.cpp | 2 +- .../classes/GUIScrollbar.cpp | 2 +- .../classes/GUIScrollbar.hpp | 28 +- .../classes/GUITextureRect.cpp | 2 +- .../singletons/AssetManager.hpp | 4 +- .../singletons/CursorSingleton.cpp | 6 +- .../singletons/GameSingleton.cpp | 3 - .../singletons/GameSingleton.hpp | 6 +- .../singletons/LoadLocalisation.cpp | 6 +- .../singletons/MapItemSingleton.cpp | 4 +- .../singletons/MenuSingleton.cpp | 2 +- .../singletons/PopulationMenu.cpp | 6 +- .../singletons/SoundSingleton.cpp | 8 +- .../src/openvic-extension/utility/UITools.cpp | 8 +- game/assets/localisation/README.md | 2 +- game/assets/localisation/quotes.txt | 4 +- game/src/Game/GameSession/BillboardManager.gd | 4 +- game/src/Game/GameSession/GameSessionMenu.gd | 2 +- game/src/Game/Model/XACLoader.gd | 2 +- game/src/Game/MusicConductor/MusicPlayer.gd | 4 +- game/src/Game/MusicConductor/MusicPlayer.tscn | 4 +- pyproject.toml | 44 +++ 56 files changed, 614 insertions(+), 148 deletions(-) create mode 100644 .clang-tidy rename .github/ISSUE_TEMPLATE/{2-victoria-2-discrepency.yml => 2-victoria-2-discrepancy.yml} (75%) create mode 100644 .pre-commit-config.yaml create mode 100644 extension/doc_tools/class.xsd create mode 100644 pyproject.toml diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 00000000..02d21a5b --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,19 @@ +Checks: + - -* + - cppcoreguidelines-pro-type-member-init + - modernize-redundant-void-arg + - modernize-use-bool-literals + - modernize-use-default-member-init + - modernize-use-nullptr + - readability-braces-around-statements + - readability-redundant-member-init +HeaderFileExtensions: ['', h, hh, hpp, hxx, inc] +ImplementationFileExtensions: [c, cc, cpp, cxx] +HeaderFilterRegex: (extension/src/openvic-extension)/ +FormatStyle: file +CheckOptions: + cppcoreguidelines-pro-type-member-init.IgnoreArrays: true + cppcoreguidelines-pro-type-member-init.UseAssignment: true + modernize-use-bool-literals.IgnoreMacros: false + modernize-use-default-member-init.IgnoreMacros: false + modernize-use-default-member-init.UseAssignment: true \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/1-bug-report.yml b/.github/ISSUE_TEMPLATE/1-bug-report.yml index ed65db16..9eaa191e 100644 --- a/.github/ISSUE_TEMPLATE/1-bug-report.yml +++ b/.github/ISSUE_TEMPLATE/1-bug-report.yml @@ -8,7 +8,7 @@ body: Thank you for filling out this bug report! When reporting a bug, please follow the guidelines in this template. This helps us quickly identify the problem you're having. - - If this report is about a feature or behavior in Victoria II that is missing or working incorrectly in OpenVic, please report a [Victoria II discrepency](https://github.com/OpenVicProject/OpenVic/issues/new?assignees=&labels=&projects=&template=2-victoria-2-discrepency.yml) instead. + - If this report is about a feature or behavior in Victoria II that is missing or working incorrectly in OpenVic, please report a [Victoria II discrepancy](https://github.com/OpenVicProject/OpenVic/issues/new?assignees=&labels=&projects=&template=2-victoria-2-discrepancy.yml) instead. - Write a descriptive issue title above. - **Always open *one* issue for *one* bug**. If you notice several bugs, make sure to create one new issue for each of them. - Verify that you are using either the latest release or the latest commit. It is preferred that you check if your issue is reproducible in the latest commit - it may already have been fixed! diff --git a/.github/ISSUE_TEMPLATE/2-victoria-2-discrepency.yml b/.github/ISSUE_TEMPLATE/2-victoria-2-discrepancy.yml similarity index 75% rename from .github/ISSUE_TEMPLATE/2-victoria-2-discrepency.yml rename to .github/ISSUE_TEMPLATE/2-victoria-2-discrepancy.yml index e56b91ee..1b969749 100644 --- a/.github/ISSUE_TEMPLATE/2-victoria-2-discrepency.yml +++ b/.github/ISSUE_TEMPLATE/2-victoria-2-discrepancy.yml @@ -1,26 +1,26 @@ -name: Victoria II Discrepency -description: "Report a discrepency from Victoria II. NOTE: Not for reporting bugs in OpenVic." -labels: ["bug", "victoria 2 discrepency", "needs triage"] +name: Victoria II Discrepancy +description: "Report a discrepancy from Victoria II. NOTE: Not for reporting bugs in OpenVic." +labels: ["bug", "victoria 2 discrepancy", "needs triage"] body: - type: markdown attributes: value: | - Thank you for filling out this discrepency report! + Thank you for filling out this discrepancy report! - When reporting a bug, please follow the guidelines in this template. This helps us quickly identify the discrepency and get to work on a solution. + When reporting a bug, please follow the guidelines in this template. This helps us quickly identify the discrepancy and get to work on a solution. - Only open this issue if you have noticed a difference between OpenVic and Victoria II. - **DO NOT FILE CRASHES HERE!** Please use the [bug report](https://github.com/OpenVicProject/OpenVic/issues/new?assignees=&labels=&projects=&template=1-bug-report.yml) template instead. - Write a descriptive issue title above. - - **Always open *one* issue for *one* discrepency**. If you notice several discrepencies, make sure to create one new issue for each of them. + - **Always open *one* issue for *one* discrepancy**. If you notice several discrepancies, make sure to create one new issue for each of them. - Verify that you are using either the latest release or the latest commit. It is preferred that you check if your issue is reproducible in the latest commit - it may already have been fixed! - - If you're playing with custom source modifications, please test if this discrepency is reproducible in the latest official build of OpenVic before opening an issue here. + - If you're playing with custom source modifications, please test if this discrepancy is reproducible in the latest official build of OpenVic before opening an issue here. - type: checkboxes attributes: label: Duplicate Issue? description: "Search [open](https://github.com/OpenVicProject/OpenVic/issues) and [closed](https://github.com/OpenVicProject/OpenVic/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported. If you don't find a relevant match or if you're not sure, don't hesitate to **open a new issue**. Contributors will handle it from there if it's a duplicate." options: - - label: I have checked for an existing discrepency report. + - label: I have checked for an existing discrepancy report. required: true - type: textarea @@ -28,7 +28,7 @@ body: attributes: label: Game & Version Info description: | - Enter the OpenVic version and commit you found this discrepency on in this box. You can find and copy this by clicking on the "Game Info" button in the bottom left corner of the OpenVic main menu. If you've found this discrepency to be reproducible on multiple versions, list all of those versions here. + Enter the OpenVic version and commit you found this discrepancy on in this box. You can find and copy this by clicking on the "Game Info" button in the bottom left corner of the OpenVic main menu. If you've found this discrepancy to be reproducible on multiple versions, list all of those versions here. placeholder: | - Found in: (c65b2a795fd35e81f7a1906d07d15c47cd94cf9c). - Not reproducible in: (1980012045ea4c6b314d6d12a796eda23ae8d7fa). @@ -43,11 +43,11 @@ body: If you used any mods or extensions, please list them here with the version and a link to each mod/extension. - type: textarea - id: discrepency-description + id: discrepancy-description attributes: label: Issue Description description: | - Describe the discrepency briefly. What happens in OpenVic, and how does it work in Victoria II? + Describe the discrepancy briefly. What happens in OpenVic, and how does it work in Victoria II? You can include images or videos with drag and drop. validations: required: true \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/3-gameplay-feature-request.yml b/.github/ISSUE_TEMPLATE/3-gameplay-feature-request.yml index 533146db..638a6678 100644 --- a/.github/ISSUE_TEMPLATE/3-gameplay-feature-request.yml +++ b/.github/ISSUE_TEMPLATE/3-gameplay-feature-request.yml @@ -5,7 +5,7 @@ body: - type: markdown attributes: value: | - - If this feature was in Victoria II, please report a [Victoria II Discrepency](https://github.com/OpenVicProject/OpenVic/issues/new?assignees=&labels=&projects=&template=2-victoria-2-discrepency.yml) instead. + - If this feature was in Victoria II, please report a [Victoria II Discrepancy](https://github.com/OpenVicProject/OpenVic/issues/new?assignees=&labels=&projects=&template=2-victoria-2-discrepency.yml) instead. - If this feature only applies to mods and contains no mechanical additions to the vanilla experience, please report it as a [mod feature request](https://github.com/OpenVicProject/OpenVic/issues/new?assignees=&labels=&projects=&template=4-mod-feature-request.yml). - Write a descriptive proposal title above. @@ -22,6 +22,6 @@ body: attributes: label: Feature Description description: An in-depth description of what feature you want added to OpenVic, and **why** its important to have. - placeholder: Example - "Add a macro builder - a menu that allows you to contruct armies or navies from templates. Think of the macro builder menu from EUIV perhaps. This will improve the game experience by allowing people to build whole armies at once rather than counting out brigades in the army build menu." + placeholder: Example - "Add a macro builder - a menu that allows you to construct armies or navies from templates. Think of the macro builder menu from EUIV perhaps. This will improve the game experience by allowing people to build whole armies at once rather than counting out brigades in the army build menu." validations: required: true diff --git a/.github/ISSUE_TEMPLATE/4-mod-feature-request.yml b/.github/ISSUE_TEMPLATE/4-mod-feature-request.yml index f965af7e..f11abe30 100644 --- a/.github/ISSUE_TEMPLATE/4-mod-feature-request.yml +++ b/.github/ISSUE_TEMPLATE/4-mod-feature-request.yml @@ -5,7 +5,7 @@ body: - type: markdown attributes: value: | - - If this feature was in Victoria II, please report a [Victoria II discrepency](https://github.com/OpenVicProject/OpenVic/issues/new?assignees=&labels=&projects=&template=2-victoria-2-discrepency.yml) instead. + - If this feature was in Victoria II, please report a [Victoria II discrepancy](https://github.com/OpenVicProject/OpenVic/issues/new?assignees=&labels=&projects=&template=2-victoria-2-discrepancy.yml) instead. - If this feature only intends to include mechanical additions to the vanilla experience, please report it as a [gameplay feature request](https://github.com/OpenVicProject/OpenVic/issues/new?assignees=&labels=&projects=&template=3-gameplay-feature-request.yml). - Write a descriptive proposal title above. diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 5dcc7ca9..a756052c 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -27,9 +27,47 @@ concurrency: cancel-in-progress: true jobs: + static-checks: + name: Code style, file formatting, and docs + runs-on: ubuntu-24.04 + steps: + - name: Checkout project + uses: actions/checkout@v4.1.1 + with: + fetch-depth: 2 + + - name: Install APT dependencies + uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: libxml2-utils + + - name: Get changed files + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if [ "${{ github.event_name }}" == "pull_request" ]; then + files=$(git diff-tree --no-commit-id --name-only -r HEAD^1..HEAD 2> /dev/null || true) + elif [ "${{ github.event_name }}" == "push" -a "${{ github.event.forced }}" == "false" -a "${{ github.event.created }}" == "false" ]; then + files=$(git diff-tree --no-commit-id --name-only -r ${{ github.event.before }}..${{ github.event.after }} 2> /dev/null || true) + fi + echo "$files" >> changed.txt + cat changed.txt + files=$(echo "$files" | xargs -I {} sh -c 'echo "\"./{}\""' | tr '\n' ' ') + echo "CHANGED_FILES=$files" >> $GITHUB_ENV + + - name: Style checks via pre-commit + uses: pre-commit/action@v3.0.1 + with: + extra_args: --files ${{ env.CHANGED_FILES }} + + - name: Class reference schema checks + run: | + xmllint --noout --schema extension/doc_tools/class.xsd extension/doc_classes/*.xml + build: runs-on: ${{matrix.os}} name: ${{matrix.name}} + needs: static-checks permissions: write-all strategy: fail-fast: false @@ -140,7 +178,7 @@ jobs: runs-on: ubuntu-latest needs: [build] - name: Peform Godot Debug Checks + name: Perform Godot Debug Checks steps: - name: Checkout project uses: actions/checkout@v4.1.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..c9bed878 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,73 @@ +default_language_version: + python: python3 + +repos: + # Waiting on Hop311 to approve clang-format + # - repo: https://github.com/pre-commit/mirrors-clang-format + # rev: v19.1.3 + # hooks: + # - id: clang-format + # files: \.(c|h|cpp|hpp|inc)$ + # types_or: [text] + # # exclude: | + # # (?x)^( + # # ) + + - repo: https://github.com/pocc/pre-commit-hooks + rev: v1.3.5 + hooks: + - id: clang-tidy + files: \.(c|h|cpp|hpp|inc)$ + args: [--fix, --quiet, --use-color] + types_or: [text] + additional_dependencies: [clang-tidy==19.1.0] + require_serial: true + stages: [manual] # Not automatically triggered, invoked via `pre-commit run --hook-stage manual clang-tidy` + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.7.3 + hooks: + - id: ruff + args: [--fix] + - id: ruff-format + exclude: | + (?x)^( + extension/doc_tools/make_rst.py| + extension/doc_tools/doc_status.py + ) + + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.13.0 + hooks: + - id: mypy + files: \.py$ + types_or: [text] + + - repo: https://github.com/crate-ci/typos + rev: v1.29.4 + hooks: + - id: typos + exclude: | + (?x)^( + game/assets/localisation/locales/.*| + game/addons/.* + ) + + + - repo: local + hooks: + - id: make-rst + name: make-rst + language: python + entry: python extension/doc_tools/make_rst.py + args: [extension, --dry-run, --color] + pass_filenames: false + files: ^(extension/doc_classes)/.*\.xml$ + + - id: doc-status + name: doc-status + language: python + entry: python extension/doc_tools/doc_status.py + args: [extension/doc_classes] + pass_filenames: false + files: ^(extension/doc_classes)/.*\.xml$ \ No newline at end of file diff --git a/docs/contribution/cloning.md b/docs/contribution/cloning.md index 06a84bbb..109e0893 100644 --- a/docs/contribution/cloning.md +++ b/docs/contribution/cloning.md @@ -11,7 +11,7 @@ After cloning you must initialize and update the submodules: cd OpenVic git submodule update --init --recursive ``` -Updating the submodules is neccessary every time the dependencies are updated, if you're unsure, on every `git pull` you should also call `git submodule update --init --recursive` +Updating the submodules is necessary every time the dependencies are updated, if you're unsure, on every `git pull` you should also call `git submodule update --init --recursive` To update the repo you must pull the repo: ```sh diff --git a/docs/contribution/rebasing.md b/docs/contribution/rebasing.md index 31d53bb9..a0b647d6 100644 --- a/docs/contribution/rebasing.md +++ b/docs/contribution/rebasing.md @@ -63,4 +63,4 @@ Read the comments following the `#` and it'll tell you what to do, generally we pick 24a0751 Update README.md for Archlinux users s 0e408c8 Add Window Override ``` -The top value is the first commit you referred to, this list is organized according to a seqeunce of the commit history, (this specific one was made via `HEAD~2`) you will always want the first one to be pick here, generally everything else is squash/s so it merges the commit into the previous commit while still giving you control over the commit messages. After this it will rebase the commits and then ask you about the commit message you wish to create, this will have to be up to you, you can always change it later, if there is a problem with it we will mention it. Now that you've done that however, the last step is to force push it, to do so you can use `git gui` and push then click the force option or you can call `git push -f`. Now your squash is complete. Be careful rebasing or squash when someone else is working on your branchs at the same time, a force push can hurt them, you should wait until they tell you that they're done and merge their changes to your branch before you rebase/squash. Rebasing/squashing commits that others rely upon is a one-way ticket to Git nigthmares. \ No newline at end of file +The top value is the first commit you referred to, this list is organized according to a sequence of the commit history, (this specific one was made via `HEAD~2`) you will always want the first one to be pick here, generally everything else is squash/s so it merges the commit into the previous commit while still giving you control over the commit messages. After this it will rebase the commits and then ask you about the commit message you wish to create, this will have to be up to you, you can always change it later, if there is a problem with it we will mention it. Now that you've done that however, the last step is to force push it, to do so you can use `git gui` and push then click the force option or you can call `git push -f`. Now your squash is complete. Be careful rebasing or squash when someone else is working on your branches at the same time, a force push can hurt them, you should wait until they tell you that they're done and merge their changes to your branch before you rebase/squash. Rebasing/squashing commits that others rely upon is a one-way ticket to Git nightmares. \ No newline at end of file diff --git a/docs/dataloading-architecture.md b/docs/dataloading-architecture.md index 36081db1..889b587b 100644 --- a/docs/dataloading-architecture.md +++ b/docs/dataloading-architecture.md @@ -37,7 +37,7 @@ First, let's look at the function's arguments: - `CountryManager const& country_manager` - an object which loads and stores countries, in the same way as `CultureManager` loads and stores cultures and culture groups; here, this is used to parse the culture group's `union` country. - `size_t& total_expected_cultures` - a reference to an unsigned integer, used to count the number of cultures in this culture group. - `GraphicalCultureType const* default_unit_graphical_culture_type` - a pointer to a graphical culture type, representing the default `Generic` graphical culture. -- `std::string_view culture_group_key` - a string (or rather an object referencing a string, but not holding the memory itself), representing the idenfifier of the culture group being loaded (for example `"north_german"`). +- `std::string_view culture_group_key` - a string (or rather an object referencing a string, but not holding the memory itself), representing the identifier of the culture group being loaded (for example `"north_german"`). - `ast::NodeCPtr culture_group_node` - a node representing the culture group's text defines, which is used as input to data parsing functions. ``` diff --git a/docs/simulation/calculations.yaml b/docs/simulation/calculations.yaml index ce47feaa..ce5908d6 100644 --- a/docs/simulation/calculations.yaml +++ b/docs/simulation/calculations.yaml @@ -49,7 +49,7 @@ Economy: /30: Hardcoded value to represent days in a month. Gold income daily: formula: MGQ * GOLD_TO_CASH_RATE - MGQ: Money good quanity = total production of goods with money = yes + MGQ: Money good quantity = total production of goods with money = yes GOLD_TO_CASH_RATE: defines.country.GOLD_TO_CASH_RATE Overseas maintenance: See: https://github.com/schombert/Project-Alice/blob/b7889a9c302feed851c039f1a98d73b75be3215a/docs/rules.md#overseas-penalty diff --git a/docs/styleguide-cpp.md b/docs/styleguide-cpp.md index 83a26475..f4677c17 100644 --- a/docs/styleguide-cpp.md +++ b/docs/styleguide-cpp.md @@ -17,7 +17,7 @@ >“Programs are meant to be read by humans and only incidentally for computers to execute.” > - H. Abelson and G. Sussman in [*Structure and Interpretation of Computer Programs*](https://en.wikipedia.org/wiki/Structure_and_Interpretation_of_Computer_Programs) -The purpose of this styleguide is to give a clear framework for other contributors, to minimize ambiguity, and to have a consistant way to convey the intent of code. +The purpose of this styleguide is to give a clear framework for other contributors, to minimize ambiguity, and to have a consistent way to convey the intent of code. ### 1.1. General Principles - Prefer clarity over brevity @@ -91,7 +91,7 @@ Source code files should adhere to the following: ``` - The content of classes should appear in the following order: - Type Aliases - - Static (class-wide) atributes + - Static (class-wide) attributes - Attributes - Constructors and Destructors - Static (class-wide) methods @@ -272,7 +272,7 @@ Source code files should adhere to the following: return num % 2 == 0; } ``` -- When a function parameter is being passed by const referance, put one space between the type and `const&`. If a parameter is passed by mutable reference do not put a space between the type and the `&` +- When a function parameter is being passed by const reference, put one space between the type and `const&`. If a parameter is passed by mutable reference do not put a space between the type and the `&` ```c++ //Correct for a const reference bool hasLargeNumber(std::vector const& numbers) { diff --git a/extension/deps/openvic-simulation b/extension/deps/openvic-simulation index 384f3d99..f3491b62 160000 --- a/extension/deps/openvic-simulation +++ b/extension/deps/openvic-simulation @@ -1 +1 @@ -Subproject commit 384f3d99391cb8aad3e684c66035b1913adef8a3 +Subproject commit f3491b62d31485692e0ae6337adeb1d8afd9a676 diff --git a/extension/doc_classes/GameSingleton.xml b/extension/doc_classes/GameSingleton.xml index af600b8a..ad0f53e2 100644 --- a/extension/doc_classes/GameSingleton.xml +++ b/extension/doc_classes/GameSingleton.xml @@ -19,7 +19,7 @@ - Returns the current bookmark's starting map position as a normalised [Vector2] (so each component should be in the range [code]0.0[/code] to [code]1.0[/code]). + Returns the current bookmark's starting map position as a normalized [Vector2] (so each component should be in the range [code]0.0[/code] to [code]1.0[/code]). @@ -81,20 +81,20 @@ - Returns the localisation key [String] of the mapmode with the specified [param index]. + Returns the localization key [String] of the mapmode with the specified [param index]. - Returns an [ImageTexture] containing the current province colour data, that is each province's base and stripe colours. + Returns an [ImageTexture] containing the current province color data, that is each province's base and stripe colors. - Returns the index [int] of the province at the specified position on the map. The [param coords] are expected to be normalised with repsect to the map's dimensions, and they'll be modulo'd to ensure they lie in the [code]0.0[/code] to [code]1.0[/code] range (meaning they can wrap around the map). + Returns the index [int] of the province at the specified position on the map. The [param coords] are expected to be normalised with respect to the map's dimensions, and they'll be modulo'd to ensure they lie in the [code]0.0[/code] to [code]1.0[/code] range (meaning they can wrap around the map). @@ -110,7 +110,7 @@ - Returns the number of textures the province shape image is split into horizontally and vertically (it is split to allow higher resolution maps as most GPUs limit indivudal textures' dimensions to at most 16,384 pixels). + Returns the number of textures the province shape image is split into horizontally and vertically (it is split to allow higher resolution maps as most GPUs limit individual textures' dimensions to at most 16,384 pixels). @@ -134,7 +134,7 @@ - Returns the viewed country's capital position as a normalised [Vector2], or [code](0.0, 0.0)[/code] if no country is being viewed. + Returns the viewed country's capital position as a normalized [Vector2], or [code](0.0, 0.0)[/code] if no country is being viewed. @@ -146,7 +146,7 @@ - Load compatibility mode text defines, localisation string and map and flag images. Returns [code]FAILED[/code] if there are any problems when loading all this data, otherwise returns [code]OK[/code]. + Load compatibility mode text defines, localization string and map and flag images. Returns [code]FAILED[/code] if there are any problems when loading all this data, otherwise returns [code]OK[/code]. @@ -195,7 +195,7 @@ - Creates and initialises the game instance, using the bookmark identified by [param bookmark_index] to determine which history entries are applied to it. Returns [code]FAILED[/code] if [param bookmark_index] is invalid or there are problems when setting up the game instance, otherwise returns [code]OK[/code]. + Creates and initializes the game instance, using the bookmark identified by [param bookmark_index] to determine which history entries are applied to it. Returns [code]FAILED[/code] if [param bookmark_index] is invalid or there are problems when setting up the game instance, otherwise returns [code]OK[/code]. @@ -207,7 +207,7 @@ - Sets up the simulation's clock and timestamps so that it can be unpaused, marking the move from the initialised but static game state used for the lobby to the dynamic game session that is ready to tick, update and simulate. + Sets up the simulation's clock and timestamps so that it can be unpaused, marking the move from the initialized but static game state used for the lobby to the dynamic game session that is ready to tick, update and simulate. diff --git a/extension/doc_tools/class.xsd b/extension/doc_tools/class.xsd new file mode 100644 index 00000000..ba9350b1 --- /dev/null +++ b/extension/doc_tools/class.xsd @@ -0,0 +1,310 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/extension/doc_tools/make_rst.py b/extension/doc_tools/make_rst.py index 2466a73c..3247bb89 100644 --- a/extension/doc_tools/make_rst.py +++ b/extension/doc_tools/make_rst.py @@ -5,11 +5,11 @@ import argparse import os import re +import subprocess import sys import xml.etree.ElementTree as ET from collections import OrderedDict from typing import Any, Dict, List, Optional, TextIO, Tuple, Union -import subprocess # Import hardcoded version information from version.py root_directory = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../") @@ -763,7 +763,7 @@ def main() -> None: engine_release = get_engine_release() if subprocess.call(f"git pull --depth=1 origin {engine_release}", cwd=doc_cache_path, shell=True) != 0: - print_error(f'Git pull for "{engine_url}" v{engine_release} failed. Type references will fail.') + print_error(f'Git pull for "{engine_url}" v{engine_release} failed. Type references will fail.', State()) engine_doc_paths = [ os.path.join(doc_cache_path, "doc/classes"), diff --git a/extension/doc_tools/patches/make_rst.patch b/extension/doc_tools/patches/make_rst.patch index 50830e54..b9403a48 100644 --- a/extension/doc_tools/patches/make_rst.patch +++ b/extension/doc_tools/patches/make_rst.patch @@ -1,5 +1,5 @@ diff --git a/extension/doc_tools/make_rst.py b/extension/doc_tools/make_rst.py -index efd902f..2466a73 100644 +index efd902f..f6e7fa2 100644 --- a/extension/doc_tools/make_rst.py +++ b/extension/doc_tools/make_rst.py @@ -9,11 +9,11 @@ import sys @@ -45,7 +45,7 @@ index efd902f..2466a73 100644 + + engine_release = get_engine_release() + if subprocess.call(f"git pull --depth=1 origin {engine_release}", cwd=doc_cache_path, shell=True) != 0: -+ print_error(f'Git pull for "{engine_url}" v{engine_release} failed. Type references will fail.') ++ print_error(f'Git pull for "{engine_url}" v{engine_release} failed. Type references will fail.', State()) + + engine_doc_paths = [ + os.path.join(doc_cache_path, "doc/classes"), diff --git a/extension/src/openvic-extension/classes/GFXButtonStateTexture.cpp b/extension/src/openvic-extension/classes/GFXButtonStateTexture.cpp index 24d2dd03..ab4d4b45 100644 --- a/extension/src/openvic-extension/classes/GFXButtonStateTexture.cpp +++ b/extension/src/openvic-extension/classes/GFXButtonStateTexture.cpp @@ -14,7 +14,7 @@ void GFXCorneredTileSupportingTexture::_bind_methods() { OV_BIND_METHOD(GFXCorneredTileSupportingTexture::draw_rect_cornered, { "to_canvas_item", "rect" }); } -GFXCorneredTileSupportingTexture::GFXCorneredTileSupportingTexture() : cornered_tile_border_size {} {} +GFXCorneredTileSupportingTexture::GFXCorneredTileSupportingTexture() {} bool GFXCorneredTileSupportingTexture::is_cornered_tile_texture() const { return cornered_tile_border_size != Vector2i {}; @@ -50,7 +50,7 @@ void GFXButtonStateTexture::_bind_methods() { BIND_ENUM_CONSTANT(SELECTED); } -GFXButtonStateTexture::GFXButtonStateTexture() : button_state { HOVER }, state_image {}, state_texture {} {} +GFXButtonStateTexture::GFXButtonStateTexture() {} Ref GFXButtonStateTexture::make_gfx_button_state_texture( ButtonState button_state, Ref const& source_image, Rect2i const& region, Vector2i const& cornered_tile_border_size @@ -179,7 +179,7 @@ void GFXButtonStateHavingTexture::_clear_button_states() { } } -GFXButtonStateHavingTexture::GFXButtonStateHavingTexture() : button_image {}, button_state_textures {} {} +GFXButtonStateHavingTexture::GFXButtonStateHavingTexture() : button_state_textures {} {} Ref GFXButtonStateHavingTexture::get_button_state_texture( GFXButtonStateTexture::ButtonState button_state diff --git a/extension/src/openvic-extension/classes/GFXButtonStateTexture.hpp b/extension/src/openvic-extension/classes/GFXButtonStateTexture.hpp index d97ca2bf..2a3a2841 100644 --- a/extension/src/openvic-extension/classes/GFXButtonStateTexture.hpp +++ b/extension/src/openvic-extension/classes/GFXButtonStateTexture.hpp @@ -37,7 +37,7 @@ namespace OpenVic { }; private: - ButtonState PROPERTY(button_state); + ButtonState PROPERTY(button_state, HOVER); godot::Ref state_image; godot::Ref state_texture; diff --git a/extension/src/openvic-extension/classes/GFXMaskedFlagTexture.cpp b/extension/src/openvic-extension/classes/GFXMaskedFlagTexture.cpp index 41eaa4d3..9f18f084 100644 --- a/extension/src/openvic-extension/classes/GFXMaskedFlagTexture.cpp +++ b/extension/src/openvic-extension/classes/GFXMaskedFlagTexture.cpp @@ -90,7 +90,7 @@ void GFXMaskedFlagTexture::_bind_methods() { OV_BIND_METHOD(GFXMaskedFlagTexture::get_flag_type); } -GFXMaskedFlagTexture::GFXMaskedFlagTexture() : gfx_masked_flag { nullptr }, flag_country { nullptr } {} +GFXMaskedFlagTexture::GFXMaskedFlagTexture() {} Ref GFXMaskedFlagTexture::make_gfx_masked_flag_texture(GFX::MaskedFlag const* gfx_masked_flag) { Ref masked_flag_texture; diff --git a/extension/src/openvic-extension/classes/GFXMaskedFlagTexture.hpp b/extension/src/openvic-extension/classes/GFXMaskedFlagTexture.hpp index b26f0dd2..2d5b4816 100644 --- a/extension/src/openvic-extension/classes/GFXMaskedFlagTexture.hpp +++ b/extension/src/openvic-extension/classes/GFXMaskedFlagTexture.hpp @@ -11,8 +11,8 @@ namespace OpenVic { class GFXMaskedFlagTexture : public GFXButtonStateHavingTexture { GDCLASS(GFXMaskedFlagTexture, GFXButtonStateHavingTexture) - GFX::MaskedFlag const* PROPERTY(gfx_masked_flag); - CountryDefinition const* PROPERTY(flag_country); + GFX::MaskedFlag const* PROPERTY(gfx_masked_flag, nullptr); + CountryDefinition const* PROPERTY(flag_country, nullptr); godot::StringName PROPERTY(flag_type); godot::Ref overlay_image, mask_image, flag_image; @@ -37,7 +37,7 @@ namespace OpenVic { /* Set the GFX::MaskedFlag, load its overlay and mask textures, and regenerate the combined image. */ godot::Error set_gfx_masked_flag(GFX::MaskedFlag const* new_gfx_masked_flag); - /* Search for a GFX::MaskedFlag with the specfied name and, if successful, set it using set_gfx_masked_flag. */ + /* Search for a GFX::MaskedFlag with the specified name and, if successful, set it using set_gfx_masked_flag. */ godot::Error set_gfx_masked_flag_name(godot::String const& gfx_masked_flag_name); /* Return the name of the GFX::MaskedFlag, or an empty String if it's null. */ diff --git a/extension/src/openvic-extension/classes/GFXPieChartTexture.cpp b/extension/src/openvic-extension/classes/GFXPieChartTexture.cpp index 5d955a37..ff0f721e 100644 --- a/extension/src/openvic-extension/classes/GFXPieChartTexture.cpp +++ b/extension/src/openvic-extension/classes/GFXPieChartTexture.cpp @@ -137,7 +137,7 @@ void GFXPieChartTexture::_bind_methods() { OV_BIND_METHOD(GFXPieChartTexture::set_slices_array, { "new_slices" }); } -GFXPieChartTexture::GFXPieChartTexture() : gfx_pie_chart { nullptr }, total_weight { 0.0f } {} +GFXPieChartTexture::GFXPieChartTexture() {} Ref GFXPieChartTexture::make_gfx_pie_chart_texture(GFX::PieChart const* gfx_pie_chart) { Ref pie_chart_texture; diff --git a/extension/src/openvic-extension/classes/GFXPieChartTexture.hpp b/extension/src/openvic-extension/classes/GFXPieChartTexture.hpp index 50616d92..3fb14d9e 100644 --- a/extension/src/openvic-extension/classes/GFXPieChartTexture.hpp +++ b/extension/src/openvic-extension/classes/GFXPieChartTexture.hpp @@ -19,9 +19,9 @@ namespace OpenVic { }; private: - GFX::PieChart const* PROPERTY(gfx_pie_chart); + GFX::PieChart const* PROPERTY(gfx_pie_chart, nullptr); std::vector slices; - float PROPERTY(total_weight); + float PROPERTY(total_weight, 0.0f); godot::Ref pie_chart_image; static godot::StringName const& _slice_identifier_key(); @@ -116,7 +116,7 @@ namespace OpenVic { /* Set the GFX::PieChart and regenerate the pie chart image. */ godot::Error set_gfx_pie_chart(GFX::PieChart const* new_gfx_pie_chart); - /* Search for a GFX::PieChart with the specfied name and, if successful, set it using set_gfx_pie_chart. */ + /* Search for a GFX::PieChart with the specified name and, if successful, set it using set_gfx_pie_chart. */ godot::Error set_gfx_pie_chart_name(godot::String const& gfx_pie_chart_name); /* Return the name of the GFX::PieChart, or an empty String if it's null. */ diff --git a/extension/src/openvic-extension/classes/GFXSpriteTexture.cpp b/extension/src/openvic-extension/classes/GFXSpriteTexture.cpp index 70c98202..797d718a 100644 --- a/extension/src/openvic-extension/classes/GFXSpriteTexture.cpp +++ b/extension/src/openvic-extension/classes/GFXSpriteTexture.cpp @@ -27,8 +27,7 @@ void GFXSpriteTexture::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "icon_index"), "set_icon_index", "get_icon_index"); } -GFXSpriteTexture::GFXSpriteTexture() - : gfx_texture_sprite { nullptr }, icon_index { GFX::NO_FRAMES }, icon_count { GFX::NO_FRAMES } {} +GFXSpriteTexture::GFXSpriteTexture() : icon_index { GFX::NO_FRAMES }, icon_count { GFX::NO_FRAMES } {} Ref GFXSpriteTexture::make_gfx_sprite_texture( GFX::TextureSprite const* gfx_texture_sprite, GFX::frame_t icon diff --git a/extension/src/openvic-extension/classes/GFXSpriteTexture.hpp b/extension/src/openvic-extension/classes/GFXSpriteTexture.hpp index 7b6b4334..cd04113f 100644 --- a/extension/src/openvic-extension/classes/GFXSpriteTexture.hpp +++ b/extension/src/openvic-extension/classes/GFXSpriteTexture.hpp @@ -14,9 +14,9 @@ namespace OpenVic { * - get_gfx_texture_sprite * - get_icon_index * - get_icon_count */ - GFX::TextureSprite const* PROPERTY(gfx_texture_sprite); - GFX::frame_t PROPERTY(icon_index); - GFX::frame_t PROPERTY(icon_count); + GFX::TextureSprite const* PROPERTY(gfx_texture_sprite, nullptr); + GFX::frame_t PROPERTY(icon_index, 0); + GFX::frame_t PROPERTY(icon_count, 0); protected: static void _bind_methods(); @@ -39,7 +39,7 @@ namespace OpenVic { GFX::TextureSprite const* new_gfx_texture_sprite, GFX::frame_t icon = GFX::NO_FRAMES ); - /* Search for a GFX::TextureSprite with the specfied name and, + /* Search for a GFX::TextureSprite with the specified name and, * if successful, call set_gfx_texture_sprite to set it and its icon. */ godot::Error set_gfx_texture_sprite_name( godot::String const& gfx_texture_sprite_name, GFX::frame_t icon = GFX::NO_FRAMES diff --git a/extension/src/openvic-extension/classes/GUIButton.cpp b/extension/src/openvic-extension/classes/GUIButton.cpp index e35d67a9..e674e286 100644 --- a/extension/src/openvic-extension/classes/GUIButton.cpp +++ b/extension/src/openvic-extension/classes/GUIButton.cpp @@ -20,7 +20,7 @@ void GUIButton::_notification(int what) { _tooltip_notification(what); } -GUIButton::GUIButton() : tooltip_active { false } {} +GUIButton::GUIButton() {} Error GUIButton::set_gfx_button_state_having_texture(Ref const& texture) { ERR_FAIL_NULL_V(texture, FAILED); diff --git a/extension/src/openvic-extension/classes/GUILabel.cpp b/extension/src/openvic-extension/classes/GUILabel.cpp index 3f351777..adcfcce6 100644 --- a/extension/src/openvic-extension/classes/GUILabel.cpp +++ b/extension/src/openvic-extension/classes/GUILabel.cpp @@ -85,7 +85,7 @@ void GUILabel::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::STRING, "text", PROPERTY_HINT_MULTILINE_TEXT), "set_text", "get_text"); ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "substitution_dict"), "set_substitution_dict", "get_substitution_dict"); ADD_PROPERTY( - PropertyInfo(Variant::INT, "horizontal_alignment", PROPERTY_HINT_ENUM, "Left,Centre,Right,Fill"), + PropertyInfo(Variant::INT, "horizontal_alignment", PROPERTY_HINT_ENUM, "Left,Center,Right,Fill"), "set_horizontal_alignment", "get_horizontal_alignment" ); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "max_size", PROPERTY_HINT_NONE, "suffix:px"), "set_max_size", "get_max_size"); @@ -180,24 +180,7 @@ void GUILabel::_notification(int what) { } } -GUILabel::GUILabel() - : tooltip_active { false }, - gui_text { nullptr }, - text {}, - substitution_dict {}, - horizontal_alignment { HORIZONTAL_ALIGNMENT_LEFT }, - max_size {}, - border_size {}, - adjusted_rect {}, - auto_adjust_to_content_size { false }, - font {}, - font_size { DEFAULT_FONT_SIZE }, - default_colour {}, - colour_codes { nullptr }, - currency_texture {}, - background {}, - lines {}, - line_update_queued { false } {} +GUILabel::GUILabel() : font_size { DEFAULT_FONT_SIZE } {} void GUILabel::clear() { gui_text = nullptr; @@ -689,11 +672,11 @@ std::vector GUILabel::wrap_lines(std::vector& unwrappe const real_t segment_width = get_segment_width(segment); if (current_line->width + segment_width <= max_content_size.width) { - // Segement on current line + // Segment on current line current_line->segments.emplace_back(std::move(segment)); current_line->width += segment_width; } else if (string_segment_t const* string_segment = std::get_if(&segment)) { - // String segement wrapped onto new line + // String segment wrapped onto new line static const String SPACE_MARKER = " "; String const& string = string_segment->text; @@ -746,7 +729,7 @@ std::vector GUILabel::wrap_lines(std::vector& unwrappe } } else { - // Currency segement on new line + // Currency segment on new line line_t* current_line = &wrapped_lines.emplace_back(); current_line->segments.push_back(std::move(segment)); current_line->width = segment_width; diff --git a/extension/src/openvic-extension/classes/GUILabel.hpp b/extension/src/openvic-extension/classes/GUILabel.hpp index f04e3abd..4583087a 100644 --- a/extension/src/openvic-extension/classes/GUILabel.hpp +++ b/extension/src/openvic-extension/classes/GUILabel.hpp @@ -18,20 +18,20 @@ namespace OpenVic { using colour_instructions_t = std::vector>; - GUI::Text const* PROPERTY(gui_text); + GUI::Text const* PROPERTY(gui_text, nullptr); godot::String PROPERTY(text); godot::Dictionary PROPERTY(substitution_dict); - godot::HorizontalAlignment PROPERTY(horizontal_alignment); + godot::HorizontalAlignment PROPERTY(horizontal_alignment, godot::HORIZONTAL_ALIGNMENT_LEFT); godot::Size2 PROPERTY(max_size); // Actual max size is max_size - 2 * border_size godot::Size2 PROPERTY(border_size); // The padding between the Nodes bounding box and the text within it godot::Rect2 PROPERTY(adjusted_rect); // Offset + size after adjustment to fit content size - bool PROPERTY_CUSTOM_PREFIX(auto_adjust_to_content_size, will); + bool PROPERTY_CUSTOM_PREFIX(auto_adjust_to_content_size, will, false); godot::Ref font; int32_t PROPERTY(font_size); godot::Color PROPERTY(default_colour); - GFX::Font::colour_codes_t const* colour_codes; + GFX::Font::colour_codes_t const* colour_codes = nullptr; godot::Ref currency_texture; godot::Ref background; @@ -50,7 +50,7 @@ namespace OpenVic { std::vector lines; - bool line_update_queued; + bool line_update_queued = false; protected: static void _bind_methods(); diff --git a/extension/src/openvic-extension/classes/GUIListBox.cpp b/extension/src/openvic-extension/classes/GUIListBox.cpp index 39ec9746..23da51f2 100644 --- a/extension/src/openvic-extension/classes/GUIListBox.cpp +++ b/extension/src/openvic-extension/classes/GUIListBox.cpp @@ -128,9 +128,7 @@ void GUIListBox::_notification(int what) { } } -GUIListBox::GUIListBox() - : gui_listbox { nullptr }, scrollbar { nullptr }, scroll_index { 0 }, max_scroll_index { 0 }, - fixed { false }, fixed_item_count { 0 }, fixed_visible_items { 0 }, fixed_item_height { 0.0_real } {} +GUIListBox::GUIListBox() : fixed_item_height { 0.0_real } {} Vector2 GUIListBox::_get_minimum_size() const { if (gui_listbox != nullptr) { diff --git a/extension/src/openvic-extension/classes/GUIListBox.hpp b/extension/src/openvic-extension/classes/GUIListBox.hpp index 775feae9..e9d075b7 100644 --- a/extension/src/openvic-extension/classes/GUIListBox.hpp +++ b/extension/src/openvic-extension/classes/GUIListBox.hpp @@ -10,9 +10,9 @@ namespace OpenVic { class GUIListBox : public godot::Container { GDCLASS(GUIListBox, godot::Container) - GUI::ListBox const* PROPERTY(gui_listbox); + GUI::ListBox const* PROPERTY(gui_listbox, nullptr); - GUIScrollbar* scrollbar; + GUIScrollbar* scrollbar = nullptr; /* The children_data index of the topmost visible child element. */ int32_t PROPERTY(scroll_index); diff --git a/extension/src/openvic-extension/classes/GUIOverlappingElementsBox.cpp b/extension/src/openvic-extension/classes/GUIOverlappingElementsBox.cpp index 52d26b70..c346b038 100644 --- a/extension/src/openvic-extension/classes/GUIOverlappingElementsBox.cpp +++ b/extension/src/openvic-extension/classes/GUIOverlappingElementsBox.cpp @@ -75,8 +75,7 @@ void GUIOverlappingElementsBox::_notification(int what) { } } -GUIOverlappingElementsBox::GUIOverlappingElementsBox() - : gui_overlapping_elements_box { nullptr }, gui_child_element { nullptr } {} +GUIOverlappingElementsBox::GUIOverlappingElementsBox() {} void GUIOverlappingElementsBox::clear() { clear_children(); diff --git a/extension/src/openvic-extension/classes/GUIOverlappingElementsBox.hpp b/extension/src/openvic-extension/classes/GUIOverlappingElementsBox.hpp index 5a420f24..b10c7d89 100644 --- a/extension/src/openvic-extension/classes/GUIOverlappingElementsBox.hpp +++ b/extension/src/openvic-extension/classes/GUIOverlappingElementsBox.hpp @@ -8,8 +8,8 @@ namespace OpenVic { class GUIOverlappingElementsBox : public godot::Container { GDCLASS(GUIOverlappingElementsBox, godot::Container) - GUI::OverlappingElementsBox const* PROPERTY(gui_overlapping_elements_box); - GUI::Element const* PROPERTY(gui_child_element); + GUI::OverlappingElementsBox const* PROPERTY(gui_overlapping_elements_box, nullptr); + GUI::Element const* PROPERTY(gui_child_element, nullptr); godot::Error _update_child_positions(); @@ -39,7 +39,7 @@ namespace OpenVic { /* Set the child GUI::Element, removing all previous child elements (even if the child GUI::Element doesn't change). */ godot::Error set_gui_child_element(GUI::Element const* new_gui_child_element); - /* Search for a GUI::Element with the specfied name and, if successful, + /* Search for a GUI::Element with the specified name and, if successful, * set the child element to it using set_gui_child_element. */ godot::Error set_gui_child_element_name( godot::String const& gui_child_element_file, godot::String const& gui_child_element_name diff --git a/extension/src/openvic-extension/classes/GUIPieChart.cpp b/extension/src/openvic-extension/classes/GUIPieChart.cpp index 0688dd30..6b8f2cf3 100644 --- a/extension/src/openvic-extension/classes/GUIPieChart.cpp +++ b/extension/src/openvic-extension/classes/GUIPieChart.cpp @@ -73,7 +73,7 @@ void GUIPieChart::_gui_input(Ref const& event) { } } -GUIPieChart::GUIPieChart() : tooltip_active { false }, tooltip_position { disabled_tooltip_position } {} +GUIPieChart::GUIPieChart() : tooltip_position { disabled_tooltip_position } {} Error GUIPieChart::set_gfx_pie_chart(GFX::PieChart const* gfx_pie_chart) { const bool needs_setting = gfx_pie_chart_texture.is_null(); diff --git a/extension/src/openvic-extension/classes/GUIPieChart.hpp b/extension/src/openvic-extension/classes/GUIPieChart.hpp index 3356dba0..32ca3505 100644 --- a/extension/src/openvic-extension/classes/GUIPieChart.hpp +++ b/extension/src/openvic-extension/classes/GUIPieChart.hpp @@ -12,7 +12,7 @@ namespace OpenVic { godot::Ref gfx_pie_chart_texture; - bool tooltip_active; + bool tooltip_active = false; godot::Vector2 tooltip_position; void _update_tooltip(); diff --git a/extension/src/openvic-extension/classes/GUIProgressBar.cpp b/extension/src/openvic-extension/classes/GUIProgressBar.cpp index d13f4558..35b449f8 100644 --- a/extension/src/openvic-extension/classes/GUIProgressBar.cpp +++ b/extension/src/openvic-extension/classes/GUIProgressBar.cpp @@ -18,7 +18,7 @@ void GUIProgressBar::_notification(int what) { _tooltip_notification(what); } -GUIProgressBar::GUIProgressBar() : tooltip_active { false } {} +GUIProgressBar::GUIProgressBar() {} Error GUIProgressBar::set_gfx_progress_bar(GFX::ProgressBar const* progress_bar) { ERR_FAIL_NULL_V(progress_bar, FAILED); diff --git a/extension/src/openvic-extension/classes/GUIScrollbar.cpp b/extension/src/openvic-extension/classes/GUIScrollbar.cpp index 6e310d72..bc782938 100644 --- a/extension/src/openvic-extension/classes/GUIScrollbar.cpp +++ b/extension/src/openvic-extension/classes/GUIScrollbar.cpp @@ -53,7 +53,7 @@ void GUIScrollbar::_bind_methods() { ADD_SIGNAL(MethodInfo(signal_value_changed(), PropertyInfo(Variant::INT, "value"))); } -GUIScrollbar::GUIScrollbar() : tooltip_active { false } { +GUIScrollbar::GUIScrollbar() { /* Anything which the constructor might not have default initialised will be set by clear(). */ clear(); } diff --git a/extension/src/openvic-extension/classes/GUIScrollbar.hpp b/extension/src/openvic-extension/classes/GUIScrollbar.hpp index d9b22f10..beba50b5 100644 --- a/extension/src/openvic-extension/classes/GUIScrollbar.hpp +++ b/extension/src/openvic-extension/classes/GUIScrollbar.hpp @@ -14,7 +14,7 @@ namespace OpenVic { GUI_TOOLTIP_DEFINITIONS - GUI::Scrollbar const* PROPERTY(gui_scrollbar); + GUI::Scrollbar const* PROPERTY(gui_scrollbar, nullptr); godot::Ref slider_texture; godot::Ref track_texture; @@ -22,7 +22,7 @@ namespace OpenVic { godot::Ref more_texture; godot::Rect2 slider_rect; - real_t slider_start, slider_distance; + real_t slider_start = 0.0F, slider_distance = 0.0F; godot::Rect2 track_rect; godot::Rect2 less_rect; godot::Rect2 more_rect; @@ -33,19 +33,19 @@ namespace OpenVic { godot::Rect2 range_limit_min_rect; godot::Rect2 range_limit_max_rect; - godot::Orientation PROPERTY(orientation); - real_t PROPERTY(length_override); + godot::Orientation PROPERTY(orientation, godot::HORIZONTAL); + real_t PROPERTY(length_override, 0.0); - int32_t PROPERTY(value); - int32_t PROPERTY(min_value); - int32_t PROPERTY(max_value); + int32_t PROPERTY(value, 0); + int32_t PROPERTY(min_value, 0); + int32_t PROPERTY(max_value, 0); bool PROPERTY_CUSTOM_PREFIX(range_limited, is); - int32_t PROPERTY(range_limit_min); - int32_t PROPERTY(range_limit_max); + int32_t PROPERTY(range_limit_min, 0); + int32_t PROPERTY(range_limit_max, 0); - bool hover_slider, hover_track, hover_less, hover_more; - bool pressed_slider, pressed_track, pressed_less, pressed_more; + bool hover_slider = false, hover_track = false, hover_less = false, hover_more = false; + bool pressed_slider = false, pressed_track = false, pressed_less = false, pressed_more = false; /* The time between value changes while the less/more button is held down (in seconds). */ static constexpr double BUTTON_CHANGE_DELAY = 1.0 / 60.0; @@ -57,14 +57,14 @@ namespace OpenVic { * increases by button_change_value_base, and every BUTTON_CHANGE_DELAY seconds value changes by button_change_value. * If button_change_value is still 0 when the button is released, then value will be increased by * button_change_value_base so that short clicks still have an effect.*/ - int32_t button_change_value_base, button_change_value; - double button_change_accelerate_timer, button_change_timer; + int32_t button_change_value_base = 0, button_change_value = 0; + double button_change_accelerate_timer = 0.0, button_change_timer = 0.0; void _start_button_change(bool shift_pressed, bool control_pressed); void _stop_button_change(); /* Changes value by button_change_value with the direction determined by orientation and pressed_less or pressed_more. - * Returns true if a change occured, otherwise false. */ + * Returns true if a change occurred, otherwise false. */ bool _update_button_change(); float _value_to_ratio(int32_t val) const; diff --git a/extension/src/openvic-extension/classes/GUITextureRect.cpp b/extension/src/openvic-extension/classes/GUITextureRect.cpp index fba9b193..15c54ab6 100644 --- a/extension/src/openvic-extension/classes/GUITextureRect.cpp +++ b/extension/src/openvic-extension/classes/GUITextureRect.cpp @@ -13,4 +13,4 @@ void GUITextureRect::_notification(int what) { _tooltip_notification(what); } -GUITextureRect::GUITextureRect() : tooltip_active { false } {} +GUITextureRect::GUITextureRect() {} diff --git a/extension/src/openvic-extension/singletons/AssetManager.hpp b/extension/src/openvic-extension/singletons/AssetManager.hpp index 14e04e24..768aca9a 100644 --- a/extension/src/openvic-extension/singletons/AssetManager.hpp +++ b/extension/src/openvic-extension/singletons/AssetManager.hpp @@ -56,7 +56,7 @@ namespace OpenVic { * image cache in case it has already been loaded, and returning nullptr if image loading fails. If the cache image * load flag is set then the loaded image will be stored in the AssetManager's image cache for future access; if the * flip y load flag is set then the image will be flipped vertically before being returned (if the image is already - * in the cache then no flipping will occur, regardless of whether it was orginally flipped or not). */ + * in the cache then no flipping will occur, regardless of whether it was originally flipped or not). */ godot::Ref get_image(godot::StringName const& path, LoadFlags load_flags = LOAD_FLAG_CACHE_IMAGE); /* Create a texture from an image found at the specified path relative to the game defines, fist checking the @@ -65,7 +65,7 @@ namespace OpenVic { * image cache for future access; if the cache texture load flag is set then the created texture will be stored in the * AssetManager's texture cache for future access; if the flip y load flag is set then the image will be flipped * vertically before being used to create the texture (if the image is already in the cache then no flipping will - * occur, regardless of whether it was orginally flipped or not). */ + * occur, regardless of whether it was originally flipped or not). */ godot::Ref get_texture( godot::StringName const& path, LoadFlags load_flags = LOAD_FLAG_CACHE_TEXTURE ); diff --git a/extension/src/openvic-extension/singletons/CursorSingleton.cpp b/extension/src/openvic-extension/singletons/CursorSingleton.cpp index 31691196..79aa9d21 100644 --- a/extension/src/openvic-extension/singletons/CursorSingleton.cpp +++ b/extension/src/openvic-extension/singletons/CursorSingleton.cpp @@ -210,7 +210,9 @@ static constexpr int32_t _rotate_right(int32_t byte, int32_t size=8) { static int32_t _load_int_256(Ref const& file) { int32_t value = file->get_8(); - if (value == 0) value = 256; + if (value == 0) { + value = 256; + } return value; } @@ -337,7 +339,7 @@ static CursorSingleton::image_hotspot_pair_asset_t _load_pair(Ref co Ref image = Ref(); image.instantiate(); - //PNGs are stored in their entirety, so use Godot's internal loader + // PNGs are stored in their entirety, so use Godot's internal loader if (image_data.slice(1,4).get_string_from_ascii() == "PNG") { image->load_png_from_buffer(image_data); } diff --git a/extension/src/openvic-extension/singletons/GameSingleton.cpp b/extension/src/openvic-extension/singletons/GameSingleton.cpp index a17eb51b..a7975325 100644 --- a/extension/src/openvic-extension/singletons/GameSingleton.cpp +++ b/extension/src/openvic-extension/singletons/GameSingleton.cpp @@ -108,7 +108,6 @@ GameSingleton::GameSingleton() : game_manager { std::bind(&GameSingleton::_on_gamestate_updated, this), std::bind(&GameSingleton::_on_clock_state_changed, this) }, - viewed_country { nullptr }, mapmode { &Mapmode::ERROR_MAPMODE } { ERR_FAIL_COND(singleton != nullptr); singleton = this; @@ -565,8 +564,6 @@ Error GameSingleton::_load_terrain_variants() { return OK; } -const Vector2i GameSingleton::flag_dims { 128, 64 }; - Error GameSingleton::_load_flag_sheet() { ERR_FAIL_COND_V_MSG( flag_sheet_image.is_valid() || flag_sheet_texture.is_valid(), FAILED, diff --git a/extension/src/openvic-extension/singletons/GameSingleton.hpp b/extension/src/openvic-extension/singletons/GameSingleton.hpp index 49155c74..653d712b 100644 --- a/extension/src/openvic-extension/singletons/GameSingleton.hpp +++ b/extension/src/openvic-extension/singletons/GameSingleton.hpp @@ -15,7 +15,7 @@ namespace OpenVic { GameManager game_manager; - CountryInstance const* PROPERTY(viewed_country); + CountryInstance const* PROPERTY(viewed_country, nullptr); godot::Vector2i image_subdivisions; godot::Ref province_shape_texture; @@ -24,7 +24,7 @@ namespace OpenVic { Mapmode const* mapmode; // This should never be null, if no mapmode is set then it'll point to Mapmode::ERROR_MAPMODE godot::Ref terrain_texture; - static const godot::Vector2i PROPERTY(flag_dims); /* The size in pixels of an individual flag. */ + inline static const godot::Vector2i PROPERTY(flag_dims, { 128, 64 }); /* The size in pixels of an individual flag. */ int32_t flag_sheet_count = 0; /* The number of flags in the flag sheet. */ godot::Vector2i flag_sheet_dims; /* The size of the flag sheet in flags, rather than pixels. */ godot::Ref flag_sheet_image; @@ -72,7 +72,7 @@ namespace OpenVic { return game_manager.get_instance_manager(); } - /* Load the game's defines in compatiblity mode from the filepath + /* Load the game's defines in compatibility mode from the filepath * pointing to the defines folder. */ godot::Error set_compatibility_mode_roots(godot::PackedStringArray const& file_paths); godot::Error load_defines_compatibility_mode(); diff --git a/extension/src/openvic-extension/singletons/LoadLocalisation.cpp b/extension/src/openvic-extension/singletons/LoadLocalisation.cpp index fbd618c4..62b3a4af 100644 --- a/extension/src/openvic-extension/singletons/LoadLocalisation.cpp +++ b/extension/src/openvic-extension/singletons/LoadLocalisation.cpp @@ -38,8 +38,8 @@ Error LoadLocalisation::_load_file(String const& file_path, Ref con ); int line_number = 0; while (!file->eof_reached()) { - static const String delimeter = ";"; - const PackedStringArray line = file->get_csv_line(delimeter); + static const String delimiter = ";"; + const PackedStringArray line = file->get_csv_line(delimiter); line_number++; if (line.size() < 2 || line[0].is_empty() || line[1].is_empty()) { if (!line[0].is_empty()) { @@ -138,7 +138,7 @@ bool LoadLocalisation::add_message(std::string_view key, Dataloader::locale_t lo } const StringName godot_key = Utilities::std_to_godot_string(key); const StringName godot_localisation = Utilities::std_to_godot_string(localisation); - if (0) { + if (false) { const StringName old_localisation = translation->get_message(godot_key); if (!old_localisation.is_empty()) { UtilityFunctions::push_warning( diff --git a/extension/src/openvic-extension/singletons/MapItemSingleton.cpp b/extension/src/openvic-extension/singletons/MapItemSingleton.cpp index ad93a901..9f0e7022 100644 --- a/extension/src/openvic-extension/singletons/MapItemSingleton.cpp +++ b/extension/src/openvic-extension/singletons/MapItemSingleton.cpp @@ -62,7 +62,7 @@ GFX::Billboard const* MapItemSingleton::get_billboard(std::string_view name, boo return billboard; } -// repackage the billboard object into a godot dictionnary for the Billboard manager to work with +// repackage the billboard object into a godot dictionary for the Billboard manager to work with bool MapItemSingleton::add_billboard_dict(std::string_view name, TypedArray& billboard_dict_array) const { static const StringName name_key = "name"; @@ -86,7 +86,7 @@ bool MapItemSingleton::add_billboard_dict(std::string_view name, TypedArray MapItemSingleton::get_billboards() const { GameSingleton const* game_singleton = GameSingleton::get_singleton(); ERR_FAIL_NULL_V(game_singleton, {}); diff --git a/extension/src/openvic-extension/singletons/MenuSingleton.cpp b/extension/src/openvic-extension/singletons/MenuSingleton.cpp index 854b9bb6..6ae94508 100644 --- a/extension/src/openvic-extension/singletons/MenuSingleton.cpp +++ b/extension/src/openvic-extension/singletons/MenuSingleton.cpp @@ -495,7 +495,7 @@ Dictionary MenuSingleton::get_province_info_from_index(int32_t index) const { ProductionType const& production_type = *rgo.get_production_type_nullable(); String contributing_modifier_effects; - // TODO - generate list of contributing modifier effects (including combined "From Technology" effeects) + // TODO - generate list of contributing modifier effects (including combined "From Technology" effects) static const StringName employment_localisation_key = "PROVINCEVIEW_EMPLOYMENT"; static const String value_replace_key = "$VALUE$"; diff --git a/extension/src/openvic-extension/singletons/PopulationMenu.cpp b/extension/src/openvic-extension/singletons/PopulationMenu.cpp index e2db7c7b..1e9e7dc6 100644 --- a/extension/src/openvic-extension/singletons/PopulationMenu.cpp +++ b/extension/src/openvic-extension/singletons/PopulationMenu.cpp @@ -98,7 +98,7 @@ TypedArray MenuSingleton::get_population_menu_province_list_rows(int bool is_expanded = true; - TypedArray array {}; + TypedArray array; /* Overloads return false if count_counter reaches 0 and the function should return, * otherwise true indicating the province list loop should continue. */ @@ -178,7 +178,7 @@ Error MenuSingleton::population_menu_select_province_list_entry(int32_t select_i struct entry_visitor_t { - const int32_t _select_index; + const int32_t _select_index = 0; int32_t index = 0, visible_index = 0; bool is_expanded = true; @@ -267,7 +267,7 @@ Error MenuSingleton::population_menu_select_province(int32_t province_index) { MenuSingleton& menu_singleton; - const int32_t _province_index; + const int32_t _province_index = 0; int32_t index = 0; diff --git a/extension/src/openvic-extension/singletons/SoundSingleton.cpp b/extension/src/openvic-extension/singletons/SoundSingleton.cpp index f09e3b6d..33c23c6e 100644 --- a/extension/src/openvic-extension/singletons/SoundSingleton.cpp +++ b/extension/src/openvic-extension/singletons/SoundSingleton.cpp @@ -157,7 +157,9 @@ bool SoundSingleton::load_title_theme(){ } - if(!ret) Logger::error("Failed to load title theme!"); + if (!ret) { + Logger::error("Failed to load title theme!"); + } return ret; } @@ -181,7 +183,9 @@ bool SoundSingleton::load_music() { for(std::filesystem::path const& file_name : music_files) { String file = std_to_godot_string(file_name.string()); String name = to_define_file_name(file,music_folder); - if(name == title_theme_name.data()) continue; + if (name == title_theme_name.data()) { + continue; + } if(!get_song(file).is_valid()){ Logger::error("failed to load song at path ",file_name); diff --git a/extension/src/openvic-extension/utility/UITools.cpp b/extension/src/openvic-extension/utility/UITools.cpp index 544ea989..edacfe29 100644 --- a/extension/src/openvic-extension/utility/UITools.cpp +++ b/extension/src/openvic-extension/utility/UITools.cpp @@ -472,7 +472,7 @@ static bool generate_text(generate_gui_args_t&& args) { ? &game_singleton->get_definition_manager().get_ui_manager().get_universal_colour_codes() : nullptr; if (gui_label->set_gui_text(&text, override_colour_codes) != OK) { - UtilityFunctions::push_error("Error initialising GUILabel for GUI text ", text_name); + UtilityFunctions::push_error("Error initializing GUILabel for GUI text ", text_name); ret = false; } @@ -495,7 +495,7 @@ static bool generate_overlapping_elements(generate_gui_args_t&& args) { if (box->set_gui_overlapping_elements_box(&overlapping_elements) != OK) { UtilityFunctions::push_error( - "Error initialising GUIOverlappingElementsBox for GUI overlapping elements ", overlapping_elements_name + "Error initializing GUIOverlappingElementsBox for GUI overlapping elements ", overlapping_elements_name ); ret = false; } @@ -514,7 +514,7 @@ static bool generate_listbox(generate_gui_args_t&& args) { ERR_FAIL_NULL_V_MSG(gui_listbox, false, vformat("Failed to create GUIListBox for GUI listbox %s", listbox_name)); if (gui_listbox->set_gui_listbox(&listbox) != OK) { - UtilityFunctions::push_error("Error initialising GUIListBox for GUI listbox ", listbox_name); + UtilityFunctions::push_error("Error initializing GUIListBox for GUI listbox ", listbox_name); ret = false; } @@ -612,7 +612,7 @@ static bool generate_scrollbar(generate_gui_args_t&& args) { ERR_FAIL_NULL_V_MSG(gui_scrollbar, false, vformat("Failed to create GUIScrollbar for GUI scrollbar %s", scrollbar_name)); if (gui_scrollbar->set_gui_scrollbar(&scrollbar) != OK) { - UtilityFunctions::push_error("Error initialising GUIScrollbar for GUI scrollbar ", scrollbar_name); + UtilityFunctions::push_error("Error initializing GUIScrollbar for GUI scrollbar ", scrollbar_name); ret = false; } diff --git a/game/assets/localisation/README.md b/game/assets/localisation/README.md index 909e380b..747bbe69 100644 --- a/game/assets/localisation/README.md +++ b/game/assets/localisation/README.md @@ -1,6 +1,6 @@ # Localisation -This folder contains localisations for in-game text. Each sub-folder must be named with a standard locale code, e.g. `en_GB`, to which the localisations contained within it shall apply (Godot's supported locale codes are listed [here](https://docs.godotengine.org/en/latest/tutorials/i18n/locales.html)). These folders contain `.csv` files where each line is interpreted as a semicolon-separated key-value pair. Empty lines allow for spacing out/separating sections, and any further entries beyond the first two on a line are ignored, which can be used to add comments at the end of lines. Lines with their key and value empty are skipped, allowing free-standing comments with no preceeding localisation, but lines with only one of their key or value empty, while not loaded as a localisation, will still result in warnings about incomplete entries. +This folder contains localisations for in-game text. Each sub-folder must be named with a standard locale code, e.g. `en_GB`, to which the localisations contained within it shall apply (Godot's supported locale codes are listed [here](https://docs.godotengine.org/en/latest/tutorials/i18n/locales.html)). These folders contain `.csv` files where each line is interpreted as a semicolon-separated key-value pair. Empty lines allow for spacing out/separating sections, and any further entries beyond the first two on a line are ignored, which can be used to add comments at the end of lines. Lines with their key and value empty are skipped, allowing free-standing comments with no preceding localisation, but lines with only one of their key or value empty, while not loaded as a localisation, will still result in warnings about incomplete entries. ``` ;; Example Localisation Comment diff --git a/game/assets/localisation/quotes.txt b/game/assets/localisation/quotes.txt index 49af5b52..223a5ff5 100644 --- a/game/assets/localisation/quotes.txt +++ b/game/assets/localisation/quotes.txt @@ -9,7 +9,7 @@ "In politics evils should be remedied, not revenged." - Emperor Napoleon III "The great questions of the day will not be settled by means of speeches and majority decisions but by iron and blood." - Otto von Bismarck "Ten million ignorances do not constitute one knowledge." - Klemens von Metternich -"Let him who loves his country in his heart, and not his lips only, follow me." - Guiseppe Garibaldi +"Let him who loves his country in his heart, and not his lips only, follow me." - Giuseppe Garibaldi "Revere the Emperor, expel the barbarians!" - Japanese nativist rallying cry "The three great elements of modern civilization, gunpowder, printing, and the Protestant religion." - Thomas Carlyle "It is well that war is so terrible, otherwise we should grow too fond of it." - General Robert E. Lee @@ -26,7 +26,7 @@ "I saw society cut into two: those who possessed nothing, united in a common greed; those who possessed something, united in a common terror. There were no bonds, no sympathy between these two great sections." - Alexis de Tocqueville "You may live to see man-made horrors beyond your comprehension." - Nikola Tesla "The wars of people will be more terrible than those of kings" - Winston Churchill -"This is not peace! It is an armistace for 20 years!" - Field Marshall Ferdinand Foch +"This is not peace! It is an armistice for 20 years!" - Field Marshall Ferdinand Foch "Here they come, black as hell and thick as grass!" - Unknown Soldier, Rorke's Drift "The lack of money is the root of all evil." - Mark Twain "It is not the size of the dog in the fight, it's the size of the fight in the dog." - Mark Twain diff --git a/game/src/Game/GameSession/BillboardManager.gd b/game/src/Game/GameSession/BillboardManager.gd index f14986b8..955ca16e 100644 --- a/game/src/Game/GameSession/BillboardManager.gd +++ b/game/src/Game/GameSession/BillboardManager.gd @@ -26,7 +26,7 @@ var provinces_size : int = 0 var total_capitals_size : int = 0 # Given a BillboardType, get the index for the texture in the shader. -# This is to reduce the number of magic indeces in the code +# This is to reduce the number of magic indices in the code # to get the proper billboard image var billboard_type_to_index : Dictionary @@ -117,7 +117,7 @@ func _ready() -> void: multimesh.instance_count = provinces_size + total_capitals_size if _map_view == null: - push_error("MapView export varible for BillboardManager must be set!") + push_error("MapView export variable for BillboardManager must be set!") return for province_index : int in provinces_size: diff --git a/game/src/Game/GameSession/GameSessionMenu.gd b/game/src/Game/GameSession/GameSessionMenu.gd index 10fb20d8..1090d309 100644 --- a/game/src/Game/GameSession/GameSessionMenu.gd +++ b/game/src/Game/GameSession/GameSessionMenu.gd @@ -18,7 +18,7 @@ func _ready() -> void: _main_menu_save_button = _main_menu_dialog.add_button("DIALOG_SAVE_AND_RESIGN", true, &"save_and_main_menu") _quit_save_button = _quit_dialog.add_button("DIALOG_SAVE_AND_QUIT", true, &"save_and_quit") - # Neccessary to center the save buttons and preserve the reference to the separator elements + # Necessary to center the save buttons and preserve the reference to the separator elements var dialog_hbox : HBoxContainer = _main_menu_dialog.get_child(2, true) var index := _main_menu_save_button.get_index(true) dialog_hbox.move_child(_main_menu_save_button, _main_menu_dialog.get_ok_button().get_index(true)) diff --git a/game/src/Game/Model/XACLoader.gd b/game/src/Game/Model/XACLoader.gd index 423c6222..ad2ea2d6 100644 --- a/game/src/Game/Model/XACLoader.gd +++ b/game/src/Game/Model/XACLoader.gd @@ -251,7 +251,7 @@ static func _load_xac_model(source_file : String, is_unit : bool) -> Node3D: influenceRange.firstInfluenceIndex + influenceRange.numInfluences ) if len(boneWeights) > 4: - push_error("num BONE WEIGHTS WAS > 4, GODOT DOESNT LIKE THIS") + push_error("num BONE WEIGHTS WAS > 4, GODOT DOESN'T LIKE THIS") # TODO: Less hacky fix? boneWeights = boneWeights.slice(0,4) diff --git a/game/src/Game/MusicConductor/MusicPlayer.gd b/game/src/Game/MusicConductor/MusicPlayer.gd index 0db44ca9..18f81ffb 100644 --- a/game/src/Game/MusicConductor/MusicPlayer.gd +++ b/game/src/Game/MusicConductor/MusicPlayer.gd @@ -5,7 +5,7 @@ extends Control @export var _previous_song_button : Button @export var _play_pause_button : Button @export var _next_song_button : Button -@export var _visbility_button : Button +@export var _visibility_button : Button var _is_user_dragging_progress_slider : bool = false @@ -56,7 +56,7 @@ func _on_progress_slider_drag_ended(_value_changed : bool) -> void: func _set_music_player_visible(is_player_visible : bool) -> void: MusicConductor.is_music_player_visible = is_player_visible - _visbility_button.text = "⬆️" if is_player_visible else "⬇" + _visibility_button.text = "⬆️" if is_player_visible else "⬇" _song_selector_button.visible = is_player_visible _progress_slider.visible = is_player_visible _previous_song_button.visible = is_player_visible diff --git a/game/src/Game/MusicConductor/MusicPlayer.tscn b/game/src/Game/MusicConductor/MusicPlayer.tscn index ef57eac5..e8b097fa 100644 --- a/game/src/Game/MusicConductor/MusicPlayer.tscn +++ b/game/src/Game/MusicConductor/MusicPlayer.tscn @@ -2,7 +2,7 @@ [ext_resource type="Script" path="res://src/Game/MusicConductor/MusicPlayer.gd" id="1_gcm4m"] -[node name="MusicPlayer" type="BoxContainer" node_paths=PackedStringArray("_song_selector_button", "_progress_slider", "_previous_song_button", "_play_pause_button", "_next_song_button", "_visbility_button")] +[node name="MusicPlayer" type="BoxContainer" node_paths=PackedStringArray("_song_selector_button", "_progress_slider", "_previous_song_button", "_play_pause_button", "_next_song_button", "_visibility_button")] editor_description = "UI-104" offset_right = 150.0 offset_bottom = 110.0 @@ -14,7 +14,7 @@ _progress_slider = NodePath("ProgressSlider") _previous_song_button = NodePath("ButtonList/PreviousSongButton") _play_pause_button = NodePath("ButtonList/PlayPauseButton") _next_song_button = NodePath("ButtonList/NextSongButton") -_visbility_button = NodePath("MusicUIVisibilityButton") +_visibility_button = NodePath("MusicUIVisibilityButton") [node name="SongSelectorButton" type="OptionButton" parent="."] editor_description = "UI-105, UI-107, UI-110, UIFUN-92" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..60385692 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,44 @@ +[tool.mypy] +ignore_missing_imports = true +disallow_any_generics = true +no_implicit_optional = true +pretty = true +show_column_numbers = true +warn_redundant_casts = true +warn_return_any = true +warn_unreachable = true +namespace_packages = true +explicit_package_bases = true + +[tool.ruff] +extend-include = ["SConstruct", "SCsub"] +line-length = 120 +target-version = "py37" + +[tool.ruff.lint] +extend-select = [ + "I", # isort +] + +[tool.ruff.lint.per-file-ignores] +"{SConstruct,SCsub}" = [ + "E402", # Module level import not at top of file + "F821", # Undefined name +] + +[tool.typos] +files.extend-exclude = [".mailmap", "*.gitignore", "*.po", "*.pot", "*.rc"] +default.extend-ignore-re = [ + "(?Rm)^.*(#|//)\\s*spellchecker:disable-line$", # Single line check disable + "(?s)(#|//)\\s*spellchecker:off.*?\\n\\s*(#|//)\\s*spellchecker:on", # Multiline check disable with // spellchecker:off // spellchecker:on (can also use #) + "(?s)(/\\*)\\s*spellchecker:off.*?\\s*spellchecker:on\\s*(\\*/)", # Multiline check disable with /* spellchecker:off ... spellchecker:on */ + "uid://\\S+", # Ignore engine uids +] +type.xml.locale = "en-us" +type.xml.check-filename = false +type.xml.extend-ignore-re = [ + "<.* name=\".+\" .+>", + "\\[(param|member|method)?.+\\]", +] +[tool.typos.default.extend-identifiers] +PNGs = "PNGs"