mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 04:51:19 +00:00
- fixed: ZDoom aborted on old WADs containing a binary LANGUAGE lump.
SVN r2414 (trunk)
This commit is contained in:
parent
ccd4dc3189
commit
ea04d2bbdf
3 changed files with 30 additions and 0 deletions
|
@ -331,6 +331,24 @@ void FScanner::RestorePos (const FScanner::SavedPos &pos)
|
|||
Crossed = false;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FScanner :: isText
|
||||
//
|
||||
// Checks if this is a text file.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
bool FScanner::isText()
|
||||
{
|
||||
for(unsigned int i=0;i<ScriptBuffer.Len();i++)
|
||||
{
|
||||
int c = ScriptBuffer[i];
|
||||
if (c < ' ' && c != '\n' && c != '\r' && c != '\t') return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FScanner :: SetCMode
|
||||
|
|
|
@ -61,6 +61,8 @@ public:
|
|||
void ScriptError(const char *message, ...);
|
||||
void ScriptMessage(const char *message, ...);
|
||||
|
||||
bool isText();
|
||||
|
||||
// Members ------------------------------------------------------
|
||||
char *String;
|
||||
int StringLen;
|
||||
|
|
|
@ -139,6 +139,7 @@ void FStringTable::LoadStrings (bool enuOnly)
|
|||
|
||||
void FStringTable::LoadLanguage (int lumpnum, DWORD code, bool exactMatch, int passnum)
|
||||
{
|
||||
static bool errordone = false;
|
||||
const DWORD orMask = exactMatch ? 0 : MAKE_ID(0,0,0xff,0);
|
||||
DWORD inCode = 0;
|
||||
StringEntry *entry, **pentry;
|
||||
|
@ -211,6 +212,15 @@ void FStringTable::LoadLanguage (int lumpnum, DWORD code, bool exactMatch, int p
|
|||
{ // Process string definitions.
|
||||
if (inCode == 0)
|
||||
{
|
||||
// LANGUAGE lump is bad. We need to check if this is an old binary
|
||||
// lump and if so just skip it to allow old WADs to run which contain
|
||||
// such a lump.
|
||||
if (!sc.isText())
|
||||
{
|
||||
if (!errordone) Printf("Skipping binary 'LANGUAGE' lump.\n");
|
||||
errordone = true;
|
||||
return;
|
||||
}
|
||||
sc.ScriptError ("Found a string without a language specified.");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue