Skip to content

Commit

Permalink
-Nodegen improvement: Sorted the saving of travelnodes and paths by n…
Browse files Browse the repository at this point in the history
…ode name. Hopefully making future node sql difs less cluttered.
  • Loading branch information
mostlikely4r committed Oct 22, 2024
1 parent 517eda0 commit af64453
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions playerbot/TravelNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2950,6 +2950,8 @@ 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(); });

WorldDatabase.BeginTransaction();

BarGoLink bar(anodes.size());
Expand Down Expand Up @@ -2982,7 +2984,14 @@ void TravelNodeMap::saveNodeStore(bool force)
{
TravelNode* node = anodes[i];

std::vector<std::pair<TravelNode*, TravelNodePath*>> links;

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(); });

for (auto& link : links)
{
TravelNodePath* path = link.second;

Expand Down

0 comments on commit af64453

Please sign in to comment.