From 7fa9ab7d34a0fc396cfb1331a30de863a33ac8dc Mon Sep 17 00:00:00 2001 From: Keleborn <22352763+Celandriel@users.noreply.github.com> Date: Mon, 30 Mar 2026 11:55:33 -0700 Subject: [PATCH] Module update for CollisionChange (#2242) ## Pull Request Description Some code changes due to core update change from MMapFactory.h ->MapCollisionData.h ## Feature Evaluation - Describe the **minimum logic** required to achieve the intended behavior. - Describe the **processing cost** when this logic executes across many bots. ## How to Test the Changes ## Impact Assessment - Does this change increase per-bot/per-tick processing or risk scaling poorly with thousands of bots? - - [x] No, not at all - - [ ] Minimal impact (**explain below**) - - [ ] Moderate impact (**explain below**) - Does this change modify default bot behavior? - - [x] No - - [ ] Yes (**explain why**) - Does this change add new decision branches or increase maintenance complexity? - - [x] No - - [ ] Yes (**explain below**) ## Messages to Translate Does this change add bot messages to translate? - - [x] No - - [ ] Yes (**list messages in the table**) | Message key | Default message | | --------------- | ------------------ | | | | | | | ## AI Assistance Was AI assistance used while working on this change? - - [ ] No - - [X] Yes (**explain below**) Identifying problematic areas generated by the change ## Final Checklist - - [x] Stability is not compromised. - - [x] Performance impact is understood, tested, and acceptable. - - [x] Added logic complexity is justified and explained. - - [x] Documentation updated if needed (Conf comments, WiKi commands). ## Notes for Reviewers --- src/Ai/Base/Trigger/StuckTriggers.cpp | 5 ++-- src/Mgr/Travel/TravelMgr.cpp | 33 ++++++++++++++------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Ai/Base/Trigger/StuckTriggers.cpp b/src/Ai/Base/Trigger/StuckTriggers.cpp index b6ade75d8..0829a2394 100644 --- a/src/Ai/Base/Trigger/StuckTriggers.cpp +++ b/src/Ai/Base/Trigger/StuckTriggers.cpp @@ -8,7 +8,7 @@ #include "CellImpl.h" #include "PathGenerator.h" #include "Playerbots.h" -#include "MMapFactory.h" +#include "MapCollisionData.h" bool MoveStuckTrigger::IsActive() { @@ -89,8 +89,7 @@ bool MoveLongStuckTrigger::IsActive() return true; } - if (cell.GridX() > 0 && cell.GridY() > 0 && - !MMAP::MMapFactory::createOrGetMMapMgr()->loadMap(botPos.GetMapId(), cell.GridX(), cell.GridY())) + if (bot->GetMap()->IsGridCreated(GridCoord(cell.GridX(), cell.GridY()))) { // LOG_INFO("playerbots", "Bot {} {}:{} <{}> was in unloaded grid {},{} on map {}", // bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), diff --git a/src/Mgr/Travel/TravelMgr.cpp b/src/Mgr/Travel/TravelMgr.cpp index d6942deab..7a5ac4f2e 100644 --- a/src/Mgr/Travel/TravelMgr.cpp +++ b/src/Mgr/Travel/TravelMgr.cpp @@ -14,7 +14,7 @@ #include "TravelNode.h" #include "Talentspec.h" #include "ChatHelper.h" -#include "MMapFactory.h" +#include "MapCollisionData.h" #include "MapMgr.h" #include "PathGenerator.h" #include "Playerbots.h" @@ -687,10 +687,11 @@ std::vector WorldPosition::frommGridCoord(mGridCoord GridCoord) return retVec; } +// TODO: Cleanup — make this actually work. void WorldPosition::loadMapAndVMap(uint32 mapId, uint8 x, uint8 y) { std::string const fileName = "load_map_grid.csv"; - +/* if (isOverworld() && false || false) { if (!MMAP::MMapFactory::createOrGetMMapMgr()->loadMap(mapId, x, y)) @@ -745,22 +746,22 @@ void WorldPosition::loadMapAndVMap(uint32 mapId, uint8 x, uint8 y) sPlayerbotAIConfig.log(fileName, out.str().c_str()); } } +*/ + if (!TravelMgr::instance().isBadMmap(mapId, x, y)) + { + // load navmesh + Map* map = getMap(); + if (map && map->GetMapCollisionData().LoadMMapTile(x, y) == MMAP::MMAP_LOAD_RESULT_ERROR) + TravelMgr::instance().addBadMmap(mapId, x, y); - if (!TravelMgr::instance().isBadMmap(mapId, x, y)) + if (sPlayerbotAIConfig.hasLog(fileName)) { - // load navmesh - if (!MMAP::MMapFactory::createOrGetMMapMgr()->loadMap(mapId, x, y)) - TravelMgr::instance().addBadMmap(mapId, x, y); - - if (sPlayerbotAIConfig.hasLog(fileName)) - { - std::ostringstream out; - out << sPlayerbotAIConfig.GetTimestampStr(); - out << "+00,\"mmap\", " << x << "," << y << "," << (TravelMgr::instance().isBadMmap(mapId, x, y) ? "0" : "1") - << ","; - printWKT(fromGridCoord(GridCoord(x, y)), out, 1, true); - sPlayerbotAIConfig.log(fileName, out.str().c_str()); - } + std::ostringstream out; + out << sPlayerbotAIConfig.GetTimestampStr(); + out << "+00,\"mmap\", " << x << "," << y << "," << (TravelMgr::instance().isBadMmap(mapId, x, y) ? "0" : "1") + << ","; + printWKT(fromGridCoord(GridCoord(x, y)), out, 1, true); + sPlayerbotAIConfig.log(fileName, out.str().c_str()); } } }