1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Fix #6006: Objects higher than 6 metres are considered trees

This commit is contained in:
Michael Steenbeek
2019-03-18 22:56:14 +01:00
committed by GitHub
parent b8aeb56bdc
commit 68aa5122fa
7 changed files with 17 additions and 7 deletions

View File

@@ -2,6 +2,7 @@
------------------------------------------------------------------------
- Change: [#8688] Move common actions from debug menu into cheats menu.
- Fix: [#5579] Network desync immediately after connecting.
- Fix: [#6006] Objects higher than 6 metres are considered trees (original bug).
- Fix: [#7884] Unfinished preserved rides can be demolished with quick demolish.
- Fix: [#8873] Potential crash when placing footpaths.
- Fix: [#8900] Peep tracking is not synchronized.

View File

@@ -19,6 +19,7 @@
#include "../windows/Intent.h"
#include "../world/Park.h"
#include "../world/Scenery.h"
#include "../world/SmallScenery.h"
#include "../world/Sprite.h"
#include "../world/Surface.h"
#include "GameAction.h"
@@ -80,7 +81,7 @@ public:
if (gParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL)
{
// Check for obstructing large trees
TileElement* tileElement = CheckTallTreeObstructions();
TileElement* tileElement = CheckTreeObstructions();
if (tileElement != nullptr)
{
map_obstruction_set_error_text(tileElement);
@@ -195,7 +196,7 @@ private:
return STR_NONE;
}
TileElement* CheckTallTreeObstructions() const
TileElement* CheckTreeObstructions() const
{
TileElement* tileElement = map_get_first_element_at(_coords.x / 32, _coords.y / 32);
do
@@ -207,7 +208,7 @@ private:
if (_height + 4 < tileElement->base_height)
continue;
rct_scenery_entry* sceneryEntry = tileElement->AsSmallScenery()->GetEntry();
if (sceneryEntry->small_scenery.height > 64)
if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_IS_TREE))
{
return tileElement;
}

View File

@@ -82,7 +82,7 @@ public:
// Check if allowed to remove item
if (gParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL)
{
if (entry->small_scenery.height > 64)
if (scenery_small_entry_has_flag(entry, SMALL_SCENERY_FLAG_IS_TREE))
{
res->Error = GA_ERROR::NO_CLEARANCE;
res->ErrorTitle = STR_CANT_REMOVE_THIS;

View File

@@ -31,7 +31,7 @@
// This string specifies which version of network stream current build uses.
// It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version.
#define NETWORK_STREAM_VERSION "5"
#define NETWORK_STREAM_VERSION "6"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
static Peep* _pickup_peep = nullptr;

View File

@@ -46,6 +46,11 @@ void SmallSceneryObject::ReadLegacy(IReadObjectContext* context, IStream* stream
{
_frameOffsets = ReadFrameOffsets(stream);
}
// This crude method was used by RCT2. JSON objects have a flag for this property.
if (_legacyType.small_scenery.height > 64)
{
_legacyType.small_scenery.flags |= SMALL_SCENERY_FLAG_IS_TREE;
}
GetImageTable().Read(context, stream);
@@ -270,6 +275,7 @@ void SmallSceneryObject::ReadJson(IReadObjectContext* context, const json_t* roo
{ "allowSupportsAbove", SMALL_SCENERY_FLAG_BUILD_DIRECTLY_ONTOP },
{ "supportsHavePrimaryColour", SMALL_SCENERY_FLAG_PAINT_SUPPORTS },
{ "SMALL_SCENERY_FLAG27", SMALL_SCENERY_FLAG27 },
{ "isTree", SMALL_SCENERY_FLAG_IS_TREE },
});
// Determine shape flags from a shape string

View File

@@ -94,7 +94,7 @@ int32_t map_place_scenery_clear_func(TileElement** tile_element, int32_t x, int3
if (gParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL)
{
if (scenery->small_scenery.height > 64)
if (scenery_small_entry_has_flag(scenery, SMALL_SCENERY_FLAG_IS_TREE))
return 1;
}
@@ -128,7 +128,7 @@ int32_t map_place_non_scenery_clear_func(TileElement** tile_element, int32_t x,
if (gParkFlags & PARK_FLAGS_FORBID_TREE_REMOVAL)
{
if (scenery->small_scenery.height > 64)
if (scenery_small_entry_has_flag(scenery, SMALL_SCENERY_FLAG_IS_TREE))
return 1;
}

View File

@@ -44,6 +44,8 @@ enum SMALL_SCENERY_FLAGS
SMALL_SCENERY_FLAG_THREE_QUARTERS = (1 << 25), // 0x2000000
SMALL_SCENERY_FLAG_PAINT_SUPPORTS = (1 << 26), // 0x4000000; used for scenery items which are support structures
SMALL_SCENERY_FLAG27 = (1 << 27), // 0x8000000
SMALL_SCENERY_FLAG_IS_TREE = (1 << 28), // Added by OpenRCT2
};
enum