Loading

Revision differences

Old revision #pwmdc97kxNew revision #pa08dtohs
1/**  1/**  
2 * Helper function  2 * Determine if a player could possibly build a ship lock that would cover this tile.
3 *  3 *  
4 * @param bridge_tile  4 * @param bridge_ramp The tile to possibly outrule a bridge position
5 * @param bridge_dir  5 * @param bridge_dir The bridge direction
6 * @return true  6 * @return true if a player could possibly build a ship lock on this tile.
7 * @see GrowTownWithBridge  7 * @see GrowTownWithBridge  
8 */  8 */  
9static bool IsPossibleLockLocationOnTownBridgeTile(const TileIndex bridge_tile, const DiagDirection bridge_dir)  9static bool IsPossibleLockLocationOnTownBridgeTile(const TileIndex bridge_tile, const DiagDirection bridge_dir)  
10{  10{  
11    const DiagDirection dir_side = ChangeDiagDir(bridge_dir, DIAGDIRDIFF_90LEFT);  11    const DiagDirection dir_side = ChangeDiagDir(bridge_dir, DIAGDIRDIFF_90LEFT);  
12    const int delta_side = TileOffsByDiagDir(dir_side);  12    const TileIndexDiff delta_side = TileOffsByDiagDir(dir_side);
13  13  
14    if (IsValidTile(bridge_tile) && IsPossibleLockLocationOnDiagDir(bridge_tile, bridge_dir, true) && IsWaterTile(bridge_tile) ||  14    if (IsValidTile(bridge_tile) && IsPossibleLockLocationOnDiagDir(bridge_tile, bridge_dir, true) && IsWaterTile(bridge_tile) ||  
15            IsValidTile(bridge_tile + delta_side) && IsPossibleLockLocationOnDiagDir(bridge_tile + delta_side, dir_side, true) && IsWaterTile(bridge_tile + delta_side) ||  15            IsValidTile(bridge_tile + delta_side) && IsPossibleLockLocationOnDiagDir(bridge_tile + delta_side, dir_side, true) && IsWaterTile(bridge_tile + delta_side) ||  
  
49    TileIndex bridge_tile = tile; // Used to store the other waterside  49    TileIndex bridge_tile = tile; // Used to store the other waterside  
50  50  
51    const int delta = TileOffsByDiagDir(bridge_dir);  51    const int delta = TileOffsByDiagDir(bridge_dir);  
52    const int delta_side = TileOffsByDiagDir(ChangeDiagDir(bridge_dir, DIAGDIRDIFF_90LEFT));  52//    const int delta_side = TileOffsByDiagDir(ChangeDiagDir(bridge_dir, DIAGDIRDIFF_90LEFT));
53  53  
54    if (slope == SLOPE_FLAT) {  54    if (slope == SLOPE_FLAT) {  
55        /* Bridges starting on flat tiles are only allowed when crossing rivers. */  55        /* Bridges starting on flat tiles are only allowed when crossing rivers. */