(svn r21521) -Codechange: Unify some cached values that were present in both road vehicles and trains.

This commit is contained in:
terkhen
2010-12-14 21:33:53 +00:00
parent cfa00ad14b
commit f69d280f14
18 changed files with 69 additions and 113 deletions

View File

@@ -258,8 +258,8 @@ public:
const Train *v = Yapf().GetVehicle();
assert(v != NULL);
assert(v->type == VEH_TRAIN);
assert(v->tcache.cached_total_length != 0);
int missing_platform_length = CeilDiv(v->tcache.cached_total_length, TILE_SIZE) - platform_length;
assert(v->gcache.cached_total_length != 0);
int missing_platform_length = CeilDiv(v->gcache.cached_total_length, 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;