mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
Don't abort when merely checking if a non-map is a map
- When P_OpenMapData() is called by P_CheckMapData(), we don't actually care if any required lumps are missing. This just means it isn't a valid map, so don't abort with I_Error().
This commit is contained in:
parent
0f0d9da839
commit
b0371e1804
5 changed files with 19 additions and 9 deletions
|
@ -541,7 +541,7 @@ CCMD (mapchecksum)
|
||||||
}
|
}
|
||||||
for (int i = 1; i < argv.argc(); ++i)
|
for (int i = 1; i < argv.argc(); ++i)
|
||||||
{
|
{
|
||||||
map = P_OpenMapData(argv[i]);
|
map = P_OpenMapData(argv[i], true);
|
||||||
if (map == NULL)
|
if (map == NULL)
|
||||||
{
|
{
|
||||||
Printf("Cannot load %s as a map\n", argv[i]);
|
Printf("Cannot load %s as a map\n", argv[i]);
|
||||||
|
|
|
@ -1923,7 +1923,7 @@ CCMD(listmaps)
|
||||||
for(unsigned i = 0; i < wadlevelinfos.Size(); i++)
|
for(unsigned i = 0; i < wadlevelinfos.Size(); i++)
|
||||||
{
|
{
|
||||||
level_info_t *info = &wadlevelinfos[i];
|
level_info_t *info = &wadlevelinfos[i];
|
||||||
MapData *map = P_OpenMapData(info->mapname);
|
MapData *map = P_OpenMapData(info->mapname, true);
|
||||||
|
|
||||||
if (map != NULL)
|
if (map != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -250,7 +250,7 @@ static int GetMapIndex(const char *mapname, int lastindex, const char *lumpname,
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
MapData *P_OpenMapData(const char * mapname)
|
MapData *P_OpenMapData(const char * mapname, bool justcheck)
|
||||||
{
|
{
|
||||||
MapData * map = new MapData;
|
MapData * map = new MapData;
|
||||||
FileReader * wadReader = NULL;
|
FileReader * wadReader = NULL;
|
||||||
|
@ -331,13 +331,18 @@ MapData *P_OpenMapData(const char * mapname)
|
||||||
const char * lumpname = Wads.GetLumpFullName(lump_name + i);
|
const char * lumpname = Wads.GetLumpFullName(lump_name + i);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
index = GetMapIndex(mapname, index, lumpname, true);
|
index = GetMapIndex(mapname, index, lumpname, !justcheck);
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
delete map;
|
delete map;
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
if (index == -2)
|
||||||
|
{
|
||||||
|
delete map;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if (index == ML_BEHAVIOR) map->HasBehavior = true;
|
if (index == ML_BEHAVIOR) map->HasBehavior = true;
|
||||||
|
|
||||||
// The next lump is not part of this map anymore
|
// The next lump is not part of this map anymore
|
||||||
|
@ -471,13 +476,18 @@ MapData *P_OpenMapData(const char * mapname)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
index = GetMapIndex(maplabel, index, lumpname, true);
|
index = GetMapIndex(maplabel, index, lumpname, !justcheck);
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
delete map;
|
delete map;
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
if (index == -2)
|
||||||
|
{
|
||||||
|
delete map;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if (index == ML_BEHAVIOR) map->HasBehavior = true;
|
if (index == ML_BEHAVIOR) map->HasBehavior = true;
|
||||||
|
|
||||||
// The next lump is not part of this map anymore
|
// The next lump is not part of this map anymore
|
||||||
|
@ -508,7 +518,7 @@ MapData *P_OpenMapData(const char * mapname)
|
||||||
|
|
||||||
bool P_CheckMapData(const char *mapname)
|
bool P_CheckMapData(const char *mapname)
|
||||||
{
|
{
|
||||||
MapData *mapd = P_OpenMapData(mapname);
|
MapData *mapd = P_OpenMapData(mapname, true);
|
||||||
if (mapd == NULL) return false;
|
if (mapd == NULL) return false;
|
||||||
delete mapd;
|
delete mapd;
|
||||||
return true;
|
return true;
|
||||||
|
@ -3610,7 +3620,7 @@ void P_SetupLevel (char *lumpname, int position)
|
||||||
P_FreeLevelData ();
|
P_FreeLevelData ();
|
||||||
interpolator.ClearInterpolations(); // [RH] Nothing to interpolate on a fresh level.
|
interpolator.ClearInterpolations(); // [RH] Nothing to interpolate on a fresh level.
|
||||||
|
|
||||||
MapData *map = P_OpenMapData(lumpname);
|
MapData *map = P_OpenMapData(lumpname, true);
|
||||||
if (map == NULL)
|
if (map == NULL)
|
||||||
{
|
{
|
||||||
I_Error("Unable to open map '%s'\n", lumpname);
|
I_Error("Unable to open map '%s'\n", lumpname);
|
||||||
|
|
|
@ -94,7 +94,7 @@ struct MapData
|
||||||
void GetChecksum(BYTE cksum[16]);
|
void GetChecksum(BYTE cksum[16]);
|
||||||
};
|
};
|
||||||
|
|
||||||
MapData * P_OpenMapData(const char * mapname);
|
MapData * P_OpenMapData(const char * mapname, bool justcheck);
|
||||||
bool P_CheckMapData(const char * mapname);
|
bool P_CheckMapData(const char * mapname);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -463,7 +463,7 @@ void STAT_ChangeLevel(const char *newl)
|
||||||
{
|
{
|
||||||
// we reached the end of this episode
|
// we reached the end of this episode
|
||||||
int wad = 0;
|
int wad = 0;
|
||||||
MapData * map = P_OpenMapData(StartEpisode->mEpisodeMap);
|
MapData * map = P_OpenMapData(StartEpisode->mEpisodeMap, false);
|
||||||
if (map != NULL)
|
if (map != NULL)
|
||||||
{
|
{
|
||||||
wad = Wads.GetLumpFile(map->lumpnum);
|
wad = Wads.GetLumpFile(map->lumpnum);
|
||||||
|
|
Loading…
Reference in a new issue