]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
[dpkdir] revert *MapFileObservers() addition, fix #105
authorThomas Debesse <dev@illwieckz.net>
Tue, 18 Jul 2017 10:52:59 +0000 (12:52 +0200)
committerThomas Debesse <dev@illwieckz.net>
Sat, 29 Jul 2017 16:11:08 +0000 (18:11 +0200)
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
radiant/map.h
radiant/plugin.cpp

index bdc7841e3ae292ecf99551dfa41014498963973c..ed69f6326a208366916acb9295a8fe076b6b041a 100644 (file)
@@ -39,7 +39,6 @@ MapModules& ReferenceAPI_getMapModules();
 #include "ifilesystem.h"
 #include "namespace.h"
 #include "moduleobserver.h"
-#include "moduleobservers.h"
 
 #include <set>
 
@@ -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 );
 
        {
index 8bfd51147c6300cfc58c14d089f7cbb24c5ecc5f..a359d46159a676405df4523b4961573c41f1d10a 100644 (file)
@@ -162,7 +162,4 @@ void Map_mergeClonedNames();
 
 const char* getMapsPath();
 
-void BindMapFileObservers();
-void UnBindMapFileObservers();
-
 #endif
index 8adf4d12ea20b46cbcb9a559b087f0655918e633..9d55cf3b4a5126afe5d54d8da82ce96097d762ea 100644 (file)
@@ -250,12 +250,10 @@ Radiant(){
        MapRoot_construct();
 
        EnginePath_verify();
-       BindMapFileObservers();
        EnginePath_Realise();
 }
 ~Radiant(){
        EnginePath_Unrealise();
-       UnBindMapFileObservers();
 
        MapRoot_destroy();
        NullModel_destroy();