Old revision #p0yhrws4t | New revision #phsigderr | ||
---|---|---|---|
1 | Index: src/industry_cmd.cpp | ||
2 | =================================================================== | ||
3 | --- src/industry_cmd.cpp (revision 27198) | ||
4 | +++ src/industry_cmd.cpp (working copy) | ||
5 | @@ -1755,11 +1755,11 @@ | ||
6 | i->location.Add(cur_tile); | ||
7 | |||
8 | WaterClass wc = (IsWaterTile(cur_tile) ? GetWaterClass(cur_tile) : WATER_CLASS_INVALID); | ||
9 | - | ||
10 | + bool river = HasBit(_me[cur_tile].m6, 0); | ||
11 | DoCommand(cur_tile, 0, 0, DC_EXEC | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, CMD_LANDSCAPE_CLEAR); | ||
12 | - | ||
13 | + if (river) SB(_me[cur_tile].m6, 0, 1, 1); | ||
14 | MakeIndustry(cur_tile, i->index, it->gfx, Random(), wc); | ||
15 | - | ||
16 | + | ||
17 | if (_generating_world) { | ||
18 | SetIndustryConstructionCounter(cur_tile, 3); | ||
19 | SetIndustryConstructionStage(cur_tile, 2); | ||
20 | Index: src/station_cmd.cpp | ||
21 | =================================================================== | ||
22 | --- src/station_cmd.cpp (revision 27198) | ||
23 | +++ src/station_cmd.cpp (working copy) | ||
24 | @@ -2511,7 +2511,7 @@ | ||
25 | |||
26 | /* Get the water class of the water tile before it is cleared.*/ | ||
27 | WaterClass wc = GetWaterClass(tile_cur); | ||
28 | - | ||
29 | + bool river = HasBit(_me[tile_cur].m6, 0); | ||
30 | ret = DoCommand(tile_cur, 0, 0, flags, CMD_LANDSCAPE_CLEAR); | ||
31 | if (ret.Failed()) return ret; | ||
32 | |||
33 | @@ -2551,7 +2551,7 @@ | ||
34 | DirtyCompanyInfrastructureWindows(st->owner); | ||
35 | |||
36 | MakeDock(tile, st->owner, st->index, direction, wc); | ||
37 | - | ||
38 | + if (river) SB(_me[tile + TileOffsByDiagDir(direction)].m6, 0, 1, 1); | ||
39 | st->UpdateVirtCoord(); | ||
40 | UpdateStationAcceptance(st, false); | ||
41 | st->RecomputeIndustriesNear(); | ||
1 | Index: src/water_cmd.cpp | 42 | Index: src/water_cmd.cpp |
2 | =================================================================== | 43 | =================================================================== |
3 | --- src/water_cmd.cpp (revision 2719 | 3 | --- src/water_cmd.cpp (revision 27198) |
4 | +++ src/water_cmd.cpp (working copy) | 45 | +++ src/water_cmd.cpp (working copy) |
5 | @@ -123,6 +123,8 @@ | 46 | @@ -123,6 +123,8 @@ |
6 | CommandCost cost = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_DEPOT_SHIP]); | 47 | CommandCost cost = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_DEPOT_SHIP]); | … | … |
21 | MakeShipDepot(tile, _current_company, depot->index, DEPOT_PART_NORTH, axis, wc1); | 62 | MakeShipDepot(tile, _current_company, depot->index, DEPOT_PART_NORTH, axis, wc1); |
22 | MakeShipDepot(tile2, _current_company, depot->index, DEPOT_PART_SOUTH, axis, wc2); | 63 | MakeShipDepot(tile2, _current_company, depot->index, DEPOT_PART_SOUTH, axis, wc2); |
23 | MarkTileDirtyByTile(tile); | 64 | MarkTileDirtyByTile(tile); |
24 | @@ - | 24 | @@ -192,7 +195,7 @@ |
25 | 66 | ||
26 | | 26 | wc = WATER_CLASS_CANAL; |
27 | | 27 | } |
28 | 28 | - | |
29 | + bool river | 29 | + bool river = HasBit(_me[tile].m6, 0); |
30 | 30 | /* Zero map array and terminate animation */ | |
31 | | 31 | DoClearSquare(tile); |
32 | 73 | ||
33 | CommandCost ret = CheckTileOwnership(tile); | 74 | @@ -199,7 +202,9 @@ |
34 | if (ret.Failed()) return ret; | 75 | /* Maybe change to water */ |
35 | 76 | switch (wc) { | |
36 | - TileIndex tile2 = GetOtherShipDepotTile(tile); | 77 | case WATER_CLASS_SEA: MakeSea(tile); break; |
37 | 78 | - case WATER_CLASS_CANAL: MakeCanal(tile, o, Random()); break; | |
38 | + | 79 | + case WATER_CLASS_CANAL: MakeCanal(tile, o, Random()); |
39 | /* do not check for ship on tile when company goes bankrupt */ | 80 | + if (river) SB(_me[tile].m6, 0, 1, 1); |
40 | if (!(flags & DC_BANKRUPT)) { | 81 | + break; |
41 | CommandCost ret = EnsureNoVehicleOnGround(tile); | 82 | case WATER_CLASS_RIVER: MakeRiver(tile, Random()); break; |
42 | @@ -231,7 +237,8 @@ | 83 | default: break; |
84 | } | ||
85 | @@ -231,9 +236,9 @@ | ||
43 | c->infrastructure.water -= 2 * LOCK_DEPOT_TILE_FACTOR; | 86 | c->infrastructure.water -= 2 * LOCK_DEPOT_TILE_FACTOR; |
44 | DirtyCompanyInfrastructureWindows(c->index); | 87 | DirtyCompanyInfrastructureWindows(c->index); |
45 | } | 88 | } |
46 | - | 89 | - |
47 | |||
48 | |||
49 | MakeWaterKeepingClass(tile, GetTileOwner(tile)); | 90 | MakeWaterKeepingClass(tile, GetTileOwner(tile)); |
50 | MakeWaterKeepingClass(tile2, GetTileOwner(tile2)); | 91 | MakeWaterKeepingClass(tile2, GetTileOwner(tile2)); |
92 | + | ||
51 | } | 93 | } |
52 | |||
53 | 94 | ||
54 | /* lower tile */ | 54 | return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_DEPOT_SHIP]); |
55 | WaterClass wc_lower = IsWaterTile(tile - delta) ? GetWaterClass(tile - delta) : WATER_CLASS_CANAL; | 55 | @@ -291,7 +296,8 @@ |
56 | - | ||
57 | + | ||
58 | if (!IsWaterTile(tile - delta)) { | ||
59 | ret = DoCommand(tile - delta, 0, 0, flags, CMD_LANDSCAPE_CLEAR); | ||
60 | if (ret.Failed()) return ret; | ||
61 | @@ -277,7 +284,7 @@ | ||
62 | |||
63 | /* upper tile */ | ||
64 | WaterClass wc_upper = IsWaterTile(tile + delta) ? GetWaterClass(tile + delta) : WATER_CLASS_CANAL; | ||
65 | - | ||
66 | + | ||
67 | if (!IsWaterTile(tile + delta)) { | ||
68 | ret = DoCommand(tile + delta, 0, 0, flags, CMD_LANDSCAPE_CLEAR); | ||
69 | if (ret.Failed()) return ret; | ||
70 | @@ -291,7 +298,8 @@ | ||
71 | if (IsBridgeAbove(tile) || IsBridgeAbove(tile - delta) || IsBridgeAbove(tile + delta)) { | 97 | if (IsBridgeAbove(tile) || IsBridgeAbove(tile - delta) || IsBridgeAbove(tile + delta)) { |
72 | return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); | 98 | return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); |
73 | } | 99 | } | … | … |
77 | if (flags & DC_EXEC) { | 103 | if (flags & DC_EXEC) { |
78 | /* Update company infrastructure counts. */ | 104 | /* Update company infrastructure counts. */ |
79 | Company *c = Company::GetIfValid(_current_company); | 105 | Company *c = Company::GetIfValid(_current_company); |
80 | @@ -303,7 +3 | 80 | @@ -303,7 +309,8 @@ |
81 | c->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // Lock is three tiles. | 107 | c->infrastructure.water += 3 * LOCK_DEPOT_TILE_FACTOR; // Lock is three tiles. |
82 | DirtyCompanyInfrastructureWindows(_current_company); | 108 | DirtyCompanyInfrastructureWindows(_current_company); |
83 | } | 109 | } | … | … |
87 | MakeLock(tile, _current_company, dir, wc_lower, wc_upper, wc_middle); | 113 | MakeLock(tile, _current_company, dir, wc_lower, wc_upper, wc_middle); |
88 | MarkTileDirtyByTile(tile); | 114 | MarkTileDirtyByTile(tile); |
89 | MarkTileDirtyByTile(tile - delta); | 115 | MarkTileDirtyByTile(tile - delta); |
90 | @@ -336,7 +345,8 @@ | 90 | @@ -352,6 +359,7 @@ |
91 | if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile + delta); | ||
92 | if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile - delta); | ||
93 | if (ret.Failed()) return ret; | ||
94 | - | ||
95 | + bool river_lower = HasBit(_me[tile - delta].m6, 0); | ||
96 | + bool river_upper = HasBit(_me[tile + delta].m6, 0); | ||
97 | if (flags & DC_EXEC) { | ||
98 | /* Remove middle part from company infrastructure count. */ | ||
99 | Company *c = Company::GetIfValid(GetTileOwner(tile)); | ||
100 | @@ -352,6 +362,8 @@ | ||
101 | } | 117 | } |
102 | MakeWaterKeepingClass(tile + delta, GetTileOwner(tile + delta)); | 118 | MakeWaterKeepingClass(tile + delta, GetTileOwner(tile + delta)); |
103 | MakeWaterKeepingClass(tile - delta, GetTileOwner(tile - delta)); | 119 | MakeWaterKeepingClass(tile - delta, GetTileOwner(tile - delta)); |
104 | + if (river_lower) SB(_me[tile - delta].m6, 0, 1, 1); | 104 | + |
105 | + if (river_upper) SB(_me[tile + delta].m6, 0, 1, 1); | ||
106 | MarkCanalsAndRiversAroundDirty(tile); | 121 | MarkCanalsAndRiversAroundDirty(tile); |
107 | MarkCanalsAndRiversAroundDirty(tile - delta); | 122 | MarkCanalsAndRiversAroundDirty(tile - delta); |
108 | MarkCanalsAndRiversAroundDirty(tile + delta); | 123 | MarkCanalsAndRiversAroundDirty(tile + delta); |
109 | @@ -419,6 +4 | 109 | @@ -419,6 +427,7 @@ |
110 | if (IsTileType(tile, MP_WATER) && (!IsTileOwner(tile, OWNER_WATER) || wc == WATER_CLASS_SEA)) continue; | 125 | if (IsTileType(tile, MP_WATER) && (!IsTileOwner(tile, OWNER_WATER) || wc == WATER_CLASS_SEA)) continue; |
111 | 126 | ||
112 | bool water = IsWaterTile(tile); | 127 | bool water = IsWaterTile(tile); | … | … |
114 | ret = DoCommand(tile, 0, 0, flags | DC_FORCE_CLEAR_TILE, CMD_LANDSCAPE_CLEAR); | 129 | ret = DoCommand(tile, 0, 0, flags | DC_FORCE_CLEAR_TILE, CMD_LANDSCAPE_CLEAR); |
115 | if (ret.Failed()) return ret; | 130 | if (ret.Failed()) return ret; |
116 | 131 | ||
117 | @@ -442,6 +45 | 117 | @@ -442,6 +451,7 @@ |
118 | /* FALL THROUGH */ | 133 | /* FALL THROUGH */ |
119 | 134 | ||
120 | default: | 135 | default: | … | … |
122 | MakeCanal(tile, _current_company, Random()); | 137 | MakeCanal(tile, _current_company, Random()); |
123 | if (Company::IsValidID(_current_company)) { | 138 | if (Company::IsValidID(_current_company)) { |
124 | Company::Get(_current_company)->infrastructure.water++; | 139 | Company::Get(_current_company)->infrastructure.water++; |
125 | @@ -465,6 +47 | 125 | @@ -465,6 +475,7 @@ |
126 | 141 | ||
127 | static CommandCost ClearTile_Water(TileIndex tile, DoCommandFlag flags) | 142 | static CommandCost ClearTile_Water(TileIndex tile, DoCommandFlag flags) |
128 | { | 143 | { | … | … |
130 | switch (GetWaterTileType(tile)) { | 145 | switch (GetWaterTileType(tile)) { |
131 | case WATER_TILE_CLEAR: { | 146 | case WATER_TILE_CLEAR: { |
132 | if (flags & DC_NO_WATER) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER); | 147 | if (flags & DC_NO_WATER) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER); |
133 | @@ -485,7 +500,6 @@ | 133 | @@ -492,6 +503,7 @@ |
134 | CommandCost ret = CheckTileOwnership(tile); | ||
135 | if (ret.Failed()) return ret; | ||
136 | } | ||
137 | - | ||
138 | if (flags & DC_EXEC) { | ||
139 | if (IsCanal(tile) && Company::IsValidID(owner)) { | ||
140 | Company::Get(owner)->infrastructure.water--; | ||
141 | @@ -492,9 +506,9 @@ | ||
142 | DirtyCompanyInfrastructureWindows(owner); | 149 | DirtyCompanyInfrastructureWindows(owner); |
143 | } | 150 | } |
144 | DoClearSquare(tile); | 151 | DoClearSquare(tile); |
145 | + if (river) MakeRiver(tile, Random()); | 152 | + if (river) MakeRiver(tile, Random()); |
146 | MarkCanalsAndRiversAroundDirty(tile); | 153 | MarkCanalsAndRiversAroundDirty(tile); |
147 | } | 147 | } |
148 | - | ||
149 | return CommandCost(EXPENSES_CONSTRUCTION, base_cost); | ||
150 | } |