1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 12:03:07 +01:00

Fix #16308: Crash when trying to place down a ride on Android

This commit is contained in:
lawrence
2022-03-21 22:36:59 +01:00
committed by Gymnasiast
parent 07f66f2322
commit 5f417987bc

View File

@@ -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<void> 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<typename T> void SetData(const T&& data)
{
ResultData = std::forward<const T&&>(data);
ResultData = std::make_shared<T>(data);
}
// This function will throw std::bad_any_cast if the type mismatches.
template<typename T> T GetData() const
{
return std::any_cast<T>(ResultData);
T* res = static_cast<T*>(ResultData.get());
return *res;
}
};