Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #10452: Limit river generation max_search_nodes #11544

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/pathfinder/npf/aystar.cpp
Expand Up @@ -301,4 +301,7 @@ void AyStar::Init(Hash_HashProc hash, uint num_buckets)
* When that one gets full it reserves another one, till this number
* That is why it can stay this high */
this->openlist_queue.Init(102400);

/* Set a reasonable default limit */
this->max_search_nodes = AYSTAR_DEF_MAX_SEARCH_NODES;
}
2 changes: 2 additions & 0 deletions src/pathfinder/npf/aystar.h
Expand Up @@ -20,6 +20,8 @@
#include "../../tile_type.h"
#include "../../track_type.h"

static const int AYSTAR_DEF_MAX_SEARCH_NODES = 10000; ///< Reference limit for #AyStar::max_search_nodes

/** Return status of #AyStar methods. */
enum AystarStatus {
AYSTAR_FOUND_END_NODE, ///< An end node was found.
Expand Down
1 change: 1 addition & 0 deletions src/pathfinder/pathfinder_type.h
Expand Up @@ -11,6 +11,7 @@
#define PATHFINDER_TYPE_H

#include "../tile_type.h"
#include "npf/aystar.h"

/** Length (penalty) of one tile with NPF */
static const int NPF_TILE_LENGTH = 100;
Expand Down
4 changes: 2 additions & 2 deletions src/table/settings/pathfinding_settings.ini
Expand Up @@ -168,7 +168,7 @@ cat = SC_EXPERT
[SDT_VAR]
var = pf.npf.npf_max_search_nodes
type = SLE_UINT
def = 10000
def = AYSTAR_DEF_MAX_SEARCH_NODES
min = 500
max = 100000
cat = SC_EXPERT
Expand Down Expand Up @@ -325,7 +325,7 @@ cat = SC_EXPERT
var = pf.yapf.max_search_nodes
type = SLE_UINT
from = SLV_28
def = 10000
def = AYSTAR_DEF_MAX_SEARCH_NODES
min = 500
max = 1000000
cat = SC_EXPERT
Expand Down