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/ServerLevel.h | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'Minecraft.Client/ServerLevel.h') diff --git a/Minecraft.Client/ServerLevel.h b/Minecraft.Client/ServerLevel.h index ae413d11..82c5400e 100644 --- a/Minecraft.Client/ServerLevel.h +++ b/Minecraft.Client/ServerLevel.h @@ -41,7 +41,7 @@ private: int activeTileEventsList; public: static void staticCtor(); - ServerLevel(MinecraftServer *server, shared_ptrlevelStorage, const wstring& levelName, int dimension, LevelSettings *levelSettings); + ServerLevel(MinecraftServer *server, std::shared_ptrlevelStorage, const wstring& levelName, int dimension, LevelSettings *levelSettings); ~ServerLevel(); void tick(); Biome::MobSpawnerData *getRandomMobSpawnAt(MobCategory *mobCategory, int x, int y, int z); @@ -65,15 +65,15 @@ public: void tickEntities(); bool tickPendingTicks(bool force); vector *fetchTicksInChunk(LevelChunk *chunk, bool remove); - virtual void tick(shared_ptr e, bool actual); - void forceTick(shared_ptr e, bool actual); + virtual void tick(std::shared_ptr e, bool actual); + void forceTick(std::shared_ptr e, bool actual); bool AllPlayersAreSleeping() { return allPlayersSleeping;} // 4J added for a message to other players bool isAtLeastOnePlayerSleeping() { return m_bAtLeastOnePlayerSleeping;} protected: ChunkSource *createChunkSource(); // 4J - was virtual, but was called from parent ctor public: - vector > *getTileEntitiesInRegion(int x0, int y0, int z0, int x1, int y1, int z1); - virtual bool mayInteract(shared_ptr player, int xt, int yt, int zt, int id); + vector > *getTileEntitiesInRegion(int x0, int y0, int z0, int x1, int y1, int z1); + virtual bool mayInteract(std::shared_ptr player, int xt, int yt, int zt, int id); protected: virtual void initializeLevel(LevelSettings *settings); virtual void setInitialSpawn(LevelSettings *settings); @@ -90,16 +90,16 @@ public: private: void saveLevelData(); - typedef unordered_map , IntKeyHash2, IntKeyEq> intEntityMap; + typedef unordered_map , IntKeyHash2, IntKeyEq> intEntityMap; intEntityMap entitiesById; // 4J - was IntHashMap, using same hashing function as this uses protected: - virtual void entityAdded(shared_ptr e); - virtual void entityRemoved(shared_ptr e); + virtual void entityAdded(std::shared_ptr e); + virtual void entityRemoved(std::shared_ptr e); public: - shared_ptr getEntity(int id); - virtual bool addGlobalEntity(shared_ptr e); - void broadcastEntityEvent(shared_ptr e, byte event); - virtual shared_ptr explode(shared_ptr source, double x, double y, double z, float r, bool fire, bool destroyBlocks); + std::shared_ptr getEntity(int id); + virtual bool addGlobalEntity(std::shared_ptr e); + void broadcastEntityEvent(std::shared_ptr e, byte event); + virtual std::shared_ptr explode(std::shared_ptr source, double x, double y, double z, float r, bool fire, bool destroyBlocks); virtual void tileEvent(int x, int y, int z, int tile, int b0, int b1); private: @@ -134,14 +134,14 @@ public: int m_primedTntCount; int m_fallingTileCount; CRITICAL_SECTION m_limiterCS; - list< shared_ptr > m_itemEntities; - list< shared_ptr > m_hangingEntities; - list< shared_ptr > m_arrowEntities; - list< shared_ptr > m_experienceOrbEntities; - - virtual bool addEntity(shared_ptr e); - void entityAddedExtra(shared_ptr e); - void entityRemovedExtra(shared_ptr e); + list< std::shared_ptr > m_itemEntities; + list< std::shared_ptr > m_hangingEntities; + list< std::shared_ptr > m_arrowEntities; + list< std::shared_ptr > m_experienceOrbEntities; + + virtual bool addEntity(std::shared_ptr e); + void entityAddedExtra(std::shared_ptr e); + void entityRemovedExtra(std::shared_ptr e); virtual bool newPrimedTntAllowed(); virtual bool newFallingTileAllowed(); -- cgit v1.2.3