Skip to content

Commit

Permalink
libdoomsday: Added audience for observing beginning of game loads
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jul 17, 2016
1 parent cd67f81 commit ea2e43c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions doomsday/apps/libdoomsday/include/doomsday/doomsdayapp.h
Expand Up @@ -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))

Expand Down
9 changes: 4 additions & 5 deletions doomsday/apps/libdoomsday/src/doomsdayapp.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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);

/*
Expand Down

0 comments on commit ea2e43c

Please sign in to comment.