|
OpenTTD Source 20251116-master-g21329071df
|
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< TileIndex > | TileIndexSet |
| 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, TileIndex > | TerraformTileHeight (TerraformerState *ts, TileIndex tile, int height) |
| Terraform the north corner of a tile to a specific height. | |
| std::tuple< CommandCost, Money, TileIndex > | CmdTerraformLand (DoCommandFlags flags, TileIndex tile, Slope slope, bool dir_up) |
| Terraform land. | |
| std::tuple< CommandCost, Money, TileIndex > | CmdLevelLand (DoCommandFlags flags, TileIndex tile, TileIndex start_tile, bool diagonal, LevelMode lm) |
| Levels a selected (rectangle) area of land. | |
Commands related to terraforming.
Definition in file terraform_cmd.cpp.
| typedef std::set<TileIndex> TileIndexSet |
Set of tiles.
Definition at line 28 of file terraform_cmd.cpp.
| typedef std::map<TileIndex, int> TileIndexToHeightMap |
Mapping of tiles to their height.
Definition at line 30 of file terraform_cmd.cpp.
| std::tuple< CommandCost, Money, TileIndex > CmdLevelLand | ( | DoCommandFlags | flags, |
| TileIndex | tile, | ||
| TileIndex | start_tile, | ||
| bool | diagonal, | ||
| LevelMode | lm | ||
| ) |
Levels a selected (rectangle) area of land.
| flags | for this command type |
| tile | end tile of area-drag |
| start_tile | start tile of area drag |
| diagonal | Whether to use the Orthogonal (false) or Diagonal (true) iterator. |
| LevelMode | Mode of leveling LevelMode. |
Definition at line 315 of file terraform_cmd.cpp.
References _current_company, _settings_game, CommandCost::AddCost(), CMD_ERROR, GameSettings::construction, TileIterator::Create(), Execute, EXPENSES_CONSTRUCTION, CommandCost::Failed(), GB(), GetAvailableMoneyForCommand(), CommandCost::GetCost(), CommandCost::GetErrorMessage(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::GetIfValid(), INVALID_STRING_ID, INVALID_TILE, LM_LEVEL, LM_LOWER, LM_RAISE, ConstructionSettings::map_height_limit, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Reset(), Map::Size(), SLOPE_N, CommandCost::Succeeded(), CompanyProperties::terraform_limit, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and TileHeight().
| std::tuple< CommandCost, Money, TileIndex > CmdTerraformLand | ( | DoCommandFlags | flags, |
| TileIndex | tile, | ||
| Slope | slope, | ||
| bool | dir_up | ||
| ) |
Terraform land.
| flags | for this command type |
| tile | tile to terraform |
| slope | corners to terraform (SLOPE_xxx) |
| dir_up | direction; eg up (true) or down (false) |
Definition at line 169 of file terraform_cmd.cpp.
References _current_company, _generating_world, _settings_game, _tile_type_procs, CommandCost::AddCost(), Auto, Backup< T >::Change(), GameSettings::construction, TerraformerState::dirty_tiles, Execute, EXPENSES_CONSTRUCTION, CommandCost::Failed(), FindClearedObject(), ClearedObjectArea::first_tile, ForceClearTile, GB(), GetBridgeHeight(), CommandCost::GetCost(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::GetIfValid(), GetSouthernBridgeEnd(), GetTileType(), INVALID_TILE, IsBridgeAbove(), IsTileType(), IsTunnelInWay(), MarkTileDirtyByTile(), ConstructionSettings::max_bridge_height, MP_VOID, NoModifyTownRating, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Reset(), Backup< T >::Restore(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Set(), SetTileHeight(), Map::Size(), SLOPE_E, SLOPE_FLAT, SLOPE_N, SLOPE_S, SLOPE_STEEP, SLOPE_W, CommandCost::Succeeded(), CompanyProperties::terraform_limit, TileTypeProcs::terraform_tile_proc, TerraformGetHeightOfTile(), TerraformTileHeight(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), TerraformerState::tile_to_new_height, TileDiffXY(), and TileHeight().
|
static |
Gets the TileHeight (height of north corner) of a tile as of current terraforming progress.
| ts | TerraformerState. |
| tile | Tile. |
Definition at line 45 of file terraform_cmd.cpp.
References TerraformerState::tile_to_new_height, and TileHeight().
Referenced by CmdTerraformLand(), and TerraformTileHeight().
|
static |
Stores the TileHeight (height of north corner) of a tile in a TerraformerState.
| ts | TerraformerState. |
| tile | Tile. |
| height | New TileHeight. |
Definition at line 58 of file terraform_cmd.cpp.
References TerraformerState::tile_to_new_height.
Referenced by TerraformTileHeight().
|
static |
Terraform the north corner of a tile to a specific height.
| ts | TerraformerState. |
| tile | Tile. |
| height | Aimed height. |
Definition at line 99 of file terraform_cmd.cpp.
References _settings_game, abs(), CommandCost::AddCost(), AddTileIndexDiffCWrap(), CMD_ERROR, GameSettings::construction, DIAGDIR_BEGIN, DIAGDIR_END, EXPENSES_CONSTRUCTION, ConstructionSettings::freeform_edges, INVALID_TILE, ConstructionSettings::map_height_limit, Map::MaxX(), Map::MaxY(), Map::Size(), TerraformAddDirtyTileAround(), TerraformGetHeightOfTile(), TerraformSetHeightOfTile(), TerraformTileHeight(), TileIndexDiffCByDiagDir(), TileX(), TileXY(), and TileY().
Referenced by CmdTerraformLand(), and TerraformTileHeight().