From 7edcdbfbbe0e1afbeee754369b56d084e45157e0 Mon Sep 17 00:00:00 2001 From: mostlikely4r Date: Wed, 23 Oct 2024 22:30:12 +0200 Subject: [PATCH] -Nodegen fix: Added map and x coordinate to the node sorting so nodes with the same names don't shift around as much in the database and the sql export. --- playerbot/TravelNode.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/playerbot/TravelNode.cpp b/playerbot/TravelNode.cpp index ae9875f9..b1779716 100644 --- a/playerbot/TravelNode.cpp +++ b/playerbot/TravelNode.cpp @@ -2987,7 +2987,7 @@ void TravelNodeMap::saveNodeStore(bool force) std::unordered_map saveNodes; std::vector anodes = sTravelNodeMap.getNodes(); - std::sort(anodes.begin(), anodes.end(), [](TravelNode* i, TravelNode* j) {return i->getName() < j->getName(); }); + std::sort(anodes.begin(), anodes.end(), [](TravelNode* i, TravelNode* j) {return i->getName() + std::to_string(i->getMapId()) + std::to_string(i->getX()) < j->getName() + std::to_string(j->getMapId()) + std::to_string(j->getX()); }); WorldDatabase.BeginTransaction(); @@ -3026,7 +3026,7 @@ void TravelNodeMap::saveNodeStore(bool force) for (auto& link : *node->getLinks()) links.push_back(std::make_pair(link.first, link.second)); - std::sort(links.begin(), links.end(), [](std::pair i, std::pair j) {return i.first->getName() < j.first->getName(); }); + std::sort(links.begin(), links.end(), [](std::pair i, std::pair j) {return i.first->getName() + std::to_string(i.first->getMapId()) + std::to_string(i.first->getX()) < j.first->getName() + std::to_string(j.first->getMapId()) + std::to_string(j.first->getX()); }); for (auto& link : links) {