]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
detect format error on Import..., and convert (as it was intended)
authorRudolf Polzer <divverent@alientrap.org>
Fri, 21 Jan 2011 22:34:25 +0000 (23:34 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 21 Jan 2011 22:34:25 +0000 (23:34 +0100)
radiant/map.cpp

index 453f7c790793b4e0a2b8f06bb7a51d426c73cd0e..572459907e56867d1e820a877da5c78dc226f7eb 100644 (file)
@@ -1643,6 +1643,13 @@ bool Map_ImportFile(const char* filename)
     goto tryDecompile;
 
   {
+    const MapFormat* format = NULL;
+    const char* moduleName = findModuleName(&GlobalFiletypes(), MapFormat::Name(), path_get_extension(filename));
+    if(string_not_empty(moduleName))
+      format = ReferenceAPI_getMapModules().findModule(moduleName);
+
+    if(format)
+      format->wrongFormat = false;
     Resource* resource = GlobalReferenceCache().capture(filename);
     resource->refresh(); // avoid loading old version if map has changed on disk since last import
     if(!resource->load())
@@ -1650,6 +1657,12 @@ bool Map_ImportFile(const char* filename)
       GlobalReferenceCache().release(filename);
       goto tryDecompile;
     }
+    if(format)
+      if(format->wrongFormat)
+      {
+        GlobalReferenceCache().release(filename);
+        goto tryDecompile;
+      }
     NodeSmartReference clone(NewMapRoot(""));
     Node_getTraversable(*resource->getNode())->traverse(CloneAll(clone));
     Map_gatherNamespaced(clone);