OpenTTD Source 20241224-master-gf74b0cf984
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_type.h"
16
17enum TownAcceptanceEffect : uint8_t;
18using HouseID = uint16_t;
19
20std::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);
21CommandCost CmdRenameTown(DoCommandFlag flags, TownID town_id, const std::string &text);
22CommandCost CmdDoTownAction(DoCommandFlag flags, TownID town_id, uint8_t action);
23CommandCost CmdTownGrowthRate(DoCommandFlag flags, TownID town_id, uint16_t growth_rate);
24CommandCost CmdTownRating(DoCommandFlag flags, TownID town_id, CompanyID company_id, int16_t rating);
25CommandCost CmdTownCargoGoal(DoCommandFlag flags, TownID town_id, TownAcceptanceEffect tae, uint32_t goal);
26CommandCost CmdTownSetText(DoCommandFlag flags, TownID town_id, const std::string &text);
27CommandCost CmdExpandTown(DoCommandFlag flags, TownID town_id, uint32_t grow_amount);
28CommandCost CmdDeleteTown(DoCommandFlag flags, TownID town_id);
29CommandCost CmdPlaceHouse(DoCommandFlag flags, TileIndex tile, HouseID house);
30
31DEF_CMD_TRAIT(CMD_FOUND_TOWN, CmdFoundTown, CMD_DEITY | CMD_NO_TEST, CMDT_LANDSCAPE_CONSTRUCTION) // founding random town can fail only in exec run
40DEF_CMD_TRAIT(CMD_PLACE_HOUSE, CmdPlaceHouse, CMD_DEITY, CMDT_OTHER_MANAGEMENT)
41
42CommandCallback CcFoundTown;
43void CcFoundRandomTown(Commands cmd, const CommandCost &result, Money, TownID town_id);
44
45#endif /* TOWN_CMD_H */
TownAcceptanceEffect
Town growth effect when delivering cargo.
Definition cargotype.h:21
Common return value for all commands.
Types related to commands.
void CommandCallback(Commands cmd, const CommandCost &result, TileIndex tile)
Define a callback function for the client, after the command is finished.
@ CMDT_LANDSCAPE_CONSTRUCTION
Construction and destruction of objects on the map.
@ CMDT_OTHER_MANAGEMENT
Renaming stuff, changing company colours, placing signs, etc.
DoCommandFlag
List of flags for a command.
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
@ CMD_LOCATION
the command has implicit location argument.
@ CMD_NO_TEST
the command's output may differ between test and execute due to town rating changes etc.
@ CMD_SERVER
the command can only be initiated by the server
@ CMD_STR_CTRL
the command's string may contain control strings
@ CMD_DEITY
the command may be executed by COMPANY_DEITY
@ CMD_OFFLINE
the command cannot be executed in a multiplayer game; single-player only
Types related to companies.
Owner
Enum for all companies/owners.
uint16_t HouseID
OpenTTD ID of house types.
Definition house_type.h:13
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 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 CmdDeleteTown(DoCommandFlag flags, TownID town_id)
Delete a town (scenario editor or worldgen only).
CommandCost CmdDoTownAction(DoCommandFlag flags, TownID town_id, uint8_t action)
Do a town action.
CommandCost CmdExpandTown(DoCommandFlag flags, TownID town_id, uint32_t grow_amount)
Expand a town (scenario editor only).
CommandCost CmdTownSetText(DoCommandFlag flags, TownID town_id, const std::string &text)
Set a custom text in the Town window.
Types related to towns.
TownLayout
Town Layouts.
Definition town_type.h:79
TownSize
Supported initial town sizes.
Definition town_type.h:19