summaryrefslogtreecommitdiff
path: root/vehicle.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-10-08 21:10:00 +0000
committerbjarni <bjarni@openttd.org>2006-10-08 21:10:00 +0000
commitec809c5d71cf9ccb37d8ebe04c583d2fe566af9e (patch)
tree85ecb9df403ac4ad8bb2337845ec134da965c837 /vehicle.c
parentfa3afe220edc938f19b4368cd1edb0d1d52e71a8 (diff)
downloadopenttd-ec809c5d71cf9ccb37d8ebe04c583d2fe566af9e.tar.xz
(svn r6696) -Codechange: changed all comparision for refit cargo in orders against CT_NO_REFIT to checks for valid cargo IDs
This should prevent any bugs made by mixing up CT_NO_REFIT and CT_INVALID
Diffstat (limited to 'vehicle.c')
-rw-r--r--vehicle.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/vehicle.c b/vehicle.c
index 620121e4d..c5fa769c4 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1901,7 +1901,7 @@ static bool VerifyAutoreplaceRefitForOrders(const Vehicle *v, const EngineID eng
}
FOR_VEHICLE_ORDERS(u, o) {
- if (o->refit_cargo == CT_NO_REFIT) continue;
+ if (!(o->refit_cargo < NUM_CARGO)) continue;
if (!CanRefitTo(v->engine_type, o->refit_cargo)) continue;
if (!CanRefitTo(engine_type, o->refit_cargo)) return false;
}
@@ -2530,7 +2530,7 @@ void VehicleEnterDepot(Vehicle *v)
v->current_order.type = OT_DUMMY;
v->current_order.flags = 0;
- if (t.refit_cargo != CT_NO_REFIT) {
+ if (t.refit_cargo < NUM_CARGO) {
int32 cost;
_current_player = v->owner;