From af644538c3583c61171c1be3e521bad0ffd15eae Mon Sep 17 00:00:00 2001 From: mostlikely4r Date: Tue, 22 Oct 2024 15:39:57 +0200 Subject: [PATCH] -Nodegen improvement: Sorted the saving of travelnodes and paths by node name. Hopefully making future node sql difs less cluttered. --- playerbot/TravelNode.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/playerbot/TravelNode.cpp b/playerbot/TravelNode.cpp index 11ed9351..2bccfe0a 100644 --- a/playerbot/TravelNode.cpp +++ b/playerbot/TravelNode.cpp @@ -2950,6 +2950,8 @@ 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(); }); + WorldDatabase.BeginTransaction(); BarGoLink bar(anodes.size()); @@ -2982,7 +2984,14 @@ void TravelNodeMap::saveNodeStore(bool force) { TravelNode* node = anodes[i]; + std::vector> links; + 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(); }); + + for (auto& link : links) { TravelNodePath* path = link.second;