summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-11-13 20:26:06 +0000
committerfrosch <frosch@openttd.org>2008-11-13 20:26:06 +0000
commit1a866c7552c1f29316984786252c68632fee9550 (patch)
tree16f9f3a9b5b0e6e11ec88ee7a596948c59ee54c2
parentf28172c5f4b07e270cf962dd01b0032f2daddb75 (diff)
downloadopenttd-1a866c7552c1f29316984786252c68632fee9550.tar.xz
(svn r14578) -Fix (r2389, r10811)[FS#Vikthor]: Allow capacity callbacks (15, 36) to return zero capacity.
-rw-r--r--src/roadveh_cmd.cpp2
-rw-r--r--src/train_cmd.cpp26
2 files changed, 12 insertions, 16 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 6a7a75f70..65c040402 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -2085,8 +2085,6 @@ CommandCost CmdRefitRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
}
- if (capacity == 0) continue;
-
total_capacity += capacity;
if (IsHumanCompany(v->owner) && new_cid != v->cargo_type) {
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 43cf9265c..c78d1ef54 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2080,21 +2080,19 @@ CommandCost CmdRefitRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32
}
}
- if (amount != 0) {
- if (new_cid != v->cargo_type) {
- cost.AddCost(GetRefitCost(v->engine_type));
- }
+ if (new_cid != v->cargo_type) {
+ cost.AddCost(GetRefitCost(v->engine_type));
+ }
- num += amount;
- if (flags & DC_EXEC) {
- v->cargo.Truncate((v->cargo_type == new_cid) ? amount : 0);
- v->cargo_type = new_cid;
- v->cargo_cap = amount;
- v->cargo_subtype = new_subtype;
- InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
- InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
- InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
- }
+ num += amount;
+ if (flags & DC_EXEC) {
+ v->cargo.Truncate((v->cargo_type == new_cid) ? amount : 0);
+ v->cargo_type = new_cid;
+ v->cargo_cap = amount;
+ v->cargo_subtype = new_subtype;
+ InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
+ InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
+ InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
}
}
} while ((v = v->Next()) != NULL && !only_this);