OpenTTD Source 20241224-master-gf74b0cf984
object_cmd.h File Reference

Command definitions related to objects. More...

#include "command_type.h"
#include "object_type.h"

Go to the source code of this file.

Functions

CommandCost CmdBuildObject (DoCommandFlag flags, TileIndex tile, ObjectType type, uint8_t view)
 Build an object object.
 
CommandCost CmdBuildObjectArea (DoCommandFlag flags, TileIndex tile, TileIndex start_tile, ObjectType type, uint8_t view, bool diagonal)
 Construct multiple objects in an area.
 

Detailed Description

Command definitions related to objects.

Definition in file object_cmd.h.

Function Documentation

◆ CmdBuildObject()

CommandCost CmdBuildObject ( DoCommandFlag  flags,
TileIndex  tile,
ObjectType  type,
uint8_t  view 
)

Build an object object.

Parameters
flagstype of operation
tiletile where the object will be located
typethe object type to build
viewthe view for the object
Returns
the cost of this operation or an error

Definition at line 210 of file object_cmd.cpp.

References _current_company, _generating_world, CommandCost::AddCost(), CompanyProperties::build_object_limit, BuildObject(), CALLBACK_FAILED, ObjectSpec::callback_mask, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_object_pool >::CanAllocateItem(), CBID_OBJECT_LAND_SLOPE_CHECK, CBM_OBJ_SLOPE_CHECK, CheckBuildableTile(), CheckOwnership(), CMD_ERROR, DC_EXEC, DC_NO_MODIFY_TOWN_RATING, DC_NO_WATER, EnsureNoVehicleOnGround(), EXPENSES_CONSTRUCTION, CommandCost::Failed(), ObjectSpec::flags, GB(), ObjectSpec::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), GetBridgeHeight(), ObjectSpec::GetBuildCost(), GetErrorMessageFromLocationCallbackResult(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::GetNumItems(), GetObjectCallback(), GetSouthernBridgeEnd(), GetTileMaxZ(), GetTileOwner(), GetTileSlope(), GetTileSlopeZ(), ObjectSpec::grf_prop, GRFFilePropsBase< Tcnt >::grffile, HasBit(), HasTileWaterGround(), ObjectSpec::height, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_TILE, ObjectSpec::IsAvailable(), IsBridgeAbove(), IsObjectType(), IsTileFlat(), IsTileOwner(), IsTileType(), IsValidTile(), IsWaterTile(), CompanyProperties::location_of_HQ, MAX_COMPANIES, MP_OBJECT, OBJECT_FLAG_ALLOW_UNDER_BRIDGE, OBJECT_FLAG_BUILT_ON_WATER, OBJECT_FLAG_NOT_ON_LAND, OBJECT_FLAG_ONLY_IN_GAME, OBJECT_FLAG_ONLY_IN_SCENEDIT, OBJECT_HQ, OBJECT_LIGHTHOUSE, OBJECT_OWNED_LAND, OBJECT_STATUE, OBJECT_TRANSMITTER, OWNER_DEITY, OWNER_NONE, OWNER_WATER, SetWindowDirty(), ObjectSpec::size, SLOPE_FLAT, TileX(), TileY(), ToggleBit(), UpdateCompanyHQ(), UpdateCompanyRatingAndValue(), ObjectSpec::views, ObjectSpec::WasEverAvailable(), and WC_COMPANY.

◆ CmdBuildObjectArea()

CommandCost CmdBuildObjectArea ( DoCommandFlag  flags,
TileIndex  tile,
TileIndex  start_tile,
ObjectType  type,
uint8_t  view,
bool  diagonal 
)

Construct multiple objects in an area.

Parameters
flagsof operation to conduct
tileend tile of area dragging
start_tilestart tile of area dragging
typethe object type to build
viewthe view for the object
diagonalWhether to use the Orthogonal (0) or Diagonal (1) iterator.
Returns
the cost of this operation or an error

Definition at line 391 of file object_cmd.cpp.

References _current_company, CommandCost::AddCost(), CompanyProperties::build_object_limit, CMD_ERROR, TileIterator::Create(), DC_EXEC, EXPENSES_CONSTRUCTION, CommandCost::Failed(), GB(), ObjectSpec::Get(), GetAvailableMoneyForCommand(), CommandCost::GetCost(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), INVALID_TILE, OBJECT_SIZE_1X1, Map::Size(), ObjectSpec::size, and ObjectSpec::views.