Mercurial > hg > openttd
diff src/train_cmd.cpp @ 10328:049acde11ee2 draft
(svn r14578) -Fix (r2389, r10811)[FS#Vikthor]: Allow capacity callbacks (15, 36) to return zero capacity.
author | frosch <frosch@openttd.org> |
---|---|
date | Thu, 13 Nov 2008 20:26:06 +0000 (2008-11-13) |
parents | 6a7dcb87c104 |
children | dd96353a63c7 |
line wrap: on
line diff
--- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -2080,21 +2080,19 @@ } } - if (amount != 0) { - 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); - } + 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); } } } while ((v = v->Next()) != NULL && !only_this);