struct { TileIndexDiff opposite_tile, next_tile_1, next_tile_2; TrackBits opposite_track, next_track_1, next_track_2; } table[] = { { TileDiffXY(-1, 1), TileDiffXY( 0, 1), TileDiffXY(-1, 0), TRACK_BIT_LEFT, _settings_game.pf.forbid_90_deg ? TRACK_BIT_X | TRACK_BIT_RIGHT : TRACK_BIT_3WAY_NE, _settings_game.pf.forbid_90_deg ? TRACK_BIT_Y | TRACK_BIT_RIGHT : TRACK_BIT_3WAY_SE }, { TileDiffXY(-1, -1), TileDiffXY(-1, 0), TileDiffXY( 0, -1), TRACK_BIT_LOWER, _settings_game.pf.forbid_90_deg ? TRACK_BIT_Y | TRACK_BIT_UPPER : TRACK_BIT_3WAY_NW, _settings_game.pf.forbid_90_deg ? TRACK_BIT_X | TRACK_BIT_UPPER : TRACK_BIT_3WAY_NE }, { TileDiffXY( 1, -1), TileDiffXY( 0, -1), TileDiffXY( 1, 0), TRACK_BIT_RIGHT, _settings_game.pf.forbid_90_deg ? TRACK_BIT_X | TRACK_BIT_LEFT : TRACK_BIT_3WAY_SW, _settings_game.pf.forbid_90_deg ? TRACK_BIT_Y | TRACK_BIT_LEFT : TRACK_BIT_3WAY_NW }, { TileDiffXY( 1, 1), TileDiffXY( 1, 0), TileDiffXY( 0, 1), TRACK_BIT_UPPER, _settings_game.pf.forbid_90_deg ? TRACK_BIT_Y | TRACK_BIT_LOWER : TRACK_BIT_3WAY_SE, _settings_game.pf.forbid_90_deg ? TRACK_BIT_X | TRACK_BIT_LOWER : TRACK_BIT_3WAY_SW }, }; static bool GrowingOnWateredTile(TileIndex tile) { Slope slope = GetTileSlope(tile); if (IsSlopeWithOneCornerRaised(slope)) { Corner corner = GetHighestSlopeCorner(slope); TileIndex opposite_tile = tile + table[corner].opposite_tile; TrackBits opposite_track = table[corner].opposite_track; TileIndex next_tile_1 = tile + table[corner].next_tile_1; TrackBits next_track_1 = table[corner].next_track_1; TileIndex next_tile_2 = tile + table[corner].next_tile_2; TrackBits next_track_2 = table[corner].next_track_2; if (IsValidTile(next_tile_1)) { next_track_1 &= TrackStatusToTrackBits(GetTileTrackStatus(next_tile_1, TRANSPORT_WATER, 0)); } if (IsValidTile(next_tile_2)) { next_track_2 &= TrackStatusToTrackBits(GetTileTrackStatus(next_tile_2, TRANSPORT_WATER, 0)); } if (next_track_1 != TRACK_BIT_NONE && next_track_2 != TRACK_BIT_NONE) { if (IsValidTile(opposite_tile)) { opposite_track &= TrackStatusToTrackBits(GetTileTrackStatus(opposite_track, TRANSPORT_WATER, 0)); } } if (next_track_1 != TRACK_BIT_NONE) { if (next_track_2 == TRACK_BIT_NONE) { return false; } else { if (opposite_track == TRACK_BIT_NONE) { return true; } else { return false; } } } if (next_track_2 != TRACK_BIT_NONE) { if (next_track_1 == TRACK_BIT_NONE) { return false; } else { if (opposite_track == TRACK_BIT_NONE) { return true; } else { return false; } } } if (next_track_1 == TRACK_BIT_NONE && next_track_2 == TRACK_BIT_NONE) { return false; } /* Should never reach here */ return false; } return false; }