Fix: Changing NPF max search nodes while in-game had no effect (#12194)

This commit is contained in:
SamuXarick 2024-03-25 16:28:16 +00:00 committed by GitHub
parent 40a75e0b8d
commit f845b4bbc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

@ -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)