From: Rudolf Polzer Date: Fri, 21 Jan 2011 22:34:25 +0000 (+0100) Subject: detect format error on Import..., and convert (as it was intended) X-Git-Tag: xonotic-v0.5.0~56 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=73c9441a021c38530b3a5ef16e92894625e76cfc;p=xonotic%2Fnetradiant.git detect format error on Import..., and convert (as it was intended) --- diff --git a/radiant/map.cpp b/radiant/map.cpp index 453f7c79..57245990 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -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);