|
OpenTTD Source 20260208-master-g43af8e94d0
|
Command definitions related to towns. More...
Go to the source code of this file.
Functions | |
| std::tuple< CommandCost, Money, TownID > | CmdFoundTown (DoCommandFlags 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 (DoCommandFlags flags, TownID town_id, const std::string &text) |
| Rename a town (server-only). | |
| CommandCost | CmdDoTownAction (DoCommandFlags flags, TownID town_id, TownAction action) |
| Do a town action. | |
| CommandCost | CmdTownGrowthRate (DoCommandFlags flags, TownID town_id, uint16_t growth_rate) |
| Change the growth rate of the town. | |
| CommandCost | CmdTownRating (DoCommandFlags flags, TownID town_id, CompanyID company_id, int16_t rating) |
| Change the rating of a company in a town. | |
| CommandCost | CmdTownCargoGoal (DoCommandFlags flags, TownID town_id, TownAcceptanceEffect tae, uint32_t goal) |
| Change the cargo goal of a town. | |
| CommandCost | CmdTownSetText (DoCommandFlags flags, TownID town_id, const EncodedString &text) |
| Set a custom text in the Town window. | |
| CommandCost | CmdExpandTown (DoCommandFlags flags, TownID town_id, uint32_t grow_amount, TownExpandModes modes) |
| Expand a town (scenario editor only). | |
| CommandCost | CmdDeleteTown (DoCommandFlags flags, TownID town_id) |
| Delete a town (scenario editor or worldgen only). | |
| CommandCost | CmdPlaceHouse (DoCommandFlags flags, TileIndex tile, HouseID house, bool house_protected, bool replace) |
| Place an individual house. | |
| CommandCost | CmdPlaceHouseArea (DoCommandFlags flags, TileIndex tile, TileIndex start_tile, HouseID house, bool is_protected, bool replace, bool diagonal) |
| Construct multiple houses in an area. | |
| 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.
| void CcFoundRandomTown | ( | Commands | cmd, |
| const CommandCost & | result, | ||
| Money | , | ||
| TownID | town_id ) |
Definition at line 1067 of file town_gui.cpp.
| CommandCost CmdDeleteTown | ( | DoCommandFlags | 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 3359 of file town_cmd.cpp.
References _generating_world, Airport, AT_OILRIG, Town::cache, CMD_ERROR, Execute, CommandCost::Failed(), Industry::GetByTile(), Object::GetByTile(), GetTileType(), GetTownIndex(), HasTownOwnedRoad(), House, Industry, IsTileType(), Map::Iterate(), SpecializedStation< Station, false >::Iterate(), SpecializedStation< Waypoint, true >::Iterate(), TrackedViewportSign::kdtree_valid, Object, OBJECT_STATUE, Road, TownCache::sign, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), TestTownOwnsBridge(), Industry::town, Object::town, TunnelBridge, and Object::type.
| CommandCost CmdDoTownAction | ( | DoCommandFlags | flags, |
| TownID | town_id, | ||
| TownAction | 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 3792 of file town_cmd.cpp.
References _current_company, CMD_ERROR, Execute, EXPENSES_OTHER, CommandCost::Failed(), GetMaskOfTownActions(), GetTownActionCost(), SetWindowDirty(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), to_underlying(), TownAction, and WC_TOWN_AUTHORITY.
| CommandCost CmdExpandTown | ( | DoCommandFlags | flags, |
| TownID | town_id, | ||
| uint32_t | grow_amount, | ||
| TownExpandModes | modes ) |
Expand a town (scenario editor only).
| flags | Type of operation. |
| town_id | Town ID to expand. |
| modes | The parts of the town that are being grown. |
| grow_amount | Amount to grow, or 0 to grow a random size up to the current amount of houses. |
Definition at line 3321 of file town_cmd.cpp.
References _current_company, Town::cache, ClampTo(), CMD_ERROR, Execute, GrowTown(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::None(), TownCache::num_houses, OWNER_DEITY, RandomRange(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), UpdateTownMaxPass(), and UpdateTownRadius().
| std::tuple< CommandCost, Money, TownID > CmdFoundTown | ( | DoCommandFlags | 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 2202 of file town_cmd.cpp.
References _current_company, _generating_world, _settings_game, AI::BroadcastNewEvent(), BuildTown, CMD_ERROR, CreateRandomTown(), DoCreateTown(), Execute, EXPENSES_OTHER, CommandCost::Failed(), GetAvailableMoneyForCommand(), CommandCost::GetCost(), GetEncodedString(), GetString(), IndustryOpen, IsUniqueTownName(), lengthof, MAX_LENGTH_TOWN_NAME_CHARS, CommandCost::MultiplyCost(), Town::name, Game::NewEvent(), NUM_TLS, OWNER_DEITY, Backup< T >::Restore(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), TF_CUSTOM_LAYOUT, TF_FORBIDDEN, TownCanBePlacedHere(), TSZ_END, TSZ_LARGE, TSZ_RANDOM, UpdateNearestTownForRoadTiles(), Town::UpdateVirtCoord(), Utf8StringLength(), and VerifyTownName().
| CommandCost CmdPlaceHouse | ( | DoCommandFlags | flags, |
| TileIndex | tile, | ||
| HouseID | house, | ||
| bool | is_protected, | ||
| bool | replace ) |
Place an individual house.
| flags | Type of operation. |
| tile | Tile on which to place the house. |
| house | The HouseID of the house spec. |
| is_protected | Whether the house is protected from the town upgrading it. |
| replace | Whether to automatically demolish an existing house on this tile, if present. |
Definition at line 2957 of file town_cmd.cpp.
References _settings_game, OrthogonalTileArea::Add(), Auto, HouseSpec::building_flags, BuildTownHouse(), ClearTownHouse(), ClosestTownFromTile(), CMD_ERROR, DIAGDIR_SE, DIAGDIR_SW, HouseSpec::enabled, Execute, HouseSpec::Get(), GetTileMaxZ(), GetTileSlope(), GetTileType(), House, IsBridgeAbove(), IsSteepSlope(), NotSloped, NoWater, Size1x2, Size2x1, Size2x2, SLOPE_FLAT, HouseSpec::Specs(), CommandCost::Succeeded(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), TileAddByDiagDir(), and TileAddXY().
| CommandCost CmdPlaceHouseArea | ( | DoCommandFlags | flags, |
| TileIndex | tile, | ||
| TileIndex | start_tile, | ||
| HouseID | house, | ||
| bool | is_protected, | ||
| bool | replace, | ||
| bool | diagonal ) |
Construct multiple houses in an area.
| flags | Type of operation. |
| tile | End tile of area dragging. |
| start_tile | Start tile of area dragging. |
| house | The HouseID of the house spec. |
| is_protected | Whether the house is protected from the town upgrading it. |
| replace | Whether we can replace existing houses. |
| diagonal | Whether to use the Diagonal or Orthogonal tile iterator. |
Definition at line 3024 of file town_cmd.cpp.
References _current_company, _settings_game, CompanyProperties::build_object_limit, HouseSpec::building_flags, CMD_ERROR, TileIterator::Create(), HouseSpec::enabled, Execute, CommandCost::Failed(), GB(), HouseSpec::Get(), INVALID_TILE, Map::Size(), Size1x1, HouseSpec::Specs(), and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().
| CommandCost CmdRenameTown | ( | DoCommandFlags | 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 3156 of file town_cmd.cpp.
References Town::cached_name, CMD_ERROR, Execute, InvalidateWindowData(), IsUniqueTownName(), MAX_LENGTH_TOWN_NAME_CHARS, Town::name, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), UpdateAllStationVirtCoords(), Town::UpdateVirtCoord(), Utf8StringLength(), and WC_TOWN_DIRECTORY.
| CommandCost CmdTownCargoGoal | ( | DoCommandFlags | 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 3206 of file town_cmd.cpp.
References _current_company, CMD_ERROR, Execute, FindFirstCargoWithTownAcceptanceEffect(), Town::goal, InvalidateWindowData(), OWNER_DEITY, TAE_END, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), UpdateTownGrowth(), and WC_TOWN_VIEW.
| CommandCost CmdTownGrowthRate | ( | DoCommandFlags | 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 3257 of file town_cmd.cpp.
References _current_company, CMD_ERROR, CustomGrowth, Execute, Town::flags, Town::grow_counter, Town::growth_rate, InvalidateWindowData(), OWNER_DEITY, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Reset(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Set(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), UpdateTownGrowth(), and WC_TOWN_VIEW.
| CommandCost CmdTownRating | ( | DoCommandFlags | 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 3295 of file town_cmd.cpp.
References _current_company, Clamp(), CMD_ERROR, Execute, InvalidateWindowData(), OWNER_DEITY, Town::ratings, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and WC_TOWN_AUTHORITY.
| CommandCost CmdTownSetText | ( | DoCommandFlags | flags, |
| TownID | town_id, | ||
| const EncodedString & | 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 3235 of file town_cmd.cpp.
References _current_company, CMD_ERROR, Execute, InvalidateWindowData(), OWNER_DEITY, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), Town::text, and WC_TOWN_VIEW.
| CommandCallback CcFoundTown |
Definition at line 46 of file town_cmd.h.