(svn r18774) -Change: Consider callback 19 only broken after subcargos 0 to 255 have been used, instead of stopping at 15.

This commit is contained in:
frosch 2010-01-10 20:33:10 +00:00
parent 632280e06e
commit fee0cebc46

View File

@ -156,8 +156,8 @@ static void DrawVehicleProfitButton(const Vehicle *v, int x, int y)
DrawSprite(SPR_BLOT, pal, x, y); DrawSprite(SPR_BLOT, pal, x, y);
} }
/** Maximum number of refit cycles we try, to prevent infinite loops. */ /** Maximum number of refit cycles we try, to prevent infinite loops. And we store only a byte anyway */
static const int MAX_REFIT_CYCLE = 16; static const uint MAX_REFIT_CYCLE = 256;
/** /**
* Get the best fitting subtype when 'cloning'/'replacing' v_from with v_for. * Get the best fitting subtype when 'cloning'/'replacing' v_from with v_for.
@ -193,7 +193,7 @@ byte GetBestFittingSubType(Vehicle *v_from, Vehicle *v_for)
v_for->cargo_type = v_from->cargo_type; v_for->cargo_type = v_from->cargo_type;
/* Cycle through the refits */ /* Cycle through the refits */
for (byte refit_cyc = 0; refit_cyc < MAX_REFIT_CYCLE; refit_cyc++) { for (uint refit_cyc = 0; refit_cyc < MAX_REFIT_CYCLE; refit_cyc++) {
v_for->cargo_subtype = refit_cyc; v_for->cargo_subtype = refit_cyc;
/* Make sure we don't pick up anything cached. */ /* Make sure we don't pick up anything cached. */
@ -262,11 +262,10 @@ static RefitList *BuildRefitList(const Vehicle *v)
* changed to test the cargo & subtype... */ * changed to test the cargo & subtype... */
CargoID temp_cargo = u->cargo_type; CargoID temp_cargo = u->cargo_type;
byte temp_subtype = u->cargo_subtype; byte temp_subtype = u->cargo_subtype;
byte refit_cyc;
u->cargo_type = cid; u->cargo_type = cid;
for (refit_cyc = 0; refit_cyc < MAX_REFIT_CYCLE && num_lines < max_lines; refit_cyc++) { for (uint refit_cyc = 0; refit_cyc < MAX_REFIT_CYCLE && num_lines < max_lines; refit_cyc++) {
bool duplicate = false; bool duplicate = false;
uint16 callback; uint16 callback;