mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
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:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user