(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

@@ -288,8 +288,8 @@ struct IndustryProductionSpriteGroup : SpriteGroup {
struct ScopeResolver {
ResolverObject &ro; ///< Surrounding resolver object.
ScopeResolver(ResolverObject &ro);
virtual ~ScopeResolver();
ScopeResolver(ResolverObject &ro) : ro(ro) {}
virtual ~ScopeResolver() {}
virtual uint32 GetRandomBits() const;
virtual uint32 GetTriggers() const;
@@ -305,8 +305,20 @@ struct ScopeResolver {
* to get the results of callbacks, rerandomisations or normal sprite lookups.
*/
struct ResolverObject {
ResolverObject(const GRFFile *grffile, CallbackID callback = CBID_NO_CALLBACK, uint32 callback_param1 = 0, uint32 callback_param2 = 0);
virtual ~ResolverObject();
/**
* Resolver constructor.
* @param grffile NewGRF file associated with the object (or \c NULL if none).
* @param callback Callback code being resolved (default value is #CBID_NO_CALLBACK).
* @param callback_param1 First parameter (var 10) of the callback (only used when \a callback is also set).
* @param callback_param2 Second parameter (var 18) of the callback (only used when \a callback is also set).
*/
ResolverObject(const GRFFile *grffile, CallbackID callback = CBID_NO_CALLBACK, uint32 callback_param1 = 0, uint32 callback_param2 = 0)
: default_scope(*this), callback(callback), callback_param1(callback_param1), callback_param2(callback_param2), grffile(grffile), root_spritegroup(NULL)
{
this->ResetState();
}
virtual ~ResolverObject() {}
ScopeResolver default_scope; ///< Default implementation of the grf scope.