mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-12 01:24:54 +00:00
(svn r27342) -Add: Optionally return the number of sprites in the spriteset from GetCustomRailSprite.
This commit is contained in:
parent
a81968d0f3
commit
574b981e33
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user