Loading

Paste #pxgtxqlwk

  1. Index: src/station_cmd.cpp
  2. ===================================================================
  3. --- src/station_cmd.cpp (revision 27632)
  4. +++ src/station_cmd.cpp (working copy)
  5. @@ -2504,6 +2504,14 @@
  6.         return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
  7.     }
  8.  
  9. +   if (HasTileWaterClass(tile_cur)) {
  10. +       TrackBits tb = TrackStatusToTrackBits(GetTileTrackStatus(tile_cur, TRANSPORT_WATER, 0));
  11. +       if (((direction == DIAGDIR_SW && (tb & TRACK_BIT_3WAY_NE) != 0) || (direction == DIAGDIR_NW && (tb & TRACK_BIT_3WAY_SE) != 0) || (direction == DIAGDIR_SE && (tb & TRACK_BIT_3WAY_NW) != 0) || (direction == DIAGDIR_NE && (tb & TRACK_BIT_3WAY_SW) != 0) && !IsShipDepotTile(tile_cur) && IsTileType(tile_cur, MP_WATER) && !IsLock(tile_cur))) {
  12. +           ret = EnsureNoVehicleOnGround(tile_cur);
  13. +           if (ret.Failed()) return ret;
  14. +       }
  15. +   }
  16. +
  17.     TileArea dock_area = TileArea(tile + ToTileIndexDiff(_dock_tileoffs_chkaround[direction]),
  18.             _dock_w_chk[direction], _dock_h_chk[direction]);
  19.  
  20. Index: src/water_cmd.cpp
  21. ===================================================================
  22. --- src/water_cmd.cpp   (revision 27632)
  23. +++ src/water_cmd.cpp   (working copy)
  24. @@ -135,6 +135,39 @@
  25.         cost.AddCost(ret);
  26.     }
  27.  
  28. +   TrackBits tb;
  29. +   TileIndex tc = tile + (axis == AXIS_X ? TileDiffXY(0, -1) : TileDiffXY(1, 0));
  30. +   if (HasTileWaterClass(tc)) {
  31. +       tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
  32. +       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))) {
  33. +           ret = EnsureNoVehicleOnGround(tc);
  34. +           if (ret.Failed()) return ret;
  35. +       }
  36. +   }
  37. +   tc = tile2 + (axis == AXIS_X ? TileDiffXY(0, -1) : TileDiffXY(1, 0));
  38. +   if (HasTileWaterClass(tc)) {
  39. +       tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
  40. +       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))) {
  41. +           ret = EnsureNoVehicleOnGround(tc);
  42. +           if (ret.Failed()) return ret;
  43. +       }
  44. +   }
  45. +   tc = tile + (axis == AXIS_X ? TileDiffXY(0, 1) : TileDiffXY(-1, 0));
  46. +   if (HasTileWaterClass(tc)) {
  47. +       tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
  48. +       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))) {
  49. +           ret = EnsureNoVehicleOnGround(tc);
  50. +           if (ret.Failed()) return ret;
  51. +       }
  52. +   }
  53. +   tc = tile2 + (axis == AXIS_X ? TileDiffXY(0, 1) : TileDiffXY(-1, 0));
  54. +   if (HasTileWaterClass(tc)) {
  55. +       tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
  56. +       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))) {
  57. +           ret = EnsureNoVehicleOnGround(tc);
  58. +           if (ret.Failed()) return ret;
  59. +       }
  60. +   }
  61.     if (flags & DC_EXEC) {
  62.         Depot *depot = new Depot(tile);
  63.         depot->build_date = _date;
  64. @@ -372,6 +405,41 @@
  65.     DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile));
  66.     if (dir == INVALID_DIAGDIR) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
  67.  
  68. +   Axis axis = DiagDirToAxis(dir);
  69. +   TrackBits tb;
  70. +   CommandCost ret;
  71. +   TileIndex tc = tile + (axis == AXIS_X ? TileDiffXY(-1, -1) : TileDiffXY(1, -1));
  72. +   if (HasTileWaterClass(tc)) {
  73. +       tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
  74. +       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))) {
  75. +           ret = EnsureNoVehicleOnGround(tc);
  76. +           if (ret.Failed()) return ret;
  77. +       }
  78. +   }
  79. +   tc = tile + (axis == AXIS_X ? TileDiffXY(1, -1) : TileDiffXY(1, 1));
  80. +   if (HasTileWaterClass(tc)) {
  81. +       tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
  82. +       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))) {
  83. +           ret = EnsureNoVehicleOnGround(tc);
  84. +           if (ret.Failed()) return ret;
  85. +       }
  86. +   }
  87. +   tc = tile + (axis == AXIS_X ? TileDiffXY(-1, 1) : TileDiffXY(-1, -1));
  88. +   if (HasTileWaterClass(tc)) {
  89. +       tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
  90. +       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))) {
  91. +           ret = EnsureNoVehicleOnGround(tc);
  92. +           if (ret.Failed()) return ret;
  93. +       }
  94. +   }
  95. +   tc = tile + (axis == AXIS_X ? TileDiffXY(1, 1) : TileDiffXY(-1, 1));
  96. +   if (HasTileWaterClass(tc)) {
  97. +       tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
  98. +       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))) {
  99. +           ret = EnsureNoVehicleOnGround(tc);
  100. +           if (ret.Failed()) return ret;
  101. +       }
  102. +   }
  103.     return DoBuildLock(tile, dir, flags);
  104.  }

Version history

Revision # Author Created at
pwaldxdg9 Anonymous 26 Aug 2016, 11:43:35 UTC Diff

Comments