From d2a76bd8cfd883070259bf572a9f723a37c0d96e Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 28 Jun 2022 19:22:06 +0200 Subject: refactor: improve includes with iwyu --- src/game/RLE_reader.cpp | 16 ++++++---------- src/game/components/statusline.cpp | 11 +++++------ src/game/components/statusline.hpp | 16 ++++++++++------ src/game/game.cpp | 31 ++++++++++++++++++++----------- src/game/game.hpp | 31 ++++++++++++++++++++----------- src/game/status_manager.cpp | 2 -- src/game/status_manager.hpp | 8 +++++--- 7 files changed, 66 insertions(+), 49 deletions(-) (limited to 'src/game') diff --git a/src/game/RLE_reader.cpp b/src/game/RLE_reader.cpp index f971966..df2823c 100644 --- a/src/game/RLE_reader.cpp +++ b/src/game/RLE_reader.cpp @@ -1,20 +1,16 @@ #include "RLE_reader.hpp" -#include "engine/data/bounds.hpp" -#include "engine/data/vector2.hpp" -#include "errors/RLE_reader.hpp" -#include "util/algorithm.hpp" -#include "util/io.hpp" -#include "util/string.hpp" - #include - #include -#include #include #include -#include +#include "engine/data/bounds.hpp" +#include "engine/data/vector2.hpp" +#include "errors/RLE_reader.hpp" +#include "util/algorithm_impl.hpp" +#include "util/io_impl.hpp" +#include "util/string_impl.hpp" RLEReader::RLEReader(const IMatrixFactory &matrix_factory) noexcept : _matrix_factory(matrix_factory) diff --git a/src/game/components/statusline.cpp b/src/game/components/statusline.cpp index c2fe7ea..aac1c27 100644 --- a/src/game/components/statusline.cpp +++ b/src/game/components/statusline.cpp @@ -1,14 +1,13 @@ #include "statusline.hpp" -#include "engine/data/bounds.hpp" -#include "engine/data/vector2.hpp" -#include "util/color.hpp" -#include "util/ranges.hpp" - #include - #include +#include "engine/data/vector2.hpp" +#include "interfaces/matrix.hpp" +#include "util/ranges.hpp" +#include "util/ranges_impl.hpp" + StatusLine::StatusLine(std::shared_ptr component_matrix) noexcept : _component_matrix(std::move(component_matrix)), _need_render(false) { diff --git a/src/game/components/statusline.hpp b/src/game/components/statusline.hpp index 4451fde..a6742c9 100644 --- a/src/game/components/statusline.hpp +++ b/src/game/components/statusline.hpp @@ -1,14 +1,17 @@ #pragma once -#include "interfaces/matrix.hpp" -#include "interfaces/statusline.hpp" +#include +#include +#include +#include #include "engine/data/style.hpp" #include "engine/data/vector2.hpp" +#include "interfaces/component.hpp" +#include "interfaces/matrix.hpp" +#include "interfaces/statusline.hpp" -#include -#include -#include +class Vector2; constexpr std::uint32_t STATUSLINE_COLOR = 0x1A1A1AU; @@ -32,7 +35,8 @@ public: const std::string_view &status, std::int32_t start) noexcept override; - void set_section_length(StatusLineSection section, std::int32_t length) noexcept override; + void + set_section_length(StatusLineSection section, std::int32_t length) noexcept override; void set_section_style(StatusLineSection section, const Style &style) noexcept override; diff --git a/src/game/game.cpp b/src/game/game.cpp index 921f21d..a121089 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -1,24 +1,33 @@ #include "game.hpp" -#include "engine/data/bounds.hpp" -#include "engine/escape.hpp" -#include "engine/keycodes.hpp" -#include "errors/RLE_reader.hpp" -#include "errors/io.hpp" -#include "util/algorithm.hpp" -#include "util/fs.hpp" -#include "util/string.hpp" - #include #include - -#include +#include +#include #include #include #include +#include #include #include +#include "engine/data/bounds.hpp" +#include "engine/escape.hpp" +#include "engine/graphics/matrix_iterator.hpp" +#include "engine/graphics/matrix_iterator_impl.hpp" +#include "engine/keycodes.hpp" +#include "errors/RLE_reader.hpp" +#include "errors/io.hpp" +#include "interfaces/RLE_reader.hpp" +#include "interfaces/cell_helper.hpp" +#include "interfaces/generation_tracker.hpp" +#include "interfaces/input.hpp" +#include "interfaces/matrix.hpp" +#include "interfaces/status_manager.hpp" +#include "util/algorithm_impl.hpp" +#include "util/fs.hpp" +#include "util/string_impl.hpp" + Game::Game( IStatusLineFactory statusline_factory, std::shared_ptr scene, diff --git a/src/game/game.hpp b/src/game/game.hpp index da1ba11..13e229e 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -1,5 +1,18 @@ #pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "engine/data/vector2.hpp" #include "interfaces/RLE_reader.hpp" #include "interfaces/cell_helper.hpp" #include "interfaces/cursor.hpp" @@ -11,17 +24,13 @@ #include "interfaces/status_manager.hpp" #include "interfaces/statusline.hpp" -#include "engine/data/vector2.hpp" - -#include -#include -#include -#include -#include -#include -#include -#include -#include +class ICellHelper; +class IGenerationTracker; +class IRLEReader; +class IStatusManager; +class IUserInputObserver; +template +class IMatrix; constexpr auto DEFAULT_GENERATIONS_PER_SECOND = 5L; diff --git a/src/game/status_manager.cpp b/src/game/status_manager.cpp index fd56627..a174680 100644 --- a/src/game/status_manager.cpp +++ b/src/game/status_manager.cpp @@ -1,9 +1,7 @@ #include "status_manager.hpp" #include - #include -#include void StatusManager::bind(const std::shared_ptr &statusline) noexcept { diff --git a/src/game/status_manager.hpp b/src/game/status_manager.hpp index b170cf9..e9f2d15 100644 --- a/src/game/status_manager.hpp +++ b/src/game/status_manager.hpp @@ -1,13 +1,15 @@ #pragma once #include "interfaces/status_manager.hpp" -#include "interfaces/statusline.hpp" - -#include +#include #include #include #include +#include +#include + +#include "interfaces/statusline.hpp" class StatusManager : public IStatusManager, public yacppdic::AutoWirable -- cgit v1.2.3-18-g5258