From 33f66b090665c981a5032cb09bcf82b4acb2d0a1 Mon Sep 17 00:00:00 2001 From: TracentEden <92269743+TracentEden@users.noreply.github.com> Date: Fri, 31 May 2024 02:42:00 +0300 Subject: [PATCH] Clear zone wide pool when last player leaves zone --- src/map/zone.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/map/zone.cpp b/src/map/zone.cpp index 3184b0b2b1e..a4d9caaf0c6 100644 --- a/src/map/zone.cpp +++ b/src/map/zone.cpp @@ -1174,6 +1174,14 @@ void CZone::CharZoneOut(CCharEntity* PChar) PChar->PTreasurePool->DelMember(PChar); } + // If zone-wide treasure pool but no players in zone then destroy current pool and create new pool + // this prevents loot from staying in zone pool after the last player leaves the zone + if (m_TreasurePool && m_TreasurePool->GetPoolType() == TREASUREPOOL_ZONE && m_zoneEntities->CharListEmpty()) + { + destroy(m_TreasurePool); + m_TreasurePool = new CTreasurePool(TREASUREPOOL_ZONE); + } + PChar->ClearTrusts(); // trusts don't survive zone lines if (PChar->isDead())