aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/ChestTileEntity.cpp
diff options
context:
space:
mode:
authorvoid_17 <61356189+void2012@users.noreply.github.com>2026-03-06 02:11:18 +0700
committerGitHub <noreply@github.com>2026-03-06 02:11:18 +0700
commit55231bb8d3e1a4e2752ac3d444c4287eb0ca4e8b (patch)
tree953c537a5c66e328e9f4ab29626cf738112d53c0 /Minecraft.World/ChestTileEntity.cpp
parent7d6658fe5b3095f35093701b5ab669ffc291e875 (diff)
Remove AUTO_VAR macro and _toString function (#592)
Diffstat (limited to 'Minecraft.World/ChestTileEntity.cpp')
-rw-r--r--Minecraft.World/ChestTileEntity.cpp25
1 files changed, 14 insertions, 11 deletions
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<shared_ptr<Entity> > *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> player = dynamic_pointer_cast<Player>(*it);
-
- ContainerMenu *containerMenu = dynamic_cast<ContainerMenu*>(player->containerMenu);
- if (containerMenu != NULL)
+ for (auto& it : *players)
{
- shared_ptr<Container> container = containerMenu->getContainer();
- shared_ptr<Container> thisContainer = dynamic_pointer_cast<Container>(shared_from_this());
- shared_ptr<CompoundContainer> compoundContainer = dynamic_pointer_cast<CompoundContainer>( container );
- if ( (container == thisContainer) || (compoundContainer != NULL && compoundContainer->contains(thisContainer)) )
+ shared_ptr<Player> player = dynamic_pointer_cast<Player>(it);
+
+ ContainerMenu* containerMenu = dynamic_cast<ContainerMenu*>(player->containerMenu);
+ if (containerMenu)
{
- openCount++;
+ shared_ptr<Container> container = containerMenu->getContainer();
+ shared_ptr<Container> thisContainer = dynamic_pointer_cast<Container>(shared_from_this());
+ shared_ptr<CompoundContainer> compoundContainer = dynamic_pointer_cast<CompoundContainer>(container);
+ if ((container == thisContainer) || (compoundContainer != NULL && compoundContainer->contains(thisContainer)))
+ {
+ openCount++;
+ }
}
}
+ delete players;
}
- delete players;
}
oOpenness = openness;