mirror of https://github.com/OpenTTD/OpenTTD.git
(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
This commit is contained in:
parent
fa3afe220e
commit
ec809c5d71
|
@ -170,11 +170,11 @@ static void DrawOrdersWindow(Window *w)
|
||||||
if (order->flags & OF_FULL_LOAD) s++; /* service at */
|
if (order->flags & OF_FULL_LOAD) s++; /* service at */
|
||||||
|
|
||||||
SetDParam(1, s);
|
SetDParam(1, s);
|
||||||
if (order->refit_cargo == CT_NO_REFIT) {
|
if (order->refit_cargo < NUM_CARGO) {
|
||||||
SetDParam(3, STR_EMPTY);
|
|
||||||
} else {
|
|
||||||
SetDParam(3, STR_REFIT_ORDER);
|
SetDParam(3, STR_REFIT_ORDER);
|
||||||
SetDParam(4, _cargoc.names_s[order->refit_cargo]);
|
SetDParam(4, _cargoc.names_s[order->refit_cargo]);
|
||||||
|
} else {
|
||||||
|
SetDParam(3, STR_EMPTY);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1901,7 +1901,7 @@ static bool VerifyAutoreplaceRefitForOrders(const Vehicle *v, const EngineID eng
|
||||||
}
|
}
|
||||||
|
|
||||||
FOR_VEHICLE_ORDERS(u, o) {
|
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(v->engine_type, o->refit_cargo)) continue;
|
||||||
if (!CanRefitTo(engine_type, o->refit_cargo)) return false;
|
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.type = OT_DUMMY;
|
||||||
v->current_order.flags = 0;
|
v->current_order.flags = 0;
|
||||||
|
|
||||||
if (t.refit_cargo != CT_NO_REFIT) {
|
if (t.refit_cargo < NUM_CARGO) {
|
||||||
int32 cost;
|
int32 cost;
|
||||||
|
|
||||||
_current_player = v->owner;
|
_current_player = v->owner;
|
||||||
|
|
Loading…
Reference in New Issue