File diff r2149:653fa1740f53 → r2150:8d17c2dcd791
tunnelbridge_cmd.c
Show inline comments
 
@@ -374,14 +374,13 @@ not_valid_below:;
 
					// this sequence swaps [... XOR (i>odd_middle_part)],
 
					// for even bridges XOR does not apply as odd_middle_part==bridge_len
 
					m5 = 2 + ((i%2==0)^(i>odd_middle_part));
 
			}
 

	
 
			_m[ti.tile].m2 = (bridge_type << 4) | m5;
 
			_m[ti.tile].m3 &= 0xF;
 
			_m[ti.tile].m3 |= (byte)(railtype << 4);
 
			SB(_m[ti.tile].m3, 4, 4, railtype);
 

	
 
			MarkTileDirtyByTile(ti.tile);
 
		}
 
	}
 

	
 
	SetSignalsOnBothDir(ti_start.tile, (direction&1) ? 1 : 0);
 
@@ -546,14 +545,14 @@ int32 CmdBuildTunnel(int x, int y, uint3
 
	TileIndex excavated_tile;
 

	
 
	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
 

	
 
	if (p1 != 0x200 && !ValParamRailtype(p1)) return CMD_ERROR;
 

	
 
	_build_tunnel_railtype = (byte)(p1 & 0xFF);
 
	_build_tunnel_bh = (byte)(p1 >> 8);
 
	_build_tunnel_railtype = GB(p1, 0, 8);
 
	_build_tunnel_bh       = GB(p1, 8, 8);
 

	
 
	_build_tunnel_endtile = 0;
 
	excavated_tile = 0;
 

	
 
	FindLandscapeHeight(&tiorg, x, y);
 

	
 
@@ -599,13 +598,13 @@ TileIndex CheckTunnelBusy(TileIndex tile
 
	do {
 
		tile += delta;
 
		len++;
 
	} while (
 
		!IsTileType(tile, MP_TUNNELBRIDGE) ||
 
		(_m[tile].m5 & 0xF0) != 0 ||
 
		(byte)(_m[tile].m5 ^ 2) != m5 ||
 
		(_m[tile].m5 ^ 2) != m5 ||
 
		GetTileZ(tile) != z
 
	);
 

	
 
	v = FindVehicleBetween(starttile, tile, z);
 
	if (v != NULL) {
 
		_error_message = v->type == VEH_Train ?
 
@@ -1012,15 +1011,15 @@ static void DrawTile_TunnelBridge(TileIn
 
	uint32 image;
 
	uint tmp;
 
	const uint32 *b;
 
	bool ice = _m[ti->tile].m4 & 0x80;
 

	
 
	// draw tunnel?
 
	if ( (byte)(ti->map5&0xF0) == 0) {
 
	if ((ti->map5 & 0xF0) == 0) {
 
		/* railway type */
 
		image = (_m[ti->tile].m3 & 0xF) * 8;
 
		image = GB(_m[ti->tile].m3, 0, 4) * 8;
 

	
 
		/* ice? */
 
		if (ice)
 
			image += 32;
 

	
 
		image += _draw_tunnel_table_1[GB(ti->map5, 2, 2)];