All pastes #955403 Raw Edit

World State core patch by Seline

public cpp v1 · immutable
#955403 ·published 2008-03-24 16:30 UTC
rendered paste body
Index: src/game/Map.cpp===================================================================--- src/game/Map.cpp	(revision 5483)+++ src/game/Map.cpp	(working copy)@@ -625,6 +625,8 @@      player->AddToWorld(); +    player->SendUpdateWorldState(state_field, state_value);+     SendInitSelf(player);     SendInitTransports(player); @@ -740,6 +742,14 @@         i_data->Update(t_diff); } +void Map::UpdateWorldState(uint32 field, uint32 value)+{+    state_field = field;+    state_value = value;+    for(PlayerList::const_iterator itr = i_Players.begin(); itr != i_Players.end(); ++itr)+        (*itr)->SendUpdateWorldState(field, value);+}+ void Map::Remove(Player *player, bool remove) {     if (Instanceable())@@ -1453,6 +1463,15 @@     transData.BuildPacket(&packet);     player->GetSession()->SendPacket(&packet); }+inline void Map::setNGrid(NGridType *grid, uint32 x, uint32 y)+{+    if(x >= MAX_NUMBER_OF_GRIDS || y >= MAX_NUMBER_OF_GRIDS)+    {+        sLog.outError("map::setNGrid() Invalid grid coordinates found: %d, %d!",x,y);+        assert(false);+    }+    i_grids[x][y] = grid;+}  uint32 Map::GetPlayersCountExceptGMs() const {Index: src/game/Map.h===================================================================--- src/game/Map.h	(revision 5483)+++ src/game/Map.h	(working copy)@@ -114,7 +114,7 @@ #define MAX_HEIGHT            100000.0f                     // can be use for find ground height at surface #define INVALID_HEIGHT       -100000.0f                     // for check, must be equal to VMAP_INVALID_HEIGHT, real value for unknown height is VMAP_INVALID_HEIGHT_VALUE -class MANGOS_DLL_DECL Map : public GridRefManager<NGridType>, public MaNGOS::ObjectLevelLockable<Map, ZThread::Mutex>+class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::ObjectLevelLockable<Map, ZThread::Mutex> {     public:         typedef std::list<Player*> PlayerList;@@ -131,6 +131,10 @@          virtual void Update(const uint32&); +        void UpdateWorldState(uint32 field, uint32 value);++        std::list<Player*> GetPlayers() { return i_Players;};+         void MessageBroadcast(Player *, WorldPacket *, bool to_self, bool own_team_only = false);          void MessageBroadcast(WorldObject *, WorldPacket *);@@ -266,15 +270,7 @@         bool isGridObjectDataLoaded(uint32 x, uint32 y) const { return getNGrid(x,y)->isGridObjectDataLoaded(); }         void setGridObjectDataLoaded(bool pLoaded, uint32 x, uint32 y) { getNGrid(x,y)->setGridObjectDataLoaded(pLoaded); } -        inline void setNGrid(NGridType* grid, uint32 x, uint32 y)-        {-            if(x >= MAX_NUMBER_OF_GRIDS || y >= MAX_NUMBER_OF_GRIDS)-            {-                sLog.outError("map::setNGrid() Invalid grid coordinates found: %d, %d!",x,y);-                assert(false);-            }-            i_grids[x][y] = grid;-        }+        inline void setNGrid(NGridType* grid, uint32 x, uint32 y);     protected:         typedef MaNGOS::ObjectLevelLockable<Map, ZThread::Mutex>::Lock Guard; @@ -289,6 +285,9 @@          time_t i_gridExpiry; +        uint32 state_field;+        uint32 state_value;+         MapEntry const* i_mapEntry;         time_t i_resetTime;         uint32 i_resetDelayTime;