summaryrefslogtreecommitdiff
path: root/src/vehicle_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-10-31 17:48:09 +0000
committerfrosch <frosch@openttd.org>2009-10-31 17:48:09 +0000
commit67cae40ec158c5df92348ce37d3ed2832abd5426 (patch)
treeacc65e62de519d9e63a268178dbe5df45192e905 /src/vehicle_cmd.cpp
parent4ee589d86d02f6e320f195fc1b4e2667853a01ec (diff)
downloadopenttd-67cae40ec158c5df92348ce37d3ed2832abd5426.tar.xz
(svn r17926) -Fix (r9352): Make the decision whether aircraft carry mail consistent. Now always the cargo class decides.
Diffstat (limited to 'src/vehicle_cmd.cpp')
-rw-r--r--src/vehicle_cmd.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp
index 58d8dabc2..9bd27ad60 100644
--- a/src/vehicle_cmd.cpp
+++ b/src/vehicle_cmd.cpp
@@ -320,7 +320,8 @@ CommandCost RefitVehicle(Vehicle *v, bool only_this, CargoID new_cid, byte new_s
v->cargo_type = new_cid;
v->cargo_subtype = new_subtype;
- uint amount = GetVehicleCapacity(v);
+ uint16 mail_capacity;
+ uint amount = GetVehicleCapacity(v, &mail_capacity);
total_capacity += amount;
/* Restore the original cargo type */
@@ -336,6 +337,11 @@ CommandCost RefitVehicle(Vehicle *v, bool only_this, CargoID new_cid, byte new_s
v->cargo_type = new_cid;
v->cargo_cap = amount;
v->cargo_subtype = new_subtype;
+ if (v->type == VEH_AIRCRAFT) {
+ Vehicle *u = v->Next();
+ u->cargo_cap = mail_capacity;
+ u->cargo.Truncate(mail_capacity);
+ }
}
}