From 5186bc0aee4b0b577af6241a4abd34e0041cf77a Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Tue, 18 Jul 2017 12:52:59 +0200 Subject: [PATCH] [dpkdir] revert *MapFileObservers() addition, fix #105 Neumond probably thoughts it would be cool to make a file observer that reloads the VFS each time the map change, was a nice idea. Badly, it makes the VFS reloading itself before saving a map, losing the current work done. Would be easier to not rely on that observer mechanism and just make an explicit call to reload VFS when needed instead, so we revert this part. This VFS reload mechanism will be reintroduced in next commit. This commit fixes #105 even if DPK VFS is not yet fully restored. Note: this observer mechanism was also made available to plugins, so it's not available to plugins anymore (it was not used, and it's a bad idea, see the next commit). --- radiant/map.cpp | 29 ----------------------------- radiant/map.h | 3 --- radiant/plugin.cpp | 2 -- 3 files changed, 34 deletions(-) diff --git a/radiant/map.cpp b/radiant/map.cpp index bdc7841e..ed69f632 100644 --- a/radiant/map.cpp +++ b/radiant/map.cpp @@ -39,7 +39,6 @@ MapModules& ReferenceAPI_getMapModules(); #include "ifilesystem.h" #include "namespace.h" #include "moduleobserver.h" -#include "moduleobservers.h" #include @@ -406,29 +405,6 @@ float g_MinWorldCoord = -64 * 1024; void AddRegionBrushes( void ); void RemoveRegionBrushes( void ); -/* Map open/close observers */ - -ModuleObservers g_mapPathObservers; - -class MapFileObserver : public ModuleObserver -{ -void realise() { - // Refresh VFS to apply new pak filtering based on mapname - // needed for daemon dpk vfs - VFS_Refresh(); -} -void unrealise() { } -}; - -MapFileObserver g_mapFileObserver; - -void BindMapFileObservers(){ - g_mapPathObservers.attach( g_mapFileObserver ); -} - -void UnBindMapFileObservers(){ - g_mapPathObservers.detach( g_mapFileObserver ); -} /* @@ -448,7 +424,6 @@ void Map_Free(){ g_currentMap = 0; Brush_unlatchPreferences(); - g_mapPathObservers.unrealise(); } class EntityFindByClassname : public scene::Graph::Walker @@ -973,7 +948,6 @@ void Map_LoadFile( const char *filename ){ } Brush_toggleFormat( i ); g_map.m_name = filename; - g_mapPathObservers.realise(); Map_UpdateTitle( g_map ); g_map.m_resource = GlobalReferenceCache().capture( g_map.m_name.c_str() ); if ( format ) { @@ -1205,12 +1179,10 @@ void Map_RenameAbsolute( const char* absolute ){ g_map.m_resource->detach( g_map ); GlobalReferenceCache().release( g_map.m_name.c_str() ); - g_mapPathObservers.unrealise(); g_map.m_resource = resource; g_map.m_name = absolute; - g_mapPathObservers.realise(); Map_UpdateTitle( g_map ); g_map.m_resource->attach( g_map ); @@ -1248,7 +1220,6 @@ void Map_New(){ //globalOutputStream() << "Map_New\n"; g_map.m_name = "unnamed.map"; - g_mapPathObservers.realise(); Map_UpdateTitle( g_map ); { diff --git a/radiant/map.h b/radiant/map.h index 8bfd5114..a359d461 100644 --- a/radiant/map.h +++ b/radiant/map.h @@ -162,7 +162,4 @@ void Map_mergeClonedNames(); const char* getMapsPath(); -void BindMapFileObservers(); -void UnBindMapFileObservers(); - #endif diff --git a/radiant/plugin.cpp b/radiant/plugin.cpp index 8adf4d12..9d55cf3b 100644 --- a/radiant/plugin.cpp +++ b/radiant/plugin.cpp @@ -250,12 +250,10 @@ Radiant(){ MapRoot_construct(); EnginePath_verify(); - BindMapFileObservers(); EnginePath_Realise(); } ~Radiant(){ EnginePath_Unrealise(); - UnBindMapFileObservers(); MapRoot_destroy(); NullModel_destroy(); -- 2.39.2