- added Gez's anti-crossinclude submission but made some changes. Cross-includes overriding core files will produce fatal errors but cross-includes between PWADs will be tolerated. For DECORATE a command line override switch exists so that for testing the error can be disabled.

SVN r2400 (trunk)
This commit is contained in:
Christoph Oelckers 2010-07-01 09:35:39 +00:00
commit 6df5e6f9cb
5 changed files with 59 additions and 16 deletions

View file

@ -51,6 +51,8 @@
#include "doomstat.h"
#include "d_player.h"
#include "autosegs.h"
#include "version.h"
#include "v_text.h"
int FindEndSequence (int type, const char *picname);
@ -1865,6 +1867,15 @@ void FMapInfoParser::ParseMapInfo (int lump, level_info_t &gamedefaults, level_i
{
sc.ScriptError("include file '%s' not found", sc.String);
}
if (Wads.GetLumpFile(sc.LumpNum) != Wads.GetLumpFile(inclump))
{
// Do not allow overriding includes from the default MAPINFO
if (Wads.GetLumpFile(sc.LumpNum) == 0)
{
I_FatalError("File %s is overriding core lump %s.",
Wads.GetWadFullName(Wads.GetLumpFile(inclump)), sc.String);
}
}
FScanner saved_sc = sc;
ParseMapInfo(inclump, gamedefaults, defaultinfo);
sc = saved_sc;
@ -1956,12 +1967,18 @@ void G_ParseMapInfo (const char *basemapinfo)
atterm(ClearEpisodes);
// Parse the default MAPINFO for the current game.
// Parse the default MAPINFO for the current game. This lump *MUST* come from zdoom.pk3.
if (basemapinfo != NULL)
{
FMapInfoParser parse;
level_info_t defaultinfo;
parse.ParseMapInfo(Wads.GetNumForFullName(basemapinfo), gamedefaults, defaultinfo);
int baselump = Wads.GetNumForFullName(basemapinfo);
if (Wads.GetLumpFile(baselump) > 0)
{
I_FatalError("File %s is overriding core lump %s.",
Wads.GetWadFullName(Wads.GetLumpFile(baselump)), basemapinfo);
}
parse.ParseMapInfo(baselump, gamedefaults, defaultinfo);
}
static const char *mapinfonames[] = { "MAPINFO", "ZMAPINFO", NULL };