diff --git a/src/openrct2-ui/windows/ViewClipping.cpp b/src/openrct2-ui/windows/ViewClipping.cpp index b3a37eef80..d38379cecb 100644 --- a/src/openrct2-ui/windows/ViewClipping.cpp +++ b/src/openrct2-ui/windows/ViewClipping.cpp @@ -20,6 +20,7 @@ #include #include #include +#include namespace OpenRCT2::Ui::Windows { diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index 2ef606e736..5a6a20fa71 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -45,6 +45,7 @@ #include "world/Climate.h" #include "world/Entrance.h" #include "world/Footpath.h" +#include "world/MapLimits.h" #include "world/Park.h" #include "world/Scenery.h" diff --git a/src/openrct2/actions/MapChangeSizeAction.h b/src/openrct2/actions/MapChangeSizeAction.h index d8e884bf27..f2817d274f 100644 --- a/src/openrct2/actions/MapChangeSizeAction.h +++ b/src/openrct2/actions/MapChangeSizeAction.h @@ -9,7 +9,7 @@ #pragma once -#include "../world/Map.h" +#include "../world/Location.hpp" #include "GameAction.h" namespace OpenRCT2::GameActions diff --git a/src/openrct2/entity/Fountain.h b/src/openrct2/entity/Fountain.h index df82902fd8..722f5289db 100644 --- a/src/openrct2/entity/Fountain.h +++ b/src/openrct2/entity/Fountain.h @@ -10,7 +10,7 @@ #pragma once #include "../core/FlagHolder.hpp" -#include "../world/Map.h" +#include "../world/Location.hpp" #include "EntityBase.h" class DataSerialiser; @@ -28,6 +28,8 @@ namespace OpenRCT2 direction = 7, }; using FountainFlags = FlagHolder; + + struct TileElement; } // namespace OpenRCT2 enum class JumpingFountainType : uint8_t diff --git a/src/openrct2/entity/PatrolArea.h b/src/openrct2/entity/PatrolArea.h index 3f1de627d7..463f2ef704 100644 --- a/src/openrct2/entity/PatrolArea.h +++ b/src/openrct2/entity/PatrolArea.h @@ -9,10 +9,11 @@ #pragma once -#include "../world/Map.h" +#include "../world/MapLimits.h" #include "Staff.h" #include +#include // The number of elements in the GameState_t.StaffPatrolAreas array per staff member. Every bit in the array represents a 4x4 // square. Right now, it's a 32-bit array like in RCT2. 32 * 128 = 4096 bits, which is also the number of 4x4 squares on a diff --git a/src/openrct2/entity/Staff.h b/src/openrct2/entity/Staff.h index 024c8ad120..e62c47d57a 100644 --- a/src/openrct2/entity/Staff.h +++ b/src/openrct2/entity/Staff.h @@ -11,13 +11,19 @@ #include "../core/EnumUtils.hpp" #include "../core/Money.hpp" -#include "../world/Map.h" #include "Peep.h" #include +namespace OpenRCT2 +{ + struct TileElement; + struct PathElement; +} // namespace OpenRCT2 + class DataSerialiser; class PatrolArea; +struct Ride; using colour_t = uint8_t; diff --git a/src/openrct2/network/NetworkPlayer.h b/src/openrct2/network/NetworkPlayer.h index 43a0af28bd..19a1b6201f 100644 --- a/src/openrct2/network/NetworkPlayer.h +++ b/src/openrct2/network/NetworkPlayer.h @@ -11,7 +11,7 @@ #include "../Game.h" #include "../core/Money.hpp" -#include "../world/Map.h" +#include "../world/Location.hpp" #include #include diff --git a/src/openrct2/paint/Paint.h b/src/openrct2/paint/Paint.h index 1361a69d78..ceb12e98cf 100644 --- a/src/openrct2/paint/Paint.h +++ b/src/openrct2/paint/Paint.h @@ -13,7 +13,7 @@ #include "../drawing/Drawing.h" #include "../interface/Colour.h" #include "../world/Location.hpp" -#include "../world/Map.h" +#include "../world/MapLimits.h" #include "Boundbox.h" #include "tile_element/Paint.Tunnel.h" diff --git a/src/openrct2/paint/tile_element/Paint.PathAddition.h b/src/openrct2/paint/tile_element/Paint.PathAddition.h index 272b8ab2e6..6319a3ba3e 100644 --- a/src/openrct2/paint/tile_element/Paint.PathAddition.h +++ b/src/openrct2/paint/tile_element/Paint.PathAddition.h @@ -14,6 +14,11 @@ #include +namespace OpenRCT2 +{ + struct PathElement; +} + void Sub6A3F61PathAddition( PaintSession& session, const OpenRCT2::PathElement& pathElement, uint16_t height, ImageId sceneryImageTemplate); void PaintLampLightEffects(PaintSession& session, const OpenRCT2::PathElement& pathEl, uint16_t height); diff --git a/src/openrct2/paint/tile_element/Paint.TileElement.h b/src/openrct2/paint/tile_element/Paint.TileElement.h index a3db772b4d..2d174fa134 100644 --- a/src/openrct2/paint/tile_element/Paint.TileElement.h +++ b/src/openrct2/paint/tile_element/Paint.TileElement.h @@ -9,7 +9,19 @@ #pragma once -#include "../../world/Map.h" +#include "../../world/Location.hpp" + +namespace OpenRCT2 +{ + struct BannerElement; + struct EntranceElement; + struct LargeSceneryElement; + struct PathElement; + struct SmallSceneryElement; + struct SurfaceElement; + struct TrackElement; + struct WallElement; +} // namespace OpenRCT2 struct PaintSession; diff --git a/src/openrct2/ride/TrackPaint.h b/src/openrct2/ride/TrackPaint.h index 3850e83f0c..82685b212b 100644 --- a/src/openrct2/ride/TrackPaint.h +++ b/src/openrct2/ride/TrackPaint.h @@ -13,7 +13,6 @@ #include "../paint/support/MetalSupports.h" #include "../paint/tile_element/Paint.TileElement.h" #include "../paint/track/Support.h" -#include "../world/Map.h" namespace OpenRCT2 { diff --git a/src/openrct2/scripting/Duktape.hpp b/src/openrct2/scripting/Duktape.hpp index ac71d5d845..ed3a8903d4 100644 --- a/src/openrct2/scripting/Duktape.hpp +++ b/src/openrct2/scripting/Duktape.hpp @@ -14,7 +14,6 @@ #include "../core/Console.hpp" #include "../core/EnumMap.hpp" #include "../ride/Vehicle.h" - #include "../world/Map.h" #include #include diff --git a/src/openrct2/world/Location.hpp b/src/openrct2/world/Location.hpp index afff50cb9a..e9a224216d 100644 --- a/src/openrct2/world/Location.hpp +++ b/src/openrct2/world/Location.hpp @@ -10,20 +10,15 @@ #pragma once #include "../core/Numerics.hpp" +#include "../world/MapLimits.h" #include constexpr int16_t kLocationNull = -32768; - -constexpr int32_t kCoordsXYStep = 32; -constexpr int32_t kCoordsXYHalfTile = (kCoordsXYStep / 2); -constexpr int32_t kCoordsZStep = 8; -constexpr int32_t kCoordsZPerTinyZ = 16; +constexpr int32_t kCoordsNull = 0xFFFF8000; constexpr auto kNumOrthogonalDirections = 4; -constexpr int32_t kCoordsNull = 0xFFFF8000; - constexpr int32_t kScreenCoordsTileWidth = 64; constexpr int32_t kScreenCoordsTileWidthHalf = kScreenCoordsTileWidth / 2; constexpr int32_t kScreenCoordsTileHeight = 32; diff --git a/src/openrct2/world/Map.h b/src/openrct2/world/Map.h index f6415511c2..98ae33f37e 100644 --- a/src/openrct2/world/Map.h +++ b/src/openrct2/world/Map.h @@ -17,34 +17,7 @@ #include #include -constexpr uint8_t kMinimumLandHeight = 2; -constexpr uint8_t kMaximumLandHeight = 254; -constexpr uint8_t kMinimumWaterHeight = 2; -constexpr uint8_t kMaximumWaterHeight = 254; -/** - * The land height that counts as 0 metres/feet for the land height labels and altitude graphs. - */ -constexpr uint8_t kMapBaseZ = 7; - -constexpr uint8_t kMinimumMapSizeTechnical = 5; -constexpr uint16_t kMaximumMapSizeTechnical = 1001; -constexpr int16_t kMinimumMapSizePractical = (kMinimumMapSizeTechnical - 2); -constexpr int16_t kMaximumMapSizePractical = (kMaximumMapSizeTechnical - 2); -constexpr const int32_t kMaximumMapSizeBig = kCoordsXYStep * kMaximumMapSizeTechnical; -constexpr int32_t kMaximumTileStartXY = kMaximumMapSizeBig - kCoordsXYStep; -constexpr const int32_t kLandHeightStep = 2 * kCoordsZStep; -constexpr const int32_t kWaterHeightStep = 2 * kCoordsZStep; -constexpr const int32_t kMinimumLandZ = kMinimumLandHeight * kCoordsZStep; constexpr TileCoordsXY kDefaultMapSize = { 150, 150 }; -// How high construction has to be off the ground when the player owns construction rights, in tile coords. -constexpr uint8_t kConstructionRightsClearanceSmall = 3; -// Same as previous, but in big coords. -constexpr const uint8_t kConstructionRightsClearanceBig = 3 * kCoordsZStep; - -constexpr int16_t kMapMinimumXY = (-kMaximumMapSizeTechnical); - -constexpr uint32_t kMaxTileElementsWithSpaceRoom = 0x1000000; -constexpr uint32_t kMaxTileElements = kMaxTileElementsWithSpaceRoom - 512; using PeepSpawn = CoordsXYZD; diff --git a/src/openrct2/world/MapLimits.h b/src/openrct2/world/MapLimits.h new file mode 100644 index 0000000000..c903a1efac --- /dev/null +++ b/src/openrct2/world/MapLimits.h @@ -0,0 +1,45 @@ +/***************************************************************************** + * Copyright (c) 2014-2025 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 + +constexpr int32_t kCoordsXYStep = 32; +constexpr int32_t kCoordsXYHalfTile = (kCoordsXYStep / 2); +constexpr int32_t kCoordsZStep = 8; +constexpr int32_t kCoordsZPerTinyZ = 16; + +constexpr uint8_t kMinimumMapSizeTechnical = 5; +constexpr uint16_t kMaximumMapSizeTechnical = 1001; +constexpr int16_t kMinimumMapSizePractical = (kMinimumMapSizeTechnical - 2); +constexpr int16_t kMaximumMapSizePractical = (kMaximumMapSizeTechnical - 2); +constexpr int32_t kMaximumMapSizeBig = kCoordsXYStep * kMaximumMapSizeTechnical; + +constexpr uint8_t kMinimumLandHeight = 2; +constexpr uint8_t kMaximumLandHeight = 254; +constexpr uint8_t kMinimumWaterHeight = 2; +constexpr uint8_t kMaximumWaterHeight = 254; + +constexpr int16_t kMapMinimumXY = (-kMaximumMapSizeTechnical); +constexpr int32_t kMaximumTileStartXY = kMaximumMapSizeBig - kCoordsXYStep; +constexpr int32_t kLandHeightStep = 2 * kCoordsZStep; +constexpr int32_t kWaterHeightStep = 2 * kCoordsZStep; +constexpr int32_t kMinimumLandZ = kMinimumLandHeight * kCoordsZStep; + +// The land height that counts as 0 metres/feet for the land height labels and altitude graphs. +constexpr uint8_t kMapBaseZ = 7; + +// How high construction has to be off the ground when the player owns construction rights, in tile coords. +constexpr uint8_t kConstructionRightsClearanceSmall = 3; +// Same as previous, but in big coords. +constexpr uint8_t kConstructionRightsClearanceBig = 3 * kCoordsZStep; + +constexpr uint32_t kMaxTileElementsWithSpaceRoom = 0x1000000; +constexpr uint32_t kMaxTileElements = kMaxTileElementsWithSpaceRoom - 512; diff --git a/src/openrct2/world/TileElementsView.h b/src/openrct2/world/TileElementsView.h index b389e54f82..bad3931f6d 100644 --- a/src/openrct2/world/TileElementsView.h +++ b/src/openrct2/world/TileElementsView.h @@ -10,12 +10,13 @@ #pragma once #include "Location.hpp" -#include "Map.h" #include namespace OpenRCT2 { + struct TileElement; + namespace Detail { template