summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-05-03 21:25:49 +0000
committerpeter1138 <peter1138@openttd.org>2006-05-03 21:25:49 +0000
commit530b4136126459729362a720142b27b77b72172b (patch)
tree610a090dee03a33a26b6d42df03a3fd21128d3a5
parentbe5744ae508c1ad7baf6158d95a7a27d52656ac2 (diff)
downloadopenttd-530b4136126459729362a720142b27b77b72172b.tar.xz
(svn r4724) - Newstations: Add per-tile random data for station tiles.
-rw-r--r--docs/landscape.html1
-rw-r--r--docs/landscape_grid.html2
-rw-r--r--station_cmd.c1
-rw-r--r--station_map.h12
4 files changed, 15 insertions, 1 deletions
diff --git a/docs/landscape.html b/docs/landscape.html
index 3e3d51a60..0bbc5be55 100644
--- a/docs/landscape.html
+++ b/docs/landscape.html
@@ -381,6 +381,7 @@ exit towards: <tt>47</tt> - NE, <tt>48</tt> - SE, <tt>49</tt> - SW, <tt>4A</tt>
<li>m1: <a href="#OwnershipInfo">owner</a> of the station</li>
<li>m2: index into the <a href="#_StationArray">array of stations</a></li>
<li>m3 bits 0..3: <a href="#TrackType">track type</a> for railway stations, must be 0 for all the other stations</li>
+<li>m3 bits 4..7: persistent random data for newstations</li>
<li>m4 = custom station id; 0 means standard graphics</li>
</ul>
</td></tr>
diff --git a/docs/landscape_grid.html b/docs/landscape_grid.html
index f1e985eed..8f1f507c3 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.
<td class="caption">station</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XXXX XXXX XXXX XXXX</td>
- <td class="bits"><span class="free">OOOO</span> XXXX</td>
+ <td class="bits">XXXX XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XXXX XXXX</td>
<td class="bits">XXXX XXXX</td>
diff --git a/station_cmd.c b/station_cmd.c
index 4774a30f5..8fd4d62d5 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 847b028d8..721d236e3 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);