1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-26 16:09:10 +00:00

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.
This commit is contained in:
Niels Martin Hansen
2020-01-26 13:45:51 +01:00
committed by GitHub
parent f88ac83408
commit c8779fb311
40 changed files with 691 additions and 20 deletions

View File

@@ -145,6 +145,17 @@ uint GetOriginFileSlot(SpriteID sprite)
return GetSpriteCache(sprite)->file_slot;
}
/**
* 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.