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. --- .../Common/GameRules/ConsoleSchematicFile.cpp | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp') diff --git a/Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp b/Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp index 0eef096b..5f4bc737 100644 --- a/Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp +++ b/Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp @@ -116,7 +116,7 @@ void ConsoleSchematicFile::load(DataInputStream *dis) for (int i = 0; i < tileEntityTags->size(); i++) { CompoundTag *teTag = tileEntityTags->get(i); - shared_ptr te = TileEntity::loadStatic(teTag); + std::shared_ptr te = TileEntity::loadStatic(teTag); if(te == NULL) { @@ -433,7 +433,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox, { for(AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end();++it) { - shared_ptr te = *it; + std::shared_ptr te = *it; double targetX = te->x; double targetY = te->y + destinationBox->y0; @@ -444,7 +444,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox, Vec3 *pos = Vec3::newTemp(targetX,targetY,targetZ); if( chunkBox->containsIncludingLowerBound(pos) ) { - shared_ptr teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 ); + std::shared_ptr teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 ); if ( teCopy != NULL ) { @@ -495,11 +495,11 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox, } CompoundTag *eTag = it->second; - shared_ptr e = EntityIO::loadStatic(eTag, NULL); + std::shared_ptr e = EntityIO::loadStatic(eTag, NULL); if( e->GetType() == eTYPE_PAINTING ) { - shared_ptr painting = dynamic_pointer_cast(e); + std::shared_ptr painting = dynamic_pointer_cast(e); double tileX = painting->xTile; double tileZ = painting->zTile; @@ -512,7 +512,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox, } else if( e->GetType() == eTYPE_ITEM_FRAME ) { - shared_ptr frame = dynamic_pointer_cast(e); + std::shared_ptr frame = dynamic_pointer_cast(e); double tileX = frame->xTile; double tileZ = frame->zTile; @@ -678,12 +678,12 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l { for (int zc = zc0; zc <= zc1; zc++) { - vector > *tileEntities = getTileEntitiesInRegion(level->getChunk(xc, zc), xStart, yStart, zStart, xStart + xSize, yStart + ySize, zStart + zSize); + vector > *tileEntities = getTileEntitiesInRegion(level->getChunk(xc, zc), xStart, yStart, zStart, xStart + xSize, yStart + ySize, zStart + zSize); for(AUTO_VAR(it, tileEntities->begin()); it != tileEntities->end(); ++it) { - shared_ptr te = *it; + std::shared_ptr te = *it; CompoundTag *teTag = new CompoundTag(); - shared_ptr teCopy = te->clone(); + std::shared_ptr teCopy = te->clone(); // Adjust the tileEntity position to schematic coords from world co-ords teCopy->x -= xStart; @@ -698,12 +698,12 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l tag.put(L"TileEntities", tileEntitiesTag); AABB *bb = AABB::newTemp(xStart,yStart,zStart,xEnd,yEnd,zEnd); - vector > *entities = level->getEntities(nullptr, bb); + vector > *entities = level->getEntities(nullptr, bb); ListTag *entitiesTag = new ListTag(L"entities"); for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) { - shared_ptr e = *it; + std::shared_ptr e = *it; bool mobCanBeSaved = false; if(bSaveMobs) @@ -1005,12 +1005,12 @@ void ConsoleSchematicFile::setBlocksAndData(LevelChunk *chunk, byteArray blockDa } } -vector > *ConsoleSchematicFile::getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1) +vector > *ConsoleSchematicFile::getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1) { - vector > *result = new vector >; + vector > *result = new vector >; for (AUTO_VAR(it, chunk->tileEntities.begin()); it != chunk->tileEntities.end(); ++it) { - shared_ptr te = it->second; + std::shared_ptr te = it->second; if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1) { result->push_back(te); -- cgit v1.2.3