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:
@@ -938,6 +938,8 @@ bool AfterLoadGame()
|
||||
_settings_game.vehicle.train_braking_model = TBM_ORIGINAL;
|
||||
}
|
||||
|
||||
AfterLoadEngines();
|
||||
|
||||
/* Update all vehicles */
|
||||
AfterLoadVehicles(true);
|
||||
|
||||
@@ -4012,6 +4014,7 @@ void ReloadNewGRFData()
|
||||
RecomputePrices();
|
||||
/* reload vehicles */
|
||||
ResetVehicleHash();
|
||||
AfterLoadEngines();
|
||||
AfterLoadVehicles(false);
|
||||
StartupEngines();
|
||||
GroupStatistics::UpdateAfterLoad();
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include "../stdafx.h"
|
||||
#include "saveload_internal.h"
|
||||
#include "../engine_base.h"
|
||||
#include "../engine_func.h"
|
||||
#include "../string_func.h"
|
||||
#include <vector>
|
||||
|
||||
@@ -196,6 +197,11 @@ static void Load_EIDS()
|
||||
}
|
||||
}
|
||||
|
||||
void AfterLoadEngines()
|
||||
{
|
||||
AnalyseEngineCallbacks();
|
||||
}
|
||||
|
||||
extern const ChunkHandler _engine_chunk_handlers[] = {
|
||||
{ 'EIDS', Save_EIDS, Load_EIDS, nullptr, nullptr, CH_ARRAY },
|
||||
{ 'ENGN', Save_ENGN, Load_ENGN, nullptr, nullptr, CH_ARRAY },
|
||||
|
@@ -26,6 +26,7 @@ void MoveWaypointsToBaseStations();
|
||||
const SaveLoad *GetBaseStationDescription();
|
||||
|
||||
void AfterLoadVehicles(bool part_of_load);
|
||||
void AfterLoadEngines();
|
||||
void FixupTrainLengths();
|
||||
void AfterLoadTemplateVehicles();
|
||||
void AfterLoadStations();
|
||||
|
Reference in New Issue
Block a user