Changeset - r3766:1027557fc8c9
[Not reviewed]
master
0 4 0
peter1138 - 18 years ago 2006-05-06 22:08:14
peter1138@openttd.org
(svn r4758) - Newstations: add support for 'blocked' station tiles, which no train can pass.
4 files changed with 26 insertions and 1 deletions:
0 comments (0 inline, 0 general)
newgrf_station.c
Show inline comments
 
@@ -640,3 +640,22 @@ bool DrawStationTile(int x, int y, RailT
 
	return true;
 
}
 

	
 
/* Check if a rail station tile is traversable.
 
 * XXX This could be cached (during build) in the map array to save on all the dereferencing */
 
bool IsStationTileBlocked(TileIndex tile)
 
{
 
	const Station *st;
 
	const StationSpec *statspec;
 
	uint specindex;
 

	
 
	if (!IsCustomStationSpecIndex(tile)) return false;
 

	
 
	st = GetStationByTile(tile);
 
	specindex = GetCustomStationSpecIndex(tile);
 
	if (specindex >= st->num_specs) return false;
 

	
 
	statspec = st->speclist[specindex].spec;
 
	if (statspec == NULL) return false;
 

	
 
	return HASBIT(statspec->blocked, GetStationGfx(tile));
 
}
newgrf_station.h
Show inline comments
 
@@ -102,6 +102,9 @@ const StationSpec *GetCustomStationSpecB
 
SpriteID GetCustomStationRelocation(const StationSpec *statspec, const Station *st, TileIndex tile);
 
uint16 GetStationCallback(uint16 callback, uint32 param1, uint32 param2, const StationSpec *statspec, const Station *st, TileIndex tile);
 

	
 
/* Check if a rail station tile is traversable. */
 
bool IsStationTileBlocked(TileIndex tile);
 

	
 
/* Allocate a StationSpec to a Station. This is called once per build operation. */
 
int AllocateSpecToStation(const StationSpec *statspec, Station *st, bool exec);
 

	
station_cmd.c
Show inline comments
 
@@ -2124,6 +2124,8 @@ static uint32 GetTileTrackStatus_Station
 
	switch (mode) {
 
		case TRANSPORT_RAIL:
 
			if (IsRailwayStation(tile)) {
 
				if (IsStationTileBlocked(tile)) return 0;
 

	
 
				return TrackToTrackBits(GetRailStationTrack(tile)) * 0x101;
 
			}
 
			break;
station_map.h
Show inline comments
 
@@ -187,7 +187,8 @@ static inline bool IsCompatibleTrainStat
 
	return
 
		IsRailwayStationTile(t1) &&
 
		IsCompatibleRail(GetRailType(t1), GetRailType(t2)) &&
 
		GetRailStationAxis(t1) == GetRailStationAxis(t2);
 
		GetRailStationAxis(t1) == GetRailStationAxis(t2) &&
 
		!IsStationTileBlocked(t1);
 
}
 

	
 

	
0 comments (0 inline, 0 general)