changeset 14364:78ca677b7820 draft

(svn r18921) -Codechange: make the preconditions for Get/Set CustomStationSpecIndex a bit more strict
author yexo <yexo@openttd.org>
date Tue, 26 Jan 2010 23:03:47 +0000
parents 15f1f0c4f677
children 476512b9eefc
files src/station_cmd.cpp src/station_map.h src/waypoint_cmd.cpp
diffstat 3 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1121,7 +1121,7 @@
 
 				/* Remove animation if overbuilding */
 				DeleteAnimatedTile(tile);
-				byte old_specindex = IsTileType(tile, MP_STATION) ? GetCustomStationSpecIndex(tile) : 0;
+				byte old_specindex = HasStationTileRail(tile) ? GetCustomStationSpecIndex(tile) : 0;
 				MakeRailStation(tile, st->owner, st->index, axis, layout & ~1, rt);
 				/* Free the spec if we overbuild something */
 				DeallocateSpecFromStation(st, old_specindex);
--- a/src/station_map.h
+++ b/src/station_map.h
@@ -407,13 +407,13 @@
 
 static inline void SetCustomStationSpecIndex(TileIndex t, byte specindex)
 {
-	assert(IsTileType(t, MP_STATION));
+	assert(HasStationTileRail(t));
 	_m[t].m4 = specindex;
 }
 
 static inline uint GetCustomStationSpecIndex(TileIndex t)
 {
-	assert(IsTileType(t, MP_STATION));
+	assert(HasStationTileRail(t));
 	return _m[t].m4;
 }
 
--- a/src/waypoint_cmd.cpp
+++ b/src/waypoint_cmd.cpp
@@ -306,7 +306,7 @@
 
 		for (int i = 0; i < count; i++) {
 			TileIndex tile = start_tile + i * offset;
-			byte old_specindex = IsTileType(tile, MP_STATION) ? GetCustomStationSpecIndex(tile) : 0;
+			byte old_specindex = HasStationTileRail(tile) ? GetCustomStationSpecIndex(tile) : 0;
 			bool reserved = IsTileType(tile, MP_RAILWAY) ?
 					HasBit(GetRailReservationTrackBits(tile), AxisToTrack(axis)) :
 					HasStationReservation(tile);