Fix #5896 Fences not always removed when building a tracked ride through (#9341)

Fence removal did not account for track direction. Added the rotation for the track/fence intersection test.
This commit is contained in:
aw20368 2019-06-04 17:27:36 -04:00 committed by Aaron van Geffen
parent 3823befa10
commit df263eb1f6
4 changed files with 27 additions and 1 deletions

View File

@ -16,6 +16,7 @@
- Change: [#8427] Ghost elements now show up as white on the mini-map.
- Change: [#8688] Move common actions from debug menu into cheats menu.
- Fix: [#2294] Clients crashing the server with invalid object selection.
- Fix: [#4568, #5896] Incorrect fences removed when building a tracked ride through
- Fix: [#5103] OpenGL: ride track preview not rendered.
- Fix: [#5889] Giant screenshot does not work while using OpenGL renderer.
- Fix: [#5579] Network desync immediately after connecting.

View File

@ -491,6 +491,7 @@ public:
// Remove walls in the directions this track intersects
uint8_t intersectingDirections = (*wallEdges)[blockIndex];
intersectingDirections ^= 0x0F;
intersectingDirections = rol4(intersectingDirections, _origin.direction);
for (int32_t i = 0; i < 4; i++)
{
if (intersectingDirections & (1 << i))

View File

@ -30,6 +30,18 @@ namespace Numerics
return (((_UIntType)(x) << shift) | ((_UIntType)(x) >> (limits::digits - shift)));
}
/**
* Bitwise left rotate of lowest 4 bits
* @param x unsigned 8-bit integer value
* @param shift positions to shift
* @return rotated value
*/
[[maybe_unused]] static constexpr uint8_t rol4(uint8_t x, size_t shift)
{
x &= 0x0F;
return (x << shift | x >> (4 - shift)) & 0x0F;
}
/**
* Bitwise right rotate
* @tparam _UIntType unsigned integral type
@ -44,4 +56,16 @@ namespace Numerics
return (((_UIntType)(x) >> shift) | ((_UIntType)(x) << (limits::digits - shift)));
}
/**
* Bitwise right rotate of lowest 4 bits
* @param x unsigned 8-bit integer value
* @param shift positions to shift
* @return rotated value
*/
[[maybe_unused]] static constexpr uint8_t ror4(uint8_t x, size_t shift)
{
x &= 0x0F;
return (x >> shift | x << (4 - shift)) & 0x0F;
}
} // namespace Numerics

View File

@ -33,7 +33,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 "36"
#define NETWORK_STREAM_VERSION "37"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
static Peep* _pickup_peep = nullptr;