diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-09-02 19:36:14 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-09-02 19:36:14 +0200 |
commit | 42dcd534df8b41ba24650c2ab6003303b5ae54ce (patch) | |
tree | 37b6dc369524037e20602e3d4c43fec10e875741 /src/Entities | |
parent | Added CustomName saving. (diff) | |
parent | Re-added alternate spellings of darkgraywool. (diff) | |
download | cuberite-42dcd534df8b41ba24650c2ab6003303b5ae54ce.tar cuberite-42dcd534df8b41ba24650c2ab6003303b5ae54ce.tar.gz cuberite-42dcd534df8b41ba24650c2ab6003303b5ae54ce.tar.bz2 cuberite-42dcd534df8b41ba24650c2ab6003303b5ae54ce.tar.lz cuberite-42dcd534df8b41ba24650c2ab6003303b5ae54ce.tar.xz cuberite-42dcd534df8b41ba24650c2ab6003303b5ae54ce.tar.zst cuberite-42dcd534df8b41ba24650c2ab6003303b5ae54ce.zip |
Diffstat (limited to 'src/Entities')
-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); |