summaryrefslogtreecommitdiff
path: root/src/newgrf_railtype.cpp
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2020-01-26 13:45:51 +0100
committerGitHub <noreply@github.com>2020-01-26 13:45:51 +0100
commitc8779fb311c2665d3fc45c18b2f3460cd998d179 (patch)
tree15321da1e265a40fce50700182b218a87494d24a /src/newgrf_railtype.cpp
parentf88ac83408bff58022699b4d9488818d509ef974 (diff)
downloadopenttd-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_railtype.cpp')
-rw-r--r--src/newgrf_railtype.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/newgrf_railtype.cpp b/src/newgrf_railtype.cpp
index 451076ccc..2a98948e7 100644
--- a/src/newgrf_railtype.cpp
+++ b/src/newgrf_railtype.cpp
@@ -65,6 +65,16 @@
return nullptr;
}
+GrfSpecFeature RailTypeResolverObject::GetFeature() const
+{
+ return GSF_RAILTYPES;
+}
+
+uint32 RailTypeResolverObject::GetDebugID() const
+{
+ return this->railtype_scope.rti->label;
+}
+
/**
* Resolver object for rail types.
* @param rti Railtype. nullptr in NewGRF Inspect window.
@@ -75,7 +85,7 @@
* @param param2 Extra parameter (second parameter of the callback, except railtypes do not have callbacks).
*/
RailTypeResolverObject::RailTypeResolverObject(const RailtypeInfo *rti, TileIndex tile, TileContext context, RailTypeSpriteGroup rtsg, uint32 param1, uint32 param2)
- : ResolverObject(rti != nullptr ? rti->grffile[rtsg] : nullptr, CBID_NO_CALLBACK, param1, param2), railtype_scope(*this, tile, context)
+ : ResolverObject(rti != nullptr ? rti->grffile[rtsg] : nullptr, CBID_NO_CALLBACK, param1, param2), railtype_scope(*this, rti, tile, context)
{
this->root_spritegroup = rti != nullptr ? rti->group[rtsg] : nullptr;
}