mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-25 05:04:07 +01:00
Codechange: Remove redundant data members from YAPF ship node. (#14577)
This commit is contained in:
@@ -16,19 +16,8 @@
|
||||
#include "yapf_node.hpp"
|
||||
|
||||
/** Yapf Node for ships */
|
||||
template <class Tkey_>
|
||||
struct CYapfShipNodeT : CYapfNodeT<Tkey_, CYapfShipNodeT<Tkey_>> {
|
||||
typedef CYapfNodeT<Tkey_, CYapfShipNodeT<Tkey_>> base;
|
||||
|
||||
TileIndex segment_last_tile;
|
||||
Trackdir segment_last_td;
|
||||
|
||||
void Set(CYapfShipNodeT *parent, TileIndex tile, Trackdir td, bool is_choice)
|
||||
{
|
||||
this->base::Set(parent, tile, td, is_choice);
|
||||
this->segment_last_tile = tile;
|
||||
this->segment_last_td = td;
|
||||
}
|
||||
template <class TKey>
|
||||
struct CYapfShipNodeT : CYapfNodeT<TKey, CYapfShipNodeT<TKey>> {
|
||||
};
|
||||
|
||||
/* now define two major node types (that differ by key type) */
|
||||
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
/** Called by YAPF to detect if node ends in the desired destination. */
|
||||
inline bool PfDetectDestination(Node &n)
|
||||
{
|
||||
return this->PfDetectDestinationTile(n.segment_last_tile, n.segment_last_td);
|
||||
return this->PfDetectDestinationTile(n.GetTile(), n.GetTrackdir());
|
||||
}
|
||||
|
||||
inline bool PfDetectDestinationTile(TileIndex tile, Trackdir trackdir)
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
n.estimate = n.cost + OctileDistanceCost(n.segment_last_tile, n.segment_last_td, destination_tile);
|
||||
n.estimate = n.cost + OctileDistanceCost(n.GetTile(), n.GetTrackdir(), destination_tile);
|
||||
assert(n.estimate >= n.parent->estimate);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user