Skip to content

Commit

Permalink
Move static Map module to MapModules.cpp.
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Jan 15, 2020
1 parent 1de6a05 commit 28b84e0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion include/imap.h
Expand Up @@ -102,7 +102,7 @@ class IMap :
};
typedef std::shared_ptr<IMap> IMapPtr;

const std::string MODULE_MAP("Map");
const char* const MODULE_MAP("Map");

// Application-wide Accessor to the currently active map
inline IMap& GlobalMapModule() {
Expand Down
9 changes: 0 additions & 9 deletions radiant/map/Map.cpp
Expand Up @@ -1005,13 +1005,4 @@ void Map::shutdownModule()
_mapPositionManager.reset();
}

// Creates the static module instance
module::StaticModule<Map> staticMapModule;

} // namespace map

// Accessor method containing the singleton Map instance
map::Map& GlobalMap()
{
return *map::staticMapModule.getModule();
}
1 change: 1 addition & 0 deletions radiant/map/Map.h
Expand Up @@ -243,4 +243,5 @@ class Map :
} // namespace map

// Accessor function for the map
// Function body defined in MapModules.cpp
map::Map& GlobalMap();
10 changes: 10 additions & 0 deletions radiant/map/MapModules.cpp
Expand Up @@ -6,10 +6,20 @@

#include "imapformat.h"
#include "modulesystem/StaticModule.h"
#include "Map.h"

// Static module instances
module::StaticModule<map::Doom3MapFormat> d3MapModule;
module::StaticModule<map::Quake4MapFormat> q4MapModule;
module::StaticModule<map::Doom3PrefabFormat> d3PrefabModule;
module::StaticModule<map::Quake3MapFormat> q3MapModule;
module::StaticModule<map::Doom3AasFileLoader> d3AasModule;

// Creates the static module instance
module::StaticModule<map::Map> staticMapModule;

// Accessor method containing the singleton Map instance
map::Map& GlobalMap()
{
return *staticMapModule.getModule();
}

0 comments on commit 28b84e0

Please sign in to comment.