summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-01-03 23:08:15 +0000
committerfrosch <frosch@openttd.org>2012-01-03 23:08:15 +0000
commit00ec5da36161b2070fcf382a41f9d6b72ab6290f (patch)
treeb41f7d93f2d9b21fcbb491bf2a36cad43bad966c /src
parent7ff95b9e97707b192754f1bdea93cc4efac010f1 (diff)
downloadopenttd-00ec5da36161b2070fcf382a41f9d6b72ab6290f.tar.xz
(svn r23745) -Fix (r23087): If autorefit fails, count the vehicle capacity nevertheless, if it is already carrying the right thing.
Diffstat (limited to 'src')
-rw-r--r--src/vehicle_cmd.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp
index 21a0ced01..32f4eaec3 100644
--- a/src/vehicle_cmd.cpp
+++ b/src/vehicle_cmd.cpp
@@ -357,6 +357,12 @@ static CommandCost RefitVehicle(Vehicle *v, bool only_this, uint8 num_vehicles,
/* Sorry, auto-refitting not allowed, subtract the cargo amount again from the total. */
total_capacity -= amount;
total_mail_capacity -= mail_capacity;
+
+ if (v->cargo_type == new_cid) {
+ /* Add the old capacity nevertheless, if the cargo matches */
+ total_capacity += v->cargo_cap;
+ if (v->type == VEH_AIRCRAFT) total_mail_capacity += v->Next()->cargo_cap;
+ }
continue;
}
cost.AddCost(refit_cost);