(svn r17725) -Codechange: Reduce usage of EngInfo and XxxVehInfo, esp. when a Engine * is already present.
This commit is contained in:
@@ -1139,12 +1139,13 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
|
||||
for (; v != NULL; v = v->Next()) {
|
||||
if (v->cargo_cap == 0) continue;
|
||||
|
||||
byte load_amount = EngInfo(v->engine_type)->load_amount;
|
||||
const Engine *e = Engine::Get(v->engine_type);
|
||||
byte load_amount = e->info.load_amount;
|
||||
|
||||
/* The default loadamount for mail is 1/4 of the load amount for passengers */
|
||||
if (v->type == VEH_AIRCRAFT && !Aircraft::From(v)->IsNormalAircraft()) load_amount = (load_amount + 3) / 4;
|
||||
|
||||
if (_settings_game.order.gradual_loading && HasBit(EngInfo(v->engine_type)->callback_mask, CBM_VEHICLE_LOAD_AMOUNT)) {
|
||||
if (_settings_game.order.gradual_loading && HasBit(e->info.callback_mask, CBM_VEHICLE_LOAD_AMOUNT)) {
|
||||
uint16 cb_load_amount = GetVehicleCallback(CBID_VEHICLE_LOAD_AMOUNT, 0, 0, v->engine_type, v);
|
||||
if (cb_load_amount != CALLBACK_FAILED && GB(cb_load_amount, 0, 8) != 0) load_amount = GB(cb_load_amount, 0, 8);
|
||||
}
|
||||
|
Reference in New Issue
Block a user