mirror of
https://github.com/luanti-org/luanti.git
synced 2025-12-18 12:55:25 +01:00
Avoid duplication of mod metadata in memory (#12562)
Co-authored-by: sfan5 <sfan5@live.de>
This commit is contained in:
committed by
GitHub
parent
03428d9825
commit
f4a01f3a5d
@@ -1991,26 +1991,6 @@ const std::string* Client::getModFile(std::string filename)
|
||||
return &it->second;
|
||||
}
|
||||
|
||||
bool Client::registerModStorage(ModMetadata *storage)
|
||||
{
|
||||
if (m_mod_storages.find(storage->getModName()) != m_mod_storages.end()) {
|
||||
errorstream << "Unable to register same mod storage twice. Storage name: "
|
||||
<< storage->getModName() << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_mod_storages[storage->getModName()] = storage;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Client::unregisterModStorage(const std::string &name)
|
||||
{
|
||||
std::unordered_map<std::string, ModMetadata *>::const_iterator it =
|
||||
m_mod_storages.find(name);
|
||||
if (it != m_mod_storages.end())
|
||||
m_mod_storages.erase(name);
|
||||
}
|
||||
|
||||
/*
|
||||
* Mod channels
|
||||
*/
|
||||
|
||||
@@ -383,9 +383,6 @@ public:
|
||||
const std::string* getModFile(std::string filename);
|
||||
ModMetadataDatabase *getModStorageDatabase() override { return m_mod_storage_database; }
|
||||
|
||||
bool registerModStorage(ModMetadata *meta) override;
|
||||
void unregisterModStorage(const std::string &name) override;
|
||||
|
||||
// Migrates away old files-based mod storage if necessary
|
||||
void migrateModStorage();
|
||||
|
||||
@@ -593,7 +590,6 @@ private:
|
||||
|
||||
// Client modding
|
||||
ClientScripting *m_script = nullptr;
|
||||
std::unordered_map<std::string, ModMetadata *> m_mod_storages;
|
||||
ModMetadataDatabase *m_mod_storage_database = nullptr;
|
||||
float m_mod_storage_save_timer = 10.0f;
|
||||
std::vector<ModSpec> m_mods;
|
||||
|
||||
Reference in New Issue
Block a user