static bool GrowingOnWateredTile(TileIndex tile) { TrackBits water_track = TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_WATER, 0)); if (water_track != TRACK_BIT_NONE) { if (water_track == TRACK_BIT_UPPER || water_track == TRACK_BIT_LOWER || water_track == TRACK_BIT_LEFT || water_track == TRACK_BIT_RIGHT) { TileIndex opposite_tile = INVALID_TILE; TrackBits opposite_track = TRACK_BIT_NONE; TileIndex next_tile_1 = INVALID_TILE; TrackBits next_track_1 = TRACK_BIT_NONE; TileIndex next_tile_2 = INVALID_TILE; TrackBits next_track_2 = TRACK_BIT_NONE; if (water_track == TRACK_BIT_UPPER) { opposite_tile = TileAddWrap(tile, -1, -1); opposite_track = TRACK_BIT_LOWER; next_tile_1 = TileAddWrap(tile, -1, 0); next_track_1 = _settings_game.pf.forbid_90_deg ? TRACK_BIT_Y | TRACK_BIT_UPPER : TRACK_BIT_3WAY_NW; next_tile_2 = TileAddWrap(tile, 0, -1); next_track_2 = _settings_game.pf.forbid_90_deg ? TRACK_BIT_X | TRACK_BIT_UPPER : TRACK_BIT_3WAY_NE; } else if (water_track == TRACK_BIT_RIGHT) { opposite_tile = TileAddWrap(tile, -1, 1); opposite_track = TRACK_BIT_LEFT; next_tile_1 = TileAddWrap(tile, 0, 1); next_track_1 = _settings_game.pf.forbid_90_deg ? TRACK_BIT_X | TRACK_BIT_RIGHT : TRACK_BIT_3WAY_NE; next_tile_2 = TileAddWrap(tile, -1, 0); next_track_2 = _settings_game.pf.forbid_90_deg ? TRACK_BIT_Y | TRACK_BIT_RIGHT : TRACK_BIT_3WAY_SE; } else if (water_track == TRACK_BIT_LOWER) { opposite_tile = TileAddWrap(tile, 1, 1); opposite_track = TRACK_BIT_UPPER; next_tile_1 = TileAddWrap(tile, 1, 0); next_track_1 = _settings_game.pf.forbid_90_deg ? TRACK_BIT_Y | TRACK_BIT_LOWER : TRACK_BIT_3WAY_SE; next_tile_2 = TileAddWrap(tile, 0, 1); next_track_2 = _settings_game.pf.forbid_90_deg ? TRACK_BIT_X | TRACK_BIT_LOWER : TRACK_BIT_3WAY_SW; } else if (water_track == TRACK_BIT_LEFT) { opposite_tile = TileAddWrap(tile, 1, -1); opposite_track = TRACK_BIT_RIGHT; next_tile_1 = TileAddWrap(tile, 0, -1); next_track_1 = _settings_game.pf.forbid_90_deg ? TRACK_BIT_X | TRACK_BIT_LEFT : TRACK_BIT_3WAY_SW; next_tile_2 = TileAddWrap(tile, 1, 0); next_track_2 = _settings_game.pf.forbid_90_deg ? TRACK_BIT_Y | TRACK_BIT_LEFT : TRACK_BIT_3WAY_NW; } 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; } } } /* Should never reach here */ return false; } return false; } return false; }