ai/default/default.c
changeset 3234 a2791a480b71
parent 3214 dd744119dfac
child 3269 62fb247bf94b
equal deleted inserted replaced
3233:9e09534dcac1 3234:a2791a480b71
  2155 				return false;
  2155 				return false;
  2156 			p->ai.cur_tile_a = TILE_MASK(_build_tunnel_endtile - TileOffsByDir(p->ai.cur_dir_a));
  2156 			p->ai.cur_tile_a = TILE_MASK(_build_tunnel_endtile - TileOffsByDir(p->ai.cur_dir_a));
  2157 			return true;
  2157 			return true;
  2158 		}
  2158 		}
  2159 
  2159 
  2160 		if (!(_m[tile].m5 & 0x40)) {
  2160 		if (IsBridgeRamp(tile)) {
  2161 
       
  2162 			// Check if the bridge points in the right direction.
  2161 			// Check if the bridge points in the right direction.
  2163 			// This is not really needed the first place AiRemoveTileAndGoForward is called.
  2162 			// This is not really needed the first place AiRemoveTileAndGoForward is called.
  2164 			if (DiagDirToAxis(GetBridgeRampDirection(tile)) != (p->ai.cur_dir_a & 1U)) return false;
  2163 			if (DiagDirToAxis(GetBridgeRampDirection(tile)) != (p->ai.cur_dir_a & 1U)) return false;
  2165 
  2164 
  2166 			tile = GetOtherBridgeEnd(tile);
  2165 			tile = GetOtherBridgeEnd(tile);
  3667 				0,
  3666 				0,
  3668 				DC_EXEC,
  3667 				DC_EXEC,
  3669 				CMD_REMOVE_ROAD);
  3668 				CMD_REMOVE_ROAD);
  3670 		}
  3669 		}
  3671 	} else if (IsTileType(tile, MP_TUNNELBRIDGE)) {
  3670 	} else if (IsTileType(tile, MP_TUNNELBRIDGE)) {
  3672 		if (!IsTileOwner(tile, _current_player) || (_m[tile].m5 & 0xC6) != 0x80)
  3671 		if (!IsTileOwner(tile, _current_player) ||
       
  3672 				!IsBridge(tile) ||
       
  3673 				!IsBridgeRamp(tile) ||
       
  3674 				GetBridgeTransportType(tile) != TRANSPORT_RAIL) {
  3673 			return;
  3675 			return;
       
  3676 		}
  3674 
  3677 
  3675 		m5 = 0;
  3678 		m5 = 0;
  3676 
  3679 
  3677 		switch (GetBridgeRampDirection(tile)) {
  3680 		switch (GetBridgeRampDirection(tile)) {
  3678 			default:
  3681 			default: