- made the coordinate check fatal. If this happens the loaded map will be broken, there is no point trying to recover.

This commit is contained in:
Christoph Oelckers 2017-03-23 10:19:07 +01:00
parent f31fb64750
commit 74a2d58a52
2 changed files with 8 additions and 6 deletions

View file

@ -262,8 +262,8 @@ double UDMFParserBase::CheckCoordinate(const char *key)
} }
if (sc.Float < -32768 || sc.Float > 32768) if (sc.Float < -32768 || sc.Float > 32768)
{ {
sc.ScriptMessage("Value %f out of range for a coordinate '%s'. Valid range is ]-32768 .. 32768]", key); sc.ScriptMessage("Value %f out of range for a coordinate '%s'. Valid range is ]-32768 .. 32768]", sc.Float, key);
sc.Float = clamp(sc.Float, -32768 + EQUAL_EPSILON*2, 32768 - EQUAL_EPSILON*2); BadCoordinates = true; // If this happens the map must not allowed to be started.
} }
return sc.Float; return sc.Float;
} }
@ -2083,10 +2083,11 @@ public:
} }
// Catch bogus maps here rather than during nodebuilding // Catch bogus maps here rather than during nodebuilding
if (ParsedVertices.Size() == 0) I_Error("Map has no vertices.\n"); if (ParsedVertices.Size() == 0) I_Error("Map has no vertices.");
if (ParsedSectors.Size() == 0) I_Error("Map has no sectors. \n"); if (ParsedSectors.Size() == 0) I_Error("Map has no sectors. ");
if (ParsedLines.Size() == 0) I_Error("Map has no linedefs.\n"); if (ParsedLines.Size() == 0) I_Error("Map has no linedefs.");
if (ParsedSides.Size() == 0) I_Error("Map has no sidedefs.\n"); if (ParsedSides.Size() == 0) I_Error("Map has no sidedefs.");
if (BadCoordinates) I_Error("Map has out of range coordinates");
// Create the real vertices // Create the real vertices
level.vertexes.Alloc(ParsedVertices.Size()); level.vertexes.Alloc(ParsedVertices.Size());

View file

@ -11,6 +11,7 @@ protected:
FName namespc; FName namespc;
int namespace_bits; int namespace_bits;
FString parsedString; FString parsedString;
bool BadCoordinates = false;
void Skip(); void Skip();
FName ParseKey(bool checkblock = false, bool *isblock = NULL); FName ParseKey(bool checkblock = false, bool *isblock = NULL);