Merge branch 'Misc' of https://github.com/dean11/Danbias into GameClient

This commit is contained in:
lanariel 2014-02-21 11:51:00 +01:00
commit 8f0a0464a5
3 changed files with 41 additions and 0 deletions

View File

@ -437,6 +437,38 @@ int ResourceManager::GetResourceId(const wchar_t c[])
return -1; return -1;
} }
int ResourceManager::GetResourceCount(const wchar_t filename[])
{
ResourceData *t = FindResource(this->resources, filename);
if(t) return t->referenceCount;
return 0;
}
int ResourceManager::GetResourceCount(const HRESOURCE& resource)
{
ResourceData *t = FindResource(this->resources, resource);
if(t) return t->referenceCount;
return 0;
}
int ResourceManager::GetResourceSize(const wchar_t filename[])
{
ResourceData *t = FindResource(this->resources, filename);
if(t) return t->resourceSize;
return 0;
}
int ResourceManager::GetResourceSize(const HRESOURCE& resource)
{
ResourceData *t = FindResource(this->resources, resource);
if(t) return t->resourceSize;
return 0;
}

View File

@ -149,6 +149,14 @@ namespace Oyster
*/ */
int GetResourceId(const wchar_t filename[]); int GetResourceId(const wchar_t filename[]);
int GetResourceCount(const wchar_t filename[]);
int GetResourceCount(const HRESOURCE& resource);
int GetResourceSize(const wchar_t filename[]);
int GetResourceSize(const HRESOURCE& resource);
private: private:
ResourceManager(const ResourceManager& obj); ResourceManager(const ResourceManager& obj);
const ResourceManager& operator=(const ResourceManager&); const ResourceManager& operator=(const ResourceManager&);

View File

@ -44,6 +44,7 @@ namespace Utility
ReferenceCount() :count(0) { } ReferenceCount() :count(0) { }
ReferenceCount(const ReferenceCount& o) { count = o.count; } ReferenceCount(const ReferenceCount& o) { count = o.count; }
inline const ReferenceCount& operator=(const ReferenceCount& o) { count = o.count; return *this;} inline const ReferenceCount& operator=(const ReferenceCount& o) { count = o.count; return *this;}
operator int() { return this->count; }
inline void Incref() { this->count++; } inline void Incref() { this->count++; }
inline void Incref(int c) { this->count += c; } inline void Incref(int c) { this->count += c; }
inline int Decref() { return --this->count;} inline int Decref() { return --this->count;}