Loading

Paste #pvbzrbley

  1. Index: src/saveload/company_sl.cpp
  2. ===================================================================
  3. --- src/saveload/company_sl.cpp (revision 27202)
  4. +++ src/saveload/company_sl.cpp (working copy)
  5. @@ -141,7 +141,7 @@
  6.  
  7.             case MP_STATION:
  8.                 c = Company::GetIfValid(GetTileOwner(tile));
  9. -               if (c != NULL && GetStationType(tile) != STATION_AIRPORT && !IsBuoy(tile)) c->infrastructure.station++;
  10. +               if (c != NULL && GetStationType(tile) != STATION_AIRPORT && !IsBuoy(tile) && !IsDock(tile)) c->infrastructure.station++;
  11.  
  12.                 switch (GetStationType(tile)) {
  13.                     case STATION_RAIL:
  14. @@ -161,6 +161,11 @@
  15.                     }
  16.  
  17.                     case STATION_DOCK:
  18. +                       if (IsDockTile(tile) && !HasTileWaterGround(tile)) {
  19. +                           if (c != NULL) c->infrastructure.station += 2;
  20. +                       }
  21. +                       /* FALL THROUGH */
  22. +
  23.                     case STATION_BUOY:
  24.                         if (GetWaterClass(tile) == WATER_CLASS_CANAL) {
  25.                             if (c != NULL) c->infrastructure.water++;
  26. Index: src/station_cmd.cpp
  27. ===================================================================
  28. --- src/station_cmd.cpp (revision 27202)
  29. +++ src/station_cmd.cpp (working copy)
  30. @@ -2509,12 +2509,8 @@
  31.  
  32.     if (IsBridgeAbove(tile_cur)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
  33.  
  34. -   /* Get the water class of the water tile before it is cleared.*/
  35.     WaterClass wc = GetWaterClass(tile_cur);
  36.  
  37. -   ret = DoCommand(tile_cur, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
  38. -   if (ret.Failed()) return ret;
  39. -
  40.     tile_cur += TileOffsByDiagDir(direction);
  41.     if (!IsTileType(tile_cur, MP_WATER) || !IsTileFlat(tile_cur)) {
  42.         return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
  43. @@ -2542,11 +2538,6 @@
  44.  
  45.         st->rect.BeforeAddRect(dock_area.tile, dock_area.w, dock_area.h, StationRect::ADD_TRY);
  46.  
  47. -       /* If the water part of the dock is on a canal, update infrastructure counts.
  48. -        * This is needed as we've unconditionally cleared that tile before. */
  49. -       if (wc == WATER_CLASS_CANAL) {
  50. -           Company::Get(st->owner)->infrastructure.water++;
  51. -       }
  52.         Company::Get(st->owner)->infrastructure.station += 2;
  53.         DirtyCompanyInfrastructureWindows(st->owner);
  54.  
  55. @@ -2587,7 +2578,7 @@
  56.     if (flags & DC_EXEC) {
  57.         DoClearSquare(tile1);
  58.         MarkTileDirtyByTile(tile1);
  59. -       MakeWaterKeepingClass(tile2, st->owner);
  60. +       MakeWaterKeepingClass(tile2, GetTileOwner(tile2));
  61.  
  62.         st->rect.AfterRemoveTile(st, tile1);
  63.         st->rect.AfterRemoveTile(st, tile2);
  64. @@ -3993,11 +3984,16 @@
  65.         }
  66.  
  67.         /* Update station tile count. */
  68. -       if (!IsBuoy(tile) && !IsAirport(tile)) {
  69. +       if (!IsBuoy(tile) && !IsAirport(tile) && !IsDock(tile)) {
  70.             old_company->infrastructure.station--;
  71.             new_company->infrastructure.station++;
  72.         }
  73.  
  74. +       if (IsDockTile(tile) && !HasTileWaterGround(tile)) {
  75. +           old_company->infrastructure.station -= 2;
  76. +           new_company->infrastructure.station += 2;
  77. +       }
  78. +
  79.         /* for buoys, owner of tile is owner of water, st->owner == OWNER_NONE */
  80.         SetTileOwner(tile, new_owner);
  81.         InvalidateWindowClassesData(WC_STATION_LIST, 0);
  82. Index: src/station_map.h
  83. ===================================================================
  84. --- src/station_map.h   (revision 27202)
  85. +++ src/station_map.h   (working copy)
  86. @@ -650,7 +650,7 @@
  87.  static inline void MakeDock(TileIndex t, Owner o, StationID sid, DiagDirection d, WaterClass wc)
  88.  {
  89.     MakeStation(t, o, sid, STATION_DOCK, d);
  90. -   MakeStation(t + TileOffsByDiagDir(d), o, sid, STATION_DOCK, GFX_DOCK_BASE_WATER_PART + DiagDirToAxis(d), wc);
  91. +   MakeStation(t + TileOffsByDiagDir(d), IsWaterTile(t + TileOffsByDiagDir(d)) ? GetTileOwner (t + TileOffsByDiagDir(d)) : o, sid, STATION_DOCK, GFX_DOCK_BASE_WATER_PART + DiagDirToAxis(d), wc);
  92.  }
  93.  
  94.  /**

Version history

Revision # Author Created at
pfly249dp Anonymous 23 Mar 2015, 00:42:24 UTC Diff

Comments