diff options
| author | ModoX <moardox@gmail.com> | 2023-04-10 04:04:33 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-10 04:04:33 +0200 |
| commit | 89e09dc44ed15567f77f862d1936e8e0d9019456 (patch) | |
| tree | f5664f4a2798acd965e8b589bd6ed7ff596ff780 /src/server/game/Scripting | |
| parent | 083b8d6c846cfdf75abb1fae481a3eeb25c13c56 (diff) | |
Core/AI: Drop script_waypoints and move data to waypoint_data (#28879)
Diffstat (limited to 'src/server/game/Scripting')
| -rw-r--r-- | src/server/game/Scripting/ScriptMgr.cpp | 1 | ||||
| -rw-r--r-- | src/server/game/Scripting/ScriptSystem.cpp | 65 | ||||
| -rw-r--r-- | src/server/game/Scripting/ScriptSystem.h | 4 |
3 files changed, 0 insertions, 70 deletions
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 74c7d0ed747..7a544bb9f41 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -1338,7 +1338,6 @@ void ScriptMgr::Unload() void ScriptMgr::LoadDatabase() { - sScriptSystemMgr->LoadScriptWaypoints(); sScriptSystemMgr->LoadScriptSplineChains(); } diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp index 78f3128c431..02769f1a9ab 100644 --- a/src/server/game/Scripting/ScriptSystem.cpp +++ b/src/server/game/Scripting/ScriptSystem.cpp @@ -32,62 +32,6 @@ SystemMgr* SystemMgr::instance() return &instance; } -void SystemMgr::LoadScriptWaypoints() -{ - uint32 oldMSTime = getMSTime(); - - // drop Existing Waypoint list - _waypointStore.clear(); - - uint64 entryCount = 0; - - // load Waypoints - QueryResult result = WorldDatabase.Query("SELECT COUNT(entry) FROM script_waypoint GROUP BY entry"); - if (result) - entryCount = result->GetRowCount(); - - TC_LOG_INFO("server.loading", "Loading Script Waypoints for {} creature(s)...", entryCount); - - // 0 1 2 3 4 5 - result = WorldDatabase.Query("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid"); - - if (!result) - { - TC_LOG_INFO("server.loading", ">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty."); - return; - } - uint32 count = 0; - - do - { - Field* fields = result->Fetch(); - uint32 entry = fields[0].GetUInt32(); - uint32 id = fields[1].GetUInt32(); - float x = fields[2].GetFloat(); - float y = fields[3].GetFloat(); - float z = fields[4].GetFloat(); - uint32 waitTime = fields[5].GetUInt32(); - - CreatureTemplate const* info = sObjectMgr->GetCreatureTemplate(entry); - if (!info) - { - TC_LOG_ERROR("sql.sql", "SystemMgr: DB table script_waypoint has waypoint for non-existant creature entry {}", entry); - continue; - } - - if (!info->ScriptID) - TC_LOG_ERROR("sql.sql", "SystemMgr: DB table script_waypoint has waypoint for creature entry {}, but creature does not have ScriptName defined and then useless.", entry); - - WaypointPath& path = _waypointStore[entry]; - path.id = entry; - path.nodes.emplace_back(id, x, y, z, std::nullopt, waitTime); - - ++count; - } while (result->NextRow()); - - TC_LOG_INFO("server.loading", ">> Loaded {} Script Waypoint nodes in {} ms", count, GetMSTimeDiffToNow(oldMSTime)); -} - void SystemMgr::LoadScriptSplineChains() { uint32 oldMSTime = getMSTime(); @@ -162,15 +106,6 @@ void SystemMgr::LoadScriptSplineChains() } } -WaypointPath const* SystemMgr::GetPath(uint32 creatureEntry) const -{ - auto itr = _waypointStore.find(creatureEntry); - if (itr == _waypointStore.end()) - return nullptr; - - return &itr->second; -} - std::vector<SplineChainLink> const* SystemMgr::GetSplineChain(uint32 entry, uint16 chainId) const { auto it = m_mSplineChainsMap.find({ entry, chainId }); diff --git a/src/server/game/Scripting/ScriptSystem.h b/src/server/game/Scripting/ScriptSystem.h index 0b717d6df6f..18bcd91e158 100644 --- a/src/server/game/Scripting/ScriptSystem.h +++ b/src/server/game/Scripting/ScriptSystem.h @@ -33,11 +33,8 @@ class TC_GAME_API SystemMgr static SystemMgr* instance(); // database - void LoadScriptWaypoints(); void LoadScriptSplineChains(); - WaypointPath const* GetPath(uint32 creatureEntry) const; - std::vector<SplineChainLink> const* GetSplineChain(uint32 entry, uint16 chainId) const; std::vector<SplineChainLink> const* GetSplineChain(Creature const* who, uint16 id) const; @@ -50,7 +47,6 @@ class TC_GAME_API SystemMgr SystemMgr(SystemMgr const&) = delete; SystemMgr& operator=(SystemMgr const&) = delete; - std::unordered_map<uint32, WaypointPath> _waypointStore; std::unordered_map<ChainKeyType, std::vector<SplineChainLink>> m_mSplineChainsMap; // spline chains }; |
