From a9fe4da2792a2b6e913f209f1a7e64634d457986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Thu, 4 Aug 2022 18:38:51 +0200 Subject: [PATCH] Use SDL_ShowMessageBox's 'close' value for dummy UI context --- src/openrct2-ui/UiContext.cpp | 3 ++- src/openrct2/park/ParkFile.cpp | 2 +- src/openrct2/ui/DummyUiContext.cpp | 4 ++-- src/openrct2/ui/UiContext.h | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/openrct2-ui/UiContext.cpp b/src/openrct2-ui/UiContext.cpp index 17e84abfc8..b061cbb17b 100644 --- a/src/openrct2-ui/UiContext.cpp +++ b/src/openrct2-ui/UiContext.cpp @@ -640,7 +640,8 @@ public: _platformUiContext->ShowMessageBox(_window, message); } - int ShowMessageBox(const std::string& title, const std::string& message, const std::vector& options) override + int32_t ShowMessageBox( + const std::string& title, const std::string& message, const std::vector& options) override { auto message_box_button_data = std::make_unique(options.size()); for (size_t i = 0; i < options.size(); i++) diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index f2506b32d9..85769403da 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -2331,7 +2331,7 @@ int32_t scenario_save(u8string_view path, int32_t flags) std::string report_bug_button = "Report bug, trigger an assert"; std::string skip_button = "Skip reporting, let me continue"; - std::vector buttons{ report_bug_button, skip_button }; + std::vector buttons{ std::move(report_bug_button), std::move(skip_button) }; int choice = uictx->ShowMessageBox(title, message, buttons); if (choice == 0) diff --git a/src/openrct2/ui/DummyUiContext.cpp b/src/openrct2/ui/DummyUiContext.cpp index 77aa929b4e..d4040832e6 100644 --- a/src/openrct2/ui/DummyUiContext.cpp +++ b/src/openrct2/ui/DummyUiContext.cpp @@ -90,9 +90,9 @@ namespace OpenRCT2::Ui void ShowMessageBox(const std::string& /*message*/) override { } - int ShowMessageBox(const std::string&, const std::string&, const std::vector&) override + int32_t ShowMessageBox(const std::string&, const std::string&, const std::vector&) override { - return 0; + return -1; } bool HasMenuSupport() override { diff --git a/src/openrct2/ui/UiContext.h b/src/openrct2/ui/UiContext.h index cac084e8da..142b79d874 100644 --- a/src/openrct2/ui/UiContext.h +++ b/src/openrct2/ui/UiContext.h @@ -120,7 +120,7 @@ namespace OpenRCT2 virtual void TriggerResize() abstract; virtual void ShowMessageBox(const std::string& message) abstract; - virtual int ShowMessageBox( + virtual int32_t ShowMessageBox( const std::string& title, const std::string& message, const std::vector& options) abstract; virtual bool HasMenuSupport() abstract;