summaryrefslogtreecommitdiff
path: root/src/yapf/yapf_base.hpp
diff options
context:
space:
mode:
authorKUDr <kudr@openttd.org>2007-02-24 00:17:46 +0000
committerKUDr <kudr@openttd.org>2007-02-24 00:17:46 +0000
commit029ceda0f1c2f11231a0662cc45057f8452f645a (patch)
treea567351d7e9a2e7575b410393280573e0ba04d98 /src/yapf/yapf_base.hpp
parent433b8054e9e63da606ccee3a23ec958d03200c75 (diff)
downloadopenttd-029ceda0f1c2f11231a0662cc45057f8452f645a.tar.xz
(svn r8869) [YAPF] -Fix: Large Train Stations/Trains makes OpenTTD crash (Jigsaw_Psyche)
Diffstat (limited to 'src/yapf/yapf_base.hpp')
-rw-r--r--src/yapf/yapf_base.hpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/yapf/yapf_base.hpp b/src/yapf/yapf_base.hpp
index 6218c6ec7..0d49171cd 100644
--- a/src/yapf/yapf_base.hpp
+++ b/src/yapf/yapf_base.hpp
@@ -7,10 +7,6 @@
#include "../debug.h"
-#include "../misc/fixedsizearray.hpp"
-#include "../misc/blob.hpp"
-#include "nodelist.hpp"
-
extern int _total_pf_time_us;
/** CYapfBaseT - A-star type path finder base class.
@@ -46,6 +42,7 @@ template <class Types>
class CYapfBaseT {
public:
typedef typename Types::Tpf Tpf; ///< the pathfinder class (derived from THIS class)
+ typedef typename Types::TrackFollower TrackFollower;
typedef typename Types::NodeList NodeList; ///< our node list
typedef typename NodeList::Titem Node; ///< this will be our node type
typedef typename Node::Key Key; ///< key to hash tables
@@ -192,20 +189,20 @@ public:
}
/** add multiple nodes - direct children of the given node */
- FORCEINLINE void AddMultipleNodes(Node* parent, TileIndex tile, TrackdirBits td_bits)
+ FORCEINLINE void AddMultipleNodes(Node* parent, const TrackFollower &tf)
{
- bool is_choice = (KillFirstBit2x64(td_bits) != 0);
- for (TrackdirBits rtds = td_bits; rtds != TRACKDIR_BIT_NONE; rtds = (TrackdirBits)KillFirstBit2x64(rtds)) {
+ bool is_choice = (KillFirstBit2x64(tf.m_new_td_bits) != 0);
+ for (TrackdirBits rtds = tf.m_new_td_bits; rtds != TRACKDIR_BIT_NONE; rtds = (TrackdirBits)KillFirstBit2x64(rtds)) {
Trackdir td = (Trackdir)FindFirstBit2x64(rtds);
Node& n = Yapf().CreateNewNode();
- n.Set(parent, tile, td, is_choice);
- Yapf().AddNewNode(n);
+ n.Set(parent, tf.m_new_tile, td, is_choice);
+ Yapf().AddNewNode(n, tf);
}
}
/** AddNewNode() - called by Tderived::PfFollowNode() for each child node.
* Nodes are evaluated here and added into open list */
- void AddNewNode(Node& n)
+ void AddNewNode(Node &n, const TrackFollower &tf)
{
// evaluate the node
bool bCached = Yapf().PfNodeCacheFetch(n);
@@ -215,7 +212,7 @@ public:
m_stats_cache_hits++;
}
- bool bValid = Yapf().PfCalcCost(n);
+ bool bValid = Yapf().PfCalcCost(n, tf);
if (bCached) {
Yapf().PfNodeCacheFlush(n);