clear_cmd.c
changeset 1878 980fabc7d8a5
parent 1796 614d996f6be7
child 1891 862800791170
equal deleted inserted replaced
1877:ab6a315fa930 1878:980fabc7d8a5
   235 	ts.cost = 0;
   235 	ts.cost = 0;
   236 	ts.modheight = modheight_data;
   236 	ts.modheight = modheight_data;
   237 	ts.tile_table = tile_table_data;
   237 	ts.tile_table = tile_table_data;
   238 
   238 
   239 	tile = TILE_FROM_XY(x,y);
   239 	tile = TILE_FROM_XY(x,y);
       
   240 
       
   241 	/* Make an extra check for map-bounds cause we add tiles to the originating tile */
       
   242 	if (tile + TILE_XY(1,1) > MapSize()) return CMD_ERROR;
   240 
   243 
   241 	if (p1 & 1) {
   244 	if (p1 & 1) {
   242 		if (!TerraformTileHeight(&ts, tile+TILE_XY(1,0),
   245 		if (!TerraformTileHeight(&ts, tile+TILE_XY(1,0),
   243 				TileHeight(tile + TILE_XY(1, 0)) + direction))
   246 				TileHeight(tile + TILE_XY(1, 0)) + direction))
   244 					return CMD_ERROR;
   247 					return CMD_ERROR;
   447 
   450 
   448 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
   451 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
   449 
   452 
   450 	tile = TILE_FROM_XY(x,y);
   453 	tile = TILE_FROM_XY(x,y);
   451 
   454 
   452 	if (!CheckTileOwnership(tile) && _current_player != OWNER_WATER)
   455 	if (!IsTileType(tile, MP_UNMOVABLE) || _map5[tile] != 3) return CMD_ERROR;
   453 		return CMD_ERROR;
   456 	if (!CheckTileOwnership(tile) && _current_player != OWNER_WATER) return CMD_ERROR;
       
   457 
   454 
   458 
   455 	if (!EnsureNoVehicle(tile)) return CMD_ERROR;
   459 	if (!EnsureNoVehicle(tile)) return CMD_ERROR;
   456 
   460 
   457 	if (flags & DC_EXEC)
   461 	if (flags & DC_EXEC)
   458 		DoClearSquare(tile);
   462 		DoClearSquare(tile);