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/spritecache.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/spritecache.cpp')
-rw-r--r-- | src/spritecache.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/spritecache.cpp b/src/spritecache.cpp index f36354c01..da0ca8048 100644 --- a/src/spritecache.cpp +++ b/src/spritecache.cpp @@ -146,6 +146,17 @@ uint GetOriginFileSlot(SpriteID sprite) } /** + * Get the GRF-local sprite id of a given sprite. + * @param sprite The sprite to look at. + * @return The GRF-local sprite id. + */ +uint32 GetSpriteLocalID(SpriteID sprite) +{ + if (!SpriteExists(sprite)) return 0; + return GetSpriteCache(sprite)->id; +} + +/** * Count the sprites which originate from a specific file slot in a range of SpriteIDs. * @param file_slot FIOS file slot. * @param begin First sprite in range. |