From 1b844d9e52d4d94fcf4bbb9eb08412d569473433 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Mon, 5 Jan 2026 19:31:34 +0100 Subject: [PATCH] Rework object header includes (#25742) * Remove EntityList.h includes in a few places * Remove Object.h dependency from Footpath.h * Remove Object.h dependency from Editor headers * Remove Object.h dependency from NetworkBase.h * Move RideFilters struct to RideTypes.h * Move ObjectSourceGame enum to its own header * Remove Object.h dependency from ObjectManager.h * Remove Object.h dependency from ObjectRepository.h * Remove Object.h dependency from ObjectTypes.h * Add missing copyright header to ObjectEntryManager.cpp * Add missing copyright header to SurfaceData.h --- src/openrct2-ui/ride/Construction.h | 1 + .../windows/EditorBottomToolbar.cpp | 1 - src/openrct2/Editor.h | 4 ++- src/openrct2/EditorObjectSelectionSession.h | 10 ++++++- src/openrct2/ParkImporter.h | 1 - src/openrct2/drawing/Drawing.cpp | 1 - src/openrct2/interface/InteractiveConsole.cpp | 1 - src/openrct2/interface/Viewport.cpp | 1 - src/openrct2/libopenrct2.vcxproj | 1 + src/openrct2/localisation/Language.cpp | 2 ++ src/openrct2/network/NetworkBase.cpp | 1 - src/openrct2/network/NetworkBase.h | 4 +-- src/openrct2/object/MusicObject.h | 1 + src/openrct2/object/Object.h | 21 +-------------- src/openrct2/object/ObjectEntryManager.cpp | 10 +++++++ src/openrct2/object/ObjectManager.h | 7 ++++- src/openrct2/object/ObjectRepository.h | 2 +- src/openrct2/object/ObjectSourceGame.h | 27 +++++++++++++++++++ src/openrct2/object/PathAdditionObject.cpp | 3 +-- .../ClassicWoodenTwisterRollerCoaster.cpp | 1 + src/openrct2/park/Legacy.h | 2 +- src/openrct2/park/ParkFile.cpp | 1 - src/openrct2/rct1/S4Importer.cpp | 1 - src/openrct2/ride/RideTypes.h | 6 +++++ src/openrct2/ride/Track.h | 2 +- src/openrct2/ride/TrackData.h | 1 + src/openrct2/scenario/Scenario.cpp | 2 -- .../scripting/bindings/entity/ScEntity.hpp | 1 - .../scripting/bindings/entity/ScStaff.cpp | 1 + src/openrct2/world/Footpath.h | 7 ++++- src/openrct2/world/SurfaceData.h | 9 +++++++ 31 files changed, 91 insertions(+), 42 deletions(-) create mode 100644 src/openrct2/object/ObjectSourceGame.h diff --git a/src/openrct2-ui/ride/Construction.h b/src/openrct2-ui/ride/Construction.h index cb6dda3ddd..7bcb7503e0 100644 --- a/src/openrct2-ui/ride/Construction.h +++ b/src/openrct2-ui/ride/Construction.h @@ -12,6 +12,7 @@ #include #include #include +#include namespace OpenRCT2 { diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp index d56788051d..e30087fcdb 100644 --- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp +++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/src/openrct2/Editor.h b/src/openrct2/Editor.h index 36223fcdb5..c696dd9aaa 100644 --- a/src/openrct2/Editor.h +++ b/src/openrct2/Editor.h @@ -9,7 +9,9 @@ #pragma once -#include "object/Object.h" +#include "core/StringTypes.h" +#include "localisation/StringIdType.h" +#include "object/ObjectTypes.h" struct ResultWithMessage; diff --git a/src/openrct2/EditorObjectSelectionSession.h b/src/openrct2/EditorObjectSelectionSession.h index c5c01a1326..2acf3eb918 100644 --- a/src/openrct2/EditorObjectSelectionSession.h +++ b/src/openrct2/EditorObjectSelectionSession.h @@ -11,10 +11,18 @@ #include "core/EnumUtils.hpp" #include "core/FlagHolder.hpp" -#include "object/Object.h" +#include "localisation/StringIdType.h" +#include "object/ObjectTypes.h" +#include #include +namespace OpenRCT2 +{ + struct ObjectEntryDescriptor; + struct ObjectRepositoryItem; +} // namespace OpenRCT2 + struct ResultWithMessage; enum class EditorInputFlag : uint8_t diff --git a/src/openrct2/ParkImporter.h b/src/openrct2/ParkImporter.h index bbcb3de400..97119a538a 100644 --- a/src/openrct2/ParkImporter.h +++ b/src/openrct2/ParkImporter.h @@ -10,7 +10,6 @@ #pragma once #include "core/StringTypes.h" -#include "object/Object.h" #include "object/ObjectList.h" #include diff --git a/src/openrct2/drawing/Drawing.cpp b/src/openrct2/drawing/Drawing.cpp index 998f17fa9f..5604f0d4df 100644 --- a/src/openrct2/drawing/Drawing.cpp +++ b/src/openrct2/drawing/Drawing.cpp @@ -17,7 +17,6 @@ #include "../SpriteIds.h" #include "../config/Config.h" #include "../core/Guard.hpp" -#include "../object/Object.h" #include "../object/ObjectEntryManager.h" #include "../object/WaterEntry.h" #include "../platform/Platform.h" diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index b4e2bc07ce..65b6f75771 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -50,7 +50,6 @@ #include "../management/NewsItem.h" #include "../management/Research.h" #include "../network/Network.h" -#include "../object/Object.h" #include "../object/ObjectList.h" #include "../object/ObjectManager.h" #include "../object/ObjectRepository.h" diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index 5365da8107..8f66e92fb3 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -21,7 +21,6 @@ #include "../drawing/Drawing.h" #include "../drawing/IDrawingEngine.h" #include "../drawing/Rectangle.h" -#include "../entity/EntityList.h" #include "../entity/Guest.h" #include "../entity/Staff.h" #include "../interface/Cursors.h" diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index 3abb613db5..36fd26acd9 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -358,6 +358,7 @@ + diff --git a/src/openrct2/localisation/Language.cpp b/src/openrct2/localisation/Language.cpp index 5e438776b4..96d10a802a 100644 --- a/src/openrct2/localisation/Language.cpp +++ b/src/openrct2/localisation/Language.cpp @@ -7,6 +7,8 @@ * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ +#include "Language.h" + #include "../Context.h" #include "../core/String.hpp" #include "../drawing/ScrollingText.h" diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index ba4544fe5c..b2e237aebe 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -23,7 +23,6 @@ #include "../core/File.h" #include "../core/Guard.hpp" #include "../core/Json.hpp" -#include "../entity/EntityList.h" #include "../entity/EntityRegistry.h" #include "../entity/EntityTweener.h" #include "../localisation/Formatter.h" diff --git a/src/openrct2/network/NetworkBase.h b/src/openrct2/network/NetworkBase.h index 006ab80a7e..039fb2fda7 100644 --- a/src/openrct2/network/NetworkBase.h +++ b/src/openrct2/network/NetworkBase.h @@ -2,7 +2,6 @@ #include "../System.hpp" #include "../actions/GameAction.h" -#include "../object/Object.h" #include "../scenario/Scenario.h" #include "NetworkConnection.h" #include "NetworkGroup.h" @@ -21,7 +20,8 @@ namespace OpenRCT2 { struct IContext; -} + struct ObjectRepositoryItem; +} // namespace OpenRCT2 namespace OpenRCT2::Network { diff --git a/src/openrct2/object/MusicObject.h b/src/openrct2/object/MusicObject.h index 76a8f28f50..d8aa09596f 100644 --- a/src/openrct2/object/MusicObject.h +++ b/src/openrct2/object/MusicObject.h @@ -9,6 +9,7 @@ #pragma once +#include "../ride/RideTypes.h" #include "AudioSampleTable.h" #include "Object.h" diff --git a/src/openrct2/object/Object.h b/src/openrct2/object/Object.h index 2b9c043794..1e56a86489 100644 --- a/src/openrct2/object/Object.h +++ b/src/openrct2/object/Object.h @@ -14,6 +14,7 @@ #include "../drawing/ImageIndexType.h" #include "ImageTable.h" #include "ObjectAsset.h" +#include "ObjectSourceGame.h" #include "ObjectTypes.h" #include "StringTable.h" @@ -22,8 +23,6 @@ #include #include -using ride_type_t = uint16_t; - namespace OpenRCT2::Drawing { struct RenderTarget; @@ -47,18 +46,6 @@ namespace OpenRCT2 constexpr uint8_t AllFlags = 0xFF; }; // namespace ObjectSelectionFlags - enum class ObjectSourceGame : uint8_t - { - custom, - wackyWorlds, - timeTwister, - openRCT2Official, - rct1, - addedAttractions, - loopyLandscapes, - rct2 = 8, - }; - #pragma pack(push, 1) /** * Object entry structure. @@ -112,12 +99,6 @@ namespace OpenRCT2 #pragma pack(pop) - struct RideFilters - { - uint8_t category[2]; - ride_type_t ride_type; - }; - enum class ObjectGeneration : uint8_t { DAT, diff --git a/src/openrct2/object/ObjectEntryManager.cpp b/src/openrct2/object/ObjectEntryManager.cpp index dc3f853190..c589d6ffbc 100644 --- a/src/openrct2/object/ObjectEntryManager.cpp +++ b/src/openrct2/object/ObjectEntryManager.cpp @@ -1,6 +1,16 @@ +/***************************************************************************** + * Copyright (c) 2014-2026 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + #include "ObjectEntryManager.h" #include "../Context.h" +#include "Object.h" #include "ObjectManager.h" namespace OpenRCT2::ObjectManager diff --git a/src/openrct2/object/ObjectManager.h b/src/openrct2/object/ObjectManager.h index 3d913dc0e1..cbe939700d 100644 --- a/src/openrct2/object/ObjectManager.h +++ b/src/openrct2/object/ObjectManager.h @@ -9,7 +9,10 @@ #pragma once -#include "../object/Object.h" +#include "../localisation/StringIdType.h" +#include "../ride/RideTypes.h" +#include "ObjectSourceGame.h" +#include "ObjectTypes.h" #include #include @@ -19,7 +22,9 @@ namespace OpenRCT2 struct IObjectRepository; class Object; class ObjectList; + struct ObjectEntryDescriptor; struct ObjectRepositoryItem; + struct RCTObjectEntry; struct IObjectManager { diff --git a/src/openrct2/object/ObjectRepository.h b/src/openrct2/object/ObjectRepository.h index 3cda2be98c..2d78c955df 100644 --- a/src/openrct2/object/ObjectRepository.h +++ b/src/openrct2/object/ObjectRepository.h @@ -9,7 +9,7 @@ #pragma once -#include "../object/Object.h" +#include "ObjectTypes.h" #include "RideObject.h" #include diff --git a/src/openrct2/object/ObjectSourceGame.h b/src/openrct2/object/ObjectSourceGame.h new file mode 100644 index 0000000000..675b70b8d9 --- /dev/null +++ b/src/openrct2/object/ObjectSourceGame.h @@ -0,0 +1,27 @@ +/***************************************************************************** + * Copyright (c) 2014-2026 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include + +namespace OpenRCT2 +{ + enum class ObjectSourceGame : uint8_t + { + custom, + wackyWorlds, + timeTwister, + openRCT2Official, + rct1, + addedAttractions, + loopyLandscapes, + rct2 = 8, + }; +} diff --git a/src/openrct2/object/PathAdditionObject.cpp b/src/openrct2/object/PathAdditionObject.cpp index 99661d28f2..4f46a91c00 100644 --- a/src/openrct2/object/PathAdditionObject.cpp +++ b/src/openrct2/object/PathAdditionObject.cpp @@ -14,9 +14,8 @@ #include "../core/Json.hpp" #include "../drawing/Drawing.h" #include "../interface/Cursors.h" -#include "../object/Object.h" -#include "../object/ObjectRepository.h" #include "ObjectList.h" +#include "ObjectRepository.h" #include diff --git a/src/openrct2/paint/track/coaster/ClassicWoodenTwisterRollerCoaster.cpp b/src/openrct2/paint/track/coaster/ClassicWoodenTwisterRollerCoaster.cpp index 97faa2b831..19677c6bf3 100644 --- a/src/openrct2/paint/track/coaster/ClassicWoodenTwisterRollerCoaster.cpp +++ b/src/openrct2/paint/track/coaster/ClassicWoodenTwisterRollerCoaster.cpp @@ -8,6 +8,7 @@ *****************************************************************************/ #include "../../../SpriteIds.h" +#include "../../../drawing/Drawing.h" #include "../../../ride/Track.h" #include "../../../ride/TrackPaint.h" #include "../../tile_element/Paint.Tunnel.h" diff --git a/src/openrct2/park/Legacy.h b/src/openrct2/park/Legacy.h index 14813f0ae0..feec732a28 100644 --- a/src/openrct2/park/Legacy.h +++ b/src/openrct2/park/Legacy.h @@ -10,7 +10,7 @@ #pragma once #include "../core/FlagHolder.hpp" -#include "../object/Object.h" +#include "../object/ObjectTypes.h" #include #include diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index 3cbe7619a5..9ecefbf0f6 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -40,7 +40,6 @@ #include "../management/Award.h" #include "../management/Finance.h" #include "../management/NewsItem.h" -#include "../object/Object.h" #include "../object/ObjectLimits.h" #include "../object/ObjectManager.h" #include "../object/ObjectRepository.h" diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 84e247c7db..63484a7847 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -38,7 +38,6 @@ #include "../management/Finance.h" #include "../management/Marketing.h" #include "../management/NewsItem.h" -#include "../object/Object.h" #include "../object/ObjectLimits.h" #include "../object/ObjectList.h" #include "../object/ObjectManager.h" diff --git a/src/openrct2/ride/RideTypes.h b/src/openrct2/ride/RideTypes.h index d279bb2bf3..48bfd78045 100644 --- a/src/openrct2/ride/RideTypes.h +++ b/src/openrct2/ride/RideTypes.h @@ -21,6 +21,12 @@ struct Ride; using ride_type_t = uint16_t; static ride_type_t constexpr kRideTypeNull = 0xFF; +struct RideFilters +{ + uint8_t category[2]; + ride_type_t ride_type; +}; + /** * Couples a ride type and subtype together. */ diff --git a/src/openrct2/ride/Track.h b/src/openrct2/ride/Track.h index a16de6897e..9f94f47d8f 100644 --- a/src/openrct2/ride/Track.h +++ b/src/openrct2/ride/Track.h @@ -11,9 +11,9 @@ #include "../Identifiers.h" #include "../actions/CommandFlag.h" -#include "../object/Object.h" #include "../world/Location.hpp" #include "../world/QuarterTile.h" +#include "RideTypes.h" #include diff --git a/src/openrct2/ride/TrackData.h b/src/openrct2/ride/TrackData.h index 1a678db4ed..428245919e 100644 --- a/src/openrct2/ride/TrackData.h +++ b/src/openrct2/ride/TrackData.h @@ -10,6 +10,7 @@ #pragma once #include "../core/FlagHolder.hpp" +#include "../localisation/StringIdType.h" #include "../paint/support/MetalSupports.h" #include "../paint/support/WoodenSupports.h" #include "../paint/tile_element/Segment.h" diff --git a/src/openrct2/scenario/Scenario.cpp b/src/openrct2/scenario/Scenario.cpp index 69355c4a23..29843cd2cf 100644 --- a/src/openrct2/scenario/Scenario.cpp +++ b/src/openrct2/scenario/Scenario.cpp @@ -36,10 +36,8 @@ #include "../management/NewsItem.h" #include "../management/Research.h" #include "../network/Network.h" -#include "../object/Object.h" #include "../object/ObjectEntryManager.h" #include "../object/ObjectLimits.h" -#include "../object/ObjectList.h" #include "../object/ObjectManager.h" #include "../object/ScenarioMetaObject.h" #include "../object/WaterEntry.h" diff --git a/src/openrct2/scripting/bindings/entity/ScEntity.hpp b/src/openrct2/scripting/bindings/entity/ScEntity.hpp index aed36134d5..8440240705 100644 --- a/src/openrct2/scripting/bindings/entity/ScEntity.hpp +++ b/src/openrct2/scripting/bindings/entity/ScEntity.hpp @@ -13,7 +13,6 @@ #include "../../../Context.h" #include "../../../GameState.h" - #include "../../../entity/EntityList.h" #include "../../../entity/EntityRegistry.h" #include "../../../entity/Peep.h" #include "../../Duktape.hpp" diff --git a/src/openrct2/scripting/bindings/entity/ScStaff.cpp b/src/openrct2/scripting/bindings/entity/ScStaff.cpp index c580b9de8a..dc8f811f86 100644 --- a/src/openrct2/scripting/bindings/entity/ScStaff.cpp +++ b/src/openrct2/scripting/bindings/entity/ScStaff.cpp @@ -16,6 +16,7 @@ #include "../../../object/ObjectManager.h" #include "../../../object/PeepAnimationsObject.h" #include "../../../peep/PeepAnimations.h" + #include "../../../rct12/RCT12.h" #include "../../../world/Map.h" namespace OpenRCT2::Scripting diff --git a/src/openrct2/world/Footpath.h b/src/openrct2/world/Footpath.h index 2287d50128..63fde1cf82 100644 --- a/src/openrct2/world/Footpath.h +++ b/src/openrct2/world/Footpath.h @@ -11,7 +11,12 @@ #include "../Identifiers.h" #include "../actions/CommandFlag.h" -#include "../object/Object.h" +#include "../interface/Colour.h" +#include "../localisation/StringIdType.h" +#include "../object/ObjectTypes.h" +#include "Location.hpp" + +#include namespace OpenRCT2 { diff --git a/src/openrct2/world/SurfaceData.h b/src/openrct2/world/SurfaceData.h index 3f3dfae8cf..e74c2d82c4 100644 --- a/src/openrct2/world/SurfaceData.h +++ b/src/openrct2/world/SurfaceData.h @@ -1,3 +1,12 @@ +/***************************************************************************** + * Copyright (c) 2014-2026 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + #pragma once #include