X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=blobdiff_plain;f=plugins%2Fmapq3%2Fplugin.cpp;h=be7212c2bc9fa84d67e12008a8d5d50d7ee5c213;hp=a11dc4a9bf3633a25e10642aa6f4449f8f8cc3f6;hb=551d4434f8270af62b2c8d1fdd21eefd95ec9311;hpb=107765f0e4b543dfc346851ee5b4605cc17eb1c6 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();