From 12440bbca3d599362af50ec0333b6bbe358e37be Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 1 Oct 2019 00:43:12 +0200 Subject: [PATCH] - new exception class for quitting the game This will eventually replace the atexit mess, right now it isn't used. --- src/utility/doomerrors.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/utility/doomerrors.h b/src/utility/doomerrors.h index 29e1a6fc989..77c1b7d489e 100644 --- a/src/utility/doomerrors.h +++ b/src/utility/doomerrors.h @@ -111,6 +111,18 @@ class CVulkanError : public CDoomError CVulkanError(const char *message) : CDoomError(message) {} }; +class CExitEvent : public std::exception +{ + int m_reason; +public: + CExitEvent(int reason) { m_reason = reason; } + char const *what() const noexcept override + { + return "The game wants to exit"; + } + int Reason() const { return m_reason; } +}; + void I_Error (const char *error, ...) GCCPRINTF(1,2); void I_FatalError (const char *error, ...) GCCPRINTF(1,2);