@@ -84,12 +84,20 @@ static inline void NewRailTypeResolver(R
res->last_value = 0;
res->trigger = 0;
res->reseed = 0;
res->count = 0;
}
/**
* Get the sprite to draw for the given tile.
* @param rti The rail type data (spec).
* @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?
* @return The sprite to draw.
*/
SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context)
{
assert(rtsg < RTSG_END);
if (rti->group[rtsg] == NULL) return 0;
@@ -101,12 +109,18 @@ SpriteID GetCustomRailSprite(const Railt
group = SpriteGroup::Resolve(rti->group[rtsg], &object);
if (group == NULL || group->GetNumResults() == 0) return 0;
return group->GetResult();
* Perform a reverse railtype lookup to get the GRF internal ID.
* @param railtype The global (OpenTTD) railtype.
* @param grffile The GRF to do the lookup for.
* @return the GRF internal ID.
uint8 GetReverseRailTypeTranslation(RailType railtype, const GRFFile *grffile)
/* No rail type table present, return rail type as-is */
if (grffile == NULL || grffile->railtype_max == 0) return railtype;
/* Look for a matching rail type label in the table */