Loading

Paste #pammldfgx

  1.     /* Make sure there are no adjacent or incompatible ship docking areas */
  2.     TileIndex tile_adj;
  3.     Axis axis_cur = DiagDirToAxis(direction);
  4.  
  5.     if (axis_cur == AXIS_Y) {
  6.         tile_adj = tile_cur + TileDiffXY(-2, 0);
  7.         if (IsTileType(tile_adj, MP_STATION) && IsOilRig(tile_adj)) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
  8.         if (IsTileType(tile_adj, MP_INDUSTRY) && GetIndustryGfx(tile_adj) == GFX_OILRIG_1) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
  9.     }
  10.  
  11.     tile_adj = tile_cur + (axis_cur == AXIS_X ? TileDiffXY(0, -1) : TileDiffXY(1, 0));
  12.     if (IsDockTile(tile_adj)) {
  13.         Station *st = Station::GetByTile(tile_adj);
  14.         tile_adj = st->dock_tile;
  15.         Axis axis_adj = DiagDirToAxis(GetDockDirection(tile_adj));
  16.         if (axis_cur != axis_adj) return_cmd_error(STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK);
  17.     }
  18.  
  19.     tile_adj = tile_cur - (axis_cur == AXIS_X ? TileDiffXY(0, -1) : TileDiffXY(1, 0));
  20.     if (IsDockTile(tile_adj)) {
  21.         Station *st = Station::GetByTile(tile_adj);
  22.         tile_adj = st->dock_tile;
  23.         Axis axis_adj = DiagDirToAxis(GetDockDirection(tile_adj));
  24.         if (axis_cur != axis_adj) return_cmd_error(STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK);
  25.     }

Comments