(svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
This commit is contained in:
		| @@ -2184,7 +2184,7 @@ static bool AiRemoveTileAndGoForward(Player *p) | ||||
|  | ||||
| 	// Then remove and signals if there are any. | ||||
| 	if (IsTileType(tile, MP_RAILWAY) && | ||||
| 			GetRailTileType(tile) == RAIL_TYPE_SIGNALS) { | ||||
| 			GetRailTileType(tile) == RAIL_TILE_SIGNALS) { | ||||
| 		DoCommand(tile, 0, 0, DC_EXEC, CMD_REMOVE_SIGNALS); | ||||
| 	} | ||||
|  | ||||
|   | ||||
							
								
								
									
										6
									
								
								elrail.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								elrail.c
									
									
									
									
									
								
							| @@ -76,9 +76,9 @@ static TrackBits GetRailTrackBitsUniversal(TileIndex t, byte *override) | ||||
| 		case MP_RAILWAY: | ||||
| 			if (GetRailType(t) != RAILTYPE_ELECTRIC) return 0; | ||||
| 			switch (GetRailTileType(t)) { | ||||
| 				case RAIL_TYPE_NORMAL: case RAIL_TYPE_SIGNALS: | ||||
| 				case RAIL_TILE_NORMAL: case RAIL_TILE_SIGNALS: | ||||
| 					return GetTrackBits(t); | ||||
| 				case RAIL_TYPE_DEPOT_WAYPOINT: | ||||
| 				case RAIL_TILE_DEPOT_WAYPOINT: | ||||
| 					if (GetRailTileSubtype(t) == RAIL_SUBTYPE_WAYPOINT) return GetRailWaypointBits(t); | ||||
| 				default: | ||||
| 					return 0; | ||||
| @@ -346,7 +346,7 @@ void DrawCatenary(const TileInfo *ti) | ||||
| { | ||||
| 	switch (GetTileType(ti->tile)) { | ||||
| 		case MP_RAILWAY: | ||||
| 			if (GetRailTileType(ti->tile) == RAIL_TYPE_DEPOT_WAYPOINT && GetRailTileSubtype(ti->tile) == RAIL_SUBTYPE_DEPOT) { | ||||
| 			if (GetRailTileType(ti->tile) == RAIL_TILE_DEPOT_WAYPOINT && GetRailTileSubtype(ti->tile) == RAIL_SUBTYPE_DEPOT) { | ||||
| 				const SortableSpriteStruct *sss = &CatenarySpriteData[WIRE_DEPOT_SW + ReverseDiagDir(GetRailDepotDirection(ti->tile))]; | ||||
| 				AddSortableSpriteToDraw( sss->image, ti->x + sss->x_offset, ti->y + sss->y_offset, | ||||
| 					sss->x_size, sss->y_size, sss->z_size, GetSlopeZ(ti->x, ti->y) + sss->z_offset); | ||||
|   | ||||
| @@ -253,7 +253,7 @@ static TileIndex FindRailStationEnd(TileIndex tile, TileIndexDiff delta, bool ch | ||||
|  | ||||
| 		if (waypoint) { | ||||
| 			if (!IsTileType(new_tile, MP_RAILWAY)) break; | ||||
| 			if (GetRailTileType(new_tile) != RAIL_TYPE_DEPOT_WAYPOINT) break; | ||||
| 			if (GetRailTileType(new_tile) != RAIL_TILE_DEPOT_WAYPOINT) break; | ||||
| 			if (GetRailTileSubtype(new_tile) != RAIL_SUBTYPE_WAYPOINT) break; | ||||
| 			if (check_axis && GetWaypointAxis(new_tile) != orig_axis) break; | ||||
| 		} else { | ||||
|   | ||||
							
								
								
									
										2
									
								
								npf.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								npf.c
									
									
									
									
									
								
							| @@ -625,7 +625,7 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current) | ||||
| 		DEBUG(npf, 5)("Expanded into trackdir: %d, remaining trackdirs: 0x%X", dst_trackdir, trackdirbits); | ||||
|  | ||||
| 		/* Check for oneway signal against us */ | ||||
| 		if (IsTileType(dst_tile, MP_RAILWAY) && GetRailTileType(dst_tile) == RAIL_TYPE_SIGNALS) { | ||||
| 		if (IsTileType(dst_tile, MP_RAILWAY) && GetRailTileType(dst_tile) == RAIL_TILE_SIGNALS) { | ||||
| 			if (HasSignalOnTrackdir(dst_tile, ReverseTrackdir(dst_trackdir)) && !HasSignalOnTrackdir(dst_tile, dst_trackdir)) | ||||
| 				// if one way signal not pointing towards us, stop going in this direction. | ||||
| 				break; | ||||
|   | ||||
| @@ -1523,7 +1523,7 @@ static bool LoadOldMain(LoadgameState *ls) | ||||
| 	for (i = 0; i < OLD_MAP_SIZE; i ++) { | ||||
| 		if (IsTileType(i, MP_RAILWAY)) { | ||||
| 			/* We save presignals different from TTDPatch, convert them */ | ||||
| 			if (GetRailTileType(i) == RAIL_TYPE_SIGNALS) { | ||||
| 			if (GetRailTileType(i) == RAIL_TILE_SIGNALS) { | ||||
| 				/* This byte is always zero in TTD for this type of tile */ | ||||
| 				if (_m[i].m4) /* Convert the presignals to our own format */ | ||||
| 					_m[i].m4 = (_m[i].m4 >> 1) & 7; | ||||
|   | ||||
| @@ -200,7 +200,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile) | ||||
| 		switch (GetTileType(tile)) { | ||||
| 		case MP_RAILWAY: | ||||
| 			if (v->type == VEH_Train && IsTileOwner(tile, _local_player)) { | ||||
| 				if (GetRailTileType(tile) == RAIL_TYPE_DEPOT_WAYPOINT && | ||||
| 				if (GetRailTileType(tile) == RAIL_TILE_DEPOT_WAYPOINT && | ||||
| 						GetRailTileSubtype(tile) == RAIL_SUBTYPE_DEPOT) { | ||||
| 					order.type = OT_GOTO_DEPOT; | ||||
| 					order.flags = OF_PART_OF_ORDERS; | ||||
|   | ||||
							
								
								
									
										4
									
								
								rail.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								rail.h
									
									
									
									
									
								
							| @@ -337,7 +337,7 @@ static inline bool HasSignalOnTrack(TileIndex tile, Track track) | ||||
| { | ||||
| 	assert(IsValidTrack(track)); | ||||
| 	return | ||||
| 		GetRailTileType(tile) == RAIL_TYPE_SIGNALS && | ||||
| 		GetRailTileType(tile) == RAIL_TILE_SIGNALS && | ||||
| 		(_m[tile].m3 & SignalOnTrack(track)) != 0; | ||||
| } | ||||
|  | ||||
| @@ -352,7 +352,7 @@ static inline bool HasSignalOnTrackdir(TileIndex tile, Trackdir trackdir) | ||||
| { | ||||
| 	assert (IsValidTrackdir(trackdir)); | ||||
| 	return | ||||
| 		GetRailTileType(tile) == RAIL_TYPE_SIGNALS && | ||||
| 		GetRailTileType(tile) == RAIL_TILE_SIGNALS && | ||||
| 		_m[tile].m3 & SignalAlongTrackdir(trackdir); | ||||
| } | ||||
|  | ||||
|   | ||||
							
								
								
									
										42
									
								
								rail_cmd.c
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								rail_cmd.c
									
									
									
									
									
								
							| @@ -77,7 +77,7 @@ static bool CheckTrackCombination(TileIndex tile, TrackBits to_build, uint flags | ||||
| 	TrackBits future; /* The track layout we want to build */ | ||||
| 	_error_message = STR_1001_IMPOSSIBLE_TRACK_COMBINATION; | ||||
|  | ||||
| 	if (type != RAIL_TYPE_NORMAL && type != RAIL_TYPE_SIGNALS) | ||||
| 	if (type != RAIL_TILE_NORMAL && type != RAIL_TILE_SIGNALS) | ||||
| 		return false; /* Cannot build anything on depots and checkpoints */ | ||||
|  | ||||
| 	/* So, we have a tile with tracks on it (and possibly signals). Let's see | ||||
| @@ -93,7 +93,7 @@ static bool CheckTrackCombination(TileIndex tile, TrackBits to_build, uint flags | ||||
| 	} | ||||
|  | ||||
| 	/* Let's see if we may build this */ | ||||
| 	if ((flags & DC_NO_RAIL_OVERLAP) || type == RAIL_TYPE_SIGNALS) { | ||||
| 	if ((flags & DC_NO_RAIL_OVERLAP) || type == RAIL_TILE_SIGNALS) { | ||||
| 		/* If we are not allowed to overlap (flag is on for ai players or we have | ||||
| 		 * signals on the tile), check that */ | ||||
| 		return future == TRACK_BIT_HORZ || future == TRACK_BIT_VERT; | ||||
| @@ -261,7 +261,7 @@ int32 CmdBuildSingleRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) | ||||
| 					!EnsureNoVehicle(tile)) { | ||||
| 				return CMD_ERROR; | ||||
| 			} | ||||
| 			if (GetRailTileType(tile) == RAIL_TYPE_DEPOT_WAYPOINT || | ||||
| 			if (GetRailTileType(tile) == RAIL_TILE_DEPOT_WAYPOINT || | ||||
| 					!IsTileOwner(tile, _current_player) || | ||||
| 					GetRailType(tile) != p1) { | ||||
| 				// Get detailed error message | ||||
| @@ -666,9 +666,9 @@ int32 CmdBuildSingleSignal(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) | ||||
| 	} | ||||
|  | ||||
| 	if (flags & DC_EXEC) { | ||||
| 		if (GetRailTileType(tile) != RAIL_TYPE_SIGNALS) { | ||||
| 		if (GetRailTileType(tile) != RAIL_TILE_SIGNALS) { | ||||
| 			// there are no signals at all on this tile yet | ||||
| 			_m[tile].m5 |= RAIL_TYPE_SIGNALS; // change into signals | ||||
| 			_m[tile].m5 |= RAIL_TILE_SIGNALS; // change into signals | ||||
| 			_m[tile].m2 |= 0xF0;              // all signals are on | ||||
| 			_m[tile].m3 &= ~0xF0;          // no signals built by default | ||||
| 			SetSignalType(tile, SIGTYPE_NORMAL); | ||||
| @@ -744,7 +744,7 @@ static int32 CmdSignalTrackHelper(TileIndex tile, uint32 flags, uint32 p1, uint3 | ||||
| 	track = TrackdirToTrack(trackdir); /* trackdir might have changed, keep track in sync */ | ||||
|  | ||||
| 	// copy the signal-style of the first rail-piece if existing | ||||
| 	if (GetRailTileType(tile) == RAIL_TYPE_SIGNALS && GetTrackBits(tile) != 0) { /* XXX: GetTrackBits check useless? */ | ||||
| 	if (GetRailTileType(tile) == RAIL_TILE_SIGNALS && GetTrackBits(tile) != 0) { /* XXX: GetTrackBits check useless? */ | ||||
| 		signals = _m[tile].m3 & SignalOnTrack(track); | ||||
| 		if (signals == 0) signals = SignalOnTrack(track); /* Can this actually occur? */ | ||||
|  | ||||
| @@ -825,7 +825,7 @@ int32 CmdRemoveSingleSignal(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) | ||||
| 		/* removed last signal from tile? */ | ||||
| 		if (GB(_m[tile].m3, 4, 4) == 0) { | ||||
| 			SB(_m[tile].m2, 4, 4, 0); | ||||
| 			SB(_m[tile].m5, 6, 2, RAIL_TYPE_NORMAL >> 6); // XXX >> because the constant is meant for direct application, not use with SB | ||||
| 			SB(_m[tile].m5, 6, 2, RAIL_TILE_NORMAL >> 6); // XXX >> because the constant is meant for direct application, not use with SB | ||||
| 			SetSignalVariant(tile, SIG_ELECTRIC); // remove any possible semaphores | ||||
| 		} | ||||
|  | ||||
| @@ -957,7 +957,7 @@ static int32 ClearTile_Track(TileIndex tile, byte flags) | ||||
| 	m5 = _m[tile].m5; | ||||
|  | ||||
| 	if (flags & DC_AUTO) { | ||||
| 		if (GetRailTileType(tile) == RAIL_TYPE_DEPOT_WAYPOINT) { | ||||
| 		if (GetRailTileType(tile) == RAIL_TILE_DEPOT_WAYPOINT) { | ||||
| 			return_cmd_error(STR_2004_BUILDING_MUST_BE_DEMOLISHED); | ||||
| 		} | ||||
|  | ||||
| @@ -971,7 +971,7 @@ static int32 ClearTile_Track(TileIndex tile, byte flags) | ||||
|  | ||||
| 	switch (GetRailTileType(tile)) { | ||||
| 		/* XXX: Why the fuck do we remove these thow signals first? */ | ||||
| 		case RAIL_TYPE_SIGNALS: | ||||
| 		case RAIL_TILE_SIGNALS: | ||||
| 			if (HasSignalOnTrack(tile, TRACK_X)) { | ||||
| 				ret = DoCommand(tile, TRACK_X, 0, flags, CMD_REMOVE_SIGNALS); | ||||
| 				if (CmdFailed(ret)) return CMD_ERROR; | ||||
| @@ -990,7 +990,7 @@ static int32 ClearTile_Track(TileIndex tile, byte flags) | ||||
| 			} | ||||
| 			/* FALLTHROUGH */ | ||||
|  | ||||
| 		case RAIL_TYPE_NORMAL: { | ||||
| 		case RAIL_TILE_NORMAL: { | ||||
| 			uint i; | ||||
|  | ||||
| 			for (i = 0; m5 != 0; i++, m5 >>= 1) { | ||||
| @@ -1003,7 +1003,7 @@ static int32 ClearTile_Track(TileIndex tile, byte flags) | ||||
| 			return cost; | ||||
| 		} | ||||
|  | ||||
| 		case RAIL_TYPE_DEPOT_WAYPOINT: | ||||
| 		case RAIL_TILE_DEPOT_WAYPOINT: | ||||
| 			if (GetRailTileSubtype(tile) == RAIL_SUBTYPE_DEPOT) { | ||||
| 				return RemoveTrainDepot(tile, flags); | ||||
| 			} else { | ||||
| @@ -1298,7 +1298,7 @@ static void DrawTile_Track(TileInfo *ti) | ||||
|  | ||||
| 	_drawtile_track_palette = SPRITE_PALETTE(PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile))); | ||||
|  | ||||
| 	if (GetRailTileType(ti->tile) != RAIL_TYPE_DEPOT_WAYPOINT) { | ||||
| 	if (GetRailTileType(ti->tile) != RAIL_TILE_DEPOT_WAYPOINT) { | ||||
| 		TrackBits rails = GetTrackBits(ti->tile); | ||||
|  | ||||
| 		DrawTrackBits(ti, rails, false); | ||||
| @@ -1306,7 +1306,7 @@ static void DrawTile_Track(TileInfo *ti) | ||||
| 		if (_display_opt & DO_FULL_DETAIL) _detailed_track_proc[GetRailGroundType(ti->tile)](ti); | ||||
|  | ||||
| 		/* draw signals also? */ | ||||
| 		if (GetRailTileType(ti->tile) == RAIL_TYPE_SIGNALS) DrawSignals(ti->tile, rails); | ||||
| 		if (GetRailTileType(ti->tile) == RAIL_TILE_SIGNALS) DrawSignals(ti->tile, rails); | ||||
|  | ||||
| 	} else { | ||||
| 		/* draw depots / waypoints */ | ||||
| @@ -1717,7 +1717,7 @@ static uint GetSlopeZ_Track(const TileInfo* ti) | ||||
| 	uint z = ti->z; | ||||
|  | ||||
| 	if (tileh == SLOPE_FLAT) return z; | ||||
| 	if (GetRailTileType(ti->tile) == RAIL_TYPE_DEPOT_WAYPOINT) { | ||||
| 	if (GetRailTileType(ti->tile) == RAIL_TILE_DEPOT_WAYPOINT) { | ||||
| 		return z + TILE_HEIGHT; | ||||
| 	} else { | ||||
| 		uint f = GetRailFoundation(ti->tileh, GetTrackBits(ti->tile)); | ||||
| @@ -1733,7 +1733,7 @@ static uint GetSlopeZ_Track(const TileInfo* ti) | ||||
| static Slope GetSlopeTileh_Track(TileIndex tile, Slope tileh) | ||||
| { | ||||
| 	if (tileh == SLOPE_FLAT) return SLOPE_FLAT; | ||||
| 	if (GetRailTileType(tile) == RAIL_TYPE_DEPOT_WAYPOINT) { | ||||
| 	if (GetRailTileType(tile) == RAIL_TILE_DEPOT_WAYPOINT) { | ||||
| 		return SLOPE_FLAT; | ||||
| 	} else { | ||||
| 		uint f = GetRailFoundation(tileh, GetTrackBits(tile)); | ||||
| @@ -1784,7 +1784,7 @@ static void TileLoop_Track(TileIndex tile) | ||||
| 	if (quick_return) return; | ||||
|  | ||||
| 	// Don't continue tile loop for depots | ||||
| 	if (GetRailTileType(tile) == RAIL_TYPE_DEPOT_WAYPOINT) return; | ||||
| 	if (GetRailTileType(tile) == RAIL_TILE_DEPOT_WAYPOINT) return; | ||||
|  | ||||
| 	new_ground = RAIL_GROUND_GRASS; | ||||
|  | ||||
| @@ -1881,11 +1881,11 @@ static uint32 GetTileTrackStatus_Track(TileIndex tile, TransportType mode) | ||||
|  | ||||
| 	if (mode != TRANSPORT_RAIL) return 0; | ||||
|  | ||||
| 	if (GetRailTileType(tile) != RAIL_TYPE_DEPOT_WAYPOINT) { | ||||
| 	if (GetRailTileType(tile) != RAIL_TILE_DEPOT_WAYPOINT) { | ||||
| 		TrackBits rails = GetTrackBits(tile); | ||||
| 		uint32 ret = rails * 0x101; | ||||
|  | ||||
| 		if (GetRailTileType(tile) != RAIL_TYPE_SIGNALS) { | ||||
| 		if (GetRailTileType(tile) != RAIL_TILE_SIGNALS) { | ||||
| 			if (rails == TRACK_BIT_CROSS) ret |= 0x40; | ||||
| 		} else { | ||||
| 			/* has_signals */ | ||||
| @@ -1930,11 +1930,11 @@ static void GetTileDesc_Track(TileIndex tile, TileDesc *td) | ||||
| { | ||||
| 	td->owner = GetTileOwner(tile); | ||||
| 	switch (GetRailTileType(tile)) { | ||||
| 		case RAIL_TYPE_NORMAL: | ||||
| 		case RAIL_TILE_NORMAL: | ||||
| 			td->str = STR_1021_RAILROAD_TRACK; | ||||
| 			break; | ||||
|  | ||||
| 		case RAIL_TYPE_SIGNALS: { | ||||
| 		case RAIL_TILE_SIGNALS: { | ||||
| 			const StringID signal_type[] = { | ||||
| 				STR_RAILROAD_TRACK_WITH_NORMAL_SIGNALS, | ||||
| 				STR_RAILROAD_TRACK_WITH_PRESIGNALS, | ||||
| @@ -1946,7 +1946,7 @@ static void GetTileDesc_Track(TileIndex tile, TileDesc *td) | ||||
| 			break; | ||||
| 		} | ||||
|  | ||||
| 		case RAIL_TYPE_DEPOT_WAYPOINT: | ||||
| 		case RAIL_TILE_DEPOT_WAYPOINT: | ||||
| 		default: | ||||
| 			td->str = (GetRailTileSubtype(tile) == RAIL_SUBTYPE_DEPOT) ? | ||||
| 				STR_1023_RAILROAD_TRAIN_DEPOT : STR_LANDINFO_WAYPOINT; | ||||
|   | ||||
| @@ -90,7 +90,7 @@ static void PlaceRail_AutoRail(TileIndex tile) | ||||
|  | ||||
| static void PlaceExtraDepotRail(TileIndex tile, uint16 extra) | ||||
| { | ||||
| 	if (GetRailTileType(tile) != RAIL_TYPE_NORMAL) return; | ||||
| 	if (GetRailTileType(tile) != RAIL_TILE_NORMAL) return; | ||||
| 	if ((GetTrackBits(tile) & GB(extra, 8, 8)) == 0) return; | ||||
|  | ||||
| 	DoCommandP(tile, _cur_railtype, extra & 0xFF, NULL, CMD_BUILD_SINGLE_RAIL | CMD_AUTO | CMD_NO_WATER); | ||||
|   | ||||
							
								
								
									
										34
									
								
								rail_map.h
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								rail_map.h
									
									
									
									
									
								
							| @@ -8,10 +8,10 @@ | ||||
|  | ||||
|  | ||||
| typedef enum RailTileType { | ||||
| 	RAIL_TYPE_NORMAL         = 0x0, | ||||
| 	RAIL_TYPE_SIGNALS        = 0x40, | ||||
| 	RAIL_TYPE_UNUSED         = 0x80, /* XXX: Maybe this could become waypoints? */ | ||||
| 	RAIL_TYPE_DEPOT_WAYPOINT = 0xC0, /* Is really depots and waypoints... */ | ||||
| 	RAIL_TILE_NORMAL         = 0x0, | ||||
| 	RAIL_TILE_SIGNALS        = 0x40, | ||||
| 	RAIL_TILE_UNUSED         = 0x80, /* XXX: Maybe this could become waypoints? */ | ||||
| 	RAIL_TILE_DEPOT_WAYPOINT = 0xC0, /* Is really depots and waypoints... */ | ||||
| 	RAIL_TILE_TYPE_MASK      = 0xC0 | ||||
| } RailTileType; | ||||
|  | ||||
| @@ -23,12 +23,12 @@ static inline RailTileType GetRailTileType(TileIndex t) | ||||
|  | ||||
| /** | ||||
|  * Returns whether this is plain rails, with or without signals. Iow, if this | ||||
|  * tiles RailTileType is RAIL_TYPE_NORMAL or RAIL_TYPE_SIGNALS. | ||||
|  * tiles RailTileType is RAIL_TILE_NORMAL or RAIL_TILE_SIGNALS. | ||||
|  */ | ||||
| static inline bool IsPlainRailTile(TileIndex tile) | ||||
| { | ||||
| 	RailTileType rtt = GetRailTileType(tile); | ||||
| 	return rtt == RAIL_TYPE_NORMAL || rtt == RAIL_TYPE_SIGNALS; | ||||
| 	return rtt == RAIL_TILE_NORMAL || rtt == RAIL_TILE_SIGNALS; | ||||
| } | ||||
|  | ||||
| /** | ||||
| @@ -36,12 +36,12 @@ static inline bool IsPlainRailTile(TileIndex tile) | ||||
|  */ | ||||
| static inline bool HasSignals(TileIndex tile) | ||||
| { | ||||
| 	return GetRailTileType(tile) == RAIL_TYPE_SIGNALS; | ||||
| 	return GetRailTileType(tile) == RAIL_TILE_SIGNALS; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** These specify the subtype when the main rail type is | ||||
|  * RAIL_TYPE_DEPOT_WAYPOINT */ | ||||
|  * RAIL_TILE_DEPOT_WAYPOINT */ | ||||
| typedef enum RailTileSubtypes { | ||||
| 	RAIL_SUBTYPE_DEPOT    = 0x00, | ||||
| 	RAIL_SUBTYPE_WAYPOINT = 0x04, | ||||
| @@ -50,11 +50,11 @@ typedef enum RailTileSubtypes { | ||||
|  | ||||
| /** | ||||
|  * Returns the RailTileSubtype of a given rail tile with type | ||||
|  * RAIL_TYPE_DEPOT_WAYPOINT | ||||
|  * RAIL_TILE_DEPOT_WAYPOINT | ||||
|  */ | ||||
| static inline RailTileSubtype GetRailTileSubtype(TileIndex tile) | ||||
| { | ||||
| 	assert(GetRailTileType(tile) == RAIL_TYPE_DEPOT_WAYPOINT); | ||||
| 	assert(GetRailTileType(tile) == RAIL_TILE_DEPOT_WAYPOINT); | ||||
| 	return (RailTileSubtype)(_m[tile].m5 & RAIL_SUBTYPE_MASK); | ||||
| } | ||||
|  | ||||
| @@ -201,13 +201,13 @@ typedef enum SignalType { | ||||
|  | ||||
| static inline SignalType GetSignalType(TileIndex t) | ||||
| { | ||||
| 	assert(GetRailTileType(t) == RAIL_TYPE_SIGNALS); | ||||
| 	assert(GetRailTileType(t) == RAIL_TILE_SIGNALS); | ||||
| 	return (SignalType)GB(_m[t].m4, 0, 2); | ||||
| } | ||||
|  | ||||
| static inline void SetSignalType(TileIndex t, SignalType s) | ||||
| { | ||||
| 	assert(GetRailTileType(t) == RAIL_TYPE_SIGNALS); | ||||
| 	assert(GetRailTileType(t) == RAIL_TILE_SIGNALS); | ||||
| 	SB(_m[t].m4, 0, 2, s); | ||||
| } | ||||
|  | ||||
| @@ -287,7 +287,7 @@ typedef enum RailGroundType { | ||||
|  | ||||
| static inline void SetRailGroundType(TileIndex t, RailGroundType rgt) | ||||
| { | ||||
| 	if (GetRailTileType(t) == RAIL_TYPE_DEPOT_WAYPOINT) { | ||||
| 	if (GetRailTileType(t) == RAIL_TILE_DEPOT_WAYPOINT) { | ||||
| 		SB(_m[t].m4, 0, 4, rgt); | ||||
| 		return; | ||||
| 	} | ||||
| @@ -297,7 +297,7 @@ static inline void SetRailGroundType(TileIndex t, RailGroundType rgt) | ||||
| static inline RailGroundType GetRailGroundType(TileIndex t) | ||||
| { | ||||
| 	/* TODO Unify this */ | ||||
| 	if (GetRailTileType(t) == RAIL_TYPE_DEPOT_WAYPOINT) return GB(_m[t].m4, 0, 4); | ||||
| 	if (GetRailTileType(t) == RAIL_TILE_DEPOT_WAYPOINT) return GB(_m[t].m4, 0, 4); | ||||
| 	return GB(_m[t].m2, 0, 4); | ||||
| } | ||||
|  | ||||
| @@ -319,7 +319,7 @@ static inline void MakeRailNormal(TileIndex t, Owner o, TrackBits b, RailType r) | ||||
| 	_m[t].m2 = 0; | ||||
| 	_m[t].m3 = r; | ||||
| 	_m[t].m4 = 0; | ||||
| 	_m[t].m5 = RAIL_TYPE_NORMAL | b; | ||||
| 	_m[t].m5 = RAIL_TILE_NORMAL | b; | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -330,7 +330,7 @@ static inline void MakeRailDepot(TileIndex t, Owner o, DiagDirection d, RailType | ||||
| 	_m[t].m2 = 0; | ||||
| 	_m[t].m3 = r; | ||||
| 	_m[t].m4 = 0; | ||||
| 	_m[t].m5 = RAIL_TYPE_DEPOT_WAYPOINT | RAIL_SUBTYPE_DEPOT | d; | ||||
| 	_m[t].m5 = RAIL_TILE_DEPOT_WAYPOINT | RAIL_SUBTYPE_DEPOT | d; | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -341,7 +341,7 @@ static inline void MakeRailWaypoint(TileIndex t, Owner o, Axis a, RailType r, ui | ||||
| 	_m[t].m2 = index; | ||||
| 	_m[t].m3 = r; | ||||
| 	_m[t].m4 = 0; | ||||
| 	_m[t].m5 = RAIL_TYPE_DEPOT_WAYPOINT | RAIL_SUBTYPE_WAYPOINT | a; | ||||
| 	_m[t].m5 = RAIL_TILE_DEPOT_WAYPOINT | RAIL_SUBTYPE_WAYPOINT | a; | ||||
| } | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -323,7 +323,7 @@ int32 CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) | ||||
| 			} | ||||
| #undef M | ||||
|  | ||||
| 			if (GetRailTileType(tile) != RAIL_TYPE_NORMAL) goto do_clear; | ||||
| 			if (GetRailTileType(tile) != RAIL_TILE_NORMAL) goto do_clear; | ||||
| 			switch (GetTrackBits(tile)) { | ||||
| 				case TRACK_BIT_X: | ||||
| 					if (pieces & ROAD_X) goto do_clear; | ||||
|   | ||||
| @@ -1819,7 +1819,7 @@ static bool NtpCallbFindDepot(TileIndex tile, TrainFindDepotData *tfdd, int trac | ||||
| { | ||||
| 	if (IsTileType(tile, MP_RAILWAY) && | ||||
| 			IsTileOwner(tile, tfdd->owner) && | ||||
| 			GetRailTileType(tile) == RAIL_TYPE_DEPOT_WAYPOINT && | ||||
| 			GetRailTileType(tile) == RAIL_TILE_DEPOT_WAYPOINT && | ||||
| 			GetRailTileSubtype(tile) == RAIL_SUBTYPE_DEPOT) { | ||||
| 		tfdd->best_length = length; | ||||
| 		tfdd->tile = tile; | ||||
| @@ -2700,7 +2700,7 @@ static const DiagDirection _otherside_signal_directions[] = { | ||||
| static void TrainMovedChangeSignals(TileIndex tile, DiagDirection dir) | ||||
| { | ||||
| 	if (IsTileType(tile, MP_RAILWAY) && | ||||
| 			GetRailTileType(tile) == RAIL_TYPE_SIGNALS) { | ||||
| 			GetRailTileType(tile) == RAIL_TILE_SIGNALS) { | ||||
| 		uint i = FindFirstBit2x64(GetTrackBits(tile) * 0x101 & _reachable_tracks[dir]); | ||||
| 		UpdateSignalsOnSegment(tile, _otherside_signal_directions[i]); | ||||
| 	} | ||||
|   | ||||
| @@ -334,7 +334,7 @@ int32 CmdBuildBridge(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2) | ||||
| 				break; | ||||
|  | ||||
| 			case MP_RAILWAY: | ||||
| 				if (GetRailTileType(tile) != RAIL_TYPE_NORMAL || | ||||
| 				if (GetRailTileType(tile) != RAIL_TILE_NORMAL || | ||||
| 						GetTrackBits(tile) != (direction == AXIS_X ? TRACK_BIT_Y : TRACK_BIT_X)) { | ||||
| 					goto not_valid_below; | ||||
| 				} | ||||
|   | ||||
| @@ -182,7 +182,7 @@ int32 CmdBuildTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) | ||||
| 	if (p1 >= GetNumCustomStations(STAT_CLASS_WAYP)) return CMD_ERROR; | ||||
|  | ||||
| 	if (!IsTileType(tile, MP_RAILWAY) || | ||||
| 			GetRailTileType(tile) != RAIL_TYPE_NORMAL || ( | ||||
| 			GetRailTileType(tile) != RAIL_TILE_NORMAL || ( | ||||
| 				(axis = AXIS_X, GetTrackBits(tile) != TRACK_BIT_X) && | ||||
| 				(axis = AXIS_Y, GetTrackBits(tile) != TRACK_BIT_Y) | ||||
| 			)) { | ||||
|   | ||||
| @@ -25,7 +25,7 @@ struct Waypoint { | ||||
| }; | ||||
|  | ||||
| enum { | ||||
| 	RAIL_TYPE_WAYPOINT = 0xC4, | ||||
| 	RAIL_TILE_WAYPOINT = 0xC4, | ||||
| 	RAIL_WAYPOINT_TRACK_MASK = 1, | ||||
| }; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 rubidium
					rubidium