diff --git a/.clang-tidy b/.clang-tidy index c2781bbb8..9b6e35de4 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -14,12 +14,15 @@ Checks: >- -cppcoreguidelines-pro-type-reinterpret-cast, -cppcoreguidelines-pro-type-union-access, misc-*, + -misc-include-cleaner, -misc-non-private-member-variables-in-classes, modernize-*, -modernize-use-auto, -modernize-use-nodiscard, -modernize-use-trailing-return-type, performance-*, + -performance-avoid-endl, + -performance-enum-size, readability-*, -readability-avoid-const-params-in-decls, -readability-braces-around-statements, diff --git a/.github/workflows/clang_analyzer.yml b/.github/workflows/clang_analyzer.yml index db1708c56..b85314e0d 100644 --- a/.github/workflows/clang_analyzer.yml +++ b/.github/workflows/clang_analyzer.yml @@ -8,7 +8,7 @@ permissions: {} jobs: clang: name: Clang Analyzer - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 timeout-minutes: 30 defaults: run: @@ -18,10 +18,10 @@ jobs: - name: Install dependencies and clang-tools run: | sudo apt-get -y update - sudo apt-get -y install libsdl2-dev libsdl2-mixer-dev libsdl2-image-dev gettext clang-tools-15 + sudo apt-get -y install libsdl2-dev libsdl2-mixer-dev libsdl2-image-dev gettext clang-tools-18 - name: Setup clang-tools run: | - sudo update-alternatives --install /usr/bin/scan-build scan-build /usr/bin/scan-build-15 100 + sudo update-alternatives --install /usr/bin/scan-build scan-build /usr/bin/scan-build-18 100 - name: Analyze run: | scan-build --status-bugs -v -o scan-build-result make -j 2 diff --git a/.github/workflows/clang_tidy.yml b/.github/workflows/clang_tidy.yml index 6ab6b7667..3b5bda966 100644 --- a/.github/workflows/clang_tidy.yml +++ b/.github/workflows/clang_tidy.yml @@ -14,7 +14,7 @@ permissions: {} jobs: tidy: name: Clang-Tidy - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 timeout-minutes: 60 defaults: run: @@ -31,11 +31,11 @@ jobs: - name: Install dependencies and clang-tidy run: | sudo apt-get -y update - sudo apt-get -y install libsdl2-dev libsdl2-mixer-dev libsdl2-image-dev gettext clang-tidy-15 + sudo apt-get -y install libsdl2-dev libsdl2-mixer-dev libsdl2-image-dev gettext clang-tidy-18 - name: Setup clang-tidy run: | - sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-15 100 - sudo update-alternatives --install /usr/bin/clang-tidy-diff clang-tidy-diff /usr/bin/clang-tidy-diff-15.py 100 + sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-18 100 + sudo update-alternatives --install /usr/bin/clang-tidy-diff clang-tidy-diff /usr/bin/clang-tidy-diff-18.py 100 - name: Prepare compile_commands.json run: | cmake -B build -DCMAKE_BUILD_TYPE=Debug -DENABLE_STRICT_COMPILATION=ON -DENABLE_IMAGE=ON -DENABLE_TOOLS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON diff --git a/.github/workflows/code_style_check.yml b/.github/workflows/code_style_check.yml index af0f3f05c..af2d548be 100644 --- a/.github/workflows/code_style_check.yml +++ b/.github/workflows/code_style_check.yml @@ -8,7 +8,7 @@ permissions: {} jobs: style: name: Code style check - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 timeout-minutes: 10 defaults: run: @@ -19,8 +19,8 @@ jobs: fetch-depth: 50 - name: Setup clang-format run: | - sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-14 100 - sudo update-alternatives --install /usr/bin/clang-format-diff clang-format-diff /usr/bin/clang-format-diff-14 100 + sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-17 100 + sudo update-alternatives --install /usr/bin/clang-format-diff clang-format-diff /usr/bin/clang-format-diff-17 100 - name: Check code format run: | bash script/tools/check_code_format.sh diff --git a/.github/workflows/iwyu.yml b/.github/workflows/iwyu.yml index 6dc9e5c14..301020010 100644 --- a/.github/workflows/iwyu.yml +++ b/.github/workflows/iwyu.yml @@ -8,7 +8,7 @@ permissions: {} jobs: iwyu: name: IWYU - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 timeout-minutes: 30 defaults: run: @@ -24,8 +24,8 @@ jobs: cmake -B build -DCMAKE_BUILD_TYPE=Debug -DENABLE_STRICT_COMPILATION=ON -DENABLE_IMAGE=ON -DENABLE_TOOLS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - name: Analyze run: | - iwyu_tool -p build -j 2 -- -Xiwyu --cxx17ns -Xiwyu --mapping_file="$GITHUB_WORKSPACE/iwyu.map" | (grep -E -v "^$|has correct #includes/fwd-decls" || true) \ - | tee iwyu-result.txt + iwyu_tool -p build -j 2 -- -Xiwyu --cxx17ns -Xiwyu --error -Xiwyu --mapping_file="$GITHUB_WORKSPACE/iwyu.map" | (grep -E -v "^$|has correct #includes/fwd-decls" || true) \ + | tee iwyu-result.txt - uses: actions/upload-artifact@v4 if: ${{ failure() }} with: diff --git a/iwyu.map b/iwyu.map index 5e784bb18..1a5e8d3f5 100644 --- a/iwyu.map +++ b/iwyu.map @@ -1,13 +1,14 @@ [ - { include: [ "", private, "", public ] }, - { include: [ "", private, "", public ] }, - { include: [ "", private, "", public ] }, - { include: [ "", private, "", public ] }, - { include: [ "", private, "", public ] }, + { include: [ "", private, "", public ] }, + { include: [ "", private, "", public ] }, + { include: [ "", private, "", public ] }, + { include: [ "", private, "", public ] }, + { include: [ "", private, "", public ] }, - { include: [ "", private, "", public ] }, + { include: [ "", private, "", public ] }, + { include: [ "", private, "", public ] }, - { include: [ "", private, "", public ] }, + { include: [ "", private, "", public ] }, - { include: [ "", private, "", public ] } + { include: [ "", private, "", public ] } ] diff --git a/script/tools/check_code_format.sh b/script/tools/check_code_format.sh index 91cfa5039..a051b030a 100644 --- a/script/tools/check_code_format.sh +++ b/script/tools/check_code_format.sh @@ -1,40 +1,47 @@ #!/bin/bash -# Copyright 2018 Google LLC -# 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 +########################################################################### +# fheroes2: https://github.com/ihhub/fheroes2 # +# Copyright (C) 2021 - 2024 # +# # +# Copyright 2018 Google LLC # +# # +# This program 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; either version 2 of the License, or # +# (at your option) any later version. # +# # +# This program 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 this program; if not, write to the # +# Free Software Foundation, Inc., # +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # +########################################################################### + +# Script to determine whether the source code in the Pull Request is formatted correctly. +# Exits with a non-zero exit code if formatting is needed. # -# 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. -# -# Script to determine if source code in Pull Request is properly formatted. -# Exits with non 0 exit code if formatting is needed. -# -# This script assumes to be invoked at the project root directory. +# It is assumed that this script is called from the project root directory. set -e -o pipefail FILES_TO_CHECK=$(git diff --name-only HEAD^ | (grep -E ".*\.(cpp|cc|c\+\+|cxx|c|h|hpp|java)$" || true) \ | (grep -v "^src/thirdparty/.*/.*" || true)) -if [ -z "${FILES_TO_CHECK}" ]; then - echo "No source code to check for formatting." +if [ -z "$FILES_TO_CHECK" ]; then + echo "There is no source code to check the formatting." exit 0 fi -FORMAT_DIFF=$(git diff -U0 HEAD^ -- ${FILES_TO_CHECK} | clang-format-diff -p1 -style=file) - -if [ -z "${FORMAT_DIFF}" ]; then - echo "All source code in PR properly formatted." +if FORMAT_DIFF=$(git diff -U0 HEAD^ -- $FILES_TO_CHECK | clang-format-diff -p1 -style=file) && [ -z "$FORMAT_DIFF" ]; then + echo "All the source code in the PR is formatted correctly." exit 0 else - echo "Found formatting errors!" - echo "${FORMAT_DIFF}" + echo "Formatting errors found!" + echo "$FORMAT_DIFF" exit 1 fi diff --git a/script/tools/check_copyright_headers.sh b/script/tools/check_copyright_headers.sh index 4c63c74de..5146d1850 100644 --- a/script/tools/check_copyright_headers.sh +++ b/script/tools/check_copyright_headers.sh @@ -2,7 +2,7 @@ ########################################################################### # fheroes2: https://github.com/ihhub/fheroes2 # -# Copyright (C) 2022 - 2023 # +# Copyright (C) 2022 - 2024 # # # # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -20,10 +20,10 @@ # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # ########################################################################### -# Script to determine if source code in Pull Request has proper copyright headers. -# Exits with non-zero exit code if formatting is needed. +# Script to determine whether the source code in the Pull Request has correct copyright headers. +# Exits with a non-zero exit code if copyright headers need to be updated. # -# This script assumes to be invoked at the project root directory. +# It is assumed that this script is called from the project root directory. set -e -o pipefail @@ -33,14 +33,13 @@ HEADERS_DIR="$SCRIPT_DIR/copyright_headers" C_LIKE_FILES_TO_CHECK=$(git diff --name-only HEAD^ | (grep -E ".*\.(cpp|cc|c\+\+|cxx|c|h|hpp|java|rc)$" || true) \ | (grep -v "^src/thirdparty/.*/.*" || true)) SCRIPT_FILES_TO_CHECK=$(git diff --name-only HEAD^ | (grep -E ".*(\.(sh|py|ps1)|CMakeLists.txt|Makefile[^/]*|Android.mk|Application.mk)$" || true) \ - | (grep -v "^script/tools/check_code_format.sh$" || true) \ | (grep -v "^src/thirdparty/.*/.*" || true)) WINBAT_FILES_TO_CHECK=$(git diff --name-only HEAD^ | (grep -E ".*\.bat$" || true) \ | (grep -v "^android/gradlew.bat$" || true) \ | (grep -v "^src/thirdparty/.*/.*" || true)) if [ -z "$C_LIKE_FILES_TO_CHECK" ] && [ -z "$SCRIPT_FILES_TO_CHECK" ] && [ -z "$WINBAT_FILES_TO_CHECK" ]; then - echo "No source code to check if the copyright headers are correct." + echo "There is no source code to check the correctness of the copyright headers." exit 0 fi @@ -62,10 +61,10 @@ if [ -n "$WINBAT_FILES_TO_CHECK" ]; then fi if [ -z "$C_LIKE_FORMAT_DIFF" ] && [ -z "$SCRIPT_FORMAT_DIFF" ] && [ -z "$WINBAT_FORMAT_DIFF" ]; then - echo "All source code in PR has proper copyright headers." + echo "All the source code in the PR has the correct copyright headers." exit 0 else - echo "Found invalid copyright headers!" + echo "Invalid copyright headers found!" [ -n "$C_LIKE_FORMAT_DIFF" ] && echo "$C_LIKE_FORMAT_DIFF" [ -n "$SCRIPT_FORMAT_DIFF" ] && echo "$SCRIPT_FORMAT_DIFF" [ -n "$WINBAT_FORMAT_DIFF" ] && echo "$WINBAT_FORMAT_DIFF" diff --git a/src/engine/audio.cpp b/src/engine/audio.cpp index 689132b1b..da6dbf94f 100644 --- a/src/engine/audio.cpp +++ b/src/engine/audio.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * fheroes2: https://github.com/ihhub/fheroes2 * - * Copyright (C) 2019 - 2023 * + * Copyright (C) 2019 - 2024 * * * * Free Heroes2 Engine: http://sourceforge.net/projects/fheroes2 * * Copyright (C) 2008 by Andrey Afletdinov * @@ -33,7 +33,6 @@ #include #include #include -#include #include #include diff --git a/src/engine/image.cpp b/src/engine/image.cpp index 01b504f05..8ff20ff42 100644 --- a/src/engine/image.cpp +++ b/src/engine/image.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include "image_palette.h" diff --git a/src/engine/logging.h b/src/engine/logging.h index 889cc05b4..78204f00d 100644 --- a/src/engine/logging.h +++ b/src/engine/logging.h @@ -1,6 +1,6 @@ /*************************************************************************** * fheroes2: https://github.com/ihhub/fheroes2 * - * Copyright (C) 2021 - 2022 * + * Copyright (C) 2021 - 2024 * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * diff --git a/src/engine/serialize.h b/src/engine/serialize.h index 291f0c30b..a9891fa13 100644 --- a/src/engine/serialize.h +++ b/src/engine/serialize.h @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include diff --git a/src/engine/tools.cpp b/src/engine/tools.cpp index d0ac89336..f66862b7e 100644 --- a/src/engine/tools.cpp +++ b/src/engine/tools.cpp @@ -29,9 +29,7 @@ #include #include #include -#include // IWYU pragma: keep #include -#include #include #include diff --git a/src/engine/xmi2mid.cpp b/src/engine/xmi2mid.cpp index 9373cf199..982d14c83 100644 --- a/src/engine/xmi2mid.cpp +++ b/src/engine/xmi2mid.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * fheroes2: https://github.com/ihhub/fheroes2 * - * Copyright (C) 2019 - 2022 * + * Copyright (C) 2019 - 2024 * * * * Free Heroes2 Engine: http://sourceforge.net/projects/fheroes2 * * Copyright (C) 2013 by Andrey Afletdinov * @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/src/fheroes2/agg/agg_image.cpp b/src/fheroes2/agg/agg_image.cpp index 27fbb33dd..4d32c2aa3 100644 --- a/src/fheroes2/agg/agg_image.cpp +++ b/src/fheroes2/agg/agg_image.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/src/fheroes2/agg/agg_image.h b/src/fheroes2/agg/agg_image.h index 367b12845..4da490d40 100644 --- a/src/fheroes2/agg/agg_image.h +++ b/src/fheroes2/agg/agg_image.h @@ -26,8 +26,10 @@ namespace fheroes2 { class Image; class Sprite; - enum class FontSize : uint8_t; + struct FontType; + + enum class FontSize : uint8_t; enum class SupportedLanguage : uint8_t; namespace AGG diff --git a/src/fheroes2/agg/bin_info.cpp b/src/fheroes2/agg/bin_info.cpp index f88f43a5d..0365e2df8 100644 --- a/src/fheroes2/agg/bin_info.cpp +++ b/src/fheroes2/agg/bin_info.cpp @@ -24,8 +24,8 @@ #include #include #include -#include #include +#include #include #include "agg.h" diff --git a/src/fheroes2/ai/ai_battle.cpp b/src/fheroes2/ai/ai_battle.cpp index 08138fd4e..8099d0e3b 100644 --- a/src/fheroes2/ai/ai_battle.cpp +++ b/src/fheroes2/ai/ai_battle.cpp @@ -29,13 +29,12 @@ #include #include #include -#include #include +#include #include #include #include #include -#include #include #include diff --git a/src/fheroes2/ai/ai_common.cpp b/src/fheroes2/ai/ai_common.cpp index d1ac0c934..40f713437 100644 --- a/src/fheroes2/ai/ai_common.cpp +++ b/src/fheroes2/ai/ai_common.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "army.h" diff --git a/src/fheroes2/ai/ai_common.h b/src/fheroes2/ai/ai_common.h index 47a11c4b0..6926ec589 100644 --- a/src/fheroes2/ai/ai_common.h +++ b/src/fheroes2/ai/ai_common.h @@ -23,14 +23,15 @@ #include #include -#include "castle.h" - class Army; +class Castle; class Heroes; class Kingdom; struct Funds; +enum building_t : uint32_t; + namespace AI { // Builds the given building in the given castle if possible. If possible and necessary, obtains the resources diff --git a/src/fheroes2/ai/ai_planner_hero.cpp b/src/fheroes2/ai/ai_planner_hero.cpp index ed229c0e1..b0da3008d 100644 --- a/src/fheroes2/ai/ai_planner_hero.cpp +++ b/src/fheroes2/ai/ai_planner_hero.cpp @@ -26,12 +26,10 @@ #include #include #include -#include #include #include #include #include -#include #include #include @@ -62,7 +60,6 @@ #include "maps_fileinfo.h" #include "maps_tiles.h" #include "maps_tiles_helper.h" -#include "math_base.h" #include "monster.h" #include "morale.h" #include "mp2.h" diff --git a/src/fheroes2/ai/ai_planner_kingdom.cpp b/src/fheroes2/ai/ai_planner_kingdom.cpp index 37d958636..5bb5e716e 100644 --- a/src/fheroes2/ai/ai_planner_kingdom.cpp +++ b/src/fheroes2/ai/ai_planner_kingdom.cpp @@ -23,12 +23,12 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include diff --git a/src/fheroes2/army/army.cpp b/src/fheroes2/army/army.cpp index 6cdb856b5..5e89c9ccd 100644 --- a/src/fheroes2/army/army.cpp +++ b/src/fheroes2/army/army.cpp @@ -27,11 +27,10 @@ #include #include #include -#include #include -#include #include #include +#include #include #include "army_troop.h" diff --git a/src/fheroes2/audio/audio_manager.cpp b/src/fheroes2/audio/audio_manager.cpp index ea9c21294..28826cf5c 100644 --- a/src/fheroes2/audio/audio_manager.cpp +++ b/src/fheroes2/audio/audio_manager.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * fheroes2: https://github.com/ihhub/fheroes2 * - * Copyright (C) 2022 - 2023 * + * Copyright (C) 2022 - 2024 * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -28,13 +28,13 @@ #include #include #include -#include #include #include #include #include #include "agg_file.h" +#include "audio.h" #include "dir.h" #include "logging.h" #include "m82.h" diff --git a/src/fheroes2/audio/audio_manager.h b/src/fheroes2/audio/audio_manager.h index 9aa147db4..972e58473 100644 --- a/src/fheroes2/audio/audio_manager.h +++ b/src/fheroes2/audio/audio_manager.h @@ -1,6 +1,6 @@ /*************************************************************************** * fheroes2: https://github.com/ihhub/fheroes2 * - * Copyright (C) 2022 - 2023 * + * Copyright (C) 2022 - 2024 * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -25,8 +25,6 @@ #include #include -#include "audio.h" - struct ListFiles; namespace M82 @@ -34,6 +32,11 @@ namespace M82 enum SoundType : int; } +namespace Music +{ + enum class PlaybackMode : uint8_t; +} + namespace AudioManager { class AudioInitializer diff --git a/src/fheroes2/battle/battle_animation.cpp b/src/fheroes2/battle/battle_animation.cpp index fd2d7a3cc..05b0aac1b 100644 --- a/src/fheroes2/battle/battle_animation.cpp +++ b/src/fheroes2/battle/battle_animation.cpp @@ -18,11 +18,11 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include "battle_animation.h" + #include -#include #include -#include "battle_animation.h" #include "logging.h" #include "monster.h" #include "monster_anim.h" diff --git a/src/fheroes2/battle/battle_arena.h b/src/fheroes2/battle/battle_arena.h index 1031990c7..354e1dbb5 100644 --- a/src/fheroes2/battle/battle_arena.h +++ b/src/fheroes2/battle/battle_arena.h @@ -37,7 +37,6 @@ #include "battle_command.h" #include "battle_grave.h" #include "battle_pathfinding.h" -#include "battle_tower.h" #include "icn.h" #include "spell.h" #include "spell_storage.h" @@ -57,10 +56,13 @@ namespace Battle class Bridge; class Catapult; class Force; - class Units; - class Unit; class Interface; class Status; + class Tower; + class Unit; + class Units; + + enum class TowerType : uint8_t; class Actions : public std::list {}; diff --git a/src/fheroes2/battle/battle_army.cpp b/src/fheroes2/battle/battle_army.cpp index 7bc3a45de..93f3dccf2 100644 --- a/src/fheroes2/battle/battle_army.cpp +++ b/src/fheroes2/battle/battle_army.cpp @@ -23,6 +23,7 @@ #include "battle_army.h" +#include #include #include "army_troop.h" diff --git a/src/fheroes2/battle/battle_army.h b/src/fheroes2/battle/battle_army.h index b44b72b58..74d8bf9bb 100644 --- a/src/fheroes2/battle/battle_army.h +++ b/src/fheroes2/battle/battle_army.h @@ -24,7 +24,6 @@ #ifndef H2BATTLE_ARMY_H #define H2BATTLE_ARMY_H -#include // IWYU pragma: keep #include #include #include diff --git a/src/fheroes2/battle/battle_board.cpp b/src/fheroes2/battle/battle_board.cpp index a17771466..7d92aa5b3 100644 --- a/src/fheroes2/battle/battle_board.cpp +++ b/src/fheroes2/battle/battle_board.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include diff --git a/src/fheroes2/battle/battle_grave.cpp b/src/fheroes2/battle/battle_grave.cpp index 2288e176d..7ce188967 100644 --- a/src/fheroes2/battle/battle_grave.cpp +++ b/src/fheroes2/battle/battle_grave.cpp @@ -25,7 +25,6 @@ #include #include -#include #include #include "battle_board.h" diff --git a/src/fheroes2/battle/battle_interface.cpp b/src/fheroes2/battle/battle_interface.cpp index eb8faf013..602a9ac05 100644 --- a/src/fheroes2/battle/battle_interface.cpp +++ b/src/fheroes2/battle/battle_interface.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include "agg_image.h" #include "audio.h" diff --git a/src/fheroes2/battle/battle_interface.h b/src/fheroes2/battle/battle_interface.h index 89c05046a..9a2224008 100644 --- a/src/fheroes2/battle/battle_interface.h +++ b/src/fheroes2/battle/battle_interface.h @@ -31,7 +31,6 @@ #include #include -#include "battle.h" #include "battle_animation.h" #include "battle_board.h" #include "battle_troop.h" @@ -64,6 +63,11 @@ namespace Battle class Tower; class Units; + struct TargetInfo; + struct TargetsInfo; + + enum class CastleDefenseElement : int; + void DialogBattleSettings(); bool DialogBattleSurrender( const HeroBase & hero, uint32_t cost, Kingdom & kingdom ); diff --git a/src/fheroes2/battle/battle_main.cpp b/src/fheroes2/battle/battle_main.cpp index 846e973c1..ab55501ae 100644 --- a/src/fheroes2/battle/battle_main.cpp +++ b/src/fheroes2/battle/battle_main.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff --git a/src/fheroes2/battle/battle_pathfinding.cpp b/src/fheroes2/battle/battle_pathfinding.cpp index 5bd26e53a..55f773e5f 100644 --- a/src/fheroes2/battle/battle_pathfinding.cpp +++ b/src/fheroes2/battle/battle_pathfinding.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include "battle_arena.h" diff --git a/src/fheroes2/battle/battle_troop.cpp b/src/fheroes2/battle/battle_troop.cpp index 2134a8dd4..e1cc5e378 100644 --- a/src/fheroes2/battle/battle_troop.cpp +++ b/src/fheroes2/battle/battle_troop.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include "agg_image.h" #include "army.h" diff --git a/src/fheroes2/campaign/campaign_data.cpp b/src/fheroes2/campaign/campaign_data.cpp index 47b1195bc..b84fd25fd 100644 --- a/src/fheroes2/campaign/campaign_data.cpp +++ b/src/fheroes2/campaign/campaign_data.cpp @@ -18,15 +18,15 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include "campaign_data.h" + #include #include #include #include -#include #include #include "artifact.h" -#include "campaign_data.h" #include "color.h" #include "game_video_type.h" #include "heroes.h" diff --git a/src/fheroes2/campaign/campaign_savedata.cpp b/src/fheroes2/campaign/campaign_savedata.cpp index eff94fba9..d9a7f9e4b 100644 --- a/src/fheroes2/campaign/campaign_savedata.cpp +++ b/src/fheroes2/campaign/campaign_savedata.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include "army.h" diff --git a/src/fheroes2/campaign/campaign_scenariodata.h b/src/fheroes2/campaign/campaign_scenariodata.h index f9ac93d05..f0ab0c37a 100644 --- a/src/fheroes2/campaign/campaign_scenariodata.h +++ b/src/fheroes2/campaign/campaign_scenariodata.h @@ -1,6 +1,6 @@ /*************************************************************************** * fheroes2: https://github.com/ihhub/fheroes2 * - * Copyright (C) 2021 - 2023 * + * Copyright (C) 2021 - 2024 * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -25,11 +25,15 @@ #include #include -#include "game_video_type.h" #include "maps_fileinfo.h" class StreamBase; +namespace Video +{ + enum class VideoAction : int; +} + namespace Campaign { enum CampaignID diff --git a/src/fheroes2/castle/buildinginfo.cpp b/src/fheroes2/castle/buildinginfo.cpp index 7279fae1c..9a98b2774 100644 --- a/src/fheroes2/castle/buildinginfo.cpp +++ b/src/fheroes2/castle/buildinginfo.cpp @@ -30,6 +30,7 @@ #include "agg_image.h" #include "army_troop.h" #include "audio_manager.h" +#include "castle.h" #include "castle_building_info.h" #include "cursor.h" #include "dialog.h" diff --git a/src/fheroes2/castle/buildinginfo.h b/src/fheroes2/castle/buildinginfo.h index 0f2938f2d..617024165 100644 --- a/src/fheroes2/castle/buildinginfo.h +++ b/src/fheroes2/castle/buildinginfo.h @@ -28,7 +28,6 @@ #include #include -#include "castle.h" #include "image.h" #include "interface_itemsbar.h" #include "math_base.h" @@ -39,8 +38,12 @@ namespace fheroes2 class ButtonBase; } +class Castle; class StatusBar; +enum building_t : uint32_t; +enum class BuildingStatus : int32_t; + class BuildingInfo { public: diff --git a/src/fheroes2/castle/castle.cpp b/src/fheroes2/castle/castle.cpp index c52b3d509..aed62714d 100644 --- a/src/fheroes2/castle/castle.cpp +++ b/src/fheroes2/castle/castle.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include "agg_image.h" #include "ai_planner.h" diff --git a/src/fheroes2/castle/castle_tavern.cpp b/src/fheroes2/castle/castle_tavern.cpp index 04c91d7fb..44d234c17 100644 --- a/src/fheroes2/castle/castle_tavern.cpp +++ b/src/fheroes2/castle/castle_tavern.cpp @@ -21,10 +21,10 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include #include #include #include +#include #include "castle.h" #include "dialog.h" diff --git a/src/fheroes2/dialog/dialog_armyinfo.cpp b/src/fheroes2/dialog/dialog_armyinfo.cpp index 3298d9b8b..c4afade54 100644 --- a/src/fheroes2/dialog/dialog_armyinfo.cpp +++ b/src/fheroes2/dialog/dialog_armyinfo.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/src/fheroes2/dialog/dialog_artifact.cpp b/src/fheroes2/dialog/dialog_artifact.cpp index 791d1e716..62a80564f 100644 --- a/src/fheroes2/dialog/dialog_artifact.cpp +++ b/src/fheroes2/dialog/dialog_artifact.cpp @@ -18,7 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include +#include +#include #include "artifact.h" #include "audio_manager.h" diff --git a/src/fheroes2/dialog/dialog_box.cpp b/src/fheroes2/dialog/dialog_box.cpp index a2091f6c2..e7ff1b6a1 100644 --- a/src/fheroes2/dialog/dialog_box.cpp +++ b/src/fheroes2/dialog/dialog_box.cpp @@ -29,7 +29,6 @@ #include "dialog.h" #include "icn.h" #include "image.h" -#include "math_base.h" #include "screen.h" #include "settings.h" diff --git a/src/fheroes2/dialog/dialog_file.cpp b/src/fheroes2/dialog/dialog_file.cpp index dac55bc26..8aaee7cd6 100644 --- a/src/fheroes2/dialog/dialog_file.cpp +++ b/src/fheroes2/dialog/dialog_file.cpp @@ -22,6 +22,7 @@ ***************************************************************************/ #include +#include #include "cursor.h" #include "dialog.h" diff --git a/src/fheroes2/dialog/dialog_game_settings.cpp b/src/fheroes2/dialog/dialog_game_settings.cpp index 2e2affa73..5223a2f87 100644 --- a/src/fheroes2/dialog/dialog_game_settings.cpp +++ b/src/fheroes2/dialog/dialog_game_settings.cpp @@ -22,6 +22,8 @@ #include #include +#include +#include #include #include "agg_image.h" diff --git a/src/fheroes2/dialog/dialog_giftresources.cpp b/src/fheroes2/dialog/dialog_giftresources.cpp index a236e94ad..53c58326e 100644 --- a/src/fheroes2/dialog/dialog_giftresources.cpp +++ b/src/fheroes2/dialog/dialog_giftresources.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff --git a/src/fheroes2/dialog/dialog_hotkeys.cpp b/src/fheroes2/dialog/dialog_hotkeys.cpp index 67be1cb8a..b41253cc5 100644 --- a/src/fheroes2/dialog/dialog_hotkeys.cpp +++ b/src/fheroes2/dialog/dialog_hotkeys.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include diff --git a/src/fheroes2/dialog/dialog_language_selection.cpp b/src/fheroes2/dialog/dialog_language_selection.cpp index ece73ec92..97493e516 100644 --- a/src/fheroes2/dialog/dialog_language_selection.cpp +++ b/src/fheroes2/dialog/dialog_language_selection.cpp @@ -31,6 +31,7 @@ #include "cursor.h" #include "dialog.h" #include "game_hotkeys.h" +#include "game_language.h" #include "icn.h" #include "image.h" #include "interface_list.h" diff --git a/src/fheroes2/dialog/dialog_language_selection.h b/src/fheroes2/dialog/dialog_language_selection.h index 6ba6de76b..f720533fd 100644 --- a/src/fheroes2/dialog/dialog_language_selection.h +++ b/src/fheroes2/dialog/dialog_language_selection.h @@ -20,12 +20,13 @@ #pragma once +#include #include -#include "game_language.h" - namespace fheroes2 { + enum class SupportedLanguage : uint8_t; + // UI window to select a language by user. void selectLanguage( const std::vector & languages, const SupportedLanguage currentLanguage ); } diff --git a/src/fheroes2/dialog/dialog_levelup.cpp b/src/fheroes2/dialog/dialog_levelup.cpp index 7d62712b9..898cc98d7 100644 --- a/src/fheroes2/dialog/dialog_levelup.cpp +++ b/src/fheroes2/dialog/dialog_levelup.cpp @@ -23,6 +23,7 @@ #include #include +#include #include "agg_image.h" #include "cursor.h" diff --git a/src/fheroes2/dialog/dialog_recruit.cpp b/src/fheroes2/dialog/dialog_recruit.cpp index 85b98b38d..62c925432 100644 --- a/src/fheroes2/dialog/dialog_recruit.cpp +++ b/src/fheroes2/dialog/dialog_recruit.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/src/fheroes2/dialog/dialog_selectcount.cpp b/src/fheroes2/dialog/dialog_selectcount.cpp index a0f2c3e59..23ad7758a 100644 --- a/src/fheroes2/dialog/dialog_selectcount.cpp +++ b/src/fheroes2/dialog/dialog_selectcount.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff --git a/src/fheroes2/dialog/dialog_system_options.cpp b/src/fheroes2/dialog/dialog_system_options.cpp index 91673a679..7b8745507 100644 --- a/src/fheroes2/dialog/dialog_system_options.cpp +++ b/src/fheroes2/dialog/dialog_system_options.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include diff --git a/src/fheroes2/editor/editor_interface_panel.cpp b/src/fheroes2/editor/editor_interface_panel.cpp index b000c1066..f060a4b6a 100644 --- a/src/fheroes2/editor/editor_interface_panel.cpp +++ b/src/fheroes2/editor/editor_interface_panel.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include diff --git a/src/fheroes2/editor/editor_options.cpp b/src/fheroes2/editor/editor_options.cpp index 72fc2e7c0..163ae16ab 100644 --- a/src/fheroes2/editor/editor_options.cpp +++ b/src/fheroes2/editor/editor_options.cpp @@ -22,6 +22,8 @@ #include #include +#include +#include #include #include "agg_image.h" diff --git a/src/fheroes2/game/difficulty.cpp b/src/fheroes2/game/difficulty.cpp index 76397aaa7..88a9139ec 100644 --- a/src/fheroes2/game/difficulty.cpp +++ b/src/fheroes2/game/difficulty.cpp @@ -27,6 +27,7 @@ #include #include +#include "castle.h" #include "kingdom.h" #include "profit.h" #include "race.h" diff --git a/src/fheroes2/game/difficulty.h b/src/fheroes2/game/difficulty.h index e9b4b6cf0..5e313bc55 100644 --- a/src/fheroes2/game/difficulty.h +++ b/src/fheroes2/game/difficulty.h @@ -26,11 +26,12 @@ #include #include -#include "castle.h" #include "resource.h" class Kingdom; +enum building_t : uint32_t; + namespace Difficulty { // !!! IMPORTANT !!! diff --git a/src/fheroes2/game/fheroes2.cpp b/src/fheroes2/game/fheroes2.cpp index 00cf142ba..b6ce86c0b 100644 --- a/src/fheroes2/game/fheroes2.cpp +++ b/src/fheroes2/game/fheroes2.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/src/fheroes2/game/game.cpp b/src/fheroes2/game/game.cpp index b2ed511e3..ec018c9d6 100644 --- a/src/fheroes2/game/game.cpp +++ b/src/fheroes2/game/game.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/src/fheroes2/game/game_campaign.cpp b/src/fheroes2/game/game_campaign.cpp index 11478ef19..bc4f00a96 100644 --- a/src/fheroes2/game/game_campaign.cpp +++ b/src/fheroes2/game/game_campaign.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/src/fheroes2/game/game_delays.cpp b/src/fheroes2/game/game_delays.cpp index 1cc0b605f..18f85ac98 100644 --- a/src/fheroes2/game/game_delays.cpp +++ b/src/fheroes2/game/game_delays.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * fheroes2: https://github.com/ihhub/fheroes2 * - * Copyright (C) 2019 - 2023 * + * Copyright (C) 2019 - 2024 * * * * Free Heroes2 Engine: http://sourceforge.net/projects/fheroes2 * * Copyright (C) 2010 by Andrey Afletdinov * @@ -24,7 +24,6 @@ #include "game_delays.h" #include -#include #include "gamedefs.h" #include "settings.h" diff --git a/src/fheroes2/game/game_highscores.cpp b/src/fheroes2/game/game_highscores.cpp index 32dc613b3..25d7eb352 100644 --- a/src/fheroes2/game/game_highscores.cpp +++ b/src/fheroes2/game/game_highscores.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/src/fheroes2/game/game_hotkeys.cpp b/src/fheroes2/game/game_hotkeys.cpp index 3b3e1ab57..27af9193e 100644 --- a/src/fheroes2/game/game_hotkeys.cpp +++ b/src/fheroes2/game/game_hotkeys.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include diff --git a/src/fheroes2/game/game_interface.cpp b/src/fheroes2/game/game_interface.cpp index 65df00172..1d322a2a6 100644 --- a/src/fheroes2/game/game_interface.cpp +++ b/src/fheroes2/game/game_interface.cpp @@ -24,6 +24,7 @@ #include "game_interface.h" #include +#include #include "agg_image.h" #include "cursor.h" diff --git a/src/fheroes2/game/game_mainmenu.cpp b/src/fheroes2/game/game_mainmenu.cpp index 237aaa223..1bd60dbd3 100644 --- a/src/fheroes2/game/game_mainmenu.cpp +++ b/src/fheroes2/game/game_mainmenu.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/src/fheroes2/game/game_newgame.cpp b/src/fheroes2/game/game_newgame.cpp index 3ce765348..744782089 100644 --- a/src/fheroes2/game/game_newgame.cpp +++ b/src/fheroes2/game/game_newgame.cpp @@ -52,6 +52,7 @@ #include "image.h" #include "localevent.h" #include "logging.h" +#include "maps_fileinfo.h" #include "math_base.h" #include "mus.h" #include "screen.h" diff --git a/src/fheroes2/game/game_scenarioinfo.cpp b/src/fheroes2/game/game_scenarioinfo.cpp index 20d5b219f..6225f20f0 100644 --- a/src/fheroes2/game/game_scenarioinfo.cpp +++ b/src/fheroes2/game/game_scenarioinfo.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff --git a/src/fheroes2/game/game_startgame.cpp b/src/fheroes2/game/game_startgame.cpp index 9a6e271a9..dc692110b 100644 --- a/src/fheroes2/game/game_startgame.cpp +++ b/src/fheroes2/game/game_startgame.cpp @@ -27,9 +27,9 @@ #include #include #include +#include #include #include -#include #include #include diff --git a/src/fheroes2/game/game_static.h b/src/fheroes2/game/game_static.h index bc235114d..c0364839f 100644 --- a/src/fheroes2/game/game_static.h +++ b/src/fheroes2/game/game_static.h @@ -26,7 +26,10 @@ #include -#include "mp2.h" +namespace MP2 +{ + enum MapObjectType : uint16_t; +} namespace Skill { diff --git a/src/fheroes2/game/game_video.cpp b/src/fheroes2/game/game_video.cpp index 6b28733d9..25a53a079 100644 --- a/src/fheroes2/game/game_video.cpp +++ b/src/fheroes2/game/game_video.cpp @@ -32,6 +32,7 @@ #include "cursor.h" #include "dir.h" #include "game_delays.h" +#include "game_video_type.h" #include "localevent.h" #include "logging.h" #include "screen.h" diff --git a/src/fheroes2/game/game_video.h b/src/fheroes2/game/game_video.h index 1d7101628..446d24d13 100644 --- a/src/fheroes2/game/game_video.h +++ b/src/fheroes2/game/game_video.h @@ -1,6 +1,6 @@ /*************************************************************************** * fheroes2: https://github.com/ihhub/fheroes2 * - * Copyright (C) 2020 - 2023 * + * Copyright (C) 2020 - 2024 * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -24,7 +24,6 @@ #include #include -#include "game_video_type.h" #include "image.h" #include "math_base.h" #include "screen.h" @@ -36,6 +35,8 @@ namespace fheroes2 namespace Video { + enum class VideoAction : int; + class Subtitle { public: diff --git a/src/fheroes2/game/highscores.cpp b/src/fheroes2/game/highscores.cpp index 8775428a2..6dd7345dc 100644 --- a/src/fheroes2/game/highscores.cpp +++ b/src/fheroes2/game/highscores.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include "campaign_scenariodata.h" #include "game_language.h" diff --git a/src/fheroes2/gui/interface_events.cpp b/src/fheroes2/gui/interface_events.cpp index 05a7b9d94..511051413 100644 --- a/src/fheroes2/gui/interface_events.cpp +++ b/src/fheroes2/gui/interface_events.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/src/fheroes2/gui/ui_campaign.cpp b/src/fheroes2/gui/ui_campaign.cpp index 8e0726841..293bdac3a 100644 --- a/src/fheroes2/gui/ui_campaign.cpp +++ b/src/fheroes2/gui/ui_campaign.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include diff --git a/src/fheroes2/gui/ui_font.cpp b/src/fheroes2/gui/ui_font.cpp index ac5f281e9..98ac11601 100644 --- a/src/fheroes2/gui/ui_font.cpp +++ b/src/fheroes2/gui/ui_font.cpp @@ -24,8 +24,8 @@ #include #include #include -#include +#include "game_language.h" #include "icn.h" #include "image.h" #include "math_base.h" diff --git a/src/fheroes2/gui/ui_font.h b/src/fheroes2/gui/ui_font.h index ea3eb146a..34581a583 100644 --- a/src/fheroes2/gui/ui_font.h +++ b/src/fheroes2/gui/ui_font.h @@ -20,14 +20,15 @@ #pragma once +#include #include -#include "game_language.h" - namespace fheroes2 { class Sprite; + enum class SupportedLanguage : uint8_t; + void generateAlphabet( const SupportedLanguage language, std::vector> & icnVsSprite ); bool isAlphabetSupported( const SupportedLanguage language ); diff --git a/src/fheroes2/gui/ui_kingdom.cpp b/src/fheroes2/gui/ui_kingdom.cpp index b30d10495..a9fcdba35 100644 --- a/src/fheroes2/gui/ui_kingdom.cpp +++ b/src/fheroes2/gui/ui_kingdom.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include "agg_image.h" #include "game_delays.h" diff --git a/src/fheroes2/gui/ui_map_object.cpp b/src/fheroes2/gui/ui_map_object.cpp index b41b8d76c..d47097329 100644 --- a/src/fheroes2/gui/ui_map_object.cpp +++ b/src/fheroes2/gui/ui_map_object.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include "agg_image.h" diff --git a/src/fheroes2/gui/ui_text.cpp b/src/fheroes2/gui/ui_text.cpp index 92dcc8559..5801c1c5b 100644 --- a/src/fheroes2/gui/ui_text.cpp +++ b/src/fheroes2/gui/ui_text.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include "agg_image.h" diff --git a/src/fheroes2/heroes/heroes.cpp b/src/fheroes2/heroes/heroes.cpp index a956cbb9b..2a903dea5 100644 --- a/src/fheroes2/heroes/heroes.cpp +++ b/src/fheroes2/heroes/heroes.cpp @@ -28,9 +28,8 @@ #include #include #include -#include -#include #include +#include #include #include diff --git a/src/fheroes2/heroes/heroes_dialog.cpp b/src/fheroes2/heroes/heroes_dialog.cpp index 5eb68744a..7d1311050 100644 --- a/src/fheroes2/heroes/heroes_dialog.cpp +++ b/src/fheroes2/heroes/heroes_dialog.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include diff --git a/src/fheroes2/heroes/heroes_meeting.cpp b/src/fheroes2/heroes/heroes_meeting.cpp index ee0002a17..fb650e855 100644 --- a/src/fheroes2/heroes/heroes_meeting.cpp +++ b/src/fheroes2/heroes/heroes_meeting.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/src/fheroes2/heroes/route.cpp b/src/fheroes2/heroes/route.cpp index 10998c45c..ece27e98f 100644 --- a/src/fheroes2/heroes/route.cpp +++ b/src/fheroes2/heroes/route.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * fheroes2: https://github.com/ihhub/fheroes2 * - * Copyright (C) 2019 - 2023 * + * Copyright (C) 2019 - 2024 * * * * Free Heroes2 Engine: http://sourceforge.net/projects/fheroes2 * * Copyright (C) 2009 by Andrey Afletdinov * @@ -24,7 +24,6 @@ #include "route.h" #include -#include #include #include "game_io.h" diff --git a/src/fheroes2/heroes/route.h b/src/fheroes2/heroes/route.h index dd8a44a5f..69005d42e 100644 --- a/src/fheroes2/heroes/route.h +++ b/src/fheroes2/heroes/route.h @@ -1,6 +1,6 @@ /*************************************************************************** * fheroes2: https://github.com/ihhub/fheroes2 * - * Copyright (C) 2019 - 2023 * + * Copyright (C) 2019 - 2024 * * * * Free Heroes2 Engine: http://sourceforge.net/projects/fheroes2 * * Copyright (C) 2009 by Andrey Afletdinov * @@ -25,7 +25,6 @@ #include #include -#include #include #include "direction.h" diff --git a/src/fheroes2/kingdom/kingdom.cpp b/src/fheroes2/kingdom/kingdom.cpp index 0b285a91b..156bfc868 100644 --- a/src/fheroes2/kingdom/kingdom.cpp +++ b/src/fheroes2/kingdom/kingdom.cpp @@ -48,6 +48,7 @@ #include "maps_tiles.h" #include "maps_tiles_helper.h" #include "math_base.h" +#include "mp2.h" #include "payment.h" #include "players.h" #include "profit.h" diff --git a/src/fheroes2/kingdom/kingdom.h b/src/fheroes2/kingdom/kingdom.h index 3798ba98a..eaba0d7f4 100644 --- a/src/fheroes2/kingdom/kingdom.h +++ b/src/fheroes2/kingdom/kingdom.h @@ -35,7 +35,6 @@ #include "heroes.h" #include "heroes_recruits.h" #include "monster.h" -#include "mp2.h" #include "pairs.h" #include "players.h" #include "puzzle.h" @@ -45,6 +44,11 @@ class StreamBase; struct EventDate; +namespace MP2 +{ + enum MapObjectType : uint16_t; +} + namespace Maps { class Tiles; diff --git a/src/fheroes2/maps/map_format_helper.cpp b/src/fheroes2/maps/map_format_helper.cpp index a513bdb6d..7b42ec01f 100644 --- a/src/fheroes2/maps/map_format_helper.cpp +++ b/src/fheroes2/maps/map_format_helper.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include @@ -42,6 +41,7 @@ #include "maps_fileinfo.h" #include "maps_tiles.h" #include "maps_tiles_helper.h" +#include "monster.h" #include "mp2.h" #include "race.h" #include "world.h" diff --git a/src/fheroes2/maps/map_object_info.cpp b/src/fheroes2/maps/map_object_info.cpp index 101f975dd..017d2e3e5 100644 --- a/src/fheroes2/maps/map_object_info.cpp +++ b/src/fheroes2/maps/map_object_info.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include diff --git a/src/fheroes2/maps/maps.cpp b/src/fheroes2/maps/maps.cpp index a4e00faec..c18f03f08 100644 --- a/src/fheroes2/maps/maps.cpp +++ b/src/fheroes2/maps/maps.cpp @@ -36,6 +36,7 @@ #include "logging.h" #include "maps_tiles.h" #include "maps_tiles_helper.h" +#include "mp2.h" #include "players.h" #include "race.h" #include "resource.h" diff --git a/src/fheroes2/maps/maps.h b/src/fheroes2/maps/maps.h index 8f25f4f35..c40be8026 100644 --- a/src/fheroes2/maps/maps.h +++ b/src/fheroes2/maps/maps.h @@ -28,12 +28,16 @@ #include #include "math_base.h" -#include "mp2.h" #define TILEWIDTH 32 class Heroes; +namespace MP2 +{ + enum MapObjectType : uint16_t; +} + using MapsIndexes = std::vector; namespace Maps diff --git a/src/fheroes2/maps/maps_objects.h b/src/fheroes2/maps/maps_objects.h index a8b95deec..707c4afdb 100644 --- a/src/fheroes2/maps/maps_objects.h +++ b/src/fheroes2/maps/maps_objects.h @@ -24,6 +24,7 @@ #define H2MAPS_OBJECTS_H #include +#include #include #include #include diff --git a/src/fheroes2/maps/maps_tiles.cpp b/src/fheroes2/maps/maps_tiles.cpp index b909d488f..2a09098fe 100644 --- a/src/fheroes2/maps/maps_tiles.cpp +++ b/src/fheroes2/maps/maps_tiles.cpp @@ -29,9 +29,9 @@ #include #include #include -#include #include #include +#include #include #include diff --git a/src/fheroes2/maps/maps_tiles_helper.h b/src/fheroes2/maps/maps_tiles_helper.h index aadfb7224..1f24a42b8 100644 --- a/src/fheroes2/maps/maps_tiles_helper.h +++ b/src/fheroes2/maps/maps_tiles_helper.h @@ -26,13 +26,18 @@ #include "army_troop.h" #include "artifact.h" #include "math_base.h" -#include "mp2.h" #include "resource.h" #include "skill.h" class Monster; class Spell; +namespace MP2 +{ + enum MapObjectType : uint16_t; + enum ObjectIcnType : uint8_t; +} + namespace Maps { class Tiles; diff --git a/src/fheroes2/maps/maps_tiles_render.cpp b/src/fheroes2/maps/maps_tiles_render.cpp index be6de3860..2174c4c89 100644 --- a/src/fheroes2/maps/maps_tiles_render.cpp +++ b/src/fheroes2/maps/maps_tiles_render.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -46,6 +45,7 @@ #include "maps_tiles_helper.h" #include "monster.h" #include "monster_anim.h" +#include "mp2.h" #include "race.h" #include "spell.h" #include "til.h" diff --git a/src/fheroes2/maps/maps_tiles_render.h b/src/fheroes2/maps/maps_tiles_render.h index 73d868f07..1ba7cb870 100644 --- a/src/fheroes2/maps/maps_tiles_render.h +++ b/src/fheroes2/maps/maps_tiles_render.h @@ -23,7 +23,6 @@ #include #include "math_base.h" -#include "mp2.h" class Heroes; @@ -38,6 +37,11 @@ namespace Interface class GameArea; } +namespace MP2 +{ + enum ObjectIcnType : uint8_t; +} + namespace Maps { class Tiles; diff --git a/src/fheroes2/monster/monster_info.cpp b/src/fheroes2/monster/monster_info.cpp index 068d3afa6..0bf90756d 100644 --- a/src/fheroes2/monster/monster_info.cpp +++ b/src/fheroes2/monster/monster_info.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/src/fheroes2/resource/artifact.cpp b/src/fheroes2/resource/artifact.cpp index 5497f7be9..bca37c979 100644 --- a/src/fheroes2/resource/artifact.cpp +++ b/src/fheroes2/resource/artifact.cpp @@ -42,6 +42,7 @@ #include "icn.h" #include "logging.h" #include "maps_fileinfo.h" +#include "mp2.h" #include "rand.h" #include "serialize.h" #include "settings.h" diff --git a/src/fheroes2/resource/artifact.h b/src/fheroes2/resource/artifact.h index 4574b4709..5f25e6696 100644 --- a/src/fheroes2/resource/artifact.h +++ b/src/fheroes2/resource/artifact.h @@ -33,13 +33,17 @@ #include "image.h" #include "interface_itemsbar.h" #include "math_base.h" -#include "mp2.h" #include "ui_tool.h" class Heroes; class StatusBar; class StreamBase; +namespace MP2 +{ + enum MapObjectType : uint16_t; +} + class Artifact { public: diff --git a/src/fheroes2/resource/artifact_info.cpp b/src/fheroes2/resource/artifact_info.cpp index f1412c0a5..d775ddeea 100644 --- a/src/fheroes2/resource/artifact_info.cpp +++ b/src/fheroes2/resource/artifact_info.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include "artifact.h" diff --git a/src/fheroes2/resource/resource.cpp b/src/fheroes2/resource/resource.cpp index 90082b0a0..b67a1b984 100644 --- a/src/fheroes2/resource/resource.cpp +++ b/src/fheroes2/resource/resource.cpp @@ -26,8 +26,7 @@ #include #include #include -#include -#include +#include #include #include #include diff --git a/src/fheroes2/system/players.cpp b/src/fheroes2/system/players.cpp index 49d3e75ec..050bb602b 100644 --- a/src/fheroes2/system/players.cpp +++ b/src/fheroes2/system/players.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include "castle.h" diff --git a/src/fheroes2/system/settings.cpp b/src/fheroes2/system/settings.cpp index c0e0b96b0..7bb0395f9 100644 --- a/src/fheroes2/system/settings.cpp +++ b/src/fheroes2/system/settings.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #if defined( MACOS_APP_BUNDLE ) diff --git a/src/fheroes2/world/world.cpp b/src/fheroes2/world/world.cpp index 11d164f0a..066979467 100644 --- a/src/fheroes2/world/world.cpp +++ b/src/fheroes2/world/world.cpp @@ -27,11 +27,9 @@ #include #include #include -#include #include #include #include -#include #include #include "ai_planner.h" diff --git a/src/fheroes2/world/world.h b/src/fheroes2/world/world.h index 984fc9202..c75333a83 100644 --- a/src/fheroes2/world/world.h +++ b/src/fheroes2/world/world.h @@ -39,7 +39,6 @@ #include "maps_tiles.h" #include "math_base.h" #include "monster.h" -#include "mp2.h" #include "pairs.h" #include "resource.h" #include "world_pathfinding.h" @@ -51,6 +50,11 @@ class StreamBase; struct MapEvent; struct Week; +namespace MP2 +{ + enum MapObjectType : uint16_t; +} + namespace Route { class Step; diff --git a/src/fheroes2/world/world_loadmap.cpp b/src/fheroes2/world/world_loadmap.cpp index e57f9c047..fceb2adb5 100644 --- a/src/fheroes2/world/world_loadmap.cpp +++ b/src/fheroes2/world/world_loadmap.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/src/fheroes2/world/world_pathfinding.cpp b/src/fheroes2/world/world_pathfinding.cpp index 227a161a3..d5ed5fb0d 100644 --- a/src/fheroes2/world/world_pathfinding.cpp +++ b/src/fheroes2/world/world_pathfinding.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/src/fheroes2/world/world_regions.cpp b/src/fheroes2/world/world_regions.cpp index 18bbe43bd..68d6c9f62 100644 --- a/src/fheroes2/world/world_regions.cpp +++ b/src/fheroes2/world/world_regions.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/src/tools/82m2wav.cpp b/src/tools/82m2wav.cpp index 37860ee42..04a323c8b 100644 --- a/src/tools/82m2wav.cpp +++ b/src/tools/82m2wav.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * fheroes2: https://github.com/ihhub/fheroes2 * - * Copyright (C) 2022 - 2023 * + * Copyright (C) 2022 - 2024 * * * * Free Heroes2 Engine: http://sourceforge.net/projects/fheroes2 * * Copyright (C) 2009 by Andrey Afletdinov * @@ -25,12 +25,11 @@ #include #include #include -#include // IWYU pragma: keep +#include #include #include #include #include -#include #include #include #include diff --git a/src/tools/bin2txt.cpp b/src/tools/bin2txt.cpp index 115bf65c7..ee4f945cd 100644 --- a/src/tools/bin2txt.cpp +++ b/src/tools/bin2txt.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * fheroes2: https://github.com/ihhub/fheroes2 * - * Copyright (C) 2022 - 2023 * + * Copyright (C) 2022 - 2024 * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -22,10 +22,9 @@ #include #include #include -#include // IWYU pragma: keep +#include #include #include -#include #include #include #include diff --git a/src/tools/extractor.cpp b/src/tools/extractor.cpp index f551ffbe3..8866c7b07 100644 --- a/src/tools/extractor.cpp +++ b/src/tools/extractor.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * fheroes2: https://github.com/ihhub/fheroes2 * - * Copyright (C) 2022 - 2023 * + * Copyright (C) 2022 - 2024 * * * * Free Heroes2 Engine: http://sourceforge.net/projects/fheroes2 * * Copyright (C) 2009 by Andrey Afletdinov * @@ -26,13 +26,12 @@ #include #include #include -#include // IWYU pragma: keep +#include #include #include #include #include #include -#include #include #include #include diff --git a/src/tools/h2dmgr.cpp b/src/tools/h2dmgr.cpp index 3fda1c7c7..086b40629 100644 --- a/src/tools/h2dmgr.cpp +++ b/src/tools/h2dmgr.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * fheroes2: https://github.com/ihhub/fheroes2 * - * Copyright (C) 2023 * + * Copyright (C) 2023 - 2024 * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -24,11 +24,11 @@ #include #include #include -#include // IWYU pragma: keep +#include +#include #include #include #include -#include #include #include #include diff --git a/src/tools/icn2img.cpp b/src/tools/icn2img.cpp index fe69aa9fd..d28e7637a 100644 --- a/src/tools/icn2img.cpp +++ b/src/tools/icn2img.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * fheroes2: https://github.com/ihhub/fheroes2 * - * Copyright (C) 2022 - 2023 * + * Copyright (C) 2022 - 2024 * * * * Free Heroes2 Engine: http://sourceforge.net/projects/fheroes2 * * Copyright (C) 2009 by Andrey Afletdinov * @@ -25,10 +25,9 @@ #include #include #include -#include // IWYU pragma: keep +#include #include #include -#include #include #include #include diff --git a/src/tools/xmi2midi.cpp b/src/tools/xmi2midi.cpp index eee1e5901..9eb6b949e 100644 --- a/src/tools/xmi2midi.cpp +++ b/src/tools/xmi2midi.cpp @@ -1,6 +1,6 @@ /*************************************************************************** * fheroes2: https://github.com/ihhub/fheroes2 * - * Copyright (C) 2022 - 2023 * + * Copyright (C) 2022 - 2024 * * * * Free Heroes2 Engine: http://sourceforge.net/projects/fheroes2 * * Copyright (C) 2009 by Andrey Afletdinov * @@ -25,10 +25,9 @@ #include #include #include -#include // IWYU pragma: keep +#include #include #include -#include #include #include #include