diff options
author | Shauren <shauren.trinity@gmail.com> | 2024-07-04 22:56:00 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2024-07-04 22:56:00 +0200 |
commit | ff4fc1ad4e91e3da9cd8c011f30473a19a3d47bd (patch) | |
tree | a37fc61a59a39520a88d024846a900c63988a0b0 /src/common/Collision/Management/VMapManager2.h | |
parent | fd329ee8483da81585db484c005a6fe22448bc63 (diff) |
Core/Vmaps: Replace manual reference counting with shared_ptr and slightly reduce memory use by deduplicating model name strings
Diffstat (limited to 'src/common/Collision/Management/VMapManager2.h')
-rw-r--r-- | src/common/Collision/Management/VMapManager2.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/common/Collision/Management/VMapManager2.h b/src/common/Collision/Management/VMapManager2.h index 57fca55d5f6..b621fc72d02 100644 --- a/src/common/Collision/Management/VMapManager2.h +++ b/src/common/Collision/Management/VMapManager2.h @@ -18,11 +18,12 @@ #ifndef _VMAPMANAGER2_H #define _VMAPMANAGER2_H +#include "Define.h" +#include "IVMapManager.h" +#include <memory> #include <mutex> #include <unordered_map> #include <vector> -#include "Define.h" -#include "IVMapManager.h" //=========================================================== @@ -52,7 +53,7 @@ namespace VMAP class WorldModel; typedef std::unordered_map<uint32, StaticMapTree*> InstanceTreeMap; - typedef std::unordered_map<std::string, ManagedModel*> ModelFileMap; + typedef std::unordered_map<std::string, std::weak_ptr<ManagedModel>> ModelFileMap; enum DisableTypes { @@ -105,7 +106,7 @@ namespace VMAP bool getAreaAndLiquidData(uint32 mapId, float x, float y, float z, Optional<uint8> reqLiquidType, AreaAndLiquidData& data) const override; - WorldModel* acquireModelInstance(std::string const& basepath, std::string const& filename); + std::shared_ptr<WorldModel> acquireModelInstance(std::string const& basepath, std::string const& filename); void releaseModelInstance(std::string const& filename); // what's the use of this? o.O |