[10914] Remove ObjectLevelLockable inheritance in Map class + cleanup locks in Map code. Restore build after recent commits.

Signed-off-by: Ambal <pogrebniak@gala.net>
This commit is contained in:
Ambal 2010-12-24 01:22:04 +02:00
parent 8f37314950
commit f56e13966f
4 changed files with 124 additions and 133 deletions

View file

@ -31,7 +31,6 @@
#include "ObjectMgr.h" #include "ObjectMgr.h"
#include "World.h" #include "World.h"
#include "ScriptCalls.h" #include "ScriptCalls.h"
#include "ScriptMgr.h"
#include "Group.h" #include "Group.h"
#include "MapRefManager.h" #include "MapRefManager.h"
#include "DBCEnums.h" #include "DBCEnums.h"
@ -39,14 +38,6 @@
#include "VMapFactory.h" #include "VMapFactory.h"
#include "BattleGroundMgr.h" #include "BattleGroundMgr.h"
struct ScriptAction
{
ObjectGuid sourceGuid;
ObjectGuid targetGuid;
ObjectGuid ownerGuid; // owner of source if source is item
ScriptInfo const* script; // pointer to static script data
};
Map::~Map() Map::~Map()
{ {
ObjectAccessor::DelinkMap(this); ObjectAccessor::DelinkMap(this);
@ -225,9 +216,6 @@ void Map::AddNotifier(Creature* obj, Cell const&, CellPair const&)
void void
Map::EnsureGridCreated(const GridPair &p) Map::EnsureGridCreated(const GridPair &p)
{ {
if(!getNGrid(p.x_coord, p.y_coord))
{
Guard guard(*this);
if(!getNGrid(p.x_coord, p.y_coord)) if(!getNGrid(p.x_coord, p.y_coord))
{ {
setNGrid(new NGridType(p.x_coord*MAX_NUMBER_OF_GRIDS + p.y_coord, p.x_coord, p.y_coord, i_gridExpiry, sWorld.getConfig(CONFIG_BOOL_GRID_UNLOAD)), setNGrid(new NGridType(p.x_coord*MAX_NUMBER_OF_GRIDS + p.y_coord, p.x_coord, p.y_coord, i_gridExpiry, sWorld.getConfig(CONFIG_BOOL_GRID_UNLOAD)),
@ -246,7 +234,6 @@ Map::EnsureGridCreated(const GridPair &p)
LoadMapAndVMap(gx,gy); LoadMapAndVMap(gx,gy);
} }
} }
}
void void
Map::EnsureGridLoadedAtEnter(const Cell &cell, Player *player) Map::EnsureGridLoadedAtEnter(const Cell &cell, Player *player)
@ -1319,8 +1306,6 @@ bool InstanceMap::Add(Player *player)
// GMs still can teleport player in instance. // GMs still can teleport player in instance.
// Is it needed? // Is it needed?
{
Guard guard(*this);
if (!CanEnter(player)) if (!CanEnter(player))
return false; return false;
@ -1429,7 +1414,6 @@ bool InstanceMap::Add(Player *player)
m_unloadTimer = 0; m_unloadTimer = 0;
m_resetAfterUnload = false; m_resetAfterUnload = false;
m_unloadWhenEmpty = false; m_unloadWhenEmpty = false;
}
// this will acquire the same mutex so it cannot be in the previous block // this will acquire the same mutex so it cannot be in the previous block
Map::Add(player); Map::Add(player);
@ -1649,13 +1633,12 @@ bool BattleGroundMap::CanEnter(Player * player)
bool BattleGroundMap::Add(Player * player) bool BattleGroundMap::Add(Player * player)
{ {
{
Guard guard(*this);
if(!CanEnter(player)) if(!CanEnter(player))
return false; return false;
// reset instance validity, battleground maps do not homebind // reset instance validity, battleground maps do not homebind
player->m_InstanceValid = true; player->m_InstanceValid = true;
}
return Map::Add(player); return Map::Add(player);
} }

View file

@ -35,6 +35,7 @@
#include "GameSystem/GridRefManager.h" #include "GameSystem/GridRefManager.h"
#include "MapRefManager.h" #include "MapRefManager.h"
#include "Utilities/TypeList.h" #include "Utilities/TypeList.h"
#include "ScriptMgr.h"
#include <bitset> #include <bitset>
#include <list> #include <list>
@ -46,7 +47,6 @@ class InstanceData;
class Group; class Group;
class InstanceSave; class InstanceSave;
struct ScriptInfo; struct ScriptInfo;
struct ScriptAction;
class BattleGround; class BattleGround;
class GridMap; class GridMap;
@ -80,7 +80,7 @@ enum LevelRequirementVsMode
#define MIN_UNLOAD_DELAY 1 // immediate unload #define MIN_UNLOAD_DELAY 1 // immediate unload
class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::ObjectLevelLockable<Map, ACE_Thread_Mutex> class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>
{ {
friend class MapReference; friend class MapReference;
friend class ObjectGridLoader; friend class ObjectGridLoader;
@ -276,7 +276,6 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
void SendObjectUpdates(); void SendObjectUpdates();
std::set<Object *> i_objectsToClientUpdate; std::set<Object *> i_objectsToClientUpdate;
protected: protected:
typedef MaNGOS::ObjectLevelLockable<Map, ACE_Thread_Mutex>::Lock Guard;
MapEntry const* i_mapEntry; MapEntry const* i_mapEntry;
uint8 i_spawnMode; uint8 i_spawnMode;

View file

@ -21,6 +21,7 @@
#include "Common.h" #include "Common.h"
#include "Policies/Singleton.h" #include "Policies/Singleton.h"
#include "ObjectGuid.h"
enum eScriptCommand enum eScriptCommand
{ {
@ -269,6 +270,14 @@ struct ScriptInfo
} }
}; };
struct ScriptAction
{
ObjectGuid sourceGuid;
ObjectGuid targetGuid;
ObjectGuid ownerGuid; // owner of source if source is item
ScriptInfo const* script; // pointer to static script data
};
typedef std::multimap<uint32, ScriptInfo> ScriptMap; typedef std::multimap<uint32, ScriptInfo> ScriptMap;
typedef std::map<uint32, ScriptMap > ScriptMapMap; typedef std::map<uint32, ScriptMap > ScriptMapMap;
extern ScriptMapMap sQuestEndScripts; extern ScriptMapMap sQuestEndScripts;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10913" #define REVISION_NR "10914"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__