Skip to content

Commit b7a5c81

Browse files
author
scinca
committed
check all headers
1 parent b0e9a48 commit b7a5c81

14 files changed

Lines changed: 42 additions & 18 deletions

File tree

ApplicationConfig.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Created by simon on 28.03.26.
33
//
44
#include <raylib.h>
5+
#include <algorithm>
56
#include "ApplicationConfig.h"
67
#include "MapCreator/MapCreator.h"
78

Database/Database.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
#include <ostream>
66
#include <string>
77
#include <format>
8+
#include <expected>
9+
#include <vector>
10+
#include <stdexcept>
11+
#include <cstdint>
812
#include "Map/Map.h"
913
#include "Database.h"
1014

Database/Database.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <expected>
99
#include <string>
1010
#include <vector>
11+
#include <string_view>
1112
#include <cstdint>
1213

1314

Game/Game.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <raygui.h>
88
#include <raylib.h>
99
#include <utility>
10+
#include <format>
1011
#include "Game.h"
1112
#include "ApplicationConfig.h"
1213

@@ -44,7 +45,7 @@ void Game::Initialize(const std::optional<int> map_number, const std::optional<s
4445
for (int i = 0; i < enemy_starting_positions.size(); i++) {
4546
enemy_players.push_back(std::make_unique<EnemyPlayer>(&game_map, &time_, player.get(), enemy_starting_positions[i], enemy_colors[i]));
4647
}
47-
48+
4849
silent_pause_ = true;
4950
state_ = GameState::PLAYING;
5051
}

Game/Game.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <memory>
55
#include <optional>
66
#include <array>
7+
#include <vector>
78
#include <raylib.h>
89
#include "Map/Map.h"
910
#include "HumanPlayer/HumanPlayer.h"

GameMenu/GameMenu.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
// Created by simon on 14.03.26.
33
//
44

5-
#include "GameMenu.h"
6-
#include "Game/Game.h"
7-
#include "ApplicationConfig.h"
5+
#include <iostream>
6+
#include <string>
87
#define RAYGUI_IMPLEMENTATION
98
#include <raygui.h>
109
#include "Database/Database.h"
11-
#include <iostream>
10+
#include "GameMenu.h"
11+
#include "Game/Game.h"
12+
#include "ApplicationConfig.h"
13+
1214

1315
GameMenu::~GameMenu() = default;
1416

GameMenu/GameMenu.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
#ifndef PACMAN_CPP_GAMEMENU_H
66
#define PACMAN_CPP_GAMEMENU_H
77

8+
#include <vector>
89
#include "Game/Game.h"
910
#include "MapCreator/MapCreator.h"
11+
#include "Database/Database.h"
12+
1013
class GameMenu {
1114
public:
1215
explicit GameMenu(Game *game, MapCreator *map_creator, Database* db);

HumanPlayer/HumanPlayer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
//
44

55
#include "HumanPlayer.h"
6-
#include <algorithm>
76
#include <raylib.h>
87
#include "Time/DeltaTime.h"
98
#include "Map/Map.h"

Map/Map.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
#include "Map/Map.h"
77

8-
#include <fstream>
98
#include <iostream>
109
#include "Database/Database.h"
11-
10+
#include <algorithm>
11+
#include <utility>
1212
#include <raylib.h>
1313
#include <regex>
14-
#include "../ApplicationConfig.h"
14+
#include "ApplicationConfig.h"
1515

1616
Map::Map(Database* db) : db_(db) {
1717
}
@@ -128,7 +128,7 @@ void Map::LoadFromString(const std::string& map) {
128128
score_ = 0;
129129
explored_map_.assign(loaded_map_.size(), false);
130130
free_tile_count_ = static_cast<int>(
131-
std::count(loaded_map_.begin(), loaded_map_.end(), '0')
131+
std::ranges::count(loaded_map_, '0')
132132
);
133133
}
134134

@@ -141,7 +141,7 @@ void Map::LoadMapFromDB(const int map_number) {
141141
std::erase(loaded_map_, '\r');
142142
explored_map_.assign(loaded_map_.size(), false);
143143
free_tile_count_ = static_cast<int>(
144-
std::count(loaded_map_.begin(), loaded_map_.end(), '0')
144+
std::ranges::count(loaded_map_, '0')
145145
);
146146
}
147147

@@ -151,20 +151,20 @@ std::optional<MapValidationError> Map::ValidateMap(const std::string& map) {
151151
if (map.length() != 1400) {
152152
return MapValidationError::InvalidLength;
153153
}
154-
if (std::count(map.begin(),map.end(), '0')<=100) {
154+
if (std::ranges::count(map, '0')<=100) {
155155
std::cerr << "Not enough coins" << std::endl;
156156
return MapValidationError::TooFewCoins;
157157
}
158158
if (!std::regex_match(map, valid_chars)) {
159159
std::cerr << "Invalid characters found.\n";
160160
return MapValidationError::UnresolvableSymbols;
161161
}
162-
auto player_starting_positions_count = std::count(map.begin(), map.end(), 'X');
162+
auto player_starting_positions_count = std::ranges::count(map, 'X');
163163
if (player_starting_positions_count != 1) {
164164
std::cerr << "Invalid player count: " << player_starting_positions_count << " (expected exactly 1)\n";
165165
return MapValidationError::InvalidPlayerCount;
166166
}
167-
auto ghost_starting_positions_count = std::count(map.begin(), map.end(), '?');
167+
auto ghost_starting_positions_count = std::ranges::count(map, '?');
168168
if (ghost_starting_positions_count > 4 || ghost_starting_positions_count < 1) {
169169
std::cerr << "Invalid ghost count: (Must be between 1 and 4) current count: " << ghost_starting_positions_count << "\n";
170170
return MapValidationError::InvalidEnemyCount;

Map/Map.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include <optional>
88
#include <string>
99
#include <vector>
10+
#include <utility>
11+
1012

1113
#include "Database/Database.h"
1214

0 commit comments

Comments
 (0)