Loading

water_cmd.cpp

  1. --- C:/Users/Ricardo/AppData/Local/Temp/water_cmd.cpp-revBASE.svn001.tmp.cpp    dom Set 21 12:24:51 2014
  2. +++ C:/OpenTTD/trunk/src/water_cmd.cpp  seg Fev 16 19:47:21 2015
  3. @@ -258,10 +258,14 @@ static CommandCost DoBuildLock(TileIndex tile, Dia
  4.  
  5.     /* middle tile */
  6.     WaterClass wc_middle = IsWaterTile(tile) ? GetWaterClass(tile) : WATER_CLASS_CANAL;
  7. -   ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
  8. -   if (ret.Failed()) return ret;
  9. -   cost.AddCost(ret);
  10.  
  11. +   if (!IsWaterTile(tile)) {
  12. +       ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
  13. +       if (ret.Failed()) return ret;
  14. +       cost.AddCost(ret);
  15. +       cost.AddCost(_price[PR_BUILD_CANAL]);
  16. +   }
  17. +
  18.     /* lower tile */
  19.     WaterClass wc_lower = IsWaterTile(tile - delta) ? GetWaterClass(tile - delta) : WATER_CLASS_CANAL;
  20.  
  21. @@ -298,6 +302,7 @@ static CommandCost DoBuildLock(TileIndex tile, Dia
  22.         if (c != NULL) {
  23.             /* Counts for the water. */
  24.             if (!IsWaterTile(tile - delta)) c->infrastructure.water++;
  25. +           if (!IsWaterTile(tile)) c->infrastructure.water++;
  26.             if (!IsWaterTile(tile + delta)) c->infrastructure.water++;
  27.             /* Count for the lock itself. */
  28.             c->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // Lock is three tiles.
  29. @@ -348,6 +353,9 @@ static CommandCost RemoveLock(TileIndex tile, DoCo
  30.         if (GetWaterClass(tile) == WATER_CLASS_RIVER) {
  31.             MakeRiver(tile, Random());
  32.         } else {
  33. +           if (c != NULL) {
  34. +               c->infrastructure.water--;
  35. +           }
  36.             DoClearSquare(tile);
  37.         }
  38.         MakeWaterKeepingClass(tile + delta, GetTileOwner(tile + delta));

Version history

Revision # Author Created at
puyaz0353 Anonymous 16 Feb 2015, 17:41:26 UTC Diff

Comments