summaryrefslogtreecommitdiff
path: root/src/pathfinder/yapf/yapf_costrail.hpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-02 10:13:49 +0000
committerrubidium <rubidium@openttd.org>2009-12-02 10:13:49 +0000
commitc56c892b2c9a30d7a5d4e7a59053e13471f038ab (patch)
tree4bc147441da298b187778958ec6853644c9ef907 /src/pathfinder/yapf/yapf_costrail.hpp
parent9165c195b9609bb9db77cc23ff424802eb4ab128 (diff)
downloadopenttd-c56c892b2c9a30d7a5d4e7a59053e13471f038ab.tar.xz
(svn r18372) -Codechange: push some extra type safety into YAPF
Diffstat (limited to 'src/pathfinder/yapf/yapf_costrail.hpp')
-rw-r--r--src/pathfinder/yapf/yapf_costrail.hpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pathfinder/yapf/yapf_costrail.hpp b/src/pathfinder/yapf/yapf_costrail.hpp
index 51c8e3920..959431520 100644
--- a/src/pathfinder/yapf/yapf_costrail.hpp
+++ b/src/pathfinder/yapf/yapf_costrail.hpp
@@ -251,11 +251,11 @@ public:
FORCEINLINE int PlatformLengthPenalty(int platform_length)
{
int cost = 0;
- const Vehicle *v = Yapf().GetVehicle();
+ const Train *v = Yapf().GetVehicle();
assert(v != NULL);
assert(v->type == VEH_TRAIN);
- assert(Train::From(v)->tcache.cached_total_length != 0);
- int missing_platform_length = (Train::From(v)->tcache.cached_total_length + TILE_SIZE - 1) / TILE_SIZE - platform_length;
+ assert(v->tcache.cached_total_length != 0);
+ int missing_platform_length = (v->tcache.cached_total_length + TILE_SIZE - 1) / TILE_SIZE - platform_length;
if (missing_platform_length < 0) {
/* apply penalty for longer platform than needed */
cost += Yapf().PfGetSettings().rail_longer_platform_penalty + Yapf().PfGetSettings().rail_longer_platform_per_tile_penalty * -missing_platform_length;
@@ -322,7 +322,7 @@ public:
int segment_entry_cost = 0;
int segment_cost = 0;
- const Vehicle *v = Yapf().GetVehicle();
+ const Train *v = Yapf().GetVehicle();
/* start at n.m_key.m_tile / n.m_key.m_td and walk to the end of segment */
TILE cur(n.m_key.m_tile, n.m_key.m_td);