Update CSimplePool offsets

This commit is contained in:
Phillip Stephens 2017-01-21 20:32:53 -08:00
parent e9222c7aba
commit 34e3a7f383
4 changed files with 24 additions and 23 deletions

View File

@ -14,7 +14,7 @@ CToken ProjectResourcePool::GetObj(const char* name)
return ret; return ret;
hecl::ProjectPath path(*m_parent.project(), name); hecl::ProjectPath path(*m_parent.project(), name);
SObjectTag tag = static_cast<ProjectResourceFactoryBase&>(x30_factory). SObjectTag tag = static_cast<ProjectResourceFactoryBase&>(x18_factory).
TagFromPath(path, hecl::SharedBlenderToken); TagFromPath(path, hecl::SharedBlenderToken);
if (tag) if (tag)
return CSimplePool::GetObj(tag); return CSimplePool::GetObj(tag);
@ -29,7 +29,7 @@ CToken ProjectResourcePool::GetObj(const char* name, const CVParamTransfer& pvxf
return ret; return ret;
hecl::ProjectPath path(*m_parent.project(), name); hecl::ProjectPath path(*m_parent.project(), name);
SObjectTag tag = static_cast<ProjectResourceFactoryBase&>(x30_factory). SObjectTag tag = static_cast<ProjectResourceFactoryBase&>(x18_factory).
TagFromPath(path, hecl::SharedBlenderToken); TagFromPath(path, hecl::SharedBlenderToken);
if (tag) if (tag)
return CSimplePool::GetObj(tag, pvxfer); return CSimplePool::GetObj(tag, pvxfer);

View File

@ -6,7 +6,7 @@ namespace urde
{ {
CSimplePool::CSimplePool(IFactory& factory) CSimplePool::CSimplePool(IFactory& factory)
: x30_factory(factory), x34_paramXfer(new TObjOwnerParam<IObjectStore*>(this)) : x18_factory(factory), x1c_paramXfer(new TObjOwnerParam<IObjectStore*>(this))
{} {}
CToken CSimplePool::GetObj(const SObjectTag& tag, const CVParamTransfer& paramXfer) CToken CSimplePool::GetObj(const SObjectTag& tag, const CVParamTransfer& paramXfer)
@ -14,28 +14,28 @@ CToken CSimplePool::GetObj(const SObjectTag& tag, const CVParamTransfer& paramXf
if (!tag) if (!tag)
return {}; return {};
auto iter = x4_resources.find(tag); auto iter = x8_resources.find(tag);
if (iter != x4_resources.end()) if (iter != x8_resources.end())
return CToken(iter->second); return CToken(iter->second);
CObjectReference* ret = new CObjectReference(*this, std::unique_ptr<IObj>(), tag, paramXfer); CObjectReference* ret = new CObjectReference(*this, std::unique_ptr<IObj>(), tag, paramXfer);
x4_resources.emplace(std::make_pair<SObjectTag, CObjectReference*>((SObjectTag)tag, std::move(ret))); x8_resources.emplace(std::make_pair<SObjectTag, CObjectReference*>((SObjectTag)tag, std::move(ret)));
return CToken(ret); return CToken(ret);
} }
CToken CSimplePool::GetObj(const SObjectTag& tag) CToken CSimplePool::GetObj(const SObjectTag& tag)
{ {
return GetObj(tag, x34_paramXfer); return GetObj(tag, x1c_paramXfer);
} }
CToken CSimplePool::GetObj(const char* resourceName) CToken CSimplePool::GetObj(const char* resourceName)
{ {
return GetObj(resourceName, x34_paramXfer); return GetObj(resourceName, x1c_paramXfer);
} }
CToken CSimplePool::GetObj(const char* resourceName, const CVParamTransfer& paramXfer) CToken CSimplePool::GetObj(const char* resourceName, const CVParamTransfer& paramXfer)
{ {
const SObjectTag* tag = x30_factory.GetResourceIdByName(resourceName); const SObjectTag* tag = x18_factory.GetResourceIdByName(resourceName);
if (!tag) if (!tag)
return {}; return {};
return GetObj(*tag, paramXfer); return GetObj(*tag, paramXfer);
@ -43,16 +43,16 @@ CToken CSimplePool::GetObj(const char* resourceName, const CVParamTransfer& para
bool CSimplePool::HasObject(const SObjectTag& tag) const bool CSimplePool::HasObject(const SObjectTag& tag) const
{ {
auto iter = x4_resources.find(tag); auto iter = x8_resources.find(tag);
if (iter != x4_resources.cend()) if (iter != x8_resources.cend())
return true; return true;
return x30_factory.CanBuild(tag); return x18_factory.CanBuild(tag);
} }
bool CSimplePool::ObjectIsLive(const SObjectTag& tag) const bool CSimplePool::ObjectIsLive(const SObjectTag& tag) const
{ {
auto iter = x4_resources.find(tag); auto iter = x8_resources.find(tag);
if (iter == x4_resources.cend()) if (iter == x8_resources.cend())
return false; return false;
return iter->second->IsLoaded(); return iter->second->IsLoaded();
} }
@ -63,9 +63,9 @@ void CSimplePool::Flush()
void CSimplePool::ObjectUnreferenced(const SObjectTag& tag) void CSimplePool::ObjectUnreferenced(const SObjectTag& tag)
{ {
auto iter = x4_resources.find(tag); auto iter = x8_resources.find(tag);
if (iter != x4_resources.end()) if (iter != x8_resources.end())
x4_resources.erase(iter); x8_resources.erase(iter);
} }
} }

View File

@ -14,10 +14,11 @@ class CObjectReference;
class CSimplePool : public IObjectStore class CSimplePool : public IObjectStore
{ {
protected: protected:
//std::list<std::pair<SObjectTag, CObjectReference*>> x4_resources; u8 x4_;
std::unordered_map<SObjectTag, CObjectReference*> x4_resources; u8 x5_;
IFactory& x30_factory; std::unordered_map<SObjectTag, CObjectReference*> x8_resources;
CVParamTransfer x34_paramXfer; IFactory& x18_factory;
CVParamTransfer x1c_paramXfer;
public: public:
CSimplePool(IFactory& factory); CSimplePool(IFactory& factory);
CToken GetObj(const SObjectTag&, const CVParamTransfer&); CToken GetObj(const SObjectTag&, const CVParamTransfer&);
@ -26,7 +27,7 @@ public:
CToken GetObj(const char*, const CVParamTransfer&); CToken GetObj(const char*, const CVParamTransfer&);
bool HasObject(const SObjectTag&) const; bool HasObject(const SObjectTag&) const;
bool ObjectIsLive(const SObjectTag&) const; bool ObjectIsLive(const SObjectTag&) const;
IFactory& GetFactory() const {return x30_factory;} IFactory& GetFactory() const {return x18_factory;}
void Flush(); void Flush();
void ObjectUnreferenced(const SObjectTag&); void ObjectUnreferenced(const SObjectTag&);
}; };

2
hecl

@ -1 +1 @@
Subproject commit b02a7baff487bbf86102c8531e98147e00b9c54e Subproject commit 51fc07f0a0f6e7c093f722fcb48454c65fa5f0ca