summaryrefslogtreecommitdiff
path: root/src/yapf/yapf_costrail.hpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-06-06 16:54:22 +0000
committersmatz <smatz@openttd.org>2009-06-06 16:54:22 +0000
commit0c10006907b7d149f91d277a0c28a79b40eaa4c0 (patch)
treedc8cb6a7a9315a10688af00187db94be8911acef /src/yapf/yapf_costrail.hpp
parentc90819ff6d8d49ac25aa9194bdf04e8dfd7149ea (diff)
downloadopenttd-0c10006907b7d149f91d277a0c28a79b40eaa4c0.tar.xz
(svn r16527) -Codechange: use static member functions instead of simple casts when converting Vehicle to specialised vehicle types. Includes safety check
Diffstat (limited to 'src/yapf/yapf_costrail.hpp')
-rw-r--r--src/yapf/yapf_costrail.hpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/yapf/yapf_costrail.hpp b/src/yapf/yapf_costrail.hpp
index 9504beced..00c824b1a 100644
--- a/src/yapf/yapf_costrail.hpp
+++ b/src/yapf/yapf_costrail.hpp
@@ -247,8 +247,8 @@ public:
const Vehicle *v = Yapf().GetVehicle();
assert(v != NULL);
assert(v->type == VEH_TRAIN);
- assert(((const Train *)v)->tcache.cached_total_length != 0);
- int missing_platform_length = (((const Train *)v)->tcache.cached_total_length + TILE_SIZE - 1) / TILE_SIZE - platform_length;
+ 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;
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;