From 73c9441a021c38530b3a5ef16e92894625e76cfc Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Fri, 21 Jan 2011 23:34:25 +0100 Subject: [PATCH] detect format error on Import..., and convert (as it was intended) --- radiant/map.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/radiant/map.cpp b/radiant/map.cpp index 453f7c7..5724599 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); -- 2.39.2