Loading

Paste #psufuz15j

  1.             /* The tile owner of LOCK_PART_LOWER and LOCK_PART_UPPER was either
  2.              * the owner of the water or the owner of the lock. The tile owner of
  3.              * LOCK_PART_MIDDLE was the real owner of the lock. */
  4.             if (IsTileType(t, MP_WATER) && IsLock(t)) {
  5.                 if (GetWaterClass(t) == WATER_CLASS_CANAL) {
  6.                     /* First, set the canal owner for every lock part to be the same as the tile owner. */
  7.                     SetCanalOwner(t, GetTileOwner(t));
  8.                 }
  9.                 /* Then, set the tile owner of LOCK_PART_LOWER and LOCK_PART_UPPER to be the same
  10.                  * as the owner of the LOCK_PART_MIDDLE. */
  11.                 static const TileIndexDiffC _lock_tomiddle_offs[][DIAGDIR_END] = {
  12.                     /*   NE       SE        SW      NW       */
  13.                     { { 0,  0}, {0,  0}, { 0, 0}, {0,  0} }, // LOCK_PART_MIDDLE
  14.                     { {-1,  0}, {0,  1}, { 1, 0}, {0, -1} }, // LOCK_PART_LOWER
  15.                     { { 1,  0}, {0, -1}, {-1, 0}, {0,  1} }, // LOCK_PART_UPPER
  16.                 };
  17.                 if (GetLockPart(t) != LOCK_PART_MIDDLE) {
  18.                     SetTileOwner(t, GetTileOwner(t + ToTileIndexDiff(_lock_tomiddle_offs[GetLockPart(t)][GetLockDirection(t)])));
  19.                 }
  20.             }

Comments