From c3e0ee96de35619d8d89324ea0be2367c6a9ce88 Mon Sep 17 00:00:00 2001 From: danij Date: Sat, 13 Sep 2014 17:07:45 +0100 Subject: [PATCH] libcommon|InFine: Determine InFine leave_hub condition using global nextMapUri Don't use the intermission info here as it may not be configured if the intermission is disabled. --- doomsday/plugins/common/include/g_common.h | 3 +++ doomsday/plugins/common/src/fi_lib.cpp | 2 +- doomsday/plugins/common/src/g_game.cpp | 6 +++--- doomsday/plugins/common/src/gamesession.cpp | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doomsday/plugins/common/include/g_common.h b/doomsday/plugins/common/include/g_common.h index 3ec935c827..d0edad4f78 100644 --- a/doomsday/plugins/common/include/g_common.h +++ b/doomsday/plugins/common/include/g_common.h @@ -32,6 +32,9 @@ class SaveSlots; extern GameRuleset defaultGameRules; +extern de::Uri nextMapUri; +extern uint nextMapEntryPoint; + /** * Schedule a new game session (deferred). * diff --git a/doomsday/plugins/common/src/fi_lib.cpp b/doomsday/plugins/common/src/fi_lib.cpp index 33652ec9af..022539cf74 100644 --- a/doomsday/plugins/common/src/fi_lib.cpp +++ b/doomsday/plugins/common/src/fi_lib.cpp @@ -93,7 +93,7 @@ static void initStateConditions(fi_state_t &s) { defn::Episode epsd(*episodeDef); Record const *currentHub = epsd.tryFindHubByMapId(COMMON_GAMESESSION->mapUri().compose()); - s.conditions.leave_hub = (!currentHub || currentHub != epsd.tryFindHubByMapId(::wmInfo.nextMap.compose())); + s.conditions.leave_hub = (!currentHub || currentHub != epsd.tryFindHubByMapId(::nextMapUri.compose())); } LOGDEV_SCR_VERBOSE("Infine state condition: leave_hub=%i") << s.conditions.leave_hub; #endif diff --git a/doomsday/plugins/common/src/g_game.cpp b/doomsday/plugins/common/src/g_game.cpp index ace6867c29..a0885bce61 100644 --- a/doomsday/plugins/common/src/g_game.cpp +++ b/doomsday/plugins/common/src/g_game.cpp @@ -102,6 +102,9 @@ dd_bool customPal; // If @c true, a non-IWAD palette is in use. wbstartstruct_t wmInfo; // Intermission parameters. +de::Uri nextMapUri; +uint nextMapEntryPoint; + static GameSession session; static bool quitInProgress; @@ -109,9 +112,6 @@ static gamestate_t gameState = GS_STARTUP; static SaveSlots *sslots; -static de::Uri nextMapUri; -static uint nextMapEntryPoint; - // Game actions. static gameaction_t gameAction; diff --git a/doomsday/plugins/common/src/gamesession.cpp b/doomsday/plugins/common/src/gamesession.cpp index eb30ee140b..038d910e05 100644 --- a/doomsday/plugins/common/src/gamesession.cpp +++ b/doomsday/plugins/common/src/gamesession.cpp @@ -1177,7 +1177,7 @@ void GameSession::leaveMap(de::Uri const &nextMapUri, uint nextMapEntryPoint) #if __JHEXEN__ defn::Episode epsd(*episodeDef()); Record const *currentHub = epsd.tryFindHubByMapId(d->mapUri.compose()); - if(currentHub != epsd.tryFindHubByMapId(nextMapUri.compose())) + if(!currentHub || currentHub != epsd.tryFindHubByMapId(nextMapUri.compose())) #endif { // Clear all saved map states in the current hub.