OpenTTD Source 20241224-master-gf74b0cf984
|
Command definitions related to towns. More...
Go to the source code of this file.
Typedefs | |
using | HouseID = uint16_t |
Functions | |
std::tuple< CommandCost, Money, TownID > | CmdFoundTown (DoCommandFlag flags, TileIndex tile, TownSize size, bool city, TownLayout layout, bool random_location, uint32_t townnameparts, const std::string &text) |
Create a new town. | |
CommandCost | CmdRenameTown (DoCommandFlag flags, TownID town_id, const std::string &text) |
Rename a town (server-only). | |
CommandCost | CmdDoTownAction (DoCommandFlag flags, TownID town_id, uint8_t action) |
Do a town action. | |
CommandCost | CmdTownGrowthRate (DoCommandFlag flags, TownID town_id, uint16_t growth_rate) |
Change the growth rate of the town. | |
CommandCost | CmdTownRating (DoCommandFlag flags, TownID town_id, CompanyID company_id, int16_t rating) |
Change the rating of a company in a town. | |
CommandCost | CmdTownCargoGoal (DoCommandFlag flags, TownID town_id, TownAcceptanceEffect tae, uint32_t goal) |
Change the cargo goal of a town. | |
CommandCost | CmdTownSetText (DoCommandFlag flags, TownID town_id, const std::string &text) |
Set a custom text in the Town window. | |
CommandCost | CmdExpandTown (DoCommandFlag flags, TownID town_id, uint32_t grow_amount) |
Expand a town (scenario editor only). | |
CommandCost | CmdDeleteTown (DoCommandFlag flags, TownID town_id) |
Delete a town (scenario editor or worldgen only). | |
CommandCost | CmdPlaceHouse (DoCommandFlag flags, TileIndex tile, HouseID house) |
void | CcFoundRandomTown (Commands cmd, const CommandCost &result, Money, TownID town_id) |
Variables | |
CommandCallback | CcFoundTown |
Command definitions related to towns.
Definition in file town_cmd.h.
using HouseID = uint16_t |
Definition at line 18 of file town_cmd.h.
void CcFoundRandomTown | ( | Commands | cmd, |
const CommandCost & | result, | ||
Money | , | ||
TownID | town_id | ||
) |
Definition at line 1098 of file town_gui.cpp.
CommandCost CmdDeleteTown | ( | DoCommandFlag | flags, |
TownID | town_id | ||
) |
Delete a town (scenario editor or worldgen only).
flags | Type of operation. |
town_id | Town ID to delete. |
Definition at line 3219 of file town_cmd.cpp.
References _generating_world, AT_OILRIG, Town::cache, CMD_ERROR, DC_EXEC, FACIL_AIRPORT, CommandCost::Failed(), Industry::GetByTile(), Object::GetByTile(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::GetNumItems(), GetTileType(), GetTownIndex(), HasTownOwnedRoad(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, IsTileType(), Map::Iterate(), SpecializedStation< Waypoint, true >::Iterate(), SpecializedStation< Station, false >::Iterate(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_depot_pool >::Iterate(), TrackedViewportSign::kdtree_valid, MP_HOUSE, MP_INDUSTRY, MP_OBJECT, MP_ROAD, MP_TUNNELBRIDGE, OBJECT_STATUE, Kdtree< T, TxyFunc, CoordT, DistT >::Remove(), TownCache::sign, TestTownOwnsBridge(), Industry::town, Object::town, and Object::type.
CommandCost CmdDoTownAction | ( | DoCommandFlag | flags, |
TownID | town_id, | ||
uint8_t | action | ||
) |
Do a town action.
This performs an action such as advertising, building a statue, funding buildings, but also bribing the town-council
flags | type of operation |
town_id | town to do the action at |
action | action to perform, |
Definition at line 3662 of file town_cmd.cpp.
References _current_company, _town_action_costs, CMD_ERROR, DC_EXEC, EXPENSES_OTHER, CommandCost::Failed(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::GetIfValid(), GetMaskOfTownActions(), HasBit(), lengthof, SetWindowDirty(), and WC_TOWN_AUTHORITY.
CommandCost CmdExpandTown | ( | DoCommandFlag | flags, |
TownID | town_id, | ||
uint32_t | grow_amount | ||
) |
Expand a town (scenario editor only).
flags | Type of operation. |
TownID | Town ID to expand. |
grow_amount | Amount to grow, or 0 to grow a random size up to the current amount of houses. |
Definition at line 3182 of file town_cmd.cpp.
References _current_company, Town::cache, CMD_ERROR, DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::GetIfValid(), GrowTown(), TownCache::num_houses, OWNER_DEITY, RandomRange(), UpdateTownMaxPass(), and UpdateTownRadius().
std::tuple< CommandCost, Money, TownID > CmdFoundTown | ( | DoCommandFlag | flags, |
TileIndex | tile, | ||
TownSize | size, | ||
bool | city, | ||
TownLayout | layout, | ||
bool | random_location, | ||
uint32_t | townnameparts, | ||
const std::string & | text | ||
) |
Create a new town.
flags | The type of operation. |
tile | The coordinates where town is built. |
size | The size of the town ( |
city | Should we build a city? |
layout | The town road layout ( |
random_location | Should we use a random location? (randomize tile ) |
townnameparts | Town name parts. |
text | Custom name for the town. If empty, the town name parts will be used. |
Definition at line 2142 of file town_cmd.cpp.
References _current_company, _generating_world, _settings_game, AI::BroadcastNewEvent(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::CanAllocateItem(), CMD_ERROR, CreateRandomTown(), DC_EXEC, DoCreateTown(), GameSettings::economy, EXPENSES_OTHER, CommandCost::Failed(), EconomySettings::found_town, GameSettings::game_creation, GetAvailableMoneyForCommand(), CommandCost::GetCost(), GetString(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, IsUniqueTownName(), lengthof, MAX_LENGTH_TOWN_NAME_CHARS, CommandCost::MultiplyCost(), Town::name, Game::NewEvent(), NT_INDUSTRY_OPEN, NUM_TLS, OWNER_DEITY, Backup< T >::Restore(), SetDParam(), SetDParamStr(), TF_CUSTOM_LAYOUT, TF_FORBIDDEN, EconomySettings::town_layout, GameCreationSettings::town_name, TownCanBePlacedHere(), TSZ_END, TSZ_LARGE, TSZ_RANDOM, UpdateNearestTownForRoadTiles(), Town::UpdateVirtCoord(), Utf8StringLength(), and VerifyTownName().
CommandCost CmdPlaceHouse | ( | DoCommandFlag | flags, |
TileIndex | tile, | ||
HouseID | house | ||
) |
Definition at line 2880 of file town_cmd.cpp.
CommandCost CmdRenameTown | ( | DoCommandFlag | flags, |
TownID | town_id, | ||
const std::string & | text | ||
) |
Rename a town (server-only).
flags | type of operation |
town_id | town ID to rename |
text | the new name or an empty string when resetting to the default |
Definition at line 3018 of file town_cmd.cpp.
References Town::cached_name, CMD_ERROR, DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::GetIfValid(), InvalidateWindowData(), IsUniqueTownName(), MAX_LENGTH_TOWN_NAME_CHARS, Town::name, UpdateAllStationVirtCoords(), Town::UpdateVirtCoord(), Utf8StringLength(), and WC_TOWN_DIRECTORY.
CommandCost CmdTownCargoGoal | ( | DoCommandFlag | flags, |
TownID | town_id, | ||
TownAcceptanceEffect | tae, | ||
uint32_t | goal | ||
) |
Change the cargo goal of a town.
flags | Type of operation. |
town_id | Town ID to cargo game of. |
tae | TownEffect to change the game of. |
goal | The new goal value. |
Definition at line 3068 of file town_cmd.cpp.
References _current_company, CMD_ERROR, DC_EXEC, FindFirstCargoWithTownAcceptanceEffect(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::GetIfValid(), Town::goal, InvalidateWindowData(), OWNER_DEITY, TAE_END, UpdateTownGrowth(), and WC_TOWN_VIEW.
CommandCost CmdTownGrowthRate | ( | DoCommandFlag | flags, |
TownID | town_id, | ||
uint16_t | growth_rate | ||
) |
Change the growth rate of the town.
flags | Type of operation. |
town_id | Town ID to cargo game of. |
growth_rate | Amount of days between growth, or TOWN_GROWTH_RATE_NONE, or 0 to reset custom growth rate. |
Definition at line 3119 of file town_cmd.cpp.
References _current_company, ClrBit(), CMD_ERROR, DC_EXEC, Town::flags, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::GetIfValid(), Town::grow_counter, Town::growth_rate, InvalidateWindowData(), OWNER_DEITY, SetBit(), TOWN_CUSTOM_GROWTH, UpdateTownGrowth(), and WC_TOWN_VIEW.
CommandCost CmdTownRating | ( | DoCommandFlag | flags, |
TownID | town_id, | ||
CompanyID | company_id, | ||
int16_t | rating | ||
) |
Change the rating of a company in a town.
flags | Type of operation. |
town_id | Town ID to change, bit 16..23 = |
company_id | Company ID to change. |
rating | New rating of company (signed int16_t). |
Definition at line 3157 of file town_cmd.cpp.
References _current_company, Clamp(), CMD_ERROR, DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::GetIfValid(), InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), OWNER_DEITY, Town::ratings, and WC_TOWN_AUTHORITY.
CommandCost CmdTownSetText | ( | DoCommandFlag | flags, |
TownID | town_id, | ||
const std::string & | text | ||
) |
Set a custom text in the Town window.
flags | Type of operation. |
town_id | Town ID to change the text of. |
text | The new text (empty to remove the text). |
Definition at line 3097 of file town_cmd.cpp.
References _current_company, CMD_ERROR, DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::GetIfValid(), InvalidateWindowData(), OWNER_DEITY, Town::text, and WC_TOWN_VIEW.
CommandCallback CcFoundTown |
Definition at line 42 of file town_cmd.h.