Loading

Paste #pj4zarksi

  1. static inline RoadTypeIdentifier GetRoadTypeRoad(TileIndex t)
  2. {
  3.     return RoadTypeIdentifier(ROADTYPE_ROAD, (RoadSubType)GB(_m[t].m4, 0, 4));
  4. }
  5.  
  6. static inline RoadTypeIdentifier GetRoadTypeTram(TileIndex t)
  7. {
  8.     return RoadTypeIdentifier(ROADTYPE_TRAM, (RoadSubType)GB(_m[t].m4, 4, 4));
  9. }
  10.  
  11. /**********************/
  12.  
  13.  
  14. struct RoadTypeIdentifiers {
  15.     RoadTypeIdentifier road_identifier = RoadTypeIdentifier(INVALID_ROADTYPE, INVALID_ROADSUBTYPE);
  16.     RoadTypeIdentifier tram_identifier = RoadTypeIdentifier(INVALID_ROADTYPE, INVALID_ROADSUBTYPE);
  17.  
  18.     RoadTypeIdentifiers(TileIndex t) {
  19.         if (GetRoadBits(t, ROADTYPE_ROAD) != ROAD_NONE) {
  20.             road_identifier = GetRoadTypeRoad(t);
  21.         }
  22.  
  23.         if (GetRoadBits(t, ROADTYPE_TRAM) != ROAD_NONE) {
  24.             road_identifier = GetRoadTypeTram(t);
  25.         }
  26.     }
  27. };

Version history

Revision # Author Created at
padmgkfwe Anonymous 11 Oct 2016, 11:30:46 UTC Diff

Comments