Skip to content

Commit

Permalink
Introduce constant for construction rights clearance
Browse files Browse the repository at this point in the history
  • Loading branch information
Gymnasiast committed Jul 28, 2022
1 parent 7399163 commit f0777e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/openrct2/world/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,8 @@ bool map_is_location_owned(const CoordsXYZ& loc)

if (surfaceElement->GetOwnership() & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED)
{
if (loc.z < surfaceElement->GetBaseZ() || loc.z - LAND_HEIGHT_STEP > surfaceElement->GetBaseZ())
if (loc.z < surfaceElement->GetBaseZ()
|| loc.z >= surfaceElement->GetBaseZ() + ConstructionRightsClearanceSmall)
return true;
}
}
Expand Down Expand Up @@ -2249,7 +2250,7 @@ uint16_t check_max_allowable_land_rights_for_tile(const CoordsXYZ& tileMapPos)
{
destOwnership = OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED;
// Do not own construction rights if too high/below surface
if (tileElement->base_height - 3 > tilePos.z || tileElement->base_height < tilePos.z)
if (tileElement->base_height - ConstructionRightsClearanceSmall > tilePos.z || tileElement->base_height < tilePos.z)
{
destOwnership = OWNERSHIP_UNOWNED;
break;
Expand Down
4 changes: 4 additions & 0 deletions src/openrct2/world/Map.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ constexpr const int32_t LAND_HEIGHT_STEP = 2 * COORDS_Z_STEP;
constexpr const int32_t WATER_HEIGHT_STEP = 2 * COORDS_Z_STEP;
constexpr const int32_t MINIMUM_LAND_HEIGHT_BIG = MINIMUM_LAND_HEIGHT * COORDS_Z_STEP;
constexpr const TileCoordsXY DEFAULT_MAP_SIZE = { 150, 150 };
// How high construction has to be off the ground when the player owns construction rights, in tile coords.
constexpr const uint8_t ConstructionRightsClearanceSmall = 3;
// Same as previous, but in big coords.
constexpr const uint8_t ConstructionRightsClearanceBig = 3 * COORDS_Z_STEP;

#define MAP_MINIMUM_X_Y (-MAXIMUM_MAP_SIZE_TECHNICAL)

Expand Down

0 comments on commit f0777e5

Please sign in to comment.