OpenTTD Source 20250312-master-gcdcc6b491d
town_cmd.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
10#ifndef TOWN_CMD_H
11#define TOWN_CMD_H
12
13#include "command_type.h"
14#include "company_type.h"
15#include "town.h"
16#include "town_type.h"
17
18enum TownAcceptanceEffect : uint8_t;
19using HouseID = uint16_t;
20
21std::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);
22CommandCost CmdRenameTown(DoCommandFlags flags, TownID town_id, const std::string &text);
24CommandCost CmdTownGrowthRate(DoCommandFlags flags, TownID town_id, uint16_t growth_rate);
25CommandCost CmdTownRating(DoCommandFlags flags, TownID town_id, CompanyID company_id, int16_t rating);
28CommandCost CmdExpandTown(DoCommandFlags flags, TownID town_id, uint32_t grow_amount);
30CommandCost CmdPlaceHouse(DoCommandFlags flags, TileIndex tile, HouseID house, bool house_protected);
31
32DEF_CMD_TRAIT(CMD_FOUND_TOWN, CmdFoundTown, CommandFlags({CommandFlag::Deity, CommandFlag::NoTest}), CMDT_LANDSCAPE_CONSTRUCTION) // founding random town can fail only in exec run
42
43CommandCallback CcFoundTown;
44void CcFoundRandomTown(Commands cmd, const CommandCost &result, Money, TownID town_id);
45
46#endif /* TOWN_CMD_H */
TownAcceptanceEffect
Town growth effect when delivering cargo.
Definition cargotype.h:22
Common return value for all commands.
Container for an encoded string, created by GetEncodedString.
Enum-as-bit-set wrapper.
Types related to commands.
@ CMDT_LANDSCAPE_CONSTRUCTION
Construction and destruction of objects on the map.
@ CMDT_OTHER_MANAGEMENT
Renaming stuff, changing company colours, placing signs, etc.
void CommandCallback(Commands cmd, const CommandCost &result, TileIndex tile)
Define a callback function for the client, after the command is finished.
@ Deity
the command may be executed by COMPANY_DEITY
@ Offline
the command cannot be executed in a multiplayer game; single-player only
@ Server
the command can only be initiated by the server
@ StrCtrl
the command's string may contain control strings
@ Location
the command has implicit location argument.
@ NoTest
the command's output may differ between test and execute due to town rating changes etc.
Commands
List of commands.
@ CMD_EXPAND_TOWN
expand a town
@ CMD_DELETE_TOWN
delete a town
@ CMD_TOWN_SET_TEXT
set the custom text of a town
@ CMD_FOUND_TOWN
found a town
@ CMD_DO_TOWN_ACTION
do a action from the town detail window (like advertises or bribe)
@ CMD_TOWN_RATING
set rating of a company in a town
@ CMD_PLACE_HOUSE
place a house
@ CMD_TOWN_GROWTH_RATE
set the town growth rate
@ CMD_RENAME_TOWN
rename a town
@ CMD_TOWN_CARGO_GOAL
set the goal of a cargo for a town
Types related to companies.
uint16_t HouseID
OpenTTD ID of house types.
Definition house_type.h:13
Base of the town class.
TownAction
Town actions of a company.
Definition town.h:210
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 CmdPlaceHouse(DoCommandFlags flags, TileIndex tile, HouseID house, bool house_protected)
Place an individual house.
CommandCost CmdDoTownAction(DoCommandFlags flags, TownID town_id, TownAction action)
Do a town action.
CommandCost CmdExpandTown(DoCommandFlags flags, TownID town_id, uint32_t grow_amount)
Expand a town (scenario editor only).
CommandCost CmdTownSetText(DoCommandFlags flags, TownID town_id, const EncodedString &text)
Set a custom text in the Town window.
CommandCost CmdTownGrowthRate(DoCommandFlags flags, TownID town_id, uint16_t growth_rate)
Change the growth rate of the town.
CommandCost CmdDeleteTown(DoCommandFlags flags, TownID town_id)
Delete a town (scenario editor or worldgen only).
CommandCost CmdRenameTown(DoCommandFlags flags, TownID town_id, const std::string &text)
Rename a town (server-only).
CommandCost CmdTownCargoGoal(DoCommandFlags flags, TownID town_id, TownAcceptanceEffect tae, uint32_t goal)
Change the cargo goal of a town.
CommandCost CmdTownRating(DoCommandFlags flags, TownID town_id, CompanyID company_id, int16_t rating)
Change the rating of a company in a town.
Types related to towns.
TownLayout
Town Layouts.
Definition town_type.h:81
TownSize
Supported initial town sizes.
Definition town_type.h:21