diff options
author | Niels Martin Hansen <nielsm@indvikleren.dk> | 2020-01-26 13:45:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-26 13:45:51 +0100 |
commit | c8779fb311c2665d3fc45c18b2f3460cd998d179 (patch) | |
tree | 15321da1e265a40fce50700182b218a87494d24a /src/newgrf_engine.cpp | |
parent | f88ac83408bff58022699b4d9488818d509ef974 (diff) | |
download | openttd-c8779fb311c2665d3fc45c18b2f3460cd998d179.tar.xz |
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.
Diffstat (limited to 'src/newgrf_engine.cpp')
-rw-r--r-- | src/newgrf_engine.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index dc0e1cfe0..db2f5ac43 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -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. |