Loading

Revision differences

Old revision #pg4tog6jeNew revision #pqijtcywx
  1Index: docs/landscape.html  
  2===================================================================  
  3--- docs/landscape.html    (revision 27198)  
  4+++ docs/landscape.html    (working copy)  
  5@@ -975,7 +975,7 @@  
  6      </li>  
  7      <li>m6 bits 5..3: the station type (rail, airport, truck, bus, oilrig, dock, buoy, waypoint)</li>  
  8      <li>m6 bit 2: pbs reservation state for railway stations/waypoints</li>  
  9-  
  10+     <li>m6 bit 0: river restoration flag for whenever a canal is removed</li>  
  11      <li>m7 bits 4..0: <a href="#OwnershipInfo">owner</a> of road (road stops)</li>  
  12      <li>m7 bits 7..6: present road types (road stops)</li>  
  13      <li>m7: animation frame (railway stations/waypoints, airports)</li>  
  14@@ -1088,6 +1088,7 @@  
  15        </tr>  
  16       </table>  
  17      </li>  
  18+     <li>m6 bit 0: river restoration flag for whenever a canal is removed</li>  
  19     </ul>  
  20    </td>  
  21   </tr>  
  22@@ -1429,6 +1430,7 @@  
  23      </li>  
  24      <li>m6 bits 5..3: random triggers (NewGRF)</li>  
  25      <li>m6 bit 2: bit 8 of type (see m5)</li>  
  26+     <li>m6 bit 0: river restoration flag for whenever a canal is removed</li>  
  27      <li>m7: animation frame</li>  
  28     </ul>  
  29    </td>  
  30@@ -1599,6 +1601,7 @@  
  31      <li>m2: index into the array of objects, bits 0 to 15 (upper bits in m5)</li>  
  32      <li>m3: random bits</li>  
  33      <li>m5: index into the array of objects, bits 16 to 23 (lower bits in m2)</li>  
  34+     <li>m6 bit 0: river restoration flag for whenever a canal is removed</li>  
  35      <li>m7: animation counter</li>  
  36     </ul>  
  37    </td>  
  38Index: docs/landscape_grid.html  
  39===================================================================  
  40--- docs/landscape_grid.html    (revision 27198)  
  41+++ docs/landscape_grid.html    (working copy)  
  42@@ -236,7 +236,7 @@  
  43       <td class="bits"><span class="free">OOOO OOOO</span></td>  
  44       <td class="bits"><span class="free">OOOO OOOO</span></td>  
  45       <td class="bits"><span class="option">~~~~ ~</span>XXX</td>  
  46-      <td class="bits"><span class="free">OO</span>XX X<span class="free">OOO</span></td>  
  47+      <td class="bits"><span class="free">OO</span>XX X<span class="free">OO</span>X</td>  
  48       <td class="bits"><span class="free">OOOO OOOO</span></td>  
  49     </tr>  
  50     <tr>  
  51@@ -260,7 +260,7 @@  
  52       <td class="bits"><span class="free">OOOO OOOO</span></td>  
  53       <td class="bits"><span class="free">OOOO OOOO</span></td>  
  54       <td class="bits"><span class="option">~~~~ ~~~~</span></td>  
  55-      <td class="bits"><span class="free">OO</span>XX X<span class="free">OOO</span></td>  
  56+      <td class="bits"><span class="free">OO</span>XX X<span class="free">OO</span>X</td>  
  57       <td class="bits"><span class="free">OOOO OOOO</span></td>  
  58     </tr>  
  59     <tr>  
  60@@ -272,7 +272,7 @@  
  61       <td class="bits"><span class="free">OOOO OOOO</span></td>  
  62       <td class="bits"><span class="free">OOOO OOOO</span></td>  
  63       <td class="bits"><span class="option">~~~~ ~~~~</span></td>  
  64-      <td class="bits"><span class="free">OO</span>XX X<span class="free">OOO</span></td>  
  65+      <td class="bits"><span class="free">OO</span>XX X<span class="free">OO</span>X</td>  
  66       <td class="bits"><span class="free">OOOO OOOO</span></td>  
  67     </tr>  
  68     <tr>  
  69@@ -297,8 +297,8 @@  
  70       <td class="bits"><span class="free">OOOO OOOO</span></td>  
  71       <td class="bits">XXXX XXXX</td>  
  72       <td class="bits">-inherit-</td>  
  73+      <td class="bits"><span class="free">OOOO OOO</span>X</td>  
  74       <td class="bits"><span class="free">OOOO OOOO</span></td>  
  75-      <td class="bits"><span class="free">OOOO OOOO</span></td>  
  76     </tr>  
  77     <tr>  
  78       <td class="caption">shipdepot</td>  
  79@@ -309,8 +309,8 @@  
  80       <td class="bits"><span class="free">OOOO OOOO</span></td>  
  81       <td class="bits"><span class="free">OOOO OOOO</span></td>  
  82       <td class="bits">-inherit-</td>  
  83+      <td class="bits"><span class="free">OOOO OOO</span>X</td>  
  84       <td class="bits"><span class="free">OOOO OOOO</span></td>  
  85-      <td class="bits"><span class="free">OOOO OOOO</span></td>  
  86     </tr>  
  87     <tr>  
  88       <td>8</td>  
  89@@ -322,7 +322,7 @@  
  90       <td class="bits">XXXX XXXX</td>  
  91       <td class="bits">XXXX XXXX</td>  
  92       <td class="bits">XXXX XXXX</td>  
  93-      <td class="bits"><span class="free">OO</span>XX XX<span class="free">OO</span></td>  
  94+      <td class="bits"><span class="free">OO</span>XX XX<span class="free">O</span>X</td>  
  95       <td class="bits">XXXX XXXX</td>  
  96     </tr>  
  97     <tr>  
  98@@ -360,7 +360,7 @@  
  99       <td class="bits">XXXX XXXX</td>  
  100       <td class="bits"><span class="free">OOOO OOOO</span></td>  
  101       <td class="bits">XXXX XXXX</td>  
  102-      <td class="bits"><span class="free">OOOO OOOO</span></td>  
  103+      <td class="bits"><span class="free">OOOO OOO</span>X</td>  
  104       <td class="bits">XXXX XXXX</td>  
  105     </tr>  
  106   </tbody>  
  107Index: src/industry_cmd.cpp  
  108===================================================================  
  109--- src/industry_cmd.cpp    (revision 27198)  
  110+++ src/industry_cmd.cpp    (working copy)  
  111@@ -1755,9 +1755,9 @@  
  112             i->location.Add(cur_tile);  
  113   
  114             WaterClass wc = (IsWaterTile(cur_tile) ? GetWaterClass(cur_tile) : WATER_CLASS_INVALID);  
  115-  
  116+            bool river = HasBit(_me[cur_tile].m6, 0);  
  117             DoCommand(cur_tile, 0, 0, DC_EXEC | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, CMD_LANDSCAPE_CLEAR);  
  118-  
  119+            if (river) SB(_me[cur_tile].m6, 0, 1, 1);  
  120             MakeIndustry(cur_tile, i->index, it->gfx, Random(), wc);  
  121   
  122             if (_generating_world) {  
  123Index: src/station_cmd.cpp  
  124===================================================================  
  125--- src/station_cmd.cpp    (revision 27198)  
  126+++ src/station_cmd.cpp    (working copy)  
  127@@ -2511,7 +2511,7 @@  
  128   
  129     /* Get the water class of the water tile before it is cleared.*/  
  130     WaterClass wc = GetWaterClass(tile_cur);  
  131-  
  132+    bool river = HasBit(_me[tile_cur].m6, 0);  
  133     ret = DoCommand(tile_cur, 0, 0, flags, CMD_LANDSCAPE_CLEAR);  
  134     if (ret.Failed()) return ret;  
  135   
  136@@ -2551,7 +2551,7 @@  
  137         DirtyCompanyInfrastructureWindows(st->owner);  
  138   
  139         MakeDock(tile, st->owner, st->index, direction, wc);  
  140-  
  141+        if (river) SB(_me[tile + TileOffsByDiagDir(direction)].m6, 0, 1, 1);  
  142         st->UpdateVirtCoord();  
  143         UpdateStationAcceptance(st, false);  
  144         st->RecomputeIndustriesNear();  
1Index: src/water_cmd.cpp  145Index: src/water_cmd.cpp  
2===================================================================  146===================================================================  
3--- src/water_cmd.cpp    (revision 27194)  3--- src/water_cmd.cpp    (revision 27198)
4+++ src/water_cmd.cpp    (working copy)  148+++ src/water_cmd.cpp    (working copy)  
5@@ -419,6 +419,7 @@  149@@ -123,6 +123,8 @@
   150     CommandCost cost = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_DEPOT_SHIP]);
   151 
   152     bool add_cost = !IsWaterTile(tile);
   153+    bool river1 = HasBit(_me[tile].m6, 0);
   154+    bool river2 = HasBit(_me[tile2].m6, 0);
   155     CommandCost ret = DoCommand(tile, 0, 0, flags | DC_AUTO, CMD_LANDSCAPE_CLEAR);
   156     if (ret.Failed()) return ret;
   157     if (add_cost) {
   158@@ -145,7 +147,8 @@
   159         }
   160         Company::Get(_current_company)->infrastructure.water += 2 * LOCK_DEPOT_TILE_FACTOR;
   161         DirtyCompanyInfrastructureWindows(_current_company);
   162-
   163+        if (river1) SB(_me[tile].m6, 0, 1, 1);
   164+        if (river2) SB(_me[tile2].m6, 0, 1, 1);
   165         MakeShipDepot(tile,  _current_company, depot->index, DEPOT_PART_NORTH, axis, wc1);
   166         MakeShipDepot(tile2, _current_company, depot->index, DEPOT_PART_SOUTH, axis, wc2);
   167         MarkTileDirtyByTile(tile);
   168@@ -192,7 +195,7 @@
   169 
   170         wc = WATER_CLASS_CANAL;
   171     }
   172-
   173+    bool river = HasBit(_me[tile].m6, 0);
   174     /* Zero map array and terminate animation */
   175     DoClearSquare(tile);
   176 
   177@@ -199,7 +202,9 @@
   178     /* Maybe change to water */
   179     switch (wc) {
   180         case WATER_CLASS_SEA:   MakeSea(tile);                break;
   181-        case WATER_CLASS_CANAL: MakeCanal(tile, o, Random()); break;
   182+        case WATER_CLASS_CANAL: MakeCanal(tile, o, Random());
   183+            if (river) SB(_me[tile].m6, 0, 1, 1);
   184+            break;
   185         case WATER_CLASS_RIVER: MakeRiver(tile, Random());    break;
   186         default: break;
   187     }
   188@@ -291,7 +296,8 @@
   189     if (IsBridgeAbove(tile) || IsBridgeAbove(tile - delta) || IsBridgeAbove(tile + delta)) {
   190         return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
   191     }
   192-
   193+    bool river_lower = HasBit(_me[tile - delta].m6, 0);
   194+    bool river_upper = HasBit(_me[tile + delta].m6, 0);
   195     if (flags & DC_EXEC) {
   196         /* Update company infrastructure counts. */
   197         Company *c = Company::GetIfValid(_current_company);
   198@@ -303,7 +309,8 @@
   199             c->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // Lock is three tiles.
   200             DirtyCompanyInfrastructureWindows(_current_company);
   201         }
   202-
   203+        if (river_lower) SB(_me[tile - delta].m6, 0, 1, 1);
   204+        if (river_upper) SB(_me[tile + delta].m6, 0, 1, 1);
   205         MakeLock(tile, _current_company, dir, wc_lower, wc_upper, wc_middle);
   206         MarkTileDirtyByTile(tile);
   207         MarkTileDirtyByTile(tile - delta);
   208@@ -419,6 +426,7 @@
6         if (IsTileType(tile, MP_WATER) && (!IsTileOwner(tile, OWNER_WATER) || wc == WATER_CLASS_SEA)) continue;  209         if (IsTileType(tile, MP_WATER) && (!IsTileOwner(tile, OWNER_WATER) || wc == WATER_CLASS_SEA)) continue;  
7   210   
8         bool water = IsWaterTile(tile);  211         bool water = IsWaterTile(tile);  
9+        bool river = GetWaterClass(tile) == WATER_CLASS_RIVER;  9+        bool river = HasTileWaterClass(tile) && GetWaterClass(tile) == WATER_CLASS_RIVER;
10         ret = DoCommand(tile, 0, 0, flags | DC_FORCE_CLEAR_TILE, CMD_LANDSCAPE_CLEAR);  213         ret = DoCommand(tile, 0, 0, flags | DC_FORCE_CLEAR_TILE, CMD_LANDSCAPE_CLEAR);  
11         if (ret.Failed()) return ret;  214         if (ret.Failed()) return ret;  
12   215   
13@@ -442,6 +443,7 @@  13@@ -442,6 +450,7 @@
14                     /* FALL THROUGH */  217                     /* FALL THROUGH */  
15   218   
16                 default:  219                 default:  
17+                    if (river) SB(_me[tile].m6, 0, 0, 1);  17+                    if (river) SB(_me[tile].m6, 0, 1, 1);
18                     MakeCanal(tile, _current_company, Random());  221                     MakeCanal(tile, _current_company, Random());  
19                     if (Company::IsValidID(_current_company)) {  222                     if (Company::IsValidID(_current_company)) {  
20                         Company::Get(_current_company)->infrastructure.water++; 223                         Company::Get(_current_company)->infrastructure.water++;
   224@@ -465,6 +474,7 @@
   225 
   226 static CommandCost ClearTile_Water(TileIndex tile, DoCommandFlag flags)
   227 {
   228+    bool river = HasBit(_me[tile].m6, 0);
   229     switch (GetWaterTileType(tile)) {
   230         case WATER_TILE_CLEAR: {
   231             if (flags & DC_NO_WATER) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
   232@@ -492,6 +502,7 @@
   233                     DirtyCompanyInfrastructureWindows(owner);
   234                 }
   235                 DoClearSquare(tile);
   236+                if (river) MakeRiver(tile, Random());
   237                 MarkCanalsAndRiversAroundDirty(tile);
   238             }