Skip to content

Commit

Permalink
libcommon|InFine: Determine InFine leave_hub condition using global n…
Browse files Browse the repository at this point in the history
…extMapUri

Don't use the intermission info here as it may not be configured if
the intermission is disabled.
  • Loading branch information
danij-deng committed Sep 13, 2014
1 parent b08ed7b commit c3e0ee9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions doomsday/plugins/common/include/g_common.h
Expand Up @@ -32,6 +32,9 @@ class SaveSlots;

extern GameRuleset defaultGameRules;

extern de::Uri nextMapUri;
extern uint nextMapEntryPoint;

/**
* Schedule a new game session (deferred).
*
Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/common/src/fi_lib.cpp
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions doomsday/plugins/common/src/g_game.cpp
Expand Up @@ -102,16 +102,16 @@ 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;
static gamestate_t gameState = GS_STARTUP;

static SaveSlots *sslots;

static de::Uri nextMapUri;
static uint nextMapEntryPoint;

// Game actions.
static gameaction_t gameAction;

Expand Down
2 changes: 1 addition & 1 deletion doomsday/plugins/common/src/gamesession.cpp
Expand Up @@ -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.
Expand Down

0 comments on commit c3e0ee9

Please sign in to comment.