Mercurial > hg > openttd
changeset 4413:3c8a0053c68d draft
(svn r6166) -Fix: [YAPF] fixes one very improbable assert when adding startup node that already exists in the open-list (thanks Panzerfather)
author | KUDr <KUDr@openttd.org> |
---|---|
date | Sun, 27 Aug 2006 09:50:43 +0000 |
parents | 094190c7f3a0 |
children | a3fa83622ef4 |
files | yapf/yapf_base.hpp |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/yapf/yapf_base.hpp +++ b/yapf/yapf_base.hpp @@ -180,7 +180,14 @@ 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 */