MakeStation(t + TileOffsByDiagDir(d), IsWaterTile(t + TileOffsByDiagDir(d)) ? HasTileWaterClass(t + TileOffsByDiagDir(d)) && GetWaterClass(t + TileOffsByDiagDir(d)) == WATER_CLASS_RIVER ? HasBit(_me[t + TileOffsByDiagDir(d)].m6, 0) ? o : GetTileOwner(t + TileOffsByDiagDir(d)) : GetTileOwner(t + TileOffsByDiagDir(d)) : wc == WATER_CLASS_SEA ? OWNER_WATER : o, sid, STATION_DOCK, GFX_DOCK_BASE_WATER_PART + DiagDirToAxis(d), wc);
static inline void MakeDock(TileIndex t, Owner o, StationID sid, DiagDirection d, WaterClass wc)
{
MakeStation(t, o, sid, STATION_DOCK, d);
int t2 = t + TileOffsByDiagDir(d);
MakeStation(t2, // Decide the owner of the water tile placed under a dock.
/* Make the owner of the dock tile the same as the current owner of the
* water tile.
* At this point, the information passed by the previous function has
* been prepared in a way which permits the Owner and the WaterClass to
* be set to their intended values.
*
* A canal tile owned by OWNER_NONE has been made sure to have never
* been demolished during preparation, as that is needed to retrieve
* its respective owner, whenever it finds a river tile.
*
* If a river tile is found, it can mean either the previous function
* demolished own canal and a river was restored, as per the Canal on
* River patch's behaviour, or it is indeed a river tile which, albeit
* being demolished, it is kept, as per the Permanent Rivers patch
* behaviour.
* This is not enough to decide on the owner, but the previous function
* has assigned a bit value to indicate if there was originally a canal.
* If it was set, it means the canal was ours, and not from another
* owner. If the bit was not set, then it was indeed a river.
*
* If a bare land tile is found at this stage, then it is known that no
* river was ever originally present, but it could have been a canal or
* a sea tile. To figure it out, it resorts to checking the original
* WaterClass of the tile even before the clearance test had happen.
* If it was sea, then it sets the owner to OWNER_WATER. If it was a
* canal then it knows that only own canals could have been demolished
* during the clearance check previously, and also that canals
* owned by OWNER_NONE are not demolished.
*/
IsWaterTile(t2) ? //
HasTileWaterClass(t2) && GetWaterClass(t2) == WATER_CLASS_RIVER ?
HasBit(_me[t2].m6, 0) ? o
: GetTileOwner(t2)
: GetTileOwner(t2)
: wc == WATER_CLASS_SEA ? OWNER_WATER : o,
sid, STATION_DOCK, GFX_DOCK_BASE_WATER_PART + DiagDirToAxis(d), wc);
}