equal
deleted
inserted
replaced
32 #include "sound_func.h" |
32 #include "sound_func.h" |
33 #include "variables.h" |
33 #include "variables.h" |
34 #include "player_func.h" |
34 #include "player_func.h" |
35 #include "settings_type.h" |
35 #include "settings_type.h" |
36 #include "clear_map.h" |
36 #include "clear_map.h" |
|
37 #include "tree_map.h" |
37 |
38 |
38 #include "table/sprites.h" |
39 #include "table/sprites.h" |
39 #include "table/strings.h" |
40 #include "table/strings.h" |
40 |
41 |
41 /** |
42 /** |
127 case MP_RAILWAY: |
128 case MP_RAILWAY: |
128 /* Shore or flooded halftile */ |
129 /* Shore or flooded halftile */ |
129 has_water |= (GetRailGroundType(neighbour) == RAIL_GROUND_WATER); |
130 has_water |= (GetRailGroundType(neighbour) == RAIL_GROUND_WATER); |
130 break; |
131 break; |
131 |
132 |
|
133 case MP_TREES: |
|
134 /* trees on shore */ |
|
135 has_water |= (GetTreeGround(neighbour) == TREE_GROUND_SHORE); |
|
136 break; |
|
137 |
132 default: break; |
138 default: break; |
133 } |
139 } |
134 } |
140 } |
135 if (has_canal || !has_water) { |
141 if (has_canal || !has_water) { |
136 MakeCanal(t, o, Random()); |
142 MakeCanal(t, o, Random()); |
824 * @return Behaviour of the tile |
830 * @return Behaviour of the tile |
825 */ |
831 */ |
826 static FloodingBehaviour GetFloodingBehaviour(TileIndex tile) |
832 static FloodingBehaviour GetFloodingBehaviour(TileIndex tile) |
827 { |
833 { |
828 /* FLOOD_ACTIVE: 'single-corner-raised'-coast, sea, sea-shipdepots, sea-buoys, rail with flooded halftile |
834 /* FLOOD_ACTIVE: 'single-corner-raised'-coast, sea, sea-shipdepots, sea-buoys, rail with flooded halftile |
829 * FLOOD_DRYUP: coast with more than one corner raised, coast with rail-track |
835 * FLOOD_DRYUP: coast with more than one corner raised, coast with rail-track, coast with trees |
830 * FLOOD_PASSIVE: oilrig, dock, water-industries |
836 * FLOOD_PASSIVE: oilrig, dock, water-industries |
831 * FLOOD_NONE: canals, rivers, everything else |
837 * FLOOD_NONE: canals, rivers, everything else |
832 */ |
838 */ |
833 switch (GetTileType(tile)) { |
839 switch (GetTileType(tile)) { |
834 case MP_WATER: |
840 case MP_WATER: |
843 if (GetRailGroundType(tile) == RAIL_GROUND_WATER) { |
849 if (GetRailGroundType(tile) == RAIL_GROUND_WATER) { |
844 return (IsSlopeWithOneCornerRaised(GetTileSlope(tile, NULL)) ? FLOOD_ACTIVE : FLOOD_DRYUP); |
850 return (IsSlopeWithOneCornerRaised(GetTileSlope(tile, NULL)) ? FLOOD_ACTIVE : FLOOD_DRYUP); |
845 } |
851 } |
846 return FLOOD_NONE; |
852 return FLOOD_NONE; |
847 |
853 |
|
854 case MP_TREES: |
|
855 return (GetTreeGround(tile) == TREE_GROUND_SHORE ? FLOOD_DRYUP : FLOOD_NONE); |
|
856 |
848 case MP_STATION: |
857 case MP_STATION: |
849 if (IsSeaBuoyTile(tile)) return FLOOD_ACTIVE; |
858 if (IsSeaBuoyTile(tile)) return FLOOD_ACTIVE; |
850 if (IsOilRig(tile) || IsDock(tile)) return FLOOD_PASSIVE; |
859 if (IsOilRig(tile) || IsDock(tile)) return FLOOD_PASSIVE; |
851 return FLOOD_NONE; |
860 return FLOOD_NONE; |
852 |
861 |
867 |
876 |
868 bool flooded = false; // Will be set to true if something is changed. |
877 bool flooded = false; // Will be set to true if something is changed. |
869 |
878 |
870 _current_player = OWNER_WATER; |
879 _current_player = OWNER_WATER; |
871 |
880 |
872 if (GetTileSlope(target, NULL) != SLOPE_FLAT) { |
881 Slope tileh = GetTileSlope(target, NULL); |
|
882 if (tileh != SLOPE_FLAT) { |
873 /* make coast.. */ |
883 /* make coast.. */ |
874 switch (GetTileType(target)) { |
884 switch (GetTileType(target)) { |
875 case MP_RAILWAY: { |
885 case MP_RAILWAY: { |
876 if (!IsPlainRailTile(target)) break; |
886 if (!IsPlainRailTile(target)) break; |
877 |
887 |
881 if (v != NULL) FloodVehicle(v); |
891 if (v != NULL) FloodVehicle(v); |
882 |
892 |
883 break; |
893 break; |
884 } |
894 } |
885 |
895 |
|
896 case MP_TREES: |
|
897 if (!IsSlopeWithOneCornerRaised(tileh)) { |
|
898 SetTreeGroundDensity(target, TREE_GROUND_SHORE, 3); |
|
899 MarkTileDirtyByTile(target); |
|
900 flooded = true; |
|
901 break; |
|
902 } |
|
903 /* FALL THROUGH */ |
886 case MP_CLEAR: |
904 case MP_CLEAR: |
887 case MP_TREES: |
|
888 if (CmdSucceeded(DoCommand(target, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR))) { |
905 if (CmdSucceeded(DoCommand(target, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR))) { |
889 MakeShore(target); |
906 MakeShore(target); |
890 MarkTileDirtyByTile(target); |
907 MarkTileDirtyByTile(target); |
891 flooded = true; |
908 flooded = true; |
892 } |
909 } |
938 case TRACK_BIT_LEFT: new_ground = RAIL_GROUND_FENCE_VERT1; break; |
955 case TRACK_BIT_LEFT: new_ground = RAIL_GROUND_FENCE_VERT1; break; |
939 case TRACK_BIT_RIGHT: new_ground = RAIL_GROUND_FENCE_VERT2; break; |
956 case TRACK_BIT_RIGHT: new_ground = RAIL_GROUND_FENCE_VERT2; break; |
940 default: NOT_REACHED(); |
957 default: NOT_REACHED(); |
941 } |
958 } |
942 SetRailGroundType(tile, new_ground); |
959 SetRailGroundType(tile, new_ground); |
|
960 MarkTileDirtyByTile(tile); |
|
961 break; |
|
962 |
|
963 case MP_TREES: |
|
964 SetTreeGroundDensity(tile, TREE_GROUND_GRASS, 3); |
943 MarkTileDirtyByTile(tile); |
965 MarkTileDirtyByTile(tile); |
944 break; |
966 break; |
945 |
967 |
946 case MP_WATER: |
968 case MP_WATER: |
947 assert(IsCoast(tile)); |
969 assert(IsCoast(tile)); |