From 7074f35e4ba831e358117842b99ee35b87f85ae5 Mon Sep 17 00:00:00 2001 From: void_17 Date: Mon, 2 Mar 2026 15:58:20 +0700 Subject: shared_ptr -> std::shared_ptr This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today. --- Minecraft.World/EntityIO.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'Minecraft.World/EntityIO.cpp') diff --git a/Minecraft.World/EntityIO.cpp b/Minecraft.World/EntityIO.cpp index d0677d38..123d4ba5 100644 --- a/Minecraft.World/EntityIO.cpp +++ b/Minecraft.World/EntityIO.cpp @@ -43,7 +43,7 @@ void EntityIO::staticCtor() { setId(ItemEntity::create, eTYPE_ITEMENTITY, L"Item", 1); setId(ExperienceOrb::create, eTYPE_EXPERIENCEORB, L"XPOrb", 2); - + setId(Painting::create, eTYPE_PAINTING, L"Painting", 9); setId(Arrow::create, eTYPE_ARROW, L"Arrow", 10); setId(Snowball::create, eTYPE_SNOWBALL, L"Snowball", 11); @@ -98,29 +98,29 @@ void EntityIO::staticCtor() setId(DragonFireball::create, eTYPE_DRAGON_FIREBALL, L"DragonFireball", 1000); } -shared_ptr EntityIO::newEntity(const wstring& id, Level *level) +std::shared_ptr EntityIO::newEntity(const wstring& id, Level *level) { - shared_ptr entity; + std::shared_ptr entity; AUTO_VAR(it, idCreateMap->find(id)); if(it != idCreateMap->end() ) { entityCreateFn create = it->second; - if (create != NULL) entity = shared_ptr(create(level)); + if (create != NULL) entity = std::shared_ptr(create(level)); } return entity; } -shared_ptr EntityIO::loadStatic(CompoundTag *tag, Level *level) +std::shared_ptr EntityIO::loadStatic(CompoundTag *tag, Level *level) { - shared_ptr entity; + std::shared_ptr entity; AUTO_VAR(it, idCreateMap->find(tag->getString(L"id"))); if(it != idCreateMap->end() ) { entityCreateFn create = it->second; - if (create != NULL) entity = shared_ptr(create(level)); + if (create != NULL) entity = std::shared_ptr(create(level)); } if (entity != NULL) @@ -136,15 +136,15 @@ shared_ptr EntityIO::loadStatic(CompoundTag *tag, Level *level) return entity; } -shared_ptr EntityIO::newById(int id, Level *level) +std::shared_ptr EntityIO::newById(int id, Level *level) { - shared_ptr entity; + std::shared_ptr entity; AUTO_VAR(it, numCreateMap->find(id)); if(it != numCreateMap->end() ) { entityCreateFn create = it->second; - if (create != NULL) entity = shared_ptr(create(level)); + if (create != NULL) entity = std::shared_ptr(create(level)); } if (entity != NULL) @@ -157,9 +157,9 @@ shared_ptr EntityIO::newById(int id, Level *level) return entity; } -shared_ptr EntityIO::newByEnumType(eINSTANCEOF eType, Level *level) +std::shared_ptr EntityIO::newByEnumType(eINSTANCEOF eType, Level *level) { - shared_ptr entity; + std::shared_ptr entity; unordered_map::iterator it = classNumMap->find( eType ); if( it != classNumMap->end() ) @@ -168,20 +168,20 @@ shared_ptr EntityIO::newByEnumType(eINSTANCEOF eType, Level *level) if(it2 != numCreateMap->end() ) { entityCreateFn create = it2->second; - if (create != NULL) entity = shared_ptr(create(level)); + if (create != NULL) entity = std::shared_ptr(create(level)); } } return entity; } -int EntityIO::getId(shared_ptr entity) +int EntityIO::getId(std::shared_ptr entity) { unordered_map::iterator it = classNumMap->find( entity->GetType() ); return (*it).second; } -wstring EntityIO::getEncodeId(shared_ptr entity) +wstring EntityIO::getEncodeId(std::shared_ptr entity) { unordered_map::iterator it = classIdMap->find( entity->GetType() ); if( it != classIdMap->end() ) @@ -208,7 +208,7 @@ wstring EntityIO::getEncodeId(int entityIoValue) //{ //return classIdMap.get(class1); //} - + AUTO_VAR(it, numClassMap->find(entityIoValue)); if(it != numClassMap->end() ) { -- cgit v1.2.3