summaryrefslogtreecommitdiff
path: root/src/newgrf_object.h
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.h
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.h')
-rw-r--r--src/newgrf_object.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/newgrf_object.h b/src/newgrf_object.h
index 90be24042..1776b760a 100644
--- a/src/newgrf_object.h
+++ b/src/newgrf_object.h
@@ -98,9 +98,10 @@ struct ObjectSpec {
/** Object scope resolver. */
struct ObjectScopeResolver : public ScopeResolver {
- struct Object *obj; ///< The object the callback is ran for.
- TileIndex tile; ///< The tile related to the object.
- uint8 view; ///< The view of the object.
+ struct Object *obj; ///< The object the callback is ran for.
+ const ObjectSpec *spec; ///< Specification of the object type.
+ TileIndex tile; ///< The tile related to the object.
+ uint8 view; ///< The view of the object.
/**
* Constructor of an object scope resolver.
@@ -109,8 +110,8 @@ struct ObjectScopeResolver : public ScopeResolver {
* @param tile %Tile of the object.
* @param view View of the object.
*/
- ObjectScopeResolver(ResolverObject &ro, Object *obj, TileIndex tile, uint8 view = 0)
- : ScopeResolver(ro), obj(obj), tile(tile), view(view)
+ ObjectScopeResolver(ResolverObject &ro, Object *obj, const ObjectSpec *spec, TileIndex tile, uint8 view = 0)
+ : ScopeResolver(ro), obj(obj), spec(spec), tile(tile), view(view)
{
}
@@ -144,6 +145,9 @@ struct ObjectResolverObject : public ResolverObject {
}
}
+ GrfSpecFeature GetFeature() const override;
+ uint32 GetDebugID() const override;
+
private:
TownScopeResolver *GetTown();
};