From: Rudolf Polzer Date: Sun, 10 Oct 2010 08:05:03 +0000 (+0200) Subject: detect the wrong type Q3 format by a different error message when loading X-Git-Tag: xonotic-v0.5.0~180 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=commitdiff_plain;h=551d4434f8270af62b2c8d1fdd21eefd95ec9311 detect the wrong type Q3 format by a different error message when loading --- diff --git a/plugins/mapq3/plugin.cpp b/plugins/mapq3/plugin.cpp index a11dc4a9..be7212c2 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();