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

Functions related to objects. More...

#include "tile_type.h"
#include "company_type.h"
#include "object_type.h"

Go to the source code of this file.

Functions

void UpdateCompanyHQ (TileIndex tile, uint score)
 Update the CompanyHQ to the state associated with the given score.
 
void BuildObject (ObjectType type, TileIndex tile, CompanyID owner=OWNER_NONE, struct Town *town=nullptr, uint8_t view=0)
 Actually build the object.
 
WindowShowBuildObjectPicker ()
 Show our object picker.
 

Detailed Description

Functions related to objects.

Definition in file object.h.

Function Documentation

◆ BuildObject()

void BuildObject ( ObjectType  type,
TileIndex  tile,
CompanyID  owner,
Town town,
uint8_t  view 
)

Actually build the object.

Parameters
typeThe type of object to build.
tileThe tile to build the northern tile of the object on.
ownerThe owner of the object.
townTown the tile is related with.
viewThe view for the object.
Precondition
All preconditions for building the object at that location are met, e.g. slope and clearness of tiles are checked.

Definition at line 88 of file object_cmd.cpp.

References Object::build_date, CalcClosestTownFromTile(), CALLBACK_FAILED, ObjectSpec::callback_mask, CBID_OBJECT_COLOUR, CBM_OBJ_COLOUR, ClearNeighbourNonFloodingStates(), Object::colour, Livery::colour1, Livery::colour2, TimerGameCalendar::date, DirtyCompanyInfrastructureWindows(), ErrorUnknownCallbackResult(), ObjectSpec::flags, GB(), ObjectSpec::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), GetObjectCallback(), GetWaterClass(), ObjectSpec::grf_prop, GRFFilePropsBase< Tcnt >::grfid, HasBit(), HasTileWaterGround(), Object::IncTypeCount(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, InvalidateWaterRegion(), IsDockingTile(), IsTileOwner(), IsWaterTile(), Object::location, MakeObject(), MarkTileDirtyByTile(), OAT_BUILT, OBJECT_FLAG_2CC_COLOUR, OBJECT_FLAG_ANIMATION, OWNER_NONE, OWNER_WATER, ObjectSpec::size, Object::town, TriggerObjectAnimation(), Object::type, Object::view, WATER_CLASS_CANAL, and WATER_CLASS_INVALID.

Referenced by CmdBuildObject(), TownActionBuildStatue(), TryBuildLightHouse(), and TryBuildTransmitter().

◆ ShowBuildObjectPicker()

Window * ShowBuildObjectPicker ( )

◆ UpdateCompanyHQ()

void UpdateCompanyHQ ( TileIndex  tile,
uint  score 
)

Update the CompanyHQ to the state associated with the given score.

Parameters
tileThe (northern) tile of the company HQ, or INVALID_TILE.
scoreThe current (performance) score of the company.

Definition at line 164 of file object_cmd.cpp.

References GetCompanyHQSize, IncreaseCompanyHQSize, and INVALID_TILE.

Referenced by CmdBuildObject(), and UpdateCompanyRatingAndValue().