OpenTTD Source  20241121-master-g67a0fccfad
terraform_cmd.h File Reference

Command definitions related to terraforming. More...

#include "command_type.h"
#include "map_type.h"
#include "slope_type.h"

Go to the source code of this file.

Functions

std::tuple< CommandCost, Money, TileIndexCmdTerraformLand (DoCommandFlag flags, TileIndex tile, Slope slope, bool dir_up)
 Terraform land. More...
 
std::tuple< CommandCost, Money, TileIndexCmdLevelLand (DoCommandFlag flags, TileIndex tile, TileIndex start_tile, bool diagonal, LevelMode lm)
 Levels a selected (rectangle) area of land. More...
 
 DEF_CMD_TRAIT (CMD_LEVEL_LAND, CmdLevelLand, CMD_ALL_TILES|CMD_AUTO|CMD_NO_TEST, CMDT_LANDSCAPE_CONSTRUCTION) CommandCallback CcPlaySound_EXPLOSION
 
void CcTerraform (Commands cmd, const CommandCost &result, Money, TileIndex tile)
 

Detailed Description

Command definitions related to terraforming.

Definition in file terraform_cmd.h.

Function Documentation

◆ CmdLevelLand()

std::tuple<CommandCost, Money, TileIndex> CmdLevelLand ( DoCommandFlag  flags,
TileIndex  tile,
TileIndex  start_tile,
bool  diagonal,
LevelMode  lm 
)

Levels a selected (rectangle) area of land.

Parameters
flagsfor this command type
tileend tile of area-drag
start_tilestart tile of area drag
diagonalWhether to use the Orthogonal (false) or Diagonal (true) iterator.
LevelModeMode of leveling LevelMode.
Returns
the cost of this operation or an error

Definition at line 315 of file terraform_cmd.cpp.

References _current_company, _settings_game, CommandCost::AddCost(), CMD_ERROR, GameSettings::construction, TileIterator::Create(), DC_EXEC, EXPENSES_CONSTRUCTION, CommandCost::Failed(), GB(), GetAvailableMoneyForCommand(), CommandCost::GetCost(), CommandCost::GetErrorMessage(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), INVALID_STRING_ID, INVALID_TILE, LM_LEVEL, LM_LOWER, LM_RAISE, ConstructionSettings::map_height_limit, Map::Size(), SLOPE_N, CommandCost::Succeeded(), CompanyProperties::terraform_limit, and TileHeight().

◆ CmdTerraformLand()

std::tuple<CommandCost, Money, TileIndex> CmdTerraformLand ( DoCommandFlag  flags,
TileIndex  tile,
Slope  slope,
bool  dir_up 
)

Terraform land.

Parameters
flagsfor this command type
tiletile to terraform
slopecorners to terraform (SLOPE_xxx)
dir_updirection; eg up (true) or down (false)
Returns
the cost of this operation or an error

Definition at line 169 of file terraform_cmd.cpp.

References _generating_world, _settings_game, CommandCost::AddCost(), GameSettings::construction, TerraformerState::dirty_tiles, EXPENSES_CONSTRUCTION, FindClearedObject(), ClearedObjectArea::first_tile, GetBridgeHeight(), GetSouthernBridgeEnd(), IsBridgeAbove(), IsTileType(), IsTunnelInWay(), ConstructionSettings::max_bridge_height, MP_VOID, Map::Size(), SLOPE_E, SLOPE_FLAT, SLOPE_N, SLOPE_S, SLOPE_STEEP, SLOPE_W, TerraformGetHeightOfTile(), TerraformTileHeight(), TileDiffXY(), and TileHeight().