From 029ceda0f1c2f11231a0662cc45057f8452f645a Mon Sep 17 00:00:00 2001 From: KUDr Date: Sat, 24 Feb 2007 00:17:46 +0000 Subject: (svn r8869) [YAPF] -Fix: Large Train Stations/Trains makes OpenTTD crash (Jigsaw_Psyche) --- src/yapf/yapf_base.hpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/yapf/yapf_base.hpp') 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 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); -- cgit v1.2.3-54-g00ecf