OpenTTD Source 20250312-master-gcdcc6b491d
terraform_cmd.cpp File Reference

Commands related to terraforming. More...

#include "stdafx.h"
#include "command_func.h"
#include "tunnel_map.h"
#include "bridge_map.h"
#include "viewport_func.h"
#include "genworld.h"
#include "object_base.h"
#include "company_base.h"
#include "company_func.h"
#include "core/backup_type.hpp"
#include "terraform_cmd.h"
#include "landscape_cmd.h"
#include "table/strings.h"
#include "safeguards.h"

Go to the source code of this file.

Data Structures

struct  TerraformerState
 State of the terraforming. More...
 

Typedefs

typedef std::set< TileIndexTileIndexSet
 Set of tiles.
 
typedef std::map< TileIndex, int > TileIndexToHeightMap
 Mapping of tiles to their height.
 

Functions

static int TerraformGetHeightOfTile (const TerraformerState *ts, TileIndex tile)
 Gets the TileHeight (height of north corner) of a tile as of current terraforming progress.
 
static void TerraformSetHeightOfTile (TerraformerState *ts, TileIndex tile, int height)
 Stores the TileHeight (height of north corner) of a tile in a TerraformerState.
 
static void TerraformAddDirtyTile (TerraformerState *ts, TileIndex tile)
 Adds a tile to the "tile_table" in a TerraformerState.
 
static void TerraformAddDirtyTileAround (TerraformerState *ts, TileIndex tile)
 Adds all tiles that incident with the north corner of a specific tile to the "tile_table" in a TerraformerState.
 
static std::tuple< CommandCost, TileIndexTerraformTileHeight (TerraformerState *ts, TileIndex tile, int height)
 Terraform the north corner of a tile to a specific height.
 
std::tuple< CommandCost, Money, TileIndexCmdTerraformLand (DoCommandFlags flags, TileIndex tile, Slope slope, bool dir_up)
 Terraform land.
 
std::tuple< CommandCost, Money, TileIndexCmdLevelLand (DoCommandFlags flags, TileIndex tile, TileIndex start_tile, bool diagonal, LevelMode lm)
 Levels a selected (rectangle) area of land.
 

Detailed Description

Commands related to terraforming.

Definition in file terraform_cmd.cpp.

Typedef Documentation

◆ TileIndexSet

typedef std::set<TileIndex> TileIndexSet

Set of tiles.

Definition at line 28 of file terraform_cmd.cpp.

◆ TileIndexToHeightMap

typedef std::map<TileIndex, int> TileIndexToHeightMap

Mapping of tiles to their height.

Definition at line 30 of file terraform_cmd.cpp.

Function Documentation

◆ CmdLevelLand()

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

◆ CmdTerraformLand()

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

◆ TerraformGetHeightOfTile()

static int TerraformGetHeightOfTile ( const TerraformerState ts,
TileIndex  tile 
)
static

Gets the TileHeight (height of north corner) of a tile as of current terraforming progress.

Parameters
tsTerraformerState.
tileTile.
Returns
TileHeight.

Definition at line 45 of file terraform_cmd.cpp.

References TerraformerState::tile_to_new_height, and TileHeight().

Referenced by CmdTerraformLand(), and TerraformTileHeight().

◆ TerraformSetHeightOfTile()

static void TerraformSetHeightOfTile ( TerraformerState ts,
TileIndex  tile,
int  height 
)
static

Stores the TileHeight (height of north corner) of a tile in a TerraformerState.

Parameters
tsTerraformerState.
tileTile.
heightNew TileHeight.

Definition at line 58 of file terraform_cmd.cpp.

References TerraformerState::tile_to_new_height.

Referenced by TerraformTileHeight().

◆ TerraformTileHeight()