aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2022-07-24 18:56:40 +0200
committerShauren <shauren.trinity@gmail.com>2022-07-24 18:56:40 +0200
commitfbe0b8efebca3bc2662b477bdf45627f9783d6c2 (patch)
tree6f5662045be0c4e5f06d8a97f9669b7f93cf2df1 /src/server/scripts
parent8f2c5413d7a3775a304c793653d41caabf3ba997 (diff)
Core/Maps: Removed MapInstanced - no longer neccessary for grid data reference counting (moved to TerrainInfo)
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Battlefield/BattlefieldTB.cpp1
-rw-r--r--src/server/scripts/Battlefield/BattlefieldWG.cpp1
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp18
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp1
-rw-r--r--src/server/scripts/Commands/cs_instance.cpp1
-rw-r--r--src/server/scripts/Commands/cs_list.cpp46
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp2
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp2
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp1
9 files changed, 31 insertions, 42 deletions
diff --git a/src/server/scripts/Battlefield/BattlefieldTB.cpp b/src/server/scripts/Battlefield/BattlefieldTB.cpp
index 93ed4da8131..c49d92eb6bc 100644
--- a/src/server/scripts/Battlefield/BattlefieldTB.cpp
+++ b/src/server/scripts/Battlefield/BattlefieldTB.cpp
@@ -29,7 +29,6 @@
#include "CreatureTextMgr.h"
#include "GameObject.h"
#include "GameTime.h"
-#include "MapManager.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "Random.h"
diff --git a/src/server/scripts/Battlefield/BattlefieldWG.cpp b/src/server/scripts/Battlefield/BattlefieldWG.cpp
index 895868b9cec..07400151e52 100644
--- a/src/server/scripts/Battlefield/BattlefieldWG.cpp
+++ b/src/server/scripts/Battlefield/BattlefieldWG.cpp
@@ -28,7 +28,6 @@
#include "GameObject.h"
#include "GameTime.h"
#include "Log.h"
-#include "MapManager.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "Random.h"
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index b3879bafd56..72e3ffc6838 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -37,6 +37,7 @@ EndScriptData */
#include "DB2Stores.h"
#include "GameTime.h"
#include "GridNotifiersImpl.h"
+#include "InstanceSaveMgr.h"
#include "InstanceScript.h"
#include "Language.h"
#include "Log.h"
@@ -1233,17 +1234,26 @@ public:
static bool HandleDebugLoadCellsCommand(ChatHandler* handler, Optional<uint32> mapId, Optional<uint32> tileX, Optional<uint32> tileY)
{
- Map* map = nullptr;
if (mapId)
{
- map = sMapMgr->FindBaseNonInstanceMap(*mapId);
+ sMapMgr->DoForAllMapsWithMapId(*mapId, [&](Map* map)
+ {
+ HandleDebugLoadCellsCommandHelper(handler, map, tileX, tileY);
+ });
+ return true;
}
- else if (Player* player = handler->GetPlayer())
+
+ if (Player* player = handler->GetPlayer())
{
// Fallback to player's map if no map has been specified
- map = player->GetMap();
+ return HandleDebugLoadCellsCommandHelper(handler, player->GetMap(), tileX, tileY);
}
+ return false;
+ }
+
+ static bool HandleDebugLoadCellsCommandHelper(ChatHandler* handler, Map* map, Optional<uint32> tileX, Optional<uint32> tileY)
+ {
if (!map)
return false;
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index e389f535569..027c72e1c23 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -33,6 +33,7 @@ EndScriptData */
#include "GameTime.h"
#include "Language.h"
#include "Log.h"
+#include "Map.h"
#include "MapManager.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
diff --git a/src/server/scripts/Commands/cs_instance.cpp b/src/server/scripts/Commands/cs_instance.cpp
index eb5173b1daf..a00853298c0 100644
--- a/src/server/scripts/Commands/cs_instance.cpp
+++ b/src/server/scripts/Commands/cs_instance.cpp
@@ -31,6 +31,7 @@ EndScriptData */
#include "InstanceSaveMgr.h"
#include "InstanceScript.h"
#include "Language.h"
+#include "Map.h"
#include "MapManager.h"
#include "Player.h"
#include "RBAC.h"
diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp
index 61668b98973..5ca3df7caca 100644
--- a/src/server/scripts/Commands/cs_list.cpp
+++ b/src/server/scripts/Commands/cs_list.cpp
@@ -32,7 +32,7 @@ EndScriptData */
#include "GameObject.h"
#include "GameTime.h"
#include "Language.h"
-#include "MapManager.h"
+#include "Map.h"
#include "ObjectMgr.h"
#include "PhasingHandler.h"
#include "Player.h"
@@ -120,28 +120,18 @@ public:
bool liveFound = false;
// Get map (only support base map from console)
- Map* thisMap;
+ Map* thisMap = nullptr;
if (handler->GetSession())
thisMap = handler->GetSession()->GetPlayer()->GetMap();
- else
- thisMap = sMapMgr->FindBaseNonInstanceMap(mapId);
// If map found, try to find active version of this creature
if (thisMap)
{
- auto const creBounds = thisMap->GetCreatureBySpawnIdStore().equal_range(guid);
- if (creBounds.first != creBounds.second)
- {
- for (std::unordered_multimap<ObjectGuid::LowType, Creature*>::const_iterator itr = creBounds.first; itr != creBounds.second;)
- {
- if (handler->GetSession())
- handler->PSendSysMessage(LANG_CREATURE_LIST_CHAT, std::to_string(guid).c_str(), std::to_string(guid).c_str(), cInfo->Name.c_str(), x, y, z, mapId, itr->second->GetGUID().ToString().c_str(), itr->second->IsAlive() ? "*" : " ");
- else
- handler->PSendSysMessage(LANG_CREATURE_LIST_CONSOLE, std::to_string(guid).c_str(), cInfo->Name.c_str(), x, y, z, mapId, itr->second->GetGUID().ToString().c_str(), itr->second->IsAlive() ? "*" : " ");
- ++itr;
- }
- liveFound = true;
- }
+ auto const creBounds = Trinity::Containers::MapEqualRange(thisMap->GetCreatureBySpawnIdStore(), guid);
+ for (auto& [spawnId, creature] : creBounds)
+ handler->PSendSysMessage(LANG_CREATURE_LIST_CHAT, std::to_string(guid).c_str(), std::to_string(guid).c_str(), cInfo->Name.c_str(),
+ x, y, z, mapId, creature->GetGUID().ToString().c_str(), creature->IsAlive() ? "*" : " ");
+ liveFound = creBounds.begin() != creBounds.end();
}
if (!liveFound)
@@ -401,28 +391,18 @@ public:
bool liveFound = false;
// Get map (only support base map from console)
- Map* thisMap;
+ Map* thisMap = nullptr;
if (handler->GetSession())
thisMap = handler->GetSession()->GetPlayer()->GetMap();
- else
- thisMap = sMapMgr->FindBaseNonInstanceMap(mapId);
// If map found, try to find active version of this object
if (thisMap)
{
- auto const goBounds = thisMap->GetGameObjectBySpawnIdStore().equal_range(guid);
- if (goBounds.first != goBounds.second)
- {
- for (std::unordered_multimap<ObjectGuid::LowType, GameObject*>::const_iterator itr = goBounds.first; itr != goBounds.second;)
- {
- if (handler->GetSession())
- handler->PSendSysMessage(LANG_GO_LIST_CHAT, std::to_string(guid).c_str(), entry, std::to_string(guid).c_str(), gInfo->name.c_str(), x, y, z, mapId, itr->second->GetGUID().ToString().c_str(), itr->second->isSpawned() ? "*" : " ");
- else
- handler->PSendSysMessage(LANG_GO_LIST_CONSOLE, std::to_string(guid).c_str(), gInfo->name.c_str(), x, y, z, mapId, itr->second->GetGUID().ToString().c_str(), itr->second->isSpawned() ? "*" : " ");
- ++itr;
- }
- liveFound = true;
- }
+ auto const goBounds = Trinity::Containers::MapEqualRange(thisMap->GetGameObjectBySpawnIdStore(), guid);
+ for (auto& [spawnId, go] : goBounds)
+ handler->PSendSysMessage(LANG_GO_LIST_CHAT, std::to_string(guid).c_str(), entry, std::to_string(guid).c_str(), gInfo->name.c_str(), x, y, z, mapId,
+ go->GetGUID().ToString().c_str(), go->isSpawned() ? "*" : " ");
+ liveFound = goBounds.begin() != goBounds.end();
}
if (!liveFound)
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
index 763fa92044f..850f9fd886a 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
@@ -20,7 +20,7 @@
#include "GameObject.h"
#include "GameObjectAI.h"
#include "InstanceScript.h"
-#include "MapManager.h"
+#include "Map.h"
#include "MotionMaster.h"
#include "MoveSplineInit.h"
#include "PassiveAI.h"
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
index 1cca54645c5..1a880c0748e 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
@@ -17,7 +17,7 @@
#include "OutdoorPvPHP.h"
#include "GameObject.h"
-#include "MapManager.h"
+#include "Map.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "WorldStatePackets.h"
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
index 6534c86bfeb..20345358fe5 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
@@ -19,7 +19,6 @@
#include "Creature.h"
#include "GameObject.h"
#include "GossipDef.h"
-#include "MapManager.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"