From 74a2d58a52ddf62b69d8dff877a7581cde77a75c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 23 Mar 2017 10:19:07 +0100 Subject: [PATCH] - made the coordinate check fatal. If this happens the loaded map will be broken, there is no point trying to recover. --- src/p_udmf.cpp | 13 +++++++------ src/p_udmf.h | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 8bb0200e50..1506059ea3 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -262,8 +262,8 @@ double UDMFParserBase::CheckCoordinate(const char *key) } 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.Float = clamp(sc.Float, -32768 + EQUAL_EPSILON*2, 32768 - EQUAL_EPSILON*2); + sc.ScriptMessage("Value %f out of range for a coordinate '%s'. Valid range is ]-32768 .. 32768]", sc.Float, key); + BadCoordinates = true; // If this happens the map must not allowed to be started. } return sc.Float; } @@ -2083,10 +2083,11 @@ public: } // Catch bogus maps here rather than during nodebuilding - if (ParsedVertices.Size() == 0) I_Error("Map has no vertices.\n"); - if (ParsedSectors.Size() == 0) I_Error("Map has no sectors. \n"); - if (ParsedLines.Size() == 0) I_Error("Map has no linedefs.\n"); - if (ParsedSides.Size() == 0) I_Error("Map has no sidedefs.\n"); + if (ParsedVertices.Size() == 0) I_Error("Map has no vertices."); + if (ParsedSectors.Size() == 0) I_Error("Map has no sectors. "); + if (ParsedLines.Size() == 0) I_Error("Map has no linedefs."); + if (ParsedSides.Size() == 0) I_Error("Map has no sidedefs."); + if (BadCoordinates) I_Error("Map has out of range coordinates"); // Create the real vertices level.vertexes.Alloc(ParsedVertices.Size()); diff --git a/src/p_udmf.h b/src/p_udmf.h index 550e70e60e..dbc7eed54f 100644 --- a/src/p_udmf.h +++ b/src/p_udmf.h @@ -11,6 +11,7 @@ protected: FName namespc; int namespace_bits; FString parsedString; + bool BadCoordinates = false; void Skip(); FName ParseKey(bool checkblock = false, bool *isblock = NULL);