Skip to content

Commit 3c375a5

Browse files
committed
Store loaded modules less stupidly
1 parent 4bd9404 commit 3c375a5

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

Managers/ModuleMan.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ namespace RTE {
2323

2424
void ModuleMan::Clear() {
2525
m_LoadedDataModules.clear();
26-
m_DataModuleIDs.clear();
2726
m_OfficialModuleCount = 0;
2827

2928
m_DisabledMods.clear();

Managers/ModuleMan.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ namespace RTE {
6060
/// Gets all the loaded DataModules.
6161
/// </summary>
6262
/// <returns>All the loaded DataModules.</returns>
63-
std::vector<DataModule *> & GetLoadedDataModules() { return m_LoadedDataModules; }
63+
std::unordered_map<int, DataModule *> & GetLoadedDataModules() { return m_LoadedDataModules; }
6464

6565

6666

@@ -194,15 +194,13 @@ namespace RTE {
194194
static const std::array<std::string, 10> c_OfficialModules; //!< Array storing the names of all the official modules.
195195
static const std::array<std::pair<std::string, std::string>, 3> c_UserdataModules; //!< Array storing the names of all the userdata modules.
196196

197-
std::vector<DataModule *> m_LoadedDataModules; //!< Owned and loaded DataModules.
198-
199-
std::map<std::string, size_t> m_DataModuleIDs; //!< Names of all DataModules mapped to indices into the m_LoadedDataModules vector. The names are all lowercase name so we can more easily find them in case-agnostic fashion.
200197

201198
/// <summary>
202199
/// How many modules are 'official' and shipped with the game, and guaranteed to not have name conflicts among them.
203200
/// All official modules are in the beginning of the m_TypeMap, so this count shows how many into that vector they represent
204201
/// </summary>
205202
int m_OfficialModuleCount;
203+
std::unordered_map<int, DataModule *> m_LoadedDataModules; //!< Map of all loaded DataModules by their ID. Owned by this.
206204

207205
std::string m_SingleModuleToLoad; //!< Name of the single module to load after the official modules.
208206

0 commit comments

Comments
 (0)