From 1dd5d3a3f5bb2015d1353f7a8d4d348f2d099401 Mon Sep 17 00:00:00 2001 From: ZehMatt Date: Sat, 30 Sep 2017 22:07:24 +0200 Subject: [PATCH] Verify there is an empty slot for a new ride --- src/openrct2/actions/RideCreateAction.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/openrct2/actions/RideCreateAction.hpp b/src/openrct2/actions/RideCreateAction.hpp index a5d8b3032d..7aeabd7727 100644 --- a/src/openrct2/actions/RideCreateAction.hpp +++ b/src/openrct2/actions/RideCreateAction.hpp @@ -73,6 +73,13 @@ public: GameActionResult::Ptr Query() const override { + sint32 rideIndex = ride_get_empty_slot(); + if (rideIndex == -1) + { + // No more free slots available. + return std::make_unique(GA_ERROR::NO_FREE_ELEMENTS, STR_NONE); + } + if (_rideType >= RIDE_TYPE_COUNT) { return std::make_unique(GA_ERROR::INVALID_PARAMETERS, STR_INVALID_RIDE_TYPE);