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 "economy_func.h"
#include "genworld.h"
#include "object_base.h"
#include "company_base.h"
#include "company_func.h"
#include "table/strings.h"
Go to the source code of this file.
Data Structures | |
struct | TerraformerHeightMod |
struct | TerraformerState |
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 CommandCost | TerraformTileHeight (TerraformerState *ts, TileIndex tile, int height) |
Terraform the north corner of a tile to a specific height. | |
CommandCost | CmdTerraformLand (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Terraform land. | |
CommandCost | CmdLevelLand (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Levels a selected (rectangle) area of land. | |
Variables | |
static const int | TERRAFORMER_MODHEIGHT_SIZE = 2 * MAX_TILE_HEIGHT * (MAX_TILE_HEIGHT + 1) |
static const int | TERRAFORMER_TILE_TABLE_SIZE = 1 + 2 * MAX_TILE_HEIGHT * (MAX_TILE_HEIGHT + 3) |
TileIndex | _terraform_err_tile |
first tile we couldn't terraform |
Commands related to terraforming.
Definition in file terraform_cmd.cpp.
CommandCost CmdLevelLand | ( | TileIndex | tile, | |
DoCommandFlag | flags, | |||
uint32 | p1, | |||
uint32 | p2, | |||
const char * | text | |||
) |
Levels a selected (rectangle) area of land.
tile | end tile of area-drag | |
flags | for this command type | |
p1 | start tile of area drag | |
p2 | various bitstuffed data. bit 0: Whether to use the Orthogonal (0) or Diagonal (1) iterator. bits 1 - 2: Mode of leveling LevelMode . | |
text | unused |
Definition at line 395 of file terraform_cmd.cpp.
References _current_company, _terraform_err_tile, CommandCost::AddCost(), CMD_ERROR, CMD_TERRAFORM_LAND, DC_EXEC, DoCommand(), 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(), HasBit(), INVALID_STRING_ID, INVALID_TILE, LM_LEVEL, LM_LOWER, LM_RAISE, MapSize(), MAX_TILE_HEIGHT, return_cmd_error, SLOPE_N, CompanyProperties::terraform_limit, and TileHeight().
CommandCost CmdTerraformLand | ( | TileIndex | tile, | |
DoCommandFlag | flags, | |||
uint32 | p1, | |||
uint32 | p2, | |||
const char * | text | |||
) |
Terraform land.
tile | tile to terraform | |
flags | for this command type | |
p1 | corners to terraform (SLOPE_xxx) | |
p2 | direction; eg up (non-zero) or down (zero) | |
text | unused |
Definition at line 241 of file terraform_cmd.cpp.
References _current_company, _generating_world, _terraform_err_tile, _tile_type_procs, CommandCost::AddCost(), CMD_LANDSCAPE_CLEAR, DC_AUTO, DC_EXEC, DC_FORCE_CLEAR_TILE, DC_NO_MODIFY_TOWN_RATING, DoCommand(), EXPENSES_CONSTRUCTION, CommandCost::Failed(), FindClearedObject(), ClearedObjectArea::first_tile, GB(), GetBridgeHeight(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), GetSouthernBridgeEnd(), GetTileType(), TerraformerHeightMod::height, INVALID_TILE, IsBridgeAbove(), IsTileType(), IsTunnelInWay(), MapSize(), MarkTileDirtyByTile(), max(), MayHaveBridgeAbove(), min(), TerraformerState::modheight, TerraformerState::modheight_count, MP_VOID, return_cmd_error, SetTileHeight(), SLOPE_E, SLOPE_FLAT, SLOPE_N, SLOPE_S, SLOPE_STEEP, SLOPE_W, CompanyProperties::terraform_limit, TileTypeProcs::terraform_tile_proc, TerraformGetHeightOfTile(), TerraformTileHeight(), TerraformerHeightMod::tile, TILE_HEIGHT, TerraformerState::tile_table, TerraformerState::tile_table_count, TileDiffXY(), and TileHeight().
static int TerraformGetHeightOfTile | ( | const TerraformerState * | ts, | |
TileIndex | tile | |||
) | [static] |
Gets the TileHeight (height of north corner) of a tile as of current terraforming progress.
ts | TerraformerState. | |
tile | Tile. |
Definition at line 68 of file terraform_cmd.cpp.
References TerraformerHeightMod::height, TerraformerState::modheight, TerraformerState::modheight_count, TerraformerHeightMod::tile, and TileHeight().
Referenced by CmdTerraformLand(), and TerraformTileHeight().
static void TerraformSetHeightOfTile | ( | TerraformerState * | ts, | |
TileIndex | tile, | |||
int | height | |||
) | [static] |
Stores the TileHeight (height of north corner) of a tile in a TerraformerState.
ts | TerraformerState. | |
tile | Tile. | |
height | New TileHeight. |
Definition at line 87 of file terraform_cmd.cpp.
References TerraformerHeightMod::height, TerraformerState::modheight, TerraformerState::modheight_count, and TerraformerHeightMod::tile.
Referenced by TerraformTileHeight().
static CommandCost TerraformTileHeight | ( | TerraformerState * | ts, | |
TileIndex | tile, | |||
int | height | |||
) | [static] |
Terraform the north corner of a tile to a specific height.
ts | TerraformerState. | |
tile | Tile. | |
height | Aimed height. |
Definition at line 155 of file terraform_cmd.cpp.
References _settings_game, _terraform_err_tile, abs(), CommandCost::AddCost(), CMD_ERROR, GameSettings::construction, Delta(), endof, EXPENSES_CONSTRUCTION, CommandCost::Failed(), ConstructionSettings::freeform_edges, MapMaxX(), MapMaxY(), MapSize(), MapSizeX(), MapSizeY(), MAX_TILE_HEIGHT, return_cmd_error, TerraformAddDirtyTileAround(), TerraformGetHeightOfTile(), TerraformSetHeightOfTile(), TileX(), TileXY(), TileY(), and ToTileIndexDiff().
Referenced by CmdTerraformLand().