* fixed some memleaks at shutdown. thx to bLuma for patch!
This commit is contained in:
parent
3717c1cd22
commit
8d261e5da0
@ -43,3 +43,12 @@ DefList *ListStorage::Get(std::string s)
|
|||||||
DefList *l = GetNoCreate(s);
|
DefList *l = GetNoCreate(s);
|
||||||
return l ? l : _Create(s);
|
return l ? l : _Create(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ListStorage::~ListStorage()
|
||||||
|
{
|
||||||
|
for(DefListMap::iterator it = _storage.begin(); it != _storage.end();)
|
||||||
|
{
|
||||||
|
delete it->second;
|
||||||
|
_storage.erase(it++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -11,6 +11,8 @@ typedef std::map<std::string,DefList*> DefListMap;
|
|||||||
class ListStorage
|
class ListStorage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
~ListStorage();
|
||||||
|
|
||||||
bool Exists(std::string);
|
bool Exists(std::string);
|
||||||
void Delete(std::string);
|
void Delete(std::string);
|
||||||
DefList *Get(std::string);
|
DefList *Get(std::string);
|
||||||
|
|||||||
@ -13,6 +13,14 @@
|
|||||||
// increase this number whenever you change something that makes old files unusable
|
// increase this number whenever you change something that makes old files unusable
|
||||||
uint32 ITEMPROTOTYPES_CACHE_VERSION = 0x00000001;
|
uint32 ITEMPROTOTYPES_CACHE_VERSION = 0x00000001;
|
||||||
|
|
||||||
|
PlayerNameCache::~PlayerNameCache()
|
||||||
|
{
|
||||||
|
for(std::vector<PlayerNameCacheItem*>::iterator i=_cache.begin(); i!=_cache.end(); i++)
|
||||||
|
{
|
||||||
|
delete *i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool PlayerNameCache::AddInfo(uint64 guid, std::string name){
|
bool PlayerNameCache::AddInfo(uint64 guid, std::string name){
|
||||||
PlayerNameCacheItem *cacheItem=new PlayerNameCacheItem;
|
PlayerNameCacheItem *cacheItem=new PlayerNameCacheItem;
|
||||||
cacheItem->_name=name;
|
cacheItem->_name=name;
|
||||||
|
|||||||
@ -8,6 +8,8 @@ struct PlayerNameCacheItem {
|
|||||||
|
|
||||||
class PlayerNameCache {
|
class PlayerNameCache {
|
||||||
public:
|
public:
|
||||||
|
~PlayerNameCache();
|
||||||
|
|
||||||
std::string GetName(uint64);
|
std::string GetName(uint64);
|
||||||
bool IsKnown(uint64);
|
bool IsKnown(uint64);
|
||||||
uint64 GetGuid(std::string);
|
uint64 GetGuid(std::string);
|
||||||
|
|||||||
@ -53,7 +53,13 @@ class UpdateMask
|
|||||||
inline uint32 GetLength() { return mBlocks << 2; }
|
inline uint32 GetLength() { return mBlocks << 2; }
|
||||||
inline uint32 GetCount() { return mCount; }
|
inline uint32 GetCount() { return mCount; }
|
||||||
inline uint8* GetMask() { return (uint8*)mUpdateMask; }
|
inline uint8* GetMask() { return (uint8*)mUpdateMask; }
|
||||||
inline void SetMask(uint32 *updateMask) { mUpdateMask = updateMask; }
|
inline void SetMask(uint32 *updateMask)
|
||||||
|
{
|
||||||
|
if(mUpdateMask)
|
||||||
|
delete [] mUpdateMask;
|
||||||
|
|
||||||
|
mUpdateMask = updateMask;
|
||||||
|
}
|
||||||
|
|
||||||
inline void SetCount (uint32 valuesCount)
|
inline void SetCount (uint32 valuesCount)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user