refactor: unglob std::shared_ptr

This commit is contained in:
Tropical
2026-03-06 11:20:45 -06:00
parent 0dd1654dec
commit 67ceccf2d4
1065 changed files with 5754 additions and 5749 deletions

View File

@@ -98,29 +98,29 @@ void EntityIO::staticCtor()
setId(DragonFireball::create, eTYPE_DRAGON_FIREBALL, L"DragonFireball", 1000);
}
shared_ptr<Entity> EntityIO::newEntity(const wstring& id, Level *level)
std::shared_ptr<Entity> EntityIO::newEntity(const wstring& id, Level *level)
{
shared_ptr<Entity> entity;
std::shared_ptr<Entity> entity;
AUTO_VAR(it, idCreateMap->find(id));
if(it != idCreateMap->end() )
{
entityCreateFn create = it->second;
if (create != NULL) entity = shared_ptr<Entity>(create(level));
if (create != NULL) entity = std::shared_ptr<Entity>(create(level));
}
return entity;
}
shared_ptr<Entity> EntityIO::loadStatic(CompoundTag *tag, Level *level)
std::shared_ptr<Entity> EntityIO::loadStatic(CompoundTag *tag, Level *level)
{
shared_ptr<Entity> entity;
std::shared_ptr<Entity> entity;
AUTO_VAR(it, idCreateMap->find(tag->getString(L"id")));
if(it != idCreateMap->end() )
{
entityCreateFn create = it->second;
if (create != NULL) entity = shared_ptr<Entity>(create(level));
if (create != NULL) entity = std::shared_ptr<Entity>(create(level));
}
if (entity != NULL)
@@ -136,15 +136,15 @@ shared_ptr<Entity> EntityIO::loadStatic(CompoundTag *tag, Level *level)
return entity;
}
shared_ptr<Entity> EntityIO::newById(int id, Level *level)
std::shared_ptr<Entity> EntityIO::newById(int id, Level *level)
{
shared_ptr<Entity> entity;
std::shared_ptr<Entity> entity;
AUTO_VAR(it, numCreateMap->find(id));
if(it != numCreateMap->end() )
{
entityCreateFn create = it->second;
if (create != NULL) entity = shared_ptr<Entity>(create(level));
if (create != NULL) entity = std::shared_ptr<Entity>(create(level));
}
if (entity != NULL)
@@ -157,9 +157,9 @@ shared_ptr<Entity> EntityIO::newById(int id, Level *level)
return entity;
}
shared_ptr<Entity> EntityIO::newByEnumType(eINSTANCEOF eType, Level *level)
std::shared_ptr<Entity> EntityIO::newByEnumType(eINSTANCEOF eType, Level *level)
{
shared_ptr<Entity> entity;
std::shared_ptr<Entity> entity;
unordered_map<eINSTANCEOF, int, eINSTANCEOFKeyHash, eINSTANCEOFKeyEq>::iterator it = classNumMap->find( eType );
if( it != classNumMap->end() )
@@ -168,20 +168,20 @@ shared_ptr<Entity> EntityIO::newByEnumType(eINSTANCEOF eType, Level *level)
if(it2 != numCreateMap->end() )
{
entityCreateFn create = it2->second;
if (create != NULL) entity = shared_ptr<Entity>(create(level));
if (create != NULL) entity = std::shared_ptr<Entity>(create(level));
}
}
return entity;
}
int EntityIO::getId(shared_ptr<Entity> entity)
int EntityIO::getId(std::shared_ptr<Entity> entity)
{
unordered_map<eINSTANCEOF, int, eINSTANCEOFKeyHash, eINSTANCEOFKeyEq>::iterator it = classNumMap->find( entity->GetType() );
return (*it).second;
}
wstring EntityIO::getEncodeId(shared_ptr<Entity> entity)
wstring EntityIO::getEncodeId(std::shared_ptr<Entity> entity)
{
unordered_map<eINSTANCEOF, wstring, eINSTANCEOFKeyHash, eINSTANCEOFKeyEq>::iterator it = classIdMap->find( entity->GetType() );
if( it != classIdMap->end() )