From 551d4434f8270af62b2c8d1fdd21eefd95ec9311 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sun, 10 Oct 2010 10:05:03 +0200 Subject: [PATCH] detect the wrong type Q3 format by a different error message when loading --- plugins/mapq3/plugin.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/plugins/mapq3/plugin.cpp b/plugins/mapq3/plugin.cpp index a11dc4a..be7212c 100644 --- a/plugins/mapq3/plugin.cpp +++ b/plugins/mapq3/plugin.cpp @@ -257,6 +257,7 @@ public: class MapQ3API : public TypeSystemRef, public MapFormat, public PrimitiveParser { + mutable bool detectedFormat; public: typedef MapFormat Type; STRING_CONSTANT(Name, "mapq3"); @@ -284,16 +285,30 @@ public: { if(string_equal(primitive, "brushDef")) { + detectedFormat = true; return GlobalBrushModule::getTable().createBrush(); } + else if(!detectedFormat && string_equal(primitive, "(")) + { + detectedFormat = true; + Tokeniser_unexpectedError(tokeniser, primitive, "#quake3-switch-to-texdef"); + return g_nullNode; + } } else { if(string_equal(primitive, "(")) { + detectedFormat = true; tokeniser.ungetToken(); // ( return GlobalBrushModule::getTable().createBrush(); } + else if(!detectedFormat && string_equal(primitive, "(")) + { + detectedFormat = true; + Tokeniser_unexpectedError(tokeniser, primitive, "#quake3-switch-to-brush-primitives"); + return g_nullNode; + } } } @@ -303,6 +318,7 @@ public: void readGraph(scene::Node& root, TextInputStream& inputStream, EntityCreator& entityTable) const { + detectedFormat = false; Tokeniser& tokeniser = GlobalScripLibModule::getTable().m_pfnNewSimpleTokeniser(inputStream); Map_Read(root, tokeniser, entityTable, *this); tokeniser.release(); -- 2.39.2