diff --git a/src/g_level.cpp b/src/g_level.cpp index 27be03b08..3fd2bae73 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -489,7 +489,7 @@ void G_ChangeLevel(const char *levelname, int position, int flags, int nextSkill } else if (strncmp(levelname, "enDSeQ", 6) != 0) { - nextinfo = FindLevelInfo (levelname); + nextinfo = FindLevelInfo (levelname, false); if (nextinfo != NULL) { level_info_t *nextredir = nextinfo->CheckLevelRedirect(); @@ -655,17 +655,14 @@ void G_DoCompleted (void) } else { - if (strncmp (nextlevel, "enDSeQ", 6) == 0) + level_info_t *nextinfo = FindLevelInfo (nextlevel, false); + if (nextinfo == NULL || strncmp (nextlevel, "enDSeQ", 6) == 0) { wminfo.next = nextlevel; wminfo.LName1 = NULL; } else { - - - - level_info_t *nextinfo = FindLevelInfo (nextlevel); wminfo.next = nextinfo->mapname; wminfo.LName1 = TexMan[TexMan.CheckForTexture(nextinfo->pname, FTexture::TEX_MiscPatch)]; } diff --git a/src/g_level.h b/src/g_level.h index cdac4b862..cd8f6c1f7 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -515,7 +515,7 @@ void G_InitLevelLocals (void); void G_AirControlChanged (); cluster_info_t *FindClusterInfo (int cluster); -level_info_t *FindLevelInfo (const char *mapname); +level_info_t *FindLevelInfo (const char *mapname, bool allowdefault=true); level_info_t *FindLevelByNum (int num); level_info_t *CheckLevelRedirect (level_info_t *info); diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index adfd626c3..cb7b03932 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -82,7 +82,7 @@ static int FindWadLevelInfo (const char *name) // //========================================================================== -level_info_t *FindLevelInfo (const char *mapname) +level_info_t *FindLevelInfo (const char *mapname, bool allowdefault) { int i; @@ -90,7 +90,7 @@ level_info_t *FindLevelInfo (const char *mapname) { return &wadlevelinfos[i]; } - else + else if (allowdefault) { if (TheDefaultLevelInfo.LevelName.IsEmpty()) { @@ -100,6 +100,7 @@ level_info_t *FindLevelInfo (const char *mapname) } return &TheDefaultLevelInfo; } + return NULL; } //==========================================================================