]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
detect the wrong type Q3 format by a different error message when loading
authorRudolf Polzer <divverent@alientrap.org>
Sun, 10 Oct 2010 08:05:03 +0000 (10:05 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Sun, 10 Oct 2010 08:05:17 +0000 (10:05 +0200)
plugins/mapq3/plugin.cpp

index a11dc4a9bf3633a25e10642aa6f4449f8f8cc3f6..be7212c2bc9fa84d67e12008a8d5d50d7ee5c213 100644 (file)
@@ -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();