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_spritegroup.h | |
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_spritegroup.h')
-rw-r--r-- | src/newgrf_spritegroup.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/newgrf_spritegroup.h b/src/newgrf_spritegroup.h index 00bfc49d0..80f70df55 100644 --- a/src/newgrf_spritegroup.h +++ b/src/newgrf_spritegroup.h @@ -56,13 +56,14 @@ extern SpriteGroupPool _spritegroup_pool; /* Common wrapper for all the different sprite group types */ struct SpriteGroup : SpriteGroupPool::PoolItem<&_spritegroup_pool> { protected: - SpriteGroup(SpriteGroupType type) : type(type) {} + SpriteGroup(SpriteGroupType type) : nfo_line(0), type(type) {} /** Base sprite group resolver */ virtual const SpriteGroup *Resolve(ResolverObject &object) const { return this; }; public: virtual ~SpriteGroup() {} + uint32 nfo_line; SpriteGroupType type; virtual SpriteID GetResult() const { return 0; } @@ -398,6 +399,18 @@ struct ResolverObject { this->used_triggers = 0; memset(this->reseed, 0, sizeof(this->reseed)); } + + /** + * Get the feature number being resolved for. + * This function is mainly intended for the callback profiling feature. + */ + virtual GrfSpecFeature GetFeature() const { return GSF_INVALID; } + /** + * Get an identifier for the item being resolved. + * This function is mainly intended for the callback profiling feature, + * and should return an identifier recognisable by the NewGRF developer. + */ + virtual uint32 GetDebugID() const { return 0; } }; #endif /* NEWGRF_SPRITEGROUP_H */ |