All pastes #896605 Raw Edit

Miscellany

public diff v1 · immutable
·published 2008-02-08 20:11 UTC
rendered paste body
Index: src/game/Player.cpp===================================================================--- src/game/Player.cpp	(revision 5176)+++ src/game/Player.cpp	(working copy)@@ -116,6 +116,9 @@     m_zoneUpdateId = 0;     m_zoneUpdateTimer = 0; +    m_areaUpdateId = 0;+    m_areaUpdateTimer = 0;+     m_dismountCost = 0;      m_nextSave = sWorld.getConfig(CONFIG_INTERVAL_SAVE);@@ -949,6 +952,22 @@             m_zoneUpdateTimer -= p_time;     } +    // use area updates as well+    // needed for free far all arenas for example+    if (m_areaUpdateTimer > 0)+    {+        if(p_time >= m_areaUpdateTimer)+        {+            uint32 newarea = GetAreaId();+            if( m_areaUpdateId != newarea )+                UpdateArea(newarea);+            else+                m_areaUpdateTimer = ZONE_UPDATE_INTERVAL;+        }+        else+            m_areaUpdateTimer -= p_time;+    }+     if (isAlive())     {         RegenerateAll();@@ -5675,8 +5694,32 @@     return zone; } +void Player::UpdateArea(uint32 newArea)+{+    // FFA_PVP flags are area and not zone id dependent+    // so apply them accordingly+    m_areaUpdateId    = newArea;+    m_areaUpdateTimer = ZONE_UPDATE_INTERVAL;++    AreaTableEntry const* area = GetAreaEntryByAreaID(newArea);++    if(area && (area->flags & 0x80))+    {+        SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_FFA_PVP);+    }+    else+    {+        // remove ffa flag only if not ffapvp realm+        // removal in sanctuaries and capitals is handled in zone update+        if(HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_FFA_PVP) && !sWorld.IsFFAPvPRealm())+            RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_FFA_PVP);+    }+}+ void Player::UpdateZone(uint32 newZone) {+    // zone changed, so area changed as well, update it+    UpdateArea(GetAreaId());     m_zoneUpdateId    = newZone;     m_zoneUpdateTimer = ZONE_UPDATE_INTERVAL; Index: src/game/Player.h===================================================================--- src/game/Player.h	(revision 5176)+++ src/game/Player.h	(working copy)@@ -1376,6 +1376,7 @@         PvPInfo pvpInfo;         void UpdatePvP(bool state, bool ovrride=false);         void UpdateZone(uint32 newZone);+        void UpdateArea(uint32 newArea);         void UpdatePvPFlag(time_t currTime);          /** todo: -maybe move UpdateDuelFlag+DuelComplete to independent DuelHandler.. **/@@ -2013,6 +2014,9 @@         uint32 m_zoneUpdateId;         uint32 m_zoneUpdateTimer; +        uint32 m_areaUpdateId;+        uint32 m_areaUpdateTimer;+         uint32 m_deathTimer;         time_t m_resurrectingSicknessExpire;