From b4ca0c35088224f7946c4f191753d5b43bd7ffae Mon Sep 17 00:00:00 2001 From: Duncan Date: Mon, 12 Sep 2016 20:11:43 +0100 Subject: [PATCH] Fix #4415: Rides that change colours each train were incorrectly loaded causing all same colour Mistake caused by new object loader not reproducing legacy technique used to indicate that a ride is a change colour each train type. --- src/object/RideObject.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/object/RideObject.cpp b/src/object/RideObject.cpp index ca6d6d9756..703572caa9 100644 --- a/src/object/RideObject.cpp +++ b/src/object/RideObject.cpp @@ -90,11 +90,16 @@ void RideObject::ReadLegacy(IReadObjectContext * context, IStream * stream) // Read preset colours, by default there are 32 _presetColours.count = stream->ReadValue(); - if (_presetColours.count == 255) + + int coloursCount = _presetColours.count; + // To indicate a ride has different colours each train the count + // is set to 255. There are only actually 32 colours though. + if (coloursCount == 255) { - _presetColours.count = 32; + coloursCount = 32; } - for (uint8 i = 0; i < _presetColours.count; i++) + + for (uint8 i = 0; i < coloursCount; i++) { _presetColours.list[i] = stream->ReadValue(); }