From cb91b8c5259cc24df0373454e57611058c75e2f0 Mon Sep 17 00:00:00 2001 From: SamuXarick <43006711+SamuXarick@users.noreply.github.com> Date: Thu, 29 Feb 2024 14:25:57 +0000 Subject: [PATCH] Fix: Changing NPF max search nodes while in-game had no effect --- src/pathfinder/npf/npf.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp index 33d5927991..5ac43cd8c9 100644 --- a/src/pathfinder/npf/npf.cpp +++ b/src/pathfinder/npf/npf.cpp @@ -1040,6 +1040,10 @@ static NPFFoundTargetData NPFRouteInternal(AyStarNode *start1, bool ignore_start /* Initialize user_data */ _npf_aystar.user_data = user; + /* We will limit the number of nodes for now, until we have a better + * solution to really fix performance */ + _npf_aystar.max_search_nodes = _settings_game.pf.npf.npf_max_search_nodes; + /* GO! */ [[maybe_unused]] int r = _npf_aystar.Main(); assert(r != AYSTAR_STILL_BUSY); @@ -1113,9 +1117,6 @@ void InitializeNPF() } _npf_aystar.loops_per_tick = 0; _npf_aystar.max_path_cost = 0; - /* We will limit the number of nodes for now, until we have a better - * solution to really fix performance */ - _npf_aystar.max_search_nodes = _settings_game.pf.npf.npf_max_search_nodes; } static void NPFFillWithOrderData(NPFFindStationOrTileData *fstd, const Vehicle *v, bool reserve_path = false)