Merge branch 'pr-7490' into jgrpp

# Conflicts:
#	src/dock_gui.cpp
#	src/water_cmd.cpp
This commit is contained in:
Jonathan G Rennison
2019-04-11 18:37:53 +01:00
3 changed files with 16 additions and 9 deletions

View File

@@ -387,7 +387,9 @@ bool RiverModifyDesertZone(TileIndex tile, void *)
* @param tile end tile of stretch-dragging
* @param flags type of operation
* @param p1 start tile of stretch-dragging
* @param p2 waterclass to build. sea and river can only be built in scenario editor, unless enable_build_river is enabled
* @param p2 various bitstuffed data
* bits 0-1: waterclass to build. sea and river can only be built in scenario editor, unless enable_build_river is enabled
* bit 2: Whether to use the Orthogonal (0) or Diagonal (1) iterator.
* @param text unused
* @return the cost of this operation or an error
*/
@@ -398,6 +400,7 @@ CommandCost CmdBuildCanal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
/* Outside of the editor you can only build canals, not oceans */
if (_game_mode != GM_EDITOR) {
if (HasBit(p2, 2)) return CMD_ERROR;
if (wc == WATER_CLASS_RIVER) {
if (!_settings_game.construction.enable_build_river) return CMD_ERROR;
} else if (wc != WATER_CLASS_CANAL) {
@@ -405,13 +408,17 @@ CommandCost CmdBuildCanal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
}
}
TileArea ta(tile, p1);
/* Outside the editor you can only drag canals, and not areas */
if (_game_mode != GM_EDITOR && ta.w != 1 && ta.h != 1) return CMD_ERROR;
if (_game_mode != GM_EDITOR) {
TileArea ta(tile, p1);
if (ta.w != 1 && ta.h != 1) return CMD_ERROR;
}
CommandCost cost(EXPENSES_CONSTRUCTION);
TILE_AREA_LOOP(tile, ta) {
TileIterator *iter = HasBit(p2, 2) ? (TileIterator *)new DiagonalTileIterator(tile, p1) : new OrthogonalTileIterator(tile, p1);
for (; *iter != INVALID_TILE; ++(*iter)) {
TileIndex tile = *iter;
CommandCost ret;
Slope slope = GetTileSlope(tile);