src/clear_cmd.cpp
branchcpp_gui
changeset 6308 646711c5feaa
parent 6303 84c215fc8eb8
equal deleted inserted replaced
6307:f40e88cff863 6308:646711c5feaa
    77 
    77 
    78 	count = ts->tile_table_count;
    78 	count = ts->tile_table_count;
    79 
    79 
    80 	if (count >= 625) return;
    80 	if (count >= 625) return;
    81 
    81 
    82 	for (t = ts->tile_table; count != 0; count--,t++) {
    82 	for (t = ts->tile_table; count != 0; count--, t++) {
    83 		if (*t == tile) return;
    83 		if (*t == tile) return;
    84 	}
    84 	}
    85 
    85 
    86 	ts->tile_table[ts->tile_table_count++] = tile;
    86 	ts->tile_table[ts->tile_table_count++] = tile;
    87 }
    87 }
   139 			}
   139 			}
   140 			return 0;
   140 			return 0;
   141 		}
   141 		}
   142 	}
   142 	}
   143 
   143 
   144 	ret = DoCommand(tile, 0,0, ts->flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
   144 	ret = DoCommand(tile, 0, 0, ts->flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
   145 
   145 
   146 	if (CmdFailed(ret)) {
   146 	if (CmdFailed(ret)) {
   147 		_terraform_err_tile = tile;
   147 		_terraform_err_tile = tile;
   148 		return -1;
   148 		return -1;
   149 	}
   149 	}
   213 
   213 
   214 		for (ttm = _terraform_tilepos; ttm != endof(_terraform_tilepos); ttm++) {
   214 		for (ttm = _terraform_tilepos; ttm != endof(_terraform_tilepos); ttm++) {
   215 			tile += ToTileIndexDiff(*ttm);
   215 			tile += ToTileIndexDiff(*ttm);
   216 
   216 
   217 			r = TerraformGetHeightOfTile(ts, tile);
   217 			r = TerraformGetHeightOfTile(ts, tile);
   218 			if (r != height && r-direction != height && r+direction != height) {
   218 			if (r != height && r - direction != height && r + direction != height) {
   219 				if (!TerraformTileHeight(ts, tile, r+direction))
   219 				if (!TerraformTileHeight(ts, tile, r + direction))
   220 					return false;
   220 					return false;
   221 			}
   221 			}
   222 		}
   222 		}
   223 	}
   223 	}
   224 
   224 
   380 	sy = TileY(p1);
   380 	sy = TileY(p1);
   381 	if (ex < sx) Swap(ex, sx);
   381 	if (ex < sx) Swap(ex, sx);
   382 	if (ey < sy) Swap(ey, sy);
   382 	if (ey < sy) Swap(ey, sy);
   383 	tile = TileXY(sx, sy);
   383 	tile = TileXY(sx, sy);
   384 
   384 
   385 	size_x = ex-sx+1;
   385 	size_x = ex - sx + 1;
   386 	size_y = ey-sy+1;
   386 	size_y = ey - sy + 1;
   387 
   387 
   388 	money = GetAvailableMoneyForCommand();
   388 	money = GetAvailableMoneyForCommand();
   389 	cost = 0;
   389 	cost = 0;
   390 
   390 
   391 	BEGIN_TILE_LOOP(tile2, size_x, size_y, tile) {
   391 	BEGIN_TILE_LOOP(tile2, size_x, size_y, tile) {