diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-09-02 20:03:42 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-09-02 20:03:42 +0200 |
commit | d3b8100a7b84a465ca52238d459bb10d32940c46 (patch) | |
tree | 2c272ec985b9228ef2e4892aeeabefa54786d215 /src/Entities/Pickup.cpp | |
parent | Removed SexyMotd link (diff) | |
parent | Re-added alternate spellings of darkgraywool. (diff) | |
download | cuberite-d3b8100a7b84a465ca52238d459bb10d32940c46.tar cuberite-d3b8100a7b84a465ca52238d459bb10d32940c46.tar.gz cuberite-d3b8100a7b84a465ca52238d459bb10d32940c46.tar.bz2 cuberite-d3b8100a7b84a465ca52238d459bb10d32940c46.tar.lz cuberite-d3b8100a7b84a465ca52238d459bb10d32940c46.tar.xz cuberite-d3b8100a7b84a465ca52238d459bb10d32940c46.tar.zst cuberite-d3b8100a7b84a465ca52238d459bb10d32940c46.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Pickup.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Entities/Pickup.cpp b/src/Entities/Pickup.cpp index aab534f41..87b5bed07 100644 --- a/src/Entities/Pickup.cpp +++ b/src/Entities/Pickup.cpp @@ -150,10 +150,14 @@ void cPickup::Tick(float a_Dt, cChunk & a_Chunk) } } - if (!IsDestroyed() && (m_Item.m_ItemCount < m_Item.GetMaxStackSize())) // Don't combine into an already full pickup + // Try to combine the pickup with adjacent same-item pickups: + if (!IsDestroyed() && (m_Item.m_ItemCount < m_Item.GetMaxStackSize())) // Don't combine if already full { + // By using a_Chunk's ForEachEntity() instead of cWorld's, pickups don't combine across chunk boundaries. + // That is a small price to pay for not having to traverse the entire world for each entity. + // The speedup in the tick thread is quite considerable. cPickupCombiningCallback PickupCombiningCallback(GetPosition(), this); - m_World->ForEachEntity(PickupCombiningCallback); // Not ForEachEntityInChunk, otherwise pickups don't combine across chunk boundaries + a_Chunk.ForEachEntity(PickupCombiningCallback); if (PickupCombiningCallback.FoundMatchingPickup()) { m_World->BroadcastEntityMetadata(*this); |