Loading

Paste #pv8ckd8ru

  1. Index: src/saveload/company_sl.cpp
  2. ===================================================================
  3. --- src/saveload/company_sl.cpp (revision 27153)
  4. +++ src/saveload/company_sl.cpp (working copy)
  5. @@ -180,6 +180,9 @@
  6.                         if (IsLock(tile) && GetLockPart(tile) == LOCK_PART_MIDDLE) {
  7.                             /* The middle tile specifies the owner of the lock. */
  8.                             c->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // the middle tile specifies the owner of the
  9. +                           if (GetWaterClass(tile) != WATER_CLASS_CANAL) {
  10. +                               c->infrastructure.water++;
  11. +                           }
  12.                             break; // do not count the middle tile as canal
  13.                         }
  14.                     }
  15. Index: src/water_cmd.cpp
  16. ===================================================================
  17. --- src/water_cmd.cpp   (revision 27153)
  18. +++ src/water_cmd.cpp   (working copy)
  19. @@ -258,10 +258,14 @@
  20.  
  21.     /* middle tile */
  22.     WaterClass wc_middle = IsWaterTile(tile) ? GetWaterClass(tile) : WATER_CLASS_CANAL;
  23. -   ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
  24. -   if (ret.Failed()) return ret;
  25. -   cost.AddCost(ret);
  26.  
  27. +   if (!IsWaterTile(tile)) {
  28. +       ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
  29. +       if (ret.Failed()) return ret;
  30. +       cost.AddCost(ret);
  31. +       cost.AddCost(_price[PR_BUILD_CANAL]);
  32. +   }
  33. +
  34.     /* lower tile */
  35.     WaterClass wc_lower = IsWaterTile(tile - delta) ? GetWaterClass(tile - delta) : WATER_CLASS_CANAL;
  36.  
  37. @@ -298,6 +302,7 @@
  38.         if (c != NULL) {
  39.             /* Counts for the water. */
  40.             if (!IsWaterTile(tile - delta)) c->infrastructure.water++;
  41. +           if (!IsWaterTile(tile)) c->infrastructure.water++;
  42.             if (!IsWaterTile(tile + delta)) c->infrastructure.water++;
  43.             /* Count for the lock itself. */
  44.             c->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // Lock is three tiles.
  45. @@ -348,6 +353,9 @@
  46.         if (GetWaterClass(tile) == WATER_CLASS_RIVER) {
  47.             MakeRiver(tile, Random());
  48.         } else {
  49. +           if (c != NULL) {
  50. +               c->infrastructure.water--;
  51. +           }
  52.             DoClearSquare(tile);
  53.         }
  54.         MakeWaterKeepingClass(tile + delta, GetTileOwner(tile + delta));
  55. @@ -1276,8 +1284,14 @@
  56.  
  57.     /* No need to dirty company windows here, we'll redraw the whole screen anyway. */
  58.     if (is_lock_middle) Company::Get(old_owner)->infrastructure.water -= 3 * LOCK_DEPOT_TILE_FACTOR; // Lock has three parts.
  59. +   if (GetWaterClass(tile) == WATER_CLASS_CANAL && is_lock_middle) {
  60. +       Company::Get(old_owner)->infrastructure.water--;
  61. +   }
  62.     if (new_owner != INVALID_OWNER) {
  63.         if (is_lock_middle) Company::Get(new_owner)->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // Lock has three parts.
  64. +       if (GetWaterClass(tile) == WATER_CLASS_CANAL && is_lock_middle) {
  65. +           Company::Get(new_owner)->infrastructure.water++;
  66. +       }
  67.         /* Only subtract from the old owner here if the new owner is valid,
  68.          * otherwise we clear ship depots and canal water below. */
  69.         if (GetWaterClass(tile) == WATER_CLASS_CANAL && !is_lock_middle) {

Version history

Revision # Author Created at
pslxvnpmw Anonymous 16 Feb 2015, 23:50:25 UTC Diff

Comments