diff --git a/docs/landscape.html b/docs/landscape.html index 3e3d51a605..0bbc5be55a 100644 --- a/docs/landscape.html +++ b/docs/landscape.html @@ -381,6 +381,7 @@ exit towards: 47 - NE, 48 - SE, 49 - SW, 4A
  • m1: owner of the station
  • m2: index into the array of stations
  • m3 bits 0..3: track type for railway stations, must be 0 for all the other stations
  • +
  • m3 bits 4..7: persistent random data for newstations
  • m4 = custom station id; 0 means standard graphics
  • diff --git a/docs/landscape_grid.html b/docs/landscape_grid.html index f1e985eed0..8f1f507c34 100644 --- a/docs/landscape_grid.html +++ b/docs/landscape_grid.html @@ -145,7 +145,7 @@ the array so you can quickly see what is used and what is not. station XXXX XXXX XXXX XXXX XXXX XXXX - OOOO XXXX + XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX diff --git a/station_cmd.c b/station_cmd.c index 4774a30f51..8fd4d62d5d 100644 --- a/station_cmd.c +++ b/station_cmd.c @@ -1083,6 +1083,7 @@ int32 CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1, uint3 MakeRailStation(tile, st->owner, st->index, axis, *layout_ptr++, GB(p2, 0, 4)); SetCustomStationSpecIndex(tile, specindex); + SetStationTileRandomBits(tile, GB(Random(), 0, 4)); tile += tile_delta; } while (--w); diff --git a/station_map.h b/station_map.h index 847b028d8f..721d236e36 100644 --- a/station_map.h +++ b/station_map.h @@ -236,6 +236,18 @@ static inline uint GetCustomStationSpecIndex(TileIndex t) return _m[t].m4; } +static inline void SetStationTileRandomBits(TileIndex t, byte random_bits) +{ + assert(IsTileType(t, MP_STATION)); + SB(_m[t].m3, 4, 4, random_bits); +} + +static inline byte GetStationTileRandomBits(TileIndex t) +{ + assert(IsTileType(t, MP_STATION)); + return GB(_m[t].m3, 4, 4); +} + static inline void MakeStation(TileIndex t, Owner o, StationID sid, byte m5) { SetTileType(t, MP_STATION);