Changeset - r3142:a7c343fab6fd
[Not reviewed]
master
0 1 0
tron - 19 years ago 2006-03-04 13:52:52
tron@openttd.org
(svn r3760) Replace some magic numbers for checking for a suitable slope for a level crossing by some less magic numbers. Quite similar to r3699, though this time for placing the rails
1 file changed with 7 insertions and 11 deletions:
0 comments (0 inline, 0 general)
rail_cmd.c
Show inline comments
 
@@ -130,7 +130,7 @@ static bool CheckTrackCombination(TileIn
 
}
 

	
 

	
 
static const byte _valid_tileh_slopes[4][15] = {
 
static const byte _valid_tileh_slopes[][15] = {
 

	
 
// set of normal ones
 
{
 
@@ -197,15 +197,6 @@ static const byte _valid_tileh_slopes[4]
 
	TRACK_BIT_X|TRACK_BIT_Y|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
 
	TRACK_BIT_X|TRACK_BIT_Y|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
 
	},
 

	
 
	// valid railway crossings on slopes
 
	{
 
		1, 0, 0, // 0, 1, 2
 
		0, 0, 1, // 3, 4, 5
 
		0, 1, 0, // 6, 7, 8
 
		0, 1, 1, // 9, 10, 11
 
		0, 1, 1, // 12, 13, 14
 
	}
 
};
 

	
 
uint GetRailFoundation(uint tileh, uint bits)
 
@@ -346,8 +337,13 @@ int32 CmdBuildSingleRail(int x, int y, u
 
			break;
 

	
 
		case MP_STREET:
 
			if (!_valid_tileh_slopes[3][tileh]) // prevent certain slopes
 
#define M(x) (1 << (x))
 
			/* Level crossings may only be built on these slopes */
 
			if (!HASBIT(M(14) | M(13) | M(11) | M(10) | M(7) | M(5) | M(0), tileh)) {
 
				return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
 
			}
 
#undef M
 

	
 
			if (!EnsureNoVehicle(tile)) return CMD_ERROR;
 

	
 
			if (GetRoadType(tile) == ROAD_NORMAL && (
0 comments (0 inline, 0 general)