summaryrefslogtreecommitdiff
path: root/src/pathfinder/npf
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-10-02 09:55:58 +0000
committeralberth <alberth@openttd.org>2010-10-02 09:55:58 +0000
commit92f0bdec2cb46b8defa6a82a9ff608ce7a2d1392 (patch)
treee4f8e3611bda7316f0ff9fa4940defdc48a2abdb /src/pathfinder/npf
parent776d541a89df8ab59d7b3412f0a0372331d7071e (diff)
downloadopenttd-92f0bdec2cb46b8defa6a82a9ff608ce7a2d1392.tar.xz
(svn r20866) -Codechange: CheckTile() always returns the same (ignored) value.
Diffstat (limited to 'src/pathfinder/npf')
-rw-r--r--src/pathfinder/npf/aystar.cpp14
-rw-r--r--src/pathfinder/npf/aystar.h2
2 files changed, 6 insertions, 10 deletions
diff --git a/src/pathfinder/npf/aystar.cpp b/src/pathfinder/npf/aystar.cpp
index 44cc49fea..956f81a83 100644
--- a/src/pathfinder/npf/aystar.cpp
+++ b/src/pathfinder/npf/aystar.cpp
@@ -84,28 +84,26 @@ static void AyStarMain_OpenList_Add(AyStar *aystar, PathNode *parent, const AySt
/*
* Checks one tile and calculate his f-value
- * return values:
- * AYSTAR_DONE : indicates we are done
*/
-int AyStar::CheckTile(AyStarNode *current, OpenListNode *parent)
+void AyStar::CheckTile(AyStarNode *current, OpenListNode *parent)
{
int new_f, new_g, new_h;
PathNode *closedlist_parent;
OpenListNode *check;
/* Check the new node against the ClosedList */
- if (AyStarMain_ClosedList_IsInList(this, current) != NULL) return AYSTAR_DONE;
+ if (AyStarMain_ClosedList_IsInList(this, current) != NULL) return;
/* Calculate the G-value for this node */
new_g = this->CalculateG(this, current, parent);
/* If the value was INVALID_NODE, we don't do anything with this node */
- if (new_g == AYSTAR_INVALID_NODE) return AYSTAR_DONE;
+ if (new_g == AYSTAR_INVALID_NODE) return;
/* There should not be given any other error-code.. */
assert(new_g >= 0);
/* Add the parent g-value to the new g-value */
new_g += parent->g;
- if (this->max_path_cost != 0 && (uint)new_g > this->max_path_cost) return AYSTAR_DONE;
+ if (this->max_path_cost != 0 && (uint)new_g > this->max_path_cost) return;
/* Calculate the h-value */
new_h = this->CalculateH(this, current, parent);
@@ -123,7 +121,7 @@ int AyStar::CheckTile(AyStarNode *current, OpenListNode *parent)
if (check != NULL) {
uint i;
/* Yes, check if this g value is lower.. */
- if (new_g > check->g) return AYSTAR_DONE;
+ if (new_g > check->g) return;
this->OpenListQueue.Delete(check, 0);
/* It is lower, so change it to this item */
check->g = new_g;
@@ -138,8 +136,6 @@ int AyStar::CheckTile(AyStarNode *current, OpenListNode *parent)
/* A new node, add him to the OpenList */
AyStarMain_OpenList_Add(this, closedlist_parent, current, new_f, new_g);
}
-
- return AYSTAR_DONE;
}
/*
diff --git a/src/pathfinder/npf/aystar.h b/src/pathfinder/npf/aystar.h
index d4445dd74..b1b0cdd4b 100644
--- a/src/pathfinder/npf/aystar.h
+++ b/src/pathfinder/npf/aystar.h
@@ -150,7 +150,7 @@ struct AyStar {
int Loop();
void Free();
void Clear();
- int CheckTile(AyStarNode *current, OpenListNode *parent);
+ void CheckTile(AyStarNode *current, OpenListNode *parent);
/* These will contain the open and closed lists */