diff --git a/src/g_game.c b/src/g_game.c index b831c5dcd26d0e06930fcad562e6531ee00c15cd..75f40c8ee238fd98d1af7078d630ff096cc5d0cb 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3868,16 +3868,24 @@ boolean G_CompetitionGametype(void) return ((gametyperules & GTR_RACE) && (gametyperules & GTR_LIVES)); } +static boolean G_IsHubMapValid(INT16 mapnum) +{ + if (!hubmapenabled || mapnum == 0) + return false; + + return mapheaderinfo[mapnum-1] && mapheaderinfo[mapnum-1]->typeoflevel & TOL_HUB; +} + // Returns true if the current hub level can be warped to. boolean G_IsHubAvailable(void) { if (marathonmode || modeattacking) return false; - if (!hubmapenabled || currenthubmap == 0 || M_MapLocked(currenthubmap, serverGamedata)) + if (M_MapLocked(currenthubmap, serverGamedata)) return false; - return mapheaderinfo[currenthubmap-1] && mapheaderinfo[currenthubmap-1]->typeoflevel & TOL_HUB; + return G_IsHubMapValid(currenthubmap); } /** Get the typeoflevel flag needed to indicate support of a gametype. @@ -4061,6 +4069,16 @@ static void G_HandleSaveLevel(void) } } +// Returns true if the hub is a valid next map. +static boolean G_IsHubValidNextMap(void) +{ + if (marathonmode || modeattacking) + return false; + + // The hub is a valid next map even if it's not unlocked. + return G_IsHubMapValid(currenthubmap); +} + // // G_GetNextMap // @@ -4082,7 +4100,7 @@ INT16 G_GetNextMap(boolean ignoretokens, boolean silent) if (newmapnum == 1104-1) // Going back to the hub { - if (G_IsHubAvailable()) // Should handle Marathon Mode. + if (G_IsHubValidNextMap()) // Should handle Marathon Mode. newmapnum = currenthubmap-1; else {