Index: src/train_cmd.cpp
===================================================================
--- src/train_cmd.cpp (revision 27760)
+++ src/train_cmd.cpp (working copy)
@@ -3901,11 +3901,21 @@
{
Money cost = 0;
const Train *v = this;
+ uint16 unc_len = 0;
do {
const Engine *e = v->GetEngine();
- if (e->u.rail.running_cost_class == INVALID_PRICE) continue;
+ if (e->u.rail.running_cost_class == INVALID_PRICE) {
+ const Train *a = v;
+
+ do {
+ unc_len += a->gcache.cached_veh_length;
+ a = a->HasArticulatedPart() ? a->GetNextArticulatedPart() : NULL;
+ } while (a != NULL);
+ continue;
+ }
+
uint cost_factor = GetVehicleProperty(v, PROP_TRAIN_RUNNING_COST_FACTOR, e->u.rail.running_cost);
if (cost_factor == 0) continue;
@@ -3915,7 +3925,7 @@
cost += GetPrice(e->u.rail.running_cost_class, cost_factor, e->GetGRF());
} while ((v = v->GetNextVehicle()) != NULL);
- return cost;
+ return cost += cost * unc_len / (VEHICLE_LENGTH * 2 * _settings_game.vehicle.max_train_length);
}
/**