Loading

Paste #pwaldxdg9

  1. Index: src/water_cmd.cpp
  2. ===================================================================
  3. --- src/water_cmd.cpp   (revision 27632)
  4. +++ src/water_cmd.cpp   (working copy)
  5. @@ -135,6 +135,39 @@
  6.         cost.AddCost(ret);
  7.     }
  8.  
  9. +   TrackBits tb;
  10. +   TileIndex tc = tile + (axis == AXIS_X ? TileDiffXY(0, -1) : TileDiffXY(1, 0));
  11. +   if (HasTileWaterClass(tc)) {
  12. +       tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
  13. +       if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_NE) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_SE) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
  14. +           ret = EnsureNoVehicleOnGround(tc);
  15. +           if (ret.Failed()) return ret;
  16. +       }
  17. +   }
  18. +   tc = tile2 + (axis == AXIS_X ? TileDiffXY(0, -1) : TileDiffXY(1, 0));
  19. +   if (HasTileWaterClass(tc)) {
  20. +       tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
  21. +       if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_NE) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_SE) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
  22. +           ret = EnsureNoVehicleOnGround(tc);
  23. +           if (ret.Failed()) return ret;
  24. +       }
  25. +   }
  26. +   tc = tile + (axis == AXIS_X ? TileDiffXY(0, 1) : TileDiffXY(-1, 0));
  27. +   if (HasTileWaterClass(tc)) {
  28. +       tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
  29. +       if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_SW) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_NW) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
  30. +           ret = EnsureNoVehicleOnGround(tc);
  31. +           if (ret.Failed()) return ret;
  32. +       }
  33. +   }
  34. +   tc = tile2 + (axis == AXIS_X ? TileDiffXY(0, 1) : TileDiffXY(-1, 0));
  35. +   if (HasTileWaterClass(tc)) {
  36. +       tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
  37. +       if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_SW) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_NW) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
  38. +           ret = EnsureNoVehicleOnGround(tc);
  39. +           if (ret.Failed()) return ret;
  40. +       }
  41. +   }
  42.     if (flags & DC_EXEC) {
  43.         Depot *depot = new Depot(tile);
  44.         depot->build_date = _date;
  45. @@ -372,6 +405,41 @@
  46.     DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile));
  47.     if (dir == INVALID_DIAGDIR) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
  48.  
  49. +   Axis axis = DiagDirToAxis(dir);
  50. +   TrackBits tb;
  51. +   CommandCost ret;
  52. +   TileIndex tc = tile + (axis == AXIS_X ? TileDiffXY(-1, -1) : TileDiffXY(1, -1));
  53. +   if (HasTileWaterClass(tc)) {
  54. +       tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
  55. +       if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_NE) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_SE) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
  56. +           ret = EnsureNoVehicleOnGround(tc);
  57. +           if (ret.Failed()) return ret;
  58. +       }
  59. +   }
  60. +   tc = tile + (axis == AXIS_X ? TileDiffXY(1, -1) : TileDiffXY(1, 1));
  61. +   if (HasTileWaterClass(tc)) {
  62. +       tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
  63. +       if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_NE) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_SE) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
  64. +           ret = EnsureNoVehicleOnGround(tc);
  65. +           if (ret.Failed()) return ret;
  66. +       }
  67. +   }
  68. +   tc = tile + (axis == AXIS_X ? TileDiffXY(-1, 1) : TileDiffXY(-1, -1));
  69. +   if (HasTileWaterClass(tc)) {
  70. +       tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
  71. +       if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_SW) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_NW) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
  72. +           ret = EnsureNoVehicleOnGround(tc);
  73. +           if (ret.Failed()) return ret;
  74. +       }
  75. +   }
  76. +   tc = tile + (axis == AXIS_X ? TileDiffXY(1, 1) : TileDiffXY(-1, 1));
  77. +   if (HasTileWaterClass(tc)) {
  78. +       tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
  79. +       if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_SW) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_NW) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
  80. +           ret = EnsureNoVehicleOnGround(tc);
  81. +           if (ret.Failed()) return ret;
  82. +       }
  83. +   }
  84.     return DoBuildLock(tile, dir, flags);
  85.  }

Comments