Core/Scripting: Allow the use of WorldMapScript for maps that are not continents (aka, all maps)

Closes #171
Signed-off-by: Subv <s.v.h21@hotmail.com>
This commit is contained in:
Subv
2012-04-07 11:59:01 -05:00
parent ae0a6cde21
commit ba3f25c143
2 changed files with 9 additions and 8 deletions

View File

@@ -1292,6 +1292,7 @@ struct MapEntry
bool IsBattleground() const { return map_type == MAP_BATTLEGROUND; }
bool IsBattleArena() const { return map_type == MAP_ARENA; }
bool IsBattlegroundOrArena() const { return map_type == MAP_BATTLEGROUND || map_type == MAP_ARENA; }
bool IsWorldMap() const { return map_type == MAP_COMMON; }
bool GetEntrancePos(int32 &mapid, float &x, float &y) const
{

View File

@@ -582,7 +582,7 @@ void ScriptMgr::OnCreateMap(Map* map)
{
ASSERT(map);
SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsContinent);
SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsWorldMap);
itr->second->OnCreate(map);
SCR_MAP_END;
@@ -599,7 +599,7 @@ void ScriptMgr::OnDestroyMap(Map* map)
{
ASSERT(map);
SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsContinent);
SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsWorldMap);
itr->second->OnDestroy(map);
SCR_MAP_END;
@@ -617,7 +617,7 @@ void ScriptMgr::OnLoadGridMap(Map* map, GridMap* gmap, uint32 gx, uint32 gy)
ASSERT(map);
ASSERT(gmap);
SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsContinent);
SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsWorldMap);
itr->second->OnLoadGridMap(map, gmap, gx, gy);
SCR_MAP_END;
@@ -635,7 +635,7 @@ void ScriptMgr::OnUnloadGridMap(Map* map, GridMap* gmap, uint32 gx, uint32 gy)
ASSERT(map);
ASSERT(gmap);
SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsContinent);
SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsWorldMap);
itr->second->OnUnloadGridMap(map, gmap, gx, gy);
SCR_MAP_END;
@@ -653,7 +653,7 @@ void ScriptMgr::OnPlayerEnterMap(Map* map, Player* player)
ASSERT(map);
ASSERT(player);
SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsContinent);
SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsWorldMap);
itr->second->OnPlayerEnter(map, player);
SCR_MAP_END;
@@ -671,7 +671,7 @@ void ScriptMgr::OnPlayerLeaveMap(Map* map, Player* player)
ASSERT(map);
ASSERT(player);
SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsContinent);
SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsWorldMap);
itr->second->OnPlayerLeave(map, player);
SCR_MAP_END;
@@ -688,7 +688,7 @@ void ScriptMgr::OnMapUpdate(Map* map, uint32 diff)
{
ASSERT(map);
SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsContinent);
SCR_MAP_BGN(WorldMapScript, map, itr, end, entry, IsWorldMap);
itr->second->OnUpdate(map, diff);
SCR_MAP_END;
@@ -1415,7 +1415,7 @@ FormulaScript::FormulaScript(const char* name)
WorldMapScript::WorldMapScript(const char* name, uint32 mapId)
: ScriptObject(name), MapScript<Map>(mapId)
{
if (GetEntry() && !GetEntry()->IsContinent())
if (GetEntry() && !GetEntry()->IsWorldMap())
sLog->outError("WorldMapScript for map %u is invalid.", mapId);
ScriptRegistry<WorldMapScript>::AddScript(this);