Loading

Revision differences

Old revision #pb5h0iyqgNew 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  2  
3  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  
4    int t2 = t + TileOffsByDiagDir(d);  8    int t2 = t + TileOffsByDiagDir(d);  
5    /* I need a big comment here */  9    MakeStation(t2, // Decide the owner of the water tile placed under a dock.
6    if (IsWaterTile(t2)) {  10        /* Make the owner of the dock tile the same as the current owner of the
7        if (HasTileWaterClass(t2) && GetWaterClass(t2) == WATER_CLASS_RIVER) {  11         * water tile.
8            if (HasBit(_me[t2].m6, 0)) {  12         * At this point, the information passed by the previous function has
9            } else {  13         * been prepared in a way which permits the Owner and the WaterClass to
10                o = GetTileOwner(t2);  14         * be set to their intended values.
11            }  15         *
12            o = GetTileOwner(t2);  16         * A canal tile owned by OWNER_NONE has been made sure to have never
13        } else {  17         * been demolished during preparation, as that is needed to retrieve
14            if (wc == WATER_CLASS_SEA) {  18         * its respective owner, whenever it finds a river tile.
15                o = OWNER_WATER;  19         *
16            } else {  20         * If a river tile is found, it can mean either the previous function
17            }  21         * demolished own canal and a river was restored, as per the Canal on
18        }  22         * River patch's behaviour, or it is indeed a river tile which, albeit
19    }  23         * being demolished, it is kept, as per the Permanent Rivers patch
20  24         * behaviour.
21    MakeStation(t2, o, sid, STATION_DOCK, GFX_DOCK_BASE_WATER_PART + DiagDirToAxis(d), wc); 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}