summaryrefslogtreecommitdiff
path: root/yapf
diff options
context:
space:
mode:
authorKUDr <KUDr@openttd.org>2006-08-27 09:50:43 +0000
committerKUDr <KUDr@openttd.org>2006-08-27 09:50:43 +0000
commit1385d33ff0891111ffffefad182a778e653557ca (patch)
tree9d339154872e05cc76d1b72f2f25e828cc59ed09 /yapf
parent422d0739104cf0a778ec7b01c363adc9deb9d54a (diff)
downloadopenttd-1385d33ff0891111ffffefad182a778e653557ca.tar.xz
(svn r6166) -Fix: [YAPF] fixes one very improbable assert when adding startup node that already exists in the open-list (thanks Panzerfather)
Diffstat (limited to 'yapf')
-rw-r--r--yapf/yapf_base.hpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/yapf/yapf_base.hpp b/yapf/yapf_base.hpp
index c5c50fe65..96893b39d 100644
--- a/yapf/yapf_base.hpp
+++ b/yapf/yapf_base.hpp
@@ -180,7 +180,14 @@ public:
FORCEINLINE void AddStartupNode(Node& n)
{
Yapf().PfNodeCacheFetch(n);
- m_nodes.InsertOpenNode(n);
+ // insert the new node only if it is not there
+ if (&m_nodes.FindOpenNode(n.m_key) == NULL) {
+ m_nodes.InsertOpenNode(n);
+ } else {
+ // if we are here, it means that node is already there - how it is possible?
+ // probably the train is in the position that both its ends point to the same tile/exit-dir
+ // very unlikely, but it happened
+ }
}
/** add multiple nodes - direct children of the given node */