1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 11:33:03 +01:00

Make GameActionResult destructor virtual to ensure proper teardown

This commit is contained in:
Michał Janiszewski
2017-10-05 22:33:11 +02:00
committed by Michał Janiszewski
parent e5fe681793
commit 07dbdfbd34
3 changed files with 13 additions and 9 deletions

View File

@@ -56,11 +56,18 @@ namespace GA_FLAGS
constexpr uint16 EDITOR_ONLY = 1 << 2;
}
#ifdef __WARN_SUGGEST_FINAL_METHODS__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-final-methods"
#pragma GCC diagnostic ignored "-Wsuggest-final-types"
#endif
/**
* Represents the result of a game action query or execution.
*/
struct GameActionResult
class GameActionResult
{
public:
typedef std::unique_ptr<GameActionResult> Ptr;
GA_ERROR Error = GA_ERROR::OK;
@@ -74,14 +81,9 @@ struct GameActionResult
GameActionResult();
GameActionResult(GA_ERROR error, rct_string_id message);
GameActionResult(const GameActionResult&) = delete;
virtual ~GameActionResult() {};
};
#ifdef __WARN_SUGGEST_FINAL_METHODS__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-final-methods"
#pragma GCC diagnostic ignored "-Wsuggest-final-types"
#endif
struct GameAction
{
public:

View File

@@ -26,8 +26,9 @@
#include "../world/park.h"
#include "../world/footpath.h"
struct PlaceParkEntranceGameActionResult : public GameActionResult
class PlaceParkEntranceGameActionResult final : public GameActionResult
{
public:
PlaceParkEntranceGameActionResult() : GameActionResult(GA_ERROR::OK, 0) {}
PlaceParkEntranceGameActionResult(GA_ERROR error, rct_string_id message) : GameActionResult(error, message)
{

View File

@@ -30,8 +30,9 @@
#include "../ride/ride.h"
#include "../ride/station.h"
struct RideCreateGameActionResult : public GameActionResult
class RideCreateGameActionResult final : public GameActionResult
{
public:
RideCreateGameActionResult() : GameActionResult(GA_ERROR::OK, 0) {}
RideCreateGameActionResult(GA_ERROR error, rct_string_id message) : GameActionResult(error, message) {}