From 7aa2cd7ac5a613ce94d0b9809570d32a8ef45201 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sat, 6 Jan 2018 00:55:02 +0100 Subject: [PATCH] Move peep list refreshing to UI module --- src/openrct2-ui/WindowManager.cpp | 10 ++++++++++ src/openrct2/actions/GuestSetNameAction.hpp | 10 ++++------ src/openrct2/actions/StaffSetNameAction.hpp | 10 ++++------ src/openrct2/windows/Intent.h | 1 + 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp index b3f082c06c..640dddcd95 100644 --- a/src/openrct2-ui/WindowManager.cpp +++ b/src/openrct2-ui/WindowManager.cpp @@ -327,6 +327,16 @@ public: window_guest_list_refresh_list(); break; + case INTENT_ACTION_REFRESH_STAFF_LIST: + { + auto w = window_find_by_class(WC_STAFF_LIST); + if (w != NULL) + { + w->no_list_items = 0; + } + break; + } + case INTENT_ACTION_CLEAR_TILE_INSPECTOR_CLIPBOARD: window_tile_inspector_clear_clipboard(); break; diff --git a/src/openrct2/actions/GuestSetNameAction.hpp b/src/openrct2/actions/GuestSetNameAction.hpp index 9b4365a5c9..bb4b234a3c 100644 --- a/src/openrct2/actions/GuestSetNameAction.hpp +++ b/src/openrct2/actions/GuestSetNameAction.hpp @@ -21,8 +21,10 @@ #include "GameAction.h" #include "../Cheats.h" +#include "../Context.h" #include "../interface/Window.h" #include "../localisation/Localisation.h" +#include "../windows/Intent.h" #include "../world/Park.h" struct GuestSetNameAction : public GameActionBase @@ -117,12 +119,8 @@ public: gfx_invalidate_screen(); - // Force guest list window refresh - rct_window * w = window_find_by_class(WC_GUEST_LIST); - if (w != NULL) - { - w->no_list_items = 0; - } + auto intent = Intent(INTENT_ACTION_REFRESH_GUEST_LIST); + context_broadcast_intent(&intent); auto res = std::make_unique(); res->Position.x = peep->x; diff --git a/src/openrct2/actions/StaffSetNameAction.hpp b/src/openrct2/actions/StaffSetNameAction.hpp index 9363464686..b270a500fe 100644 --- a/src/openrct2/actions/StaffSetNameAction.hpp +++ b/src/openrct2/actions/StaffSetNameAction.hpp @@ -21,9 +21,11 @@ #include "GameAction.h" #include "../Cheats.h" +#include "../Context.h" #include "../peep/Staff.h" #include "../interface/Window.h" #include "../localisation/Localisation.h" +#include "../windows/Intent.h" #include "../world/Park.h" struct StaffSetNameAction : public GameActionBase @@ -117,12 +119,8 @@ public: gfx_invalidate_screen(); - // Force staff list window refresh - rct_window * w = window_find_by_class(WC_STAFF_LIST); - if (w != NULL) - { - w->no_list_items = 0; - } + auto intent = Intent(INTENT_ACTION_REFRESH_STAFF_LIST); + context_broadcast_intent(&intent); auto res = std::make_unique(); res->Position.x = peep->x; diff --git a/src/openrct2/windows/Intent.h b/src/openrct2/windows/Intent.h index c9e4a398e6..b3c600a513 100644 --- a/src/openrct2/windows/Intent.h +++ b/src/openrct2/windows/Intent.h @@ -87,6 +87,7 @@ extern "C" { INTENT_ACTION_CLEAR_TILE_INSPECTOR_CLIPBOARD, INTENT_ACTION_SET_TILE_INSPECTOR_PAGE, INTENT_ACTION_SET_TILE_INSPECTOR_BUTTONS, + INTENT_ACTION_REFRESH_STAFF_LIST, }; Intent *intent_create(rct_windowclass clss);