1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-12 09:09:09 +00:00

Feature: NewGRF callback profiling (#7868)

Adds a console command newgrf_profile to collect some profiling data about NewGRF action 2 callbacks and produce a CSV file.
This commit is contained in:
Niels Martin Hansen
2020-01-26 13:45:51 +01:00
committed by GitHub
parent f88ac83408
commit c8779fb311
40 changed files with 691 additions and 20 deletions

View File

@@ -946,6 +946,22 @@ static uint32 VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *object,
return in_motion ? group->loaded[set] : group->loading[set];
}
GrfSpecFeature VehicleResolverObject::GetFeature() const
{
switch (Engine::Get(this->self_scope.self_type)->type) {
case VEH_TRAIN: return GSF_TRAINS;
case VEH_ROAD: return GSF_ROADVEHICLES;
case VEH_SHIP: return GSF_SHIPS;
case VEH_AIRCRAFT: return GSF_AIRCRAFT;
default: return GSF_INVALID;
}
}
uint32 VehicleResolverObject::GetDebugID() const
{
return Engine::Get(this->self_scope.self_type)->grf_prop.local_id;
}
/**
* Get the grf file associated with an engine type.
* @param engine_type Engine to query.