src/clear_cmd.cpp
changeset 8473 773b817b64d0
parent 8223 6a034093dc1d
child 8604 8afdd9877afd
equal deleted inserted replaced
8472:88d932993efd 8473:773b817b64d0
   436 	if (flags & DC_EXEC) {
   436 	if (flags & DC_EXEC) {
   437 		MakeOwnedLand(tile, _current_player);
   437 		MakeOwnedLand(tile, _current_player);
   438 		MarkTileDirtyByTile(tile);
   438 		MarkTileDirtyByTile(tile);
   439 	}
   439 	}
   440 
   440 
   441 	return cost.AddCost(_price.purchase_land * 10);
   441 	return cost.AddCost(_price.clear_roughland * 10);
   442 }
   442 }
   443 
   443 
   444 
   444 
   445 static CommandCost ClearTile_Clear(TileIndex tile, byte flags)
   445 static CommandCost ClearTile_Clear(TileIndex tile, byte flags)
   446 {
   446 {
   447 	static const Money* clear_price_table[] = {
   447 	static const Money* clear_price_table[] = {
   448 		&_price.clear_1,
   448 		&_price.clear_grass,
   449 		&_price.purchase_land,
   449 		&_price.clear_roughland,
   450 		&_price.clear_2,
   450 		&_price.clear_rocks,
   451 		&_price.clear_3,
   451 		&_price.clear_fields,
   452 		&_price.purchase_land,
   452 		&_price.clear_roughland,
   453 		&_price.purchase_land,
   453 		&_price.clear_roughland,
   454 		&_price.clear_2, // XXX unused?
       
   455 	};
   454 	};
   456 	CommandCost price;
   455 	CommandCost price;
   457 
   456 
   458 	if (!IsClearGround(tile, CLEAR_GRASS) || GetClearDensity(tile) != 0) {
   457 	if (!IsClearGround(tile, CLEAR_GRASS) || GetClearDensity(tile) != 0) {
   459 		price.AddCost(*clear_price_table[GetClearGround(tile)]);
   458 		price.AddCost(*clear_price_table[GetClearGround(tile)]);
   482 
   481 
   483 	if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
   482 	if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
   484 
   483 
   485 	if (flags & DC_EXEC) DoClearSquare(tile);
   484 	if (flags & DC_EXEC) DoClearSquare(tile);
   486 
   485 
   487 	return CommandCost(- _price.purchase_land * 2);
   486 	return CommandCost(- _price.clear_roughland * 2);
   488 }
   487 }
   489 
   488 
   490 
   489 
   491 #include "table/clear_land.h"
   490 #include "table/clear_land.h"
   492 
   491