1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-15 15:02:34 +02:00

rwengine: iwyu: reduce warnings in engine subdirectory

This commit is contained in:
Anonymous Maarten 2017-10-31 04:05:12 +01:00 committed by Daniel Evans
parent a7203e00a0
commit fb58dfb082
24 changed files with 212 additions and 136 deletions

View File

@ -4,6 +4,7 @@
#include <limits> #include <limits>
#include <utility> #include <utility>
#include <btBulletDynamicsCommon.h>
#include <glm/gtc/constants.hpp> #include <glm/gtc/constants.hpp>
#include <glm/gtc/quaternion.hpp> #include <glm/gtc/quaternion.hpp>

View File

@ -9,12 +9,12 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <data/Clump.hpp>
#include <rw/defines.hpp> #include <rw/defines.hpp>
#include <rw/forward.hpp> #include <rw/forward.hpp>
#include "data/CollisionModel.hpp" #include <data/CollisionModel.hpp>
#include "data/Clump.hpp" #include <data/PathData.hpp>
#include "data/PathData.hpp"
#ifdef RW_WINDOWS #ifdef RW_WINDOWS
#include <rw_mingw.hpp> #include <rw_mingw.hpp>
#endif #endif

View File

@ -1,8 +1,14 @@
#include "engine/Animator.hpp"
#include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp>
#include <data/Clump.hpp> #include <data/Clump.hpp>
#include <engine/Animator.hpp>
#include <glm/gtc/matrix_transform.hpp> #include "loaders/LoaderIFP.hpp"
#include <loaders/LoaderDFF.hpp>
#include <queue> #include <algorithm>
#include <cmath>
Animator::Animator(ClumpPtr model) : model(model) { Animator::Animator(ClumpPtr model) : model(model) {
} }

View File

@ -1,14 +1,12 @@
#pragma once #ifndef _RWENGINE_ANIMATOR_HPP_
#ifndef _ANIMATOR_HPP_ #define _RWENGINE_ANIMATOR_HPP_
#define _ANIMATOR_HPP_
#include <cstdint>
#include <glm/glm.hpp>
#include <glm/gtx/quaternion.hpp>
#include <loaders/LoaderIFP.hpp>
#include <map> #include <map>
#include <rw/defines.hpp> #include <vector>
#include <rw/defines.hpp>
#include <rw/forward.hpp> #include <rw/forward.hpp>
struct AnimationBone;
class ModelFrame; class ModelFrame;
/** /**

View File

@ -1,24 +1,35 @@
#include <data/Clump.hpp> #include "engine/GameData.hpp"
#include <data/ModelData.hpp>
#include <data/WeaponData.hpp>
#include <engine/GameData.hpp>
#include <engine/GameState.hpp>
#include <engine/GameWorld.hpp>
#include <loaders/LoaderCOL.hpp>
#include <loaders/LoaderIDE.hpp>
#include <loaders/LoaderIPL.hpp>
#include <platform/FileHandle.hpp>
#include <script/SCMFile.hpp>
#include <core/Logger.hpp>
#include <loaders/GenericDATLoader.hpp>
#include <loaders/LoaderGXT.hpp>
#include <platform/FileIndex.hpp>
#include <algorithm> #include <algorithm>
#include <boost/algorithm/string/predicate.hpp> #include <cctype>
#include <cmath>
#include <cstdlib>
#include <fstream> #include <fstream>
#include <iostream> #include <iterator>
#include <sstream> #include <stdexcept>
#include <boost/algorithm/string/predicate.hpp>
#include <data/Clump.hpp>
#include <rw/defines.hpp>
#include <rw/types.hpp>
#include "core/Logger.hpp"
//#include "data/WeaponData.hpp"
#include "engine/GameState.hpp"
#include "engine/GameWorld.hpp"
#include "loaders/LoaderCOL.hpp"
#include "loaders/LoaderDFF.hpp"
#include "loaders/LoaderIDE.hpp"
#include "loaders/LoaderIFP.hpp"
#include "loaders/LoaderIMG.hpp"
#include "loaders/LoaderIPL.hpp"
#include "loaders/LoaderTXD.hpp"
#include "platform/FileHandle.hpp"
#include "script/SCMFile.hpp"
#include "loaders/GenericDATLoader.hpp"
#include "loaders/LoaderGXT.hpp"
#include "platform/FileIndex.hpp"
GameData::GameData(Logger* log, const rwfs::path& path) GameData::GameData(Logger* log, const rwfs::path& path)
: datpath(path), logger(log), engine(nullptr) { : datpath(path), logger(log), engine(nullptr) {

View File

@ -1,28 +1,35 @@
#pragma once #ifndef _RWENGINE_GAMEDATA_HPP_
#ifndef _GAMEDATA_HPP_ #define _RWENGINE_GAMEDATA_HPP_
#define _GAMEDATA_HPP_
class Logger; #include <array>
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <map>
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
#include <glm/glm.hpp>
#include <platform/FileIndex.hpp>
#include <rw/defines.hpp>
#include <rw/forward.hpp>
#include <data/GameTexts.hpp> #include <data/GameTexts.hpp>
#include <data/ModelData.hpp>
#include <data/PedData.hpp> #include <data/PedData.hpp>
#include <data/ZoneData.hpp> #include <data/ZoneData.hpp>
#include <data/AnimGroup.hpp> #include <data/AnimGroup.hpp>
#include <loaders/LoaderDFF.hpp> #include <loaders/LoaderDFF.hpp>
#include <loaders/LoaderIDE.hpp>
#include <loaders/LoaderIFP.hpp>
#include <loaders/LoaderIMG.hpp> #include <loaders/LoaderIMG.hpp>
#include <loaders/LoaderTXD.hpp> #include <loaders/LoaderTXD.hpp>
#include <loaders/WeatherLoader.hpp> #include <loaders/WeatherLoader.hpp>
#include <objects/VehicleInfo.hpp> #include <objects/VehicleInfo.hpp>
#include <rw/types.hpp>
#include <gl/TextureData.hpp> #include <gl/TextureData.hpp>
#include <platform/FileIndex.hpp>
#include <memory> class Logger;
struct DynamicObjectData;
struct WeaponData; struct WeaponData;
class GameWorld; class GameWorld;
class TextureAtlas; class TextureAtlas;

View File

@ -1,4 +1,4 @@
#include <engine/GameState.hpp> #include "engine/GameState.hpp"
BasicState::BasicState() BasicState::BasicState()
: saveName{0} : saveName{0}

View File

@ -1,21 +1,23 @@
#pragma once #ifndef _RWENGINE_GAMESTATE_HPP_
#ifndef _GAMESTATE_HPP_ #define _RWENGINE_GAMESTATE_HPP_
#define _GAMESTATE_HPP_
#include <bitset> #include <bitset>
#include <cstdint>
#include <string>
#include <map>
#include <vector>
#include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp>
#include <data/GameTexts.hpp>
#include <data/VehicleGenerator.hpp> #include <data/VehicleGenerator.hpp>
#include <engine/GameInputState.hpp> #include <engine/GameInputState.hpp>
#include <engine/ScreenText.hpp> #include <engine/ScreenText.hpp>
#include <glm/glm.hpp>
#include <glm/gtx/quaternion.hpp>
#include <map>
#include <objects/ObjectTypes.hpp> #include <objects/ObjectTypes.hpp>
#include <string>
#include <vector>
class GameWorld; class GameWorld;
class GameObject; class GameObject;
class ScriptMachine; class ScriptMachine;
class PlayerController;
struct CutsceneData; struct CutsceneData;
struct SystemTime { struct SystemTime {

View File

@ -1,33 +1,40 @@
#include "engine/GameWorld.hpp" #include "engine/GameWorld.hpp"
//#include <LinearMath/btScalar.h>
//#include <BulletCollision/CollisionDispatch/btGhostObject.h>
#include <btBulletDynamicsCommon.h>
#include <glm/gtx/norm.hpp>
#include <data/Clump.hpp> #include <data/Clump.hpp>
#include <engine/GameData.hpp> #include "core/Logger.hpp"
#include <engine/GameState.hpp>
#include <core/Logger.hpp> #include "engine/GameData.hpp"
#include "engine/GameState.hpp"
#include <BulletCollision/CollisionDispatch/btGhostObject.h> #include "ai/DefaultAIController.hpp"
#include <ai/DefaultAIController.hpp> #include "ai/PlayerController.hpp"
#include <ai/TrafficDirector.hpp> #include "ai/TrafficDirector.hpp"
#include <data/WeaponData.hpp>
#include <loaders/LoaderIDE.hpp>
#include <loaders/LoaderIPL.hpp>
// 3 isn't enough to cause a factory. #include "data/CutsceneData.hpp"
#include <objects/CharacterObject.hpp> #include "data/WeaponData.hpp"
#include <objects/CutsceneObject.hpp>
#include <objects/InstanceObject.hpp> #include "loaders/LoaderCutsceneDAT.hpp"
#include <objects/ItemPickup.hpp> #include "loaders/LoaderIPL.hpp"
#include <objects/VehicleObject.hpp>
#include "objects/CharacterObject.hpp"
#include "objects/CutsceneObject.hpp"
#include "objects/InstanceObject.hpp"
#include "objects/ItemPickup.hpp"
#include "objects/VehicleObject.hpp"
#include "render/ViewCamera.hpp"
#include <data/CutsceneData.hpp>
#include <loaders/LoaderCutsceneDAT.hpp>
#ifdef RW_WINDOWS #ifdef RW_WINDOWS
#include <rw_mingw.hpp> #include <rw_mingw.hpp>
#endif #endif
#include <render/ViewCamera.hpp>
// Behaviour Tuning // Behaviour Tuning
constexpr float kMaxTrafficSpawnRadius = 100.f; constexpr float kMaxTrafficSpawnRadius = 100.f;
@ -210,8 +217,6 @@ void GameWorld::cleanupTraffic(const ViewCamera& focus) {
destroyQueuedObjects(); destroyQueuedObjects();
} }
#include <ai/PlayerController.hpp>
#include <core/Logger.hpp>
CutsceneObject* GameWorld::createCutsceneObject(const uint16_t id, CutsceneObject* GameWorld::createCutsceneObject(const uint16_t id,
const glm::vec3& pos, const glm::vec3& pos,
const glm::quat& rot) { const glm::quat& rot) {

View File

@ -1,18 +1,43 @@
#ifndef _GAMEWORLD_HPP_ #ifndef _RWENGINE_GAMEWORLD_HPP_
#define _GAMEWORLD_HPP_ #define _RWENGINE_GAMEWORLD_HPP_
#include <cstdint>
#include <map>
#include <memory>
#include <random>
#include <set>
#include <string>
#include <vector>
#include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp>
#include <LinearMath/btScalar.h>
#include <ai/AIGraph.hpp>
#include <ai/AIGraphNode.hpp>
#include <audio/SoundManager.hpp>
#include <objects/ObjectTypes.hpp>
#include <render/VisualFX.hpp>
#include <data/Chase.hpp>
class btCollisionDispatcher;
class btDefaultCollisionConfiguration;
class btDiscreteDynamicsWorld;
class btDynamicsWorld;
class btManifoldPoint;
class btOverlappingPairCallback;
class btSequentialImpulseConstraintSolver;
struct btDbvtBroadphase;
class GameState;
class PlayerController; class PlayerController;
class Logger; class Logger;
class GameData; class GameData;
#include <ai/AIGraph.hpp>
#include <ai/AIGraphNode.hpp>
#include <audio/SoundManager.hpp>
#include <engine/GameState.hpp>
class CutsceneObject; class CutsceneObject;
#include <objects/ObjectTypes.hpp>
class GameObject; class GameObject;
class CharacterObject; class CharacterObject;
@ -21,27 +46,11 @@ class VehicleObject;
class PickupObject; class PickupObject;
class ViewCamera; class ViewCamera;
#include <data/ModelData.hpp>
#include <render/VisualFX.hpp>
struct BlipData; struct BlipData;
struct WeaponScan; struct WeaponScan;
struct VehicleGenerator; struct VehicleGenerator;
#include <data/Chase.hpp>
#include <glm/glm.hpp>
#include <data/Clump.hpp>
#include <btBulletCollisionCommon.h>
#include <btBulletDynamicsCommon.h>
#include <array>
#include <random>
#include <set>
#include <vector>
/** /**
* Information about "Goal" locations so they can be rendered * Information about "Goal" locations so they can be rendered
* (this doesn't really belong here). * (this doesn't really belong here).

View File

@ -1,18 +1,33 @@
#include <ai/PlayerController.hpp> #include "engine/SaveGame.hpp"
#include <cstdint>
#include <cstdlib>
#include <cstring> #include <cstring>
#include <engine/GameData.hpp> #include <cstdio>
#include <engine/GameState.hpp>
#include <engine/GameWorld.hpp> #if RW_DEBUG
#include <engine/SaveGame.hpp> #include <iostream>
#include <objects/CharacterObject.hpp> #endif
#include <objects/GameObject.hpp>
#include <objects/InstanceObject.hpp>
#include <objects/VehicleObject.hpp>
#include <script/SCMFile.hpp>
#include <script/ScriptMachine.hpp>
#include <rw/filesystem.hpp> #include <rw/filesystem.hpp>
#include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp>
#include <rw/defines.hpp>
#include "data/ZoneData.hpp"
#include "engine/GameData.hpp"
#include "engine/GameState.hpp"
#include "engine/GameWorld.hpp"
#include "objects/CharacterObject.hpp"
#include "objects/GameObject.hpp"
#include "objects/InstanceObject.hpp"
#include "objects/VehicleObject.hpp"
#include "script/SCMFile.hpp"
#include "script/ScriptMachine.hpp"
#include "script/ScriptTypes.hpp"
// Original save game file data structures // Original save game file data structures
typedef uint16_t BlockWord; typedef uint16_t BlockWord;
typedef uint32_t BlockDword; typedef uint32_t BlockDword;
@ -484,23 +499,23 @@ bool readBlock(std::FILE* str, T& out) {
#define READ_VALUE(var) \ #define READ_VALUE(var) \
if (!readBlock(loadFile, var)) { \ if (!readBlock(loadFile, var)) { \
std::cerr << file << ": Failed to load block " #var << std::endl; \ RW_ERROR(file << ": Failed to load block " #var); \
return false; \ return false; \
} }
#define READ_SIZE(var) \ #define READ_SIZE(var) \
if (!readBlock(loadFile, var)) { \ if (!readBlock(loadFile, var)) { \
std::cerr << file << ": Failed to load size " #var << std::endl; \ RW_ERROR(file << ": Failed to load size " #var); \
return false; \ return false; \
} }
#define CHECK_SIG(expected) \ #define CHECK_SIG(expected) \
{ \ { \
char signature[4]; \ char signature[4]; \
if (fread(signature, sizeof(char), 4, loadFile) != 4) { \ if (fread(signature, sizeof(char), 4, loadFile) != 4) { \
std::cerr << "Failed to read signature" << std::endl; \ RW_ERROR("Failed to read signature"); \
return false; \ return false; \
} \ } \
if (strncmp(signature, expected, 3) != 0) { \ if (strncmp(signature, expected, 3) != 0) { \
std::cerr << "Signature " expected " incorrect" << std::endl; \ RW_ERROR("Signature " expected " incorrect"); \
return false; \ return false; \
} \ } \
} }
@ -512,7 +527,7 @@ bool readBlock(std::FILE* str, T& out) {
bool SaveGame::loadGame(GameState& state, const std::string& file) { bool SaveGame::loadGame(GameState& state, const std::string& file) {
std::FILE* loadFile = std::fopen(file.c_str(), "rb"); std::FILE* loadFile = std::fopen(file.c_str(), "rb");
if (loadFile == nullptr) { if (loadFile == nullptr) {
std::cerr << "Failed to open save file" << std::endl; RW_ERROR("Failed to open save file");
return false; return false;
} }
@ -538,7 +553,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) {
if (fread(state.script->getGlobals(), sizeof(SCMByte), scriptVarCount, if (fread(state.script->getGlobals(), sizeof(SCMByte), scriptVarCount,
loadFile) != scriptVarCount) { loadFile) != scriptVarCount) {
std::cerr << "Failed to read script memory" << std::endl; RW_ERROR("Failed to read script memory");
return false; return false;
} }

View File

@ -1,16 +1,10 @@
#pragma once #ifndef _RWENGINE_SAVEGAME_HPP_
#ifndef _SAVEGAME_HPP_ #define _RWENGINE_SAVEGAME_HPP_
#define _SAVEGAME_HPP_
#include <rw/types.hpp>
#include <engine/GameState.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
class GameWorld; #include <engine/GameState.hpp>
class ScriptMachine;
struct SaveGameInfo { struct SaveGameInfo {
std::string savePath; std::string savePath;

View File

@ -1,4 +1,6 @@
#include <engine/ScreenText.hpp> #include "engine/ScreenText.hpp"
#include <rw/defines.hpp>
void ScreenText::tick(float dt) { void ScreenText::tick(float dt) {
int millis = dt * 1000; int millis = dt * 1000;

View File

@ -1,12 +1,15 @@
#ifndef RWENGINE_SCREENTEXT_HPP #ifndef _RWENGINE_SCREENTEXT_HPP_
#define RWENGINE_SCREENTEXT_HPP #define _RWENGINE_SCREENTEXT_HPP_
#include <algorithm> #include <algorithm>
#include <array> #include <array>
#include <data/GameTexts.hpp> #include <cstddef>
#include <rw/types.hpp> #include <string>
#include <utility>
#include <vector> #include <vector>
#include <glm/glm.hpp>
#include <data/GameTexts.hpp>
enum class ScreenTextType { enum class ScreenTextType {
/// Big text will be rendered according to the proscribed style. /// Big text will be rendered according to the proscribed style.
/// Adding a 2nd big text will cause the first to terminate. /// Adding a 2nd big text will cause the first to terminate.

View File

@ -1,13 +1,17 @@
#include <ai/CharacterController.hpp> #include <ai/CharacterController.hpp>
#include <engine/Animator.hpp> #include <engine/Animator.hpp>
#include <engine/GameData.hpp> #include <engine/GameData.hpp>
#include <engine/GameState.hpp>
#include <engine/GameWorld.hpp> #include <engine/GameWorld.hpp>
#include <objects/CharacterObject.hpp> #include <objects/CharacterObject.hpp>
#include <objects/VehicleObject.hpp> #include <objects/VehicleObject.hpp>
#include <rw/defines.hpp> #include <rw/defines.hpp>
#include "loaders/LoaderIFP.hpp"
#include <algorithm> #include <algorithm>
#include <btBulletDynamicsCommon.h>
// Required for BT_BULLET_VERSION // Required for BT_BULLET_VERSION
#include "LinearMath/btScalar.h" #include "LinearMath/btScalar.h"
#ifndef BT_BULLET_VERSION #ifndef BT_BULLET_VERSION

View File

@ -1,8 +1,11 @@
#pragma once #ifndef _RWENGINE_OBJECTTYPES_
#define _RWENGINE_OBJECTTYPES_
#include <cstdint> #include <cstdint>
/** /**
* all wordly GameObjects are associated with a 32-bit identifier * all wordly GameObjects are associated with a 32-bit identifier
*/ */
typedef uint32_t GameObjectID; typedef uint32_t GameObjectID;
#endif

View File

@ -1,7 +1,10 @@
#include "objects/PickupObject.hpp"
#include <btBulletDynamicsCommon.h>
#include <engine/GameData.hpp> #include <engine/GameData.hpp>
#include <engine/GameWorld.hpp> #include <engine/GameWorld.hpp>
#include <objects/CharacterObject.hpp> #include <objects/CharacterObject.hpp>
#include <objects/PickupObject.hpp>
uint32_t colours[14] = { uint32_t colours[14] = {
0xff0000, // bat, detonator, adrenaline 0xff0000, // bat, detonator, adrenaline

View File

@ -1,3 +1,8 @@
#include "objects/VehicleObject.hpp"
#include <btBulletDynamicsCommon.h>
#include <glm/gtx/quaternion.hpp>
#include <BulletDynamics/Vehicle/btRaycastVehicle.h> #include <BulletDynamics/Vehicle/btRaycastVehicle.h>
#include <data/Clump.hpp> #include <data/Clump.hpp>
#include <data/CollisionModel.hpp> #include <data/CollisionModel.hpp>
@ -7,7 +12,6 @@
#include <engine/GameData.hpp> #include <engine/GameData.hpp>
#include <engine/GameWorld.hpp> #include <engine/GameWorld.hpp>
#include <objects/CharacterObject.hpp> #include <objects/CharacterObject.hpp>
#include <objects/VehicleObject.hpp>
#define PART_CLOSE_VELOCITY 0.25f #define PART_CLOSE_VELOCITY 0.25f
constexpr float kVehicleMaxExitVelocity = 0.15f; constexpr float kVehicleMaxExitVelocity = 0.15f;

View File

@ -7,6 +7,8 @@
#include "SDL.h" #include "SDL.h"
#include <iostream>
// Use first 8 chars of git hash as the build string // Use first 8 chars of git hash as the build string
const std::string kBuildStr(kGitSHA1Hash, 8); const std::string kBuildStr(kGitSHA1Hash, 8);
const std::string kWindowTitle = "RWGame"; const std::string kWindowTitle = "RWGame";

View File

@ -1,4 +1,7 @@
#include "RWGame.hpp" #include "RWGame.hpp"
#include <glm/gtx/norm.hpp>
#include "DrawUI.hpp" #include "DrawUI.hpp"
#include "GameInput.hpp" #include "GameInput.hpp"
#include "State.hpp" #include "State.hpp"

View File

@ -18,6 +18,7 @@
#include <script/ScriptMachine.hpp> #include <script/ScriptMachine.hpp>
#include <glm/gtc/constants.hpp> #include <glm/gtc/constants.hpp>
#include <glm/gtx/norm.hpp>
#include <glm/gtx/matrix_major_storage.hpp> #include <glm/gtx/matrix_major_storage.hpp>
constexpr float kAutoLookTime = 2.f; constexpr float kAutoLookTime = 2.f;

View File

@ -1,6 +1,7 @@
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <data/Clump.hpp> #include <data/Clump.hpp>
#include <engine/Animator.hpp> #include <engine/Animator.hpp>
#include <loaders/LoaderIFP.hpp>
#include <glm/gtx/string_cast.hpp> #include <glm/gtx/string_cast.hpp>
#include "test_Globals.hpp" #include "test_Globals.hpp"

View File

@ -1,6 +1,7 @@
#ifndef _TESTGLOBALS_HPP_ #ifndef _TESTGLOBALS_HPP_
#define _TESTGLOBALS_HPP_ #define _TESTGLOBALS_HPP_
#include <btBulletDynamicsCommon.h>
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include <GameWindow.hpp> #include <GameWindow.hpp>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>

View File

@ -1,5 +1,6 @@
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <data/ModelData.hpp> #include <data/ModelData.hpp>
#include <loaders/LoaderIDE.hpp>
#include "test_Globals.hpp" #include "test_Globals.hpp"
BOOST_AUTO_TEST_SUITE(ObjectDataTests) BOOST_AUTO_TEST_SUITE(ObjectDataTests)