Mercurial > hg > openttd
changeset 4782:3d6a7eacea0b draft
(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
author | bjarni <bjarni@openttd.org> |
---|---|
date | Sun, 08 Oct 2006 21:10:00 +0000 |
parents | ce218925cfae |
children | 3c41fc3b5814 |
files | order_gui.c vehicle.c |
diffstat | 2 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/order_gui.c +++ b/order_gui.c @@ -170,11 +170,11 @@ if (order->flags & OF_FULL_LOAD) s++; /* service at */ SetDParam(1, s); - if (order->refit_cargo == CT_NO_REFIT) { - SetDParam(3, STR_EMPTY); - } else { + if (order->refit_cargo < NUM_CARGO) { SetDParam(3, STR_REFIT_ORDER); SetDParam(4, _cargoc.names_s[order->refit_cargo]); + } else { + SetDParam(3, STR_EMPTY); } break; }
--- a/vehicle.c +++ b/vehicle.c @@ -1901,7 +1901,7 @@ } 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 @@ 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;