Loading

Revision differences

Old revision #p8tcnva6vNew revision #pep5wvgvq
1MakeStation(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); 1MakeStation(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);
   2
   3
   4static inline void MakeDock(TileIndex t, Owner o, StationID sid, DiagDirection d, WaterClass wc)
   5{
   6    MakeStation(t, o, sid, STATION_DOCK, d);
   7
   8    int t2 = t + TileOffsByDiagDir(d);
   9    MakeStation(t2, // Decide the owner of the water tile placed under a dock.
   10        /* Make the owner of the dock tile the same as the current owner of the
   11         * water tile.
   12         * At this point, the information passed by the previous function has
   13         * been prepared in a way which permits the Owner and the WaterClass to
   14         * be set to their intended values.
   15         *
   16         * A canal tile owned by OWNER_NONE has been made sure to have never
   17         * been demolished during preparation, as that is needed to retrieve
   18         * its respective owner, whenever it finds a river tile.
   19         *
   20         * If a river tile is found, it can mean either the previous function
   21         * demolished own canal and a river was restored, as per the Canal on
   22         * River patch's behaviour, or it is indeed a river tile which, albeit
   23         * being demolished, it is kept, as per the Permanent Rivers patch
   24         * behaviour.
   25         * This is not enough to decide on the owner, but the previous function
   26         * has assigned a bit value to indicate if there was originally a canal.
   27         * If it was set, it means the canal was ours, and not from another
   28         * owner. If the bit was not set, then it was indeed a river.
   29         *
   30         * If a bare land tile is found at this stage, then it is known that no
   31         * river was ever originally present, but it could have been a canal or
   32         * a sea tile. To figure it out, it resorts to checking the original
   33         * WaterClass of the tile even before the clearance test had happen.
   34         * If it was sea, then it sets the owner to OWNER_WATER. If it was a
   35         * canal then it knows that only own canals could have been demolished
   36         * during the clearance check previously, and also that canals
   37         * owned by OWNER_NONE are not demolished.
   38         */
   39            IsWaterTile(t2) ? //
   40                    HasTileWaterClass(t2) && GetWaterClass(t2) == WATER_CLASS_RIVER ?
   41                            HasBit(_me[t2].m6, 0) ?    o
   42                            : GetTileOwner(t2)
   43                    : GetTileOwner(t2)
   44            : wc == WATER_CLASS_SEA ? OWNER_WATER :    o,
   45        sid, STATION_DOCK, GFX_DOCK_BASE_WATER_PART + DiagDirToAxis(d), wc);
   46}