Loading

Revision differences

Old revision #pkap1qfo6New revision #pm51wvliq
2===================================================================  2===================================================================  
3--- src/water_cmd.cpp    (revision 27527)  3--- src/water_cmd.cpp    (revision 27527)  
4+++ src/water_cmd.cpp    (working copy)  4+++ src/water_cmd.cpp    (working copy)  
5@@ -489,7 +489,9 @@  5@@ -409,7 +409,7 @@
6                     Company::Get(owner)->infrastructure.water--;  6         CommandCost ret;
7                     DirtyCompanyInfrastructureWindows(owner);    
8                 }    
9+                bool river = HasTileWaterClass(tile) && GetWaterClass(tile) == WATER_CLASS_RIVER;    
10                 DoClearSquare(tile);    
11+                if (river) MakeRiver(tile, Random());    
12                 MarkCanalsAndRiversAroundDirty(tile);    
13             }    
14   7   
15@@ -1240,7 +1242,17 @@  8         Slope slope = GetTileSlope(tile);
   9-        if (slope != SLOPE_FLAT && (wc != WATER_CLASS_RIVER || !IsInclinedSlope(slope))) {
   10+        if (slope != SLOPE_FLAT && wc != WATER_CLASS_RIVER) {
   11             return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED);
   12         }
   13 
   14@@ -1233,6 +1233,7 @@
   15 
   16 static TrackStatus GetTileTrackStatus_Water(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
   17 {
   18+    static const byte clear_tracks[] = {63, 32, 4, 0, 16, 0, 0, 8, 8, 0, 0, 16, 0, 4, 32, 63};
   19     static const byte coast_tracks[] = {0, 32, 4, 0, 16, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0};
   20 
   21     TrackBits ts;
   22@@ -1240,7 +1241,7 @@
16     if (mode != TRANSPORT_WATER) return 0;  23     if (mode != TRANSPORT_WATER) return 0;  
17   24   
18     switch (GetWaterTileType(tile)) {  25     switch (GetWaterTileType(tile)) {  
19-        case WATER_TILE_CLEAR: ts = IsTileFlat(tile) ? TRACK_BIT_ALL : TRACK_BIT_NONE; break;  26-        case WATER_TILE_CLEAR: ts = IsTileFlat(tile) ? TRACK_BIT_ALL : TRACK_BIT_NONE; break;  
20+        case WATER_TILE_CLEAR:  20+        case WATER_TILE_CLEAR: ts = IsTileFlat(tile) ? TRACK_BIT_ALL : (TrackBits)clear_tracks[GetTileSlope(tile) & 0xF]; break;
21+            if (IsTileFlat(tile)) ts = TRACK_BIT_ALL;    
22+            if (GetTileSlope(tile) == SLOPE_W) ts = TRACK_BIT_RIGHT;    
23+            if (GetTileSlope(tile) == SLOPE_S) ts = TRACK_BIT_UPPER;    
24+            if (GetTileSlope(tile) == SLOPE_E) ts = TRACK_BIT_LEFT;    
25+            if (GetTileSlope(tile) == SLOPE_N) ts = TRACK_BIT_LOWER;    
26+            if (GetTileSlope(tile) == SLOPE_NWS) ts = TRACK_BIT_LEFT;    
27+            if (GetTileSlope(tile) == SLOPE_WSE) ts = TRACK_BIT_LOWER;    
28+            if (GetTileSlope(tile) == SLOPE_SEN) ts = TRACK_BIT_RIGHT;    
29+            if (GetTileSlope(tile) == SLOPE_ENW) ts = TRACK_BIT_UPPER;    
30+            break;    
31         case WATER_TILE_COAST: ts = (TrackBits)coast_tracks[GetTileSlope(tile) & 0xF]; break;  28         case WATER_TILE_COAST: ts = (TrackBits)coast_tracks[GetTileSlope(tile) & 0xF]; break;  
32         case WATER_TILE_LOCK:  ts = DiagDirToDiagTrackBits(GetLockDirection(tile)); break;  29         case WATER_TILE_LOCK:  ts = DiagDirToDiagTrackBits(GetLockDirection(tile)); break;  
33         case WATER_TILE_DEPOT: ts = AxisToTrackBits(GetShipDepotAxis(tile)); break; 30         case WATER_TILE_DEPOT: ts = AxisToTrackBits(GetShipDepotAxis(tile)); break;
   31@@ -1312,6 +1313,8 @@
   32     /* Canals can't be terraformed */
   33     if (IsWaterTile(tile) && IsCanal(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_CANAL_FIRST);
   34 
   35+    if (IsWaterTile(tile) && IsRiver(tile))    return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_WATER]);
   36+
   37     return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
   38 }