From 55231bb8d3e1a4e2752ac3d444c4287eb0ca4e8b Mon Sep 17 00:00:00 2001 From: void_17 <61356189+void2012@users.noreply.github.com> Date: Fri, 6 Mar 2026 02:11:18 +0700 Subject: Remove AUTO_VAR macro and _toString function (#592) --- Minecraft.World/ChestTileEntity.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'Minecraft.World/ChestTileEntity.cpp') diff --git a/Minecraft.World/ChestTileEntity.cpp b/Minecraft.World/ChestTileEntity.cpp index fded7d28..b8f323f4 100644 --- a/Minecraft.World/ChestTileEntity.cpp +++ b/Minecraft.World/ChestTileEntity.cpp @@ -271,23 +271,26 @@ void ChestTileEntity::tick() float range = 5; vector > *players = level->getEntitiesOfClass(typeid(Player), AABB::newTemp(x - range, y - range, z - range, x + 1 + range, y + 1 + range, z + 1 + range)); - for (AUTO_VAR(it,players->begin()); it != players->end(); ++it) + if ( players ) { - shared_ptr player = dynamic_pointer_cast(*it); - - ContainerMenu *containerMenu = dynamic_cast(player->containerMenu); - if (containerMenu != NULL) + for (auto& it : *players) { - shared_ptr container = containerMenu->getContainer(); - shared_ptr thisContainer = dynamic_pointer_cast(shared_from_this()); - shared_ptr compoundContainer = dynamic_pointer_cast( container ); - if ( (container == thisContainer) || (compoundContainer != NULL && compoundContainer->contains(thisContainer)) ) + shared_ptr player = dynamic_pointer_cast(it); + + ContainerMenu* containerMenu = dynamic_cast(player->containerMenu); + if (containerMenu) { - openCount++; + shared_ptr container = containerMenu->getContainer(); + shared_ptr thisContainer = dynamic_pointer_cast(shared_from_this()); + shared_ptr compoundContainer = dynamic_pointer_cast(container); + if ((container == thisContainer) || (compoundContainer != NULL && compoundContainer->contains(thisContainer))) + { + openCount++; + } } } + delete players; } - delete players; } oOpenness = openness; -- cgit v1.2.3