OpenTTD Source 20241224-master-gee860a5c8e
clear_cmd.cpp File Reference

Commands related to clear tiles. More...

#include "stdafx.h"
#include "clear_map.h"
#include "command_func.h"
#include "landscape.h"
#include "genworld.h"
#include "viewport_func.h"
#include "core/random_func.hpp"
#include "newgrf_generic.h"
#include "landscape_cmd.h"
#include "table/strings.h"
#include "table/sprites.h"
#include "table/clear_land.h"
#include "safeguards.h"

Go to the source code of this file.

Functions

static CommandCost ClearTile_Clear (TileIndex tile, DoCommandFlag flags)
 
void DrawClearLandTile (const TileInfo *ti, uint8_t set)
 
void DrawHillyLandTile (const TileInfo *ti)
 
static void DrawClearLandFence (const TileInfo *ti)
 
static void DrawTile_Clear (TileInfo *ti)
 
static int GetSlopePixelZ_Clear (TileIndex tile, uint x, uint y, bool)
 
static Foundation GetFoundation_Clear (TileIndex, Slope)
 
static void UpdateFences (TileIndex tile)
 
static void TileLoopClearAlps (TileIndex tile)
 Convert to or from snowy tiles.
 
static bool NeighbourIsNormal (TileIndex tile)
 Tests if at least one surrounding tile is non-desert.
 
static void TileLoopClearDesert (TileIndex tile)
 
static void TileLoop_Clear (TileIndex tile)
 
void GenerateClearTile ()
 
static TrackStatus GetTileTrackStatus_Clear (TileIndex, TransportType, uint, DiagDirection)
 
static void GetTileDesc_Clear (TileIndex tile, TileDesc *td)
 
static void ChangeTileOwner_Clear (TileIndex, Owner, Owner)
 
static CommandCost TerraformTile_Clear (TileIndex tile, DoCommandFlag flags, int, Slope)
 

Variables

static const StringID _clear_land_str []
 
const TileTypeProcs _tile_type_clear_procs
 

Detailed Description

Commands related to clear tiles.

Definition in file clear_cmd.cpp.

Function Documentation

◆ ChangeTileOwner_Clear()

static void ChangeTileOwner_Clear ( TileIndex  ,
Owner  ,
Owner   
)
static

Definition at line 349 of file clear_cmd.cpp.

◆ ClearTile_Clear()

static CommandCost ClearTile_Clear ( TileIndex  tile,
DoCommandFlag  flags 
)
static

Definition at line 26 of file clear_cmd.cpp.

◆ DrawClearLandFence()

static void DrawClearLandFence ( const TileInfo ti)
static

Definition at line 61 of file clear_cmd.cpp.

◆ DrawClearLandTile()

void DrawClearLandTile ( const TileInfo ti,
uint8_t  set 
)

Definition at line 47 of file clear_cmd.cpp.

◆ DrawHillyLandTile()

void DrawHillyLandTile ( const TileInfo ti)

Definition at line 52 of file clear_cmd.cpp.

◆ DrawTile_Clear()

static void DrawTile_Clear ( TileInfo ti)
static

Definition at line 101 of file clear_cmd.cpp.

◆ GenerateClearTile()

void GenerateClearTile ( )

Definition at line 284 of file clear_cmd.cpp.

◆ GetFoundation_Clear()

static Foundation GetFoundation_Clear ( TileIndex  ,
Slope   
)
static

Definition at line 137 of file clear_cmd.cpp.

◆ GetSlopePixelZ_Clear()

static int GetSlopePixelZ_Clear ( TileIndex  tile,
uint  x,
uint  y,
bool   
)
static

Definition at line 130 of file clear_cmd.cpp.

◆ GetTileDesc_Clear()

static void GetTileDesc_Clear ( TileIndex  tile,
TileDesc td 
)
static

Definition at line 339 of file clear_cmd.cpp.

◆ GetTileTrackStatus_Clear()

static TrackStatus GetTileTrackStatus_Clear ( TileIndex  ,
TransportType  ,
uint  ,
DiagDirection   
)
static

Definition at line 325 of file clear_cmd.cpp.

◆ NeighbourIsNormal()

static bool NeighbourIsNormal ( TileIndex  tile)
inlinestatic

Tests if at least one surrounding tile is non-desert.

Parameters
tiletile to check
Returns
does this tile have at least one non-desert tile around?

Definition at line 194 of file clear_cmd.cpp.

References DIAGDIR_BEGIN, DIAGDIR_END, GetTropicZone(), GetWaterClass(), HasTileWaterClass(), IsValidTile(), TileOffsByDiagDir(), TROPICZONE_DESERT, and WATER_CLASS_SEA.

◆ TerraformTile_Clear()

static CommandCost TerraformTile_Clear ( TileIndex  tile,
DoCommandFlag  flags,
int  ,
Slope   
)
static

Definition at line 354 of file clear_cmd.cpp.

◆ TileLoop_Clear()

static void TileLoop_Clear ( TileIndex  tile)
static

Definition at line 229 of file clear_cmd.cpp.

◆ TileLoopClearAlps()

static void TileLoopClearAlps ( TileIndex  tile)
static

Convert to or from snowy tiles.

Definition at line 160 of file clear_cmd.cpp.

References AddClearDensity(), ClearSnow(), GetClearDensity(), GetSnowLine(), GetTileZ(), IsSnowTile(), MakeSnow(), and MarkTileDirtyByTile().

◆ TileLoopClearDesert()

static void TileLoopClearDesert ( TileIndex  tile)
static

Definition at line 205 of file clear_cmd.cpp.

◆ UpdateFences()

static void UpdateFences ( TileIndex  tile)
static

Definition at line 142 of file clear_cmd.cpp.

Variable Documentation

◆ _clear_land_str

const StringID _clear_land_str[]
static
Initial value:
= {
STR_LAI_CLEAR_DESCRIPTION_GRASS,
STR_LAI_CLEAR_DESCRIPTION_ROUGH_LAND,
STR_LAI_CLEAR_DESCRIPTION_ROCKS,
STR_LAI_CLEAR_DESCRIPTION_FIELDS,
STR_LAI_CLEAR_DESCRIPTION_SNOW_COVERED_LAND,
STR_LAI_CLEAR_DESCRIPTION_DESERT
}

Definition at line 330 of file clear_cmd.cpp.

◆ _tile_type_clear_procs

const TileTypeProcs _tile_type_clear_procs
extern
Initial value:
= {
DrawTile_Clear,
GetSlopePixelZ_Clear,
ClearTile_Clear,
nullptr,
GetTileDesc_Clear,
GetTileTrackStatus_Clear,
nullptr,
nullptr,
TileLoop_Clear,
ChangeTileOwner_Clear,
nullptr,
nullptr,
GetFoundation_Clear,
TerraformTile_Clear,
}