MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetRoadSpriteOffset

Function GetRoadSpriteOffset

src/road_cmd.cpp:1323–1342  ·  view source on GitHub ↗

* Get the sprite offset within a spritegroup. * @param slope Slope * @param bits Roadbits * @return Offset for the sprite within the spritegroup. */

Source from the content-addressed store, hash-verified

1321 * @return Offset for the sprite within the spritegroup.
1322 */
1323static uint GetRoadSpriteOffset(Slope slope, RoadBits bits)
1324{
1325 if (slope != SLOPE_FLAT) {
1326 switch (slope) {
1327 case SLOPE_NE: return 11;
1328 case SLOPE_SE: return 12;
1329 case SLOPE_SW: return 13;
1330 case SLOPE_NW: return 14;
1331 default: NOT_REACHED();
1332 }
1333 } else {
1334 static const uint offsets[] = {
1335 0, 18, 17, 7,
1336 16, 0, 10, 5,
1337 15, 8, 1, 4,
1338 9, 3, 6, 2
1339 };
1340 return offsets[bits];
1341 }
1342}
1343
1344/**
1345 * Should the road be drawn as a unpaved snow/desert road?

Callers 4

DrawRoadTypeCatenaryFunction · 0.85
DrawRoadGroundSpritesFunction · 0.85
DrawTile_RoadFunction · 0.85
DrawRoadDepotSpriteFunction · 0.85

Calls 1

NOT_REACHEDFunction · 0.85

Tested by

no test coverage detected