From 80f672d5b43a972844d7646b16878973326bc2c5 Mon Sep 17 00:00:00 2001 From: Kuhnovic <68320206+Kuhnovic@users.noreply.github.com> Date: Wed, 3 Sep 2025 12:52:15 +0200 Subject: [PATCH] Codechange: Remove redundant data members from YAPF ship node. (#14577) --- src/pathfinder/yapf/yapf_node_ship.hpp | 15 ++------------- src/pathfinder/yapf/yapf_ship.cpp | 4 ++-- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/pathfinder/yapf/yapf_node_ship.hpp b/src/pathfinder/yapf/yapf_node_ship.hpp index a6eae6a12e..8b79a6a47e 100644 --- a/src/pathfinder/yapf/yapf_node_ship.hpp +++ b/src/pathfinder/yapf/yapf_node_ship.hpp @@ -16,19 +16,8 @@ #include "yapf_node.hpp" /** Yapf Node for ships */ -template -struct CYapfShipNodeT : CYapfNodeT> { - typedef CYapfNodeT> 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 +struct CYapfShipNodeT : CYapfNodeT> { }; /* now define two major node types (that differ by key type) */ diff --git a/src/pathfinder/yapf/yapf_ship.cpp b/src/pathfinder/yapf/yapf_ship.cpp index 2c3b26d39d..a5f1ef67a2 100644 --- a/src/pathfinder/yapf/yapf_ship.cpp +++ b/src/pathfinder/yapf/yapf_ship.cpp @@ -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; }