Index: src/build_vehicle_gui.cpp =================================================================== --- src/build_vehicle_gui.cpp (revision 27762) +++ src/build_vehicle_gui.cpp (working copy) @@ -580,11 +580,11 @@ } /* Running cost */ - if (rvi->running_cost_class != INVALID_PRICE) { +// if (rvi->running_cost_class != INVALID_PRICE) { SetDParam(0, e->GetRunningCost()); DrawString(left, right, y, STR_PURCHASE_INFO_RUNNINGCOST); y += FONT_HEIGHT_NORMAL; - } +// } return y; } Index: src/engine.cpp =================================================================== --- src/engine.cpp (revision 27762) +++ src/engine.cpp (working copy) @@ -285,6 +285,7 @@ { Price base_price; uint cost_factor; +// int shift = 0; switch (this->type) { case VEH_ROAD: base_price = this->u.road.running_cost_class; @@ -294,7 +295,19 @@ case VEH_TRAIN: base_price = this->u.rail.running_cost_class; - if (base_price == INVALID_PRICE) return 0; + if (this->u.rail.railveh_type == RAILVEH_WAGON) { + if (base_price == INVALID_PRICE) { + if (this->u.rail.railtype == RAILTYPE_RAIL) base_price = PR_RUNNING_TRAIN_ELECTRIC; + if (this->u.rail.railtype == RAILTYPE_ELECTRIC) base_price = PR_RUNNING_TRAIN_ELECTRIC; + if (this->u.rail.railtype == RAILTYPE_MONO) base_price = PR_RUNNING_TRAIN_DIESEL; + if (this->u.rail.railtype == RAILTYPE_MAGLEV) base_price = PR_RUNNING_TRAIN_STEAM; + cost_factor = this->u.rail.weight; +// shift = -3; + break; + } + } else { + if (base_price == INVALID_PRICE) return 0; + } cost_factor = GetEngineProperty(this->index, PROP_TRAIN_RUNNING_COST_FACTOR, this->u.rail.running_cost); break; @@ -311,7 +324,7 @@ default: NOT_REACHED(); } - return GetPrice(base_price, cost_factor, this->GetGRF(), -8); + return GetPrice(base_price, cost_factor, this->GetGRF(), -8/* + shift*/); } /** Index: src/train_cmd.cpp =================================================================== --- src/train_cmd.cpp (revision 27762) +++ src/train_cmd.cpp (working copy) @@ -3901,11 +3901,27 @@ { 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); + if (v->IsWagon()) { + if (e->u.rail.railtype == RAILTYPE_RAIL) cost += GetPrice(PR_RUNNING_TRAIN_ELECTRIC, e->u.rail.weight, e->GetGRF()); + if (e->u.rail.railtype == RAILTYPE_ELECTRIC) cost += GetPrice(PR_RUNNING_TRAIN_ELECTRIC, e->u.rail.weight, e->GetGRF()); + if (e->u.rail.railtype == RAILTYPE_MONO) cost += GetPrice(PR_RUNNING_TRAIN_DIESEL, e->u.rail.weight, e->GetGRF()); + if (e->u.rail.railtype == RAILTYPE_MAGLEV) cost += GetPrice(PR_RUNNING_TRAIN_STEAM, e->u.rail.weight, e->GetGRF()); + } + continue; + } + uint cost_factor = GetVehicleProperty(v, PROP_TRAIN_RUNNING_COST_FACTOR, e->u.rail.running_cost); if (cost_factor == 0) continue; @@ -3915,6 +3931,7 @@ cost += GetPrice(e->u.rail.running_cost_class, cost_factor, e->GetGRF()); } while ((v = v->GetNextVehicle()) != NULL); +// cost += cost * unc_len / (VEHICLE_LENGTH * 2); return cost; }