Loading

Paste #prwe7i9wl

  1.     if (IsSavegameVersionBefore(196)) {
  2.         for (TileIndex t = 0; t < map_size; t++) {
  3.             /* To be able to restore the original owner of the canal under a dock,
  4.              * the watered part of the dock now stores that owner. Since this
  5.              * feature wasn't previously available, set the owner to OWNER_WATER,
  6.              * for as long as the water class was not WATER_CLASS_CANAL. */
  7.             if (IsDockTile(t) && HasTileWaterGround(t)) {
  8.                 if (HasTileWaterClass(t) && GetWaterClass(t) != WATER_CLASS_CANAL) {
  9.                     SetTileOwner(t, OWNER_WATER);
  10.                 }
  11.             }
  12.             /* Industry completed bit is no longer set at m1 bit 7, but at m1 bit 4. */
  13.             if (IsTileType(t, MP_INDUSTRY) && HasBit(_m[t].m1, 7)) {
  14.                 SetIndustryCompleted(t);
  15.                 SB(_m[t].m1, 7, 1, 0);
  16.             }
  17.             /* When the Oil Rig industry was completed, m1 bit 7 would be set, and
  18.              * an Oil Rig station would inherit this bit. m1 bit 7 is being used to
  19.              * determine if a canal was built on a river now, and since this feature
  20.              * was previously unavailable, clear it. */
  21.             if (IsTileType(t, MP_STATION) && IsOilRig(t) && HasBit(_m[t].m1, 7)) {
  22.                 SB(_m[t].m1, 7, 1, 0);
  23.             }
  24.             /* There was no real way to store canals owners before this version.
  25.              * Set the canal owner to be the same as the tile owner. */
  26.             if (IsWaterTile(t) && IsCanal(t)) {
  27.                 SetCanalOwner(t, GetTileOwner(t));
  28.             }
  29.             if (IsShipDepotTile(t) && GetWaterClass(t) == WATER_CLASS_CANAL) {
  30.                 SetCanalOwner(t, GetTileOwner(t));
  31.             }
  32.         }
  33.         _settings_game.construction.build_on_competitor_canal = 1;
  34.     }

Comments