From 81ba7e774f669b1a5bf1cd0c8c3c25aafe720cc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Sun, 22 Oct 2017 22:21:00 +0200 Subject: [PATCH] Don't trigger assert on invalid TopSpin paint --- src/openrct2/ride/thrill/TopSpin.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/openrct2/ride/thrill/TopSpin.cpp b/src/openrct2/ride/thrill/TopSpin.cpp index 6e99dee1a8..ff563577c9 100644 --- a/src/openrct2/ride/thrill/TopSpin.cpp +++ b/src/openrct2/ride/thrill/TopSpin.cpp @@ -14,6 +14,7 @@ *****************************************************************************/ #pragma endregion +#include "../../core/Util.hpp" #include "../../interface/viewport.h" #include "../../localisation/localisation.h" #include "../../paint/paint.h" @@ -148,9 +149,12 @@ static void top_spin_paint_vehicle(paint_session * session, sint8 al, sint8 cl, LocationXYZ16 seatCoords = { al, cl, static_cast(height) }; + if (armRotation >= static_cast(Util::CountOf(TopSpinSeatHeightOffset))) + { + return; + } seatCoords.z += TopSpinSeatHeightOffset[armRotation]; - assert(armRotation < static_cast(sizeof(TopSpinSeatPositionOffset))); switch (direction) { case 0: