(svn r27984) -Codechange: Make ScopeResolver constructors/destructors inlineable. Speedup sprite resolving by about 8 percent.

This commit is contained in:
frosch
2018-03-11 13:19:41 +00:00
parent 7c406f0d9d
commit d9d669dcf8
23 changed files with 145 additions and 220 deletions

View File

@@ -26,7 +26,18 @@ struct AirportScopeResolver : public ScopeResolver {
byte layout; ///< Layout of the airport to build.
TileIndex tile; ///< Tile for the callback, only valid for airporttile callbacks.
AirportScopeResolver(ResolverObject &ro, TileIndex tile, Station *st, byte airport_id, byte layout);
/**
* Constructor of the scope resolver for an airport.
* @param ro Surrounding resolver.
* @param tile %Tile for the callback, only valid for airporttile callbacks.
* @param st %Station of the airport for which the callback is run, or \c NULL for build gui.
* @param airport_id Type of airport for which the callback is run.
* @param layout Layout of the airport to build.
*/
AirportScopeResolver(ResolverObject &ro, TileIndex tile, Station *st, byte airport_id, byte layout)
: ScopeResolver(ro), st(st), airport_id(airport_id), layout(layout), tile(tile)
{
}
/* virtual */ uint32 GetRandomBits() const;
/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
@@ -242,22 +253,6 @@ AirportResolverObject::AirportResolverObject(TileIndex tile, Station *st, byte a
this->root_spritegroup = AirportSpec::Get(airport_id)->grf_prop.spritegroup[0];
}
/**
* Constructor of the scope resolver for an airport.
* @param ro Surrounding resolver.
* @param tile %Tile for the callback, only valid for airporttile callbacks.
* @param st %Station of the airport for which the callback is run, or \c NULL for build gui.
* @param airport_id Type of airport for which the callback is run.
* @param layout Layout of the airport to build.
*/
AirportScopeResolver::AirportScopeResolver(ResolverObject &ro, TileIndex tile, Station *st, byte airport_id, byte layout) : ScopeResolver(ro)
{
this->st = st;
this->airport_id = airport_id;
this->layout = layout;
this->tile = tile;
}
SpriteID GetCustomAirportSprite(const AirportSpec *as, byte layout)
{
AirportResolverObject object(INVALID_TILE, NULL, as->GetIndex(), layout);