From ea2e43c683d8d8733eeeed50bb9db1f38a641790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= Date: Sun, 17 Jul 2016 15:24:43 +0300 Subject: [PATCH] libdoomsday: Added audience for observing beginning of game loads --- doomsday/apps/libdoomsday/include/doomsday/doomsdayapp.h | 2 ++ doomsday/apps/libdoomsday/src/doomsdayapp.cpp | 9 ++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doomsday/apps/libdoomsday/include/doomsday/doomsdayapp.h b/doomsday/apps/libdoomsday/include/doomsday/doomsdayapp.h index a97f176f59..e0044d3812 100644 --- a/doomsday/apps/libdoomsday/include/doomsday/doomsdayapp.h +++ b/doomsday/apps/libdoomsday/include/doomsday/doomsdayapp.h @@ -48,6 +48,8 @@ class LIBDOOMSDAY_PUBLIC DoomsdayApp /// Notified before the current game is unloaded. DENG2_DEFINE_AUDIENCE2(GameUnload, void aboutToUnloadGame(Game const &gameBeingUnloaded)) + DENG2_DEFINE_AUDIENCE2(GameLoad, void aboutToLoadGame(Game const &gameBeingLoaded)) + /// Notified after the current game has been changed. DENG2_DEFINE_AUDIENCE2(GameChange, void currentGameChanged(Game const &newGame)) diff --git a/doomsday/apps/libdoomsday/src/doomsdayapp.cpp b/doomsday/apps/libdoomsday/src/doomsdayapp.cpp index 1ef958b098..ef44f023f7 100644 --- a/doomsday/apps/libdoomsday/src/doomsdayapp.cpp +++ b/doomsday/apps/libdoomsday/src/doomsdayapp.cpp @@ -345,12 +345,14 @@ DENG2_PIMPL(DoomsdayApp) } #endif // WIN32 + DENG2_PIMPL_AUDIENCE(GameLoad) DENG2_PIMPL_AUDIENCE(GameUnload) DENG2_PIMPL_AUDIENCE(GameChange) DENG2_PIMPL_AUDIENCE(ConsoleRegistration) DENG2_PIMPL_AUDIENCE(FileRefresh) }; +DENG2_AUDIENCE_METHOD(DoomsdayApp, GameLoad) DENG2_AUDIENCE_METHOD(DoomsdayApp, GameUnload) DENG2_AUDIENCE_METHOD(DoomsdayApp, GameChange) DENG2_AUDIENCE_METHOD(DoomsdayApp, ConsoleRegistration) @@ -707,14 +709,11 @@ bool DoomsdayApp::changeGame(GameProfile const &profile, } // The current game will now be unloaded. - DENG2_FOR_AUDIENCE2(GameUnload, i) - { - i->aboutToUnloadGame(game()); - } - + DENG2_FOR_AUDIENCE2(GameUnload, i) i->aboutToUnloadGame(game()); unloadGame(profile); // Do the switch. + DENG2_FOR_AUDIENCE2(GameLoad, i) i->aboutToLoadGame(newGame); makeGameCurrent(profile); /*