3 | static bool GrowingOnWateredTile(TileIndex tile)
| 1 | static bool GrowingOnWateredTile(TileIndex tile)
|
---|
4 | {
| 2 | {
|
---|
5 | TrackBits water_track = TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_WATER, 0));
| 3 | TrackBits water_track = TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_WATER, 0));
|
---|
6 | if (water_track != TRACK_BIT_NONE) {
| 4 | if (water_track != TRACK_BIT_NONE) {
|
---|
7 | if (water_track == TRACK_BIT_UPPER || water_track == TRACK_BIT_LOWER || water_track == TRACK_BIT_LEFT || water_track == TRACK_BIT_RIGHT) {
| 5 | if (water_track == TRACK_BIT_UPPER || water_track == TRACK_BIT_LOWER || water_track == TRACK_BIT_LEFT || water_track == TRACK_BIT_RIGHT) {
|
---|
15 | TileIndex next_tile_2 = TileAddWrap(tile, 0, -1);
| 21 | next_tile_2 = TileAddWrap(tile, 0, -1);
|
---|
16 | TrackBits next_track_2 = _settings_game.pf.forbid_90_deg ? TRACK_BIT_X | TRACK_BIT_UPPER : TRACK_BIT_3WAY_NE;
| 22 | next_track_2 = _settings_game.pf.forbid_90_deg ? TRACK_BIT_X | TRACK_BIT_UPPER : TRACK_BIT_3WAY_NE;
|
---|
| | 23 | } else if (water_track == TRACK_BIT_RIGHT) {
|
---|
| | 24 | opposite_tile = TileAddWrap(tile, -1, 1);
|
---|
| | 25 | opposite_track = TRACK_BIT_LEFT;
|
---|
| | 26 |
|
---|
| | 27 | next_tile_1 = TileAddWrap(tile, 0, 1);
|
---|
| | 28 | next_track_1 = _settings_game.pf.forbid_90_deg ? TRACK_BIT_X | TRACK_BIT_RIGHT : TRACK_BIT_3WAY_NE;
|
---|
| | 29 |
|
---|
| | 30 | next_tile_2 = TileAddWrap(tile, -1, 0);
|
---|
| | 31 | next_track_2 = _settings_game.pf.forbid_90_deg ? TRACK_BIT_Y | TRACK_BIT_RIGHT : TRACK_BIT_3WAY_SE;
|
---|
33 | TileIndex next_tile_2 = TileAddWrap(tile, 1, 0);
| 33 | next_tile_2 = TileAddWrap(tile, 1, 0);
|
---|
34 | TrackBits next_track_2 = _settings_game.pf.forbid_90_deg ? TRACK_BIT_Y | TRACK_BIT_LEFT : TRACK_BIT_3WAY_NW;
| 34 | next_track_2 = _settings_game.pf.forbid_90_deg ? TRACK_BIT_Y | TRACK_BIT_LEFT : TRACK_BIT_3WAY_NW;
|
---|
35 | } else if (water_track == TRACK_BIT_RIGHT) {
| | |
---|
36 | TileIndex opposite_tile = TileAddWrap(tile, -1, 1);
| | |
---|
37 | TrackBits opposite_track = TRACK_BIT_LEFT;
| | |
---|
38 |
| | |
---|
39 | TileIndex next_tile_1 = TileAddWrap(tile, 0, 1);
| | |
---|
40 | TrackBits next_track_1 = _settings_game.pf.forbid_90_deg ? TRACK_BIT_X | TRACK_BIT_RIGHT : TRACK_BIT_3WAY_NE;
| | |
---|
41 |
| | |
---|
42 | TileIndex next_tile_2 = TileAddWrap(tile, -1, 0);
| | |
---|
43 | TrackBits next_track_2 = _settings_game.pf.forbid_90_deg ? TRACK_BIT_Y | TRACK_BIT_RIGHT : TRACK_BIT_3WAY_SE;
| | |
---|
| | 51 | if (IsValidTile(next_tile_1)) {
|
---|
| | 52 | next_track_1 &= TrackStatusToTrackBits(GetTileTrackStatus(next_tile_1, TRANSPORT_WATER, 0));
|
---|
| | 53 | }
|
---|
| | 54 | if (IsValidTile(next_tile_2)) {
|
---|
| | 55 | next_track_2 &= TrackStatusToTrackBits(GetTileTrackStatus(next_tile_2, TRANSPORT_WATER, 0));
|
---|
| | 56 | }
|
---|
| | 57 | if (next_track_1 != TRACK_BIT_NONE && next_track_2 != TRACK_BIT_NONE) {
|
---|
| | 58 | if (IsValidTile(opposite_tile)) {
|
---|
| | 59 | opposite_track &= TrackStatusToTrackBits(GetTileTrackStatus(opposite_track, TRANSPORT_WATER, 0));
|
---|
| | 60 | }
|
---|
| | 61 | }
|
---|
| | 62 | if (next_track_1 != TRACK_BIT_NONE) {
|
---|
| | 63 | if (next_track_2 == TRACK_BIT_NONE) {
|
---|
| | 64 | return false;
|
---|
| | 65 | } else {
|
---|
| | 66 | if (opposite_track == TRACK_BIT_NONE) {
|
---|
| | 67 | return true;
|
---|
| | 68 | } else {
|
---|
| | 69 | return false;
|
---|
| | 70 | }
|
---|
| | 71 | }
|
---|
| | 72 | }
|
---|
| | 73 | if (next_track_2 != TRACK_BIT_NONE) {
|
---|
| | 74 | if (next_track_1 == TRACK_BIT_NONE) {
|
---|
| | 75 | return false;
|
---|
| | 76 | } else {
|
---|
| | 77 | if (opposite_track == TRACK_BIT_NONE) {
|
---|
| | 78 | return true;
|
---|
| | 79 | } else {
|
---|
| | 80 | return false;
|
---|
| | 81 | }
|
---|
| | 82 | }
|
---|
| | 83 | }
|
---|
| | 84 | if (next_track_1 == TRACK_BIT_NONE && next_track_2 == TRACK_BIT_NONE) {
|
---|
| | 85 | return false;
|
---|
| | 86 | }
|
---|
| | 87 | /* Should never reach here */
|
---|