summaryrefslogtreecommitdiff
path: root/rail_cmd.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2005-11-16 22:20:15 +0000
committerpeter1138 <peter1138@openttd.org>2005-11-16 22:20:15 +0000
commit754d26407e8cda101f04c93a94c60bc0625f540c (patch)
tree981b72e2eee14dca280a68f1b688ab83202c9f73 /rail_cmd.c
parent5cb9de35d114cf1f7b92945924c9fc05fa117d47 (diff)
downloadopenttd-754d26407e8cda101f04c93a94c60bc0625f540c.tar.xz
(svn r3212) - Waypoints/Depots: Store waypoint index in m2 for waypoints. This moves the ground type bits from m2 to m4 for waypoints and depots (leaving room for depot index in m2 in future), and moves the custom graphics ID to the waypoint struct.
- Waypoints: Until now stat_id was saved but never assigned to. Instead we now save the GRFID/local index of the custom graphics so that GRF file changes can leave graphics intact.
Diffstat (limited to 'rail_cmd.c')
-rw-r--r--rail_cmd.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/rail_cmd.c b/rail_cmd.c
index 18e0a7481..7a7bd68c8 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -1493,7 +1493,8 @@ static void DrawTile_Track(TileInfo *ti)
if (IsRailWaypoint(ti->tile) && HASBIT(_m[ti->tile].m3, 4)) {
// look for customization
- const StationSpec *stat = GetCustomStation(STAT_CLASS_WAYP, _m[ti->tile].m4 + 1);
+ byte stat_id = GetWaypointByTile(ti->tile)->stat_id;
+ const StationSpec *stat = GetCustomStation(STAT_CLASS_WAYP, stat_id);
if (stat != NULL) {
DrawTileSeqStruct const *seq;
@@ -1535,7 +1536,7 @@ static void DrawTile_Track(TileInfo *ti)
// adjust ground tile for desert
// (don't adjust for arctic depots, because snow in depots looks weird)
// type >= 4 means waypoints
- if ((_m[ti->tile].m2 & RAIL_MAP2LO_GROUND_MASK) == RAIL_GROUND_ICE_DESERT && (_opt.landscape == LT_DESERT || type >= 4)) {
+ if ((_m[ti->tile].m4 & RAIL_MAP2LO_GROUND_MASK) == RAIL_GROUND_ICE_DESERT && (_opt.landscape == LT_DESERT || type >= 4)) {
if (image != SPR_FLAT_GRASS_TILE) {
image += rti->snow_offset; // tile with tracks
} else {
@@ -1974,7 +1975,7 @@ static void TileLoop_Track(TileIndex tile)
byte new_ground;
TrackBits rail;
- old_ground = GB(_m[tile].m2, 0, 4);
+ old_ground = _m[tile].m5 & RAIL_TYPE_SPECIAL ? GB(_m[tile].m4, 0, 4) : GB(_m[tile].m2, 0, 4);
switch (_opt.landscape) {
case LT_HILLY:
@@ -2045,7 +2046,11 @@ static void TileLoop_Track(TileIndex tile)
modify_me:;
/* tile changed? */
if (old_ground != new_ground) {
- SB(_m[tile].m2, 0, 4, new_ground);
+ if (_m[tile].m5 & RAIL_TYPE_SPECIAL) {
+ SB(_m[tile].m4, 0, 4, new_ground);
+ } else {
+ SB(_m[tile].m2, 0, 4, new_ground);
+ }
MarkTileDirtyByTile(tile);
}
}