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.Client/ParticleEngine.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Minecraft.Client/ParticleEngine.cpp') diff --git a/Minecraft.Client/ParticleEngine.cpp b/Minecraft.Client/ParticleEngine.cpp index 3a34253a..12ef4a87 100644 --- a/Minecraft.Client/ParticleEngine.cpp +++ b/Minecraft.Client/ParticleEngine.cpp @@ -18,7 +18,7 @@ ParticleEngine::ParticleEngine(Level *level, Textures *textures) this->level = level; } this->textures = textures; - + this->random = new Random(); } @@ -27,7 +27,7 @@ ParticleEngine::~ParticleEngine() delete random; } -void ParticleEngine::add(shared_ptr p) +void ParticleEngine::add(std::shared_ptr p) { int t = p->getParticleTexture(); int l = p->level->dimension->id == 0 ? 0 : ( p->level->dimension->id == -1 ? 1 : 2); @@ -43,7 +43,7 @@ void ParticleEngine::tick() { for (unsigned int i = 0; i < particles[l][tt].size(); i++) { - shared_ptr p = particles[l][tt][i]; + std::shared_ptr p = particles[l][tt][i]; p->tick(); if (p->removed) { @@ -56,7 +56,7 @@ void ParticleEngine::tick() } } -void ParticleEngine::render(shared_ptr player, float a) +void ParticleEngine::render(std::shared_ptr player, float a) { // 4J - change brought forward from 1.2.3 float xa = Camera::xa; @@ -99,7 +99,7 @@ void ParticleEngine::render(shared_ptr player, float a) t->end(); t->begin(); } - shared_ptr p = particles[l][tt][i]; + std::shared_ptr p = particles[l][tt][i]; if (SharedConstants::TEXTURE_LIGHTING) // 4J - change brought forward from 1.8.2 { @@ -118,7 +118,7 @@ void ParticleEngine::render(shared_ptr player, float a) } -void ParticleEngine::renderLit(shared_ptr player, float a) +void ParticleEngine::renderLit(std::shared_ptr player, float a) { // 4J - added. We call this before ParticleEngine::render in the general render per player, so if we // don't set this here then the offsets will be from the previous player - a single frame lag for the @@ -142,7 +142,7 @@ void ParticleEngine::renderLit(shared_ptr player, float a) Tesselator *t = Tesselator::getInstance(); for (unsigned int i = 0; i < particles[l][tt].size(); i++) { - shared_ptr p = particles[l][tt][i]; + std::shared_ptr p = particles[l][tt][i]; if (SharedConstants::TEXTURE_LIGHTING) // 4J - change brought forward from 1.8.2 { @@ -182,7 +182,7 @@ void ParticleEngine::destroy(int x, int y, int z, int tid, int data) double yp = y + (yy + 0.5) / SD; double zp = z + (zz + 0.5) / SD; int face = random->nextInt(6); - add(( shared_ptr(new TerrainParticle(level, xp, yp, zp, xp - x - 0.5f, yp - y - 0.5f, zp - z - 0.5f, tile, face, data, textures) ) )->init(x, y, z, data)); + add(( std::shared_ptr(new TerrainParticle(level, xp, yp, zp, xp - x - 0.5f, yp - y - 0.5f, zp - z - 0.5f, tile, face, data, textures) ) )->init(x, y, z, data)); } } @@ -201,7 +201,7 @@ void ParticleEngine::crack(int x, int y, int z, int face) if (face == 3) zp = z + tile->getShapeZ1() + r; if (face == 4) xp = x + tile->getShapeX0() - r; if (face == 5) xp = x + tile->getShapeX1() + r; - add(( shared_ptr(new TerrainParticle(level, xp, yp, zp, 0, 0, 0, tile, face, level->getData(x, y, z), textures) ) )->init(x, y, z, level->getData(x, y, z))->setPower(0.2f)->scale(0.6f)); + add(( std::shared_ptr(new TerrainParticle(level, xp, yp, zp, 0, 0, 0, tile, face, level->getData(x, y, z), textures) ) )->init(x, y, z, level->getData(x, y, z))->setPower(0.2f)->scale(0.6f)); } -- cgit v1.2.3