NewGRF: Elide unmasked vehicle callbacks where possible
This includes: * CBID_VEHICLE_32DAY_CALLBACK * CBID_VEHICLE_REFIT_COST * CBID_VEHICLE_MODIFY_PROPERTY This is on a per-property basis The main benefit of this is to avoid callbacks not handled by the vehicle's current sprite group from using the full graphics chain as the "default" branch in the callback switch. In the case where the graphics chain is long/expensive, a lot of work had to be done before a callback failure result was eventually returned.
This commit is contained in:
@@ -1203,7 +1203,7 @@ static void RunVehicleDayProc()
|
||||
if (v == nullptr) continue;
|
||||
|
||||
/* Call the 32-day callback if needed */
|
||||
if ((v->day_counter & 0x1F) == 0 && v->HasEngineType()) {
|
||||
if ((v->day_counter & 0x1F) == 0 && v->HasEngineType() && (Engine::Get(v->engine_type)->callbacks_used & SGCU_VEHICLE_32DAY_CALLBACK) != 0) {
|
||||
uint16 callback = GetVehicleCallback(CBID_VEHICLE_32DAY_CALLBACK, 0, 0, v->engine_type, v);
|
||||
if (callback != CALLBACK_FAILED) {
|
||||
if (HasBit(callback, 0)) {
|
||||
|
Reference in New Issue
Block a user