(svn r4724) - Newstations: Add per-tile random data for station tiles.
authorpeter1138
Wed, 03 May 2006 21:25:49 +0000
changeset 3742 8528d7737361
parent 3741 e901ee333003
child 3743 c6efbe2e3a28
(svn r4724) - Newstations: Add per-tile random data for station tiles.
docs/landscape.html
docs/landscape_grid.html
station_cmd.c
station_map.h
--- a/docs/landscape.html	Wed May 03 21:19:21 2006 +0000
+++ b/docs/landscape.html	Wed May 03 21:25:49 2006 +0000
@@ -381,6 +381,7 @@
 <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>
--- a/docs/landscape_grid.html	Wed May 03 21:19:21 2006 +0000
+++ b/docs/landscape_grid.html	Wed May 03 21:25:49 2006 +0000
@@ -145,7 +145,7 @@
       <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>
--- a/station_cmd.c	Wed May 03 21:19:21 2006 +0000
+++ b/station_cmd.c	Wed May 03 21:25:49 2006 +0000
@@ -1083,6 +1083,7 @@
 
 				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);
--- a/station_map.h	Wed May 03 21:19:21 2006 +0000
+++ b/station_map.h	Wed May 03 21:25:49 2006 +0000
@@ -236,6 +236,18 @@
 	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);