aboutsummaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-06-28 19:22:06 +0200
committerHampusM <hampus@hampusmat.com>2022-06-28 19:22:06 +0200
commitd2a76bd8cfd883070259bf572a9f723a37c0d96e (patch)
treecca72b471b0c3a562789a1ab966e4568edf7165a /src/game
parentdaf39f75d764449f18cd480b6d3c645b8372b0a5 (diff)
refactor: improve includes with iwyu
Diffstat (limited to 'src/game')
-rw-r--r--src/game/RLE_reader.cpp16
-rw-r--r--src/game/components/statusline.cpp11
-rw-r--r--src/game/components/statusline.hpp16
-rw-r--r--src/game/game.cpp31
-rw-r--r--src/game/game.hpp31
-rw-r--r--src/game/status_manager.cpp2
-rw-r--r--src/game/status_manager.hpp8
7 files changed, 66 insertions, 49 deletions
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 <ctre.hpp>
-
#include <cctype>
-#include <fstream>
#include <string>
#include <vector>
-#include <iostream>
+#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<MatrixElement> &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 <fmt/color.h>
-
#include <utility>
+#include "engine/data/vector2.hpp"
+#include "interfaces/matrix.hpp"
+#include "util/ranges.hpp"
+#include "util/ranges_impl.hpp"
+
StatusLine::StatusLine(std::shared_ptr<ComponentMatrix> 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 <cstdint>
+#include <memory>
+#include <string_view>
+#include <unordered_map>
#include "engine/data/style.hpp"
#include "engine/data/vector2.hpp"
+#include "interfaces/component.hpp"
+#include "interfaces/matrix.hpp"
+#include "interfaces/statusline.hpp"
-#include <memory>
-#include <string_view>
-#include <unordered_map>
+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 <fmt/color.h>
#include <fmt/core.h>
-
-#include <algorithm>
+#include <fmt/format.h>
+#include <yacppdic/factory.hpp>
#include <cstdlib>
#include <filesystem>
#include <iostream>
+#include <iterator>
#include <stdexcept>
#include <utility>
+#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<IScene> 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 <chrono>
+#include <cstddef>
+#include <cstdint>
+#include <functional>
+#include <list>
+#include <memory>
+#include <optional>
+#include <string>
+#include <string_view>
+#include <unordered_map>
+#include <vector>
+
+#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 <chrono>
-#include <cstddef>
-#include <functional>
-#include <list>
-#include <memory>
-#include <optional>
-#include <string>
-#include <string_view>
-#include <vector>
+class ICellHelper;
+class IGenerationTracker;
+class IRLEReader;
+class IStatusManager;
+class IUserInputObserver;
+template <typename ElementType>
+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 <fmt/core.h>
-
#include <stdexcept>
-#include <utility>
void StatusManager::bind(const std::shared_ptr<IStatusLine> &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 <yacppdic/auto_wirable.hpp>
+#include <cstdint>
#include <memory>
#include <optional>
#include <string_view>
+#include <unordered_map>
+#include <yacppdic/auto_wirable.hpp>
+
+#include "interfaces/statusline.hpp"
class StatusManager : public IStatusManager,
public yacppdic::AutoWirable<IStatusManager, StatusManager>