diff options
-rw-r--r-- | src/newgrf_railtype.cpp | 5 | ||||
-rw-r--r-- | src/newgrf_railtype.h | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/newgrf_railtype.cpp b/src/newgrf_railtype.cpp index 872a3a7f6..8a074db97 100644 --- a/src/newgrf_railtype.cpp +++ b/src/newgrf_railtype.cpp @@ -100,9 +100,10 @@ RailTypeResolverObject::RailTypeResolverObject(const RailtypeInfo *rti, TileInde * @param tile The tile to get the sprite for. * @param rtsg The type of sprite to draw. * @param content Where are we drawing the tile? + * @param [out] num_results If not NULL, return the number of sprites in the spriteset. * @return The sprite to draw. */ -SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context) +SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context, uint *num_results) { assert(rtsg < RTSG_END); @@ -112,6 +113,8 @@ SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSp const SpriteGroup *group = object.Resolve(); if (group == NULL || group->GetNumResults() == 0) return 0; + if (num_results) *num_results = group->GetNumResults(); + return group->GetResult(); } diff --git a/src/newgrf_railtype.h b/src/newgrf_railtype.h index 9b00bf5bf..4c68e7d1d 100644 --- a/src/newgrf_railtype.h +++ b/src/newgrf_railtype.h @@ -44,7 +44,7 @@ struct RailTypeResolverObject : public ResolverObject { /* virtual */ const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const; }; -SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context = TCX_NORMAL); +SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context = TCX_NORMAL, uint *num_results = NULL); SpriteID GetCustomSignalSprite(const RailtypeInfo *rti, TileIndex tile, SignalType type, SignalVariant var, SignalState state, bool gui = false); uint8 GetReverseRailTypeTranslation(RailType railtype, const GRFFile *grffile); |