From 5f417987bc5d2b69ea7c7a8132875df4f1030852 Mon Sep 17 00:00:00 2001 From: lawrence Date: Mon, 21 Mar 2022 22:36:59 +0100 Subject: [PATCH] Fix #16308: Crash when trying to place down a ride on Android --- src/openrct2/actions/GameActionResult.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/openrct2/actions/GameActionResult.h b/src/openrct2/actions/GameActionResult.h index e79eeb6811..4d1973c1b0 100644 --- a/src/openrct2/actions/GameActionResult.h +++ b/src/openrct2/actions/GameActionResult.h @@ -70,7 +70,7 @@ namespace GameActions CoordsXYZ Position = { LOCATION_NULL, LOCATION_NULL, LOCATION_NULL }; money32 Cost = 0; ExpenditureType Expenditure = ExpenditureType::Count; - std::any ResultData; + std::shared_ptr ResultData; Result() = default; Result(GameActions::Status error, rct_string_id title, rct_string_id message, uint8_t* args = nullptr); @@ -82,13 +82,13 @@ namespace GameActions // is still just uint32_t, this guarantees the data is associated with the correct type. template void SetData(const T&& data) { - ResultData = std::forward(data); + ResultData = std::make_shared(data); } - // This function will throw std::bad_any_cast if the type mismatches. template T GetData() const { - return std::any_cast(ResultData); + T* res = static_cast(ResultData.get()); + return *res; } };