(svn r14578) -Fix (r2389, r10811)[FS#Vikthor]: Allow capacity callbacks (15, 36) to return zero capacity.

This commit is contained in:
frosch 2008-11-13 20:26:06 +00:00
parent f28172c5f4
commit 1a866c7552
2 changed files with 12 additions and 16 deletions

View File

@ -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) {

View File

@ -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);