Skip to content

Commit

Permalink
-Nodegen fix: Added map and x coordinate to the node sorting so nodes…
Browse files Browse the repository at this point in the history
… with the same names don't shift around as much in the database and the sql export.
  • Loading branch information
mostlikely4r committed Oct 23, 2024
1 parent 5356c9c commit 7edcdbf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions playerbot/TravelNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2987,7 +2987,7 @@ void TravelNodeMap::saveNodeStore(bool force)
std::unordered_map<TravelNode*, uint32> saveNodes;
std::vector<TravelNode*> 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();

Expand Down Expand Up @@ -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<TravelNode*, TravelNodePath*> i, std::pair<TravelNode*, TravelNodePath*> j) {return i.first->getName() < j.first->getName(); });
std::sort(links.begin(), links.end(), [](std::pair<TravelNode*, TravelNodePath*> i, std::pair<TravelNode*, TravelNodePath*> 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)
{
Expand Down

0 comments on commit 7edcdbf

Please sign in to comment.