diff options
author | alberth <alberth@openttd.org> | 2012-11-10 20:41:45 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2012-11-10 20:41:45 +0000 |
commit | 82e6001451f0dcfd5f85427a1f3a843656292f1e (patch) | |
tree | 1dc33da7c37b360fb225cd9086463c24bd538b55 /src/newgrf_railtype.h | |
parent | c417efc962a2d452bf52842b615bf3e09ecef7d6 (diff) | |
download | openttd-82e6001451f0dcfd5f85427a1f3a843656292f1e.tar.xz |
(svn r24685) -Codechange: Add resolver classes for rail types.
Diffstat (limited to 'src/newgrf_railtype.h')
-rw-r--r-- | src/newgrf_railtype.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/newgrf_railtype.h b/src/newgrf_railtype.h index 5b3baf0f3..93677f58d 100644 --- a/src/newgrf_railtype.h +++ b/src/newgrf_railtype.h @@ -14,6 +14,35 @@ #include "rail.h" #include "newgrf_commons.h" +#include "newgrf_spritegroup.h" + + +struct RailTypeScopeResolver : public ScopeResolver { + TileIndex tile; ///< Tracktile. For track on a bridge this is the southern bridgehead. + TileContext context; ///< Are we resolving sprites for the upper halftile, or on a bridge? + + RailTypeScopeResolver(ResolverObject *ro, TileIndex tile, TileContext context); + + /* virtual */ uint32 GetRandomBits() const; + /* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const; +}; + +/** Resolver object for rail types. */ +struct RailTypeResolverObject : public ResolverObject { + RailTypeScopeResolver railtype_scope; + + RailTypeResolverObject(TileIndex tile, TileContext context, const GRFFile *grffile, uint32 param1 = 0, uint32 param2 = 0); + + /* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0) + { + switch (scope) { + case VSG_SCOPE_SELF: return &this->railtype_scope; + default: return &this->default_scope; // XXX ResolverObject::GetScope(scope, relative); + } + } + + /* virtual */ const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const; +}; SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context = TCX_NORMAL); SpriteID GetCustomSignalSprite(const RailtypeInfo *rti, TileIndex tile, SignalType type, SignalVariant var, SignalState state, bool gui = false); |