(svn r2912) -Fix: [autorenew]: fixed issue where autorenewed vehicles didn't get all stats updated (peter1138)

This commit is contained in:
bjarni 2005-09-03 19:22:56 +00:00
parent 3ace3769c9
commit 864cb3fa11

View File

@ -1370,6 +1370,7 @@ int32 ReplaceVehicle(Vehicle *v)
EngineID old_engine_type = v->engine_type;
EngineID new_engine_type = p->engine_replacement[old_engine_type];
Vehicle *u, *first;
Engine *e;
int cost, build_cost, rear_engine_cost = 0;
// If replacing due to age only, use the same type :-)
@ -1460,9 +1461,8 @@ int32 ReplaceVehicle(Vehicle *v)
}
cost = build_cost - v->value + rear_engine_cost;
if (old_engine_type != new_engine_type) {
/* We do not really buy a new vehicle, we upgrade the old one */
const Engine* e = GetEngine(new_engine_type);
e = GetEngine(new_engine_type);
v->reliability = e->reliability;
v->reliability_spd_dec = e->reliability_spd_dec;
@ -1605,10 +1605,6 @@ int32 ReplaceVehicle(Vehicle *v)
v->cargo_count = v->cargo_cap;
}
}
}
// A replaced vehicle should be classed as new
v->age = 0;
InvalidateWindow(WC_REPLACE_VEHICLE, v->type);
ResortVehicleLists();