Mercurial > hg > openttd
diff src/train_cmd.cpp @ 9208:aa4576e5111a draft
(svn r13074) -Fix: For multiheaded engines, halve power and running cost when used instead of when loading, to allow callback values to work properly.
author | peter1138 <peter1138@openttd.org> |
---|---|
date | Tue, 13 May 2008 20:39:57 +0000 |
parents | c93fe0a517f2 |
children | 6ad7fc7fbcaf |
line wrap: on
line diff
--- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -118,6 +118,9 @@ if (engine_has_power) { uint16 power = GetVehicleProperty(u, 0x0B, rvi_u->power); if (power != 0) { + /* Halve power for multiheaded parts */ + if (IsMultiheaded(u)) power /= 2; + total_power += power; /* Tractive effort in (tonnes * 1000 * 10 =) N */ max_te += (u->u.rail.cached_veh_weight * 10000 * GetVehicleProperty(u, 0x1F, rvi_u->tractive_effort)) / 256; @@ -3499,6 +3502,9 @@ byte cost_factor = GetVehicleProperty(v, 0x0D, rvi->running_cost); if (cost_factor == 0) continue; + /* Halve running cost for multiheaded parts */ + if (IsMultiheaded(v)) cost_factor /= 2; + cost += cost_factor * GetPriceByIndex(rvi->running_cost_class); } while ((v = GetNextVehicle(v)) != NULL);