summaryrefslogtreecommitdiff
path: root/src/newgrf_object.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_object.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_object.cpp')
-rw-r--r--src/newgrf_object.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp
index 34e18c43a..8827245d3 100644
--- a/src/newgrf_object.cpp
+++ b/src/newgrf_object.cpp
@@ -352,7 +352,7 @@ unhandled:
*/
ObjectResolverObject::ObjectResolverObject(const ObjectSpec *spec, Object *obj, TileIndex tile, uint8 view,
CallbackID callback, uint32 param1, uint32 param2)
- : ResolverObject(spec->grf_prop.grffile, callback, param1, param2), object_scope(*this, obj, tile, view)
+ : ResolverObject(spec->grf_prop.grffile, callback, param1, param2), object_scope(*this, obj, spec, tile, view)
{
this->town_scope = nullptr;
this->root_spritegroup = (obj == nullptr && spec->grf_prop.spritegroup[CT_PURCHASE_OBJECT] != nullptr) ?
@@ -384,6 +384,16 @@ TownScopeResolver *ObjectResolverObject::GetTown()
return this->town_scope;
}
+GrfSpecFeature ObjectResolverObject::GetFeature() const
+{
+ return GSF_OBJECTS;
+}
+
+uint32 ObjectResolverObject::GetDebugID() const
+{
+ return this->object_scope.spec->grf_prop.local_id;
+}
+
/**
* Perform a callback for an object.
* @param callback The callback to perform.