OpenTTD Source: src/town_cmd.h Source File

OpenTTD Source 13.2.1

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
17 enum TownEffect : byte;
18
19 std::tuple<CommandCost, Money, TownID> CmdFoundTown(DoCommandFlag flags, TileIndex tile, TownSize size, bool city, TownLayout layout, bool random_location, uint32 townnameparts, const std::string &text);
20 CommandCost CmdRenameTown(DoCommandFlag flags, TownID town_id, const std::string &text);
21 CommandCost CmdDoTownAction(DoCommandFlag flags, TownID town_id, uint8 action);
22 CommandCost CmdTownGrowthRate(DoCommandFlag flags, TownID town_id, uint16 growth_rate);
23 CommandCost CmdTownRating(DoCommandFlag flags, TownID town_id, CompanyID company_id, int16 rating);
24 CommandCost CmdTownCargoGoal(DoCommandFlag flags, TownID town_id, TownEffect te, uint32 goal);
25 CommandCost CmdTownSetText(DoCommandFlag flags, TownID town_id, const std::string &text);
26 CommandCost CmdExpandTown(DoCommandFlag flags, TownID town_id, uint32 grow_amount);
27 CommandCost CmdDeleteTown(DoCommandFlag flags, TownID town_id);
28
29 DEF_CMD_TRAIT(CMD_FOUND_TOWN, CmdFoundTown, CMD_DEITY | CMD_NO_TEST, CMDT_LANDSCAPE_CONSTRUCTION) // founding random town can fail only in exec run
30 DEF_CMD_TRAIT(CMD_RENAME_TOWN, CmdRenameTown, CMD_DEITY | CMD_SERVER, CMDT_OTHER_MANAGEMENT)
31 DEF_CMD_TRAIT(CMD_DO_TOWN_ACTION, CmdDoTownAction, CMD_LOCATION, CMDT_LANDSCAPE_CONSTRUCTION)
32 DEF_CMD_TRAIT(CMD_TOWN_CARGO_GOAL, CmdTownCargoGoal, CMD_DEITY, CMDT_OTHER_MANAGEMENT)
33 DEF_CMD_TRAIT(CMD_TOWN_GROWTH_RATE, CmdTownGrowthRate, CMD_DEITY, CMDT_OTHER_MANAGEMENT)
34 DEF_CMD_TRAIT(CMD_TOWN_RATING, CmdTownRating, CMD_DEITY, CMDT_OTHER_MANAGEMENT)
35 DEF_CMD_TRAIT(CMD_TOWN_SET_TEXT, CmdTownSetText, CMD_DEITY | CMD_STR_CTRL, CMDT_OTHER_MANAGEMENT)
36 DEF_CMD_TRAIT(CMD_EXPAND_TOWN, CmdExpandTown, CMD_DEITY, CMDT_LANDSCAPE_CONSTRUCTION)
37 DEF_CMD_TRAIT(CMD_DELETE_TOWN, CmdDeleteTown, CMD_OFFLINE, CMDT_LANDSCAPE_CONSTRUCTION)
38
39 CommandCallback CcFoundTown;
40 void CcFoundRandomTown(Commands cmd, const CommandCost &result, Money, TownID town_id);
41
42 #endif /* TOWN_CMD_H */
CMD_DO_TOWN_ACTION
@ CMD_DO_TOWN_ACTION
do a action from the town detail window (like advertises or bribe)
Definition: command_type.h:266
CmdTownRating
CommandCost CmdTownRating(DoCommandFlag flags, TownID town_id, CompanyID company_id, int16 rating)
Change the rating of a company in a town.
Definition: town_cmd.cpp:2906
Commands
Commands
List of commands.
Definition: command_type.h:176
CMD_OFFLINE
@ CMD_OFFLINE
the command cannot be executed in a multiplayer game; single-player only
Definition: command_type.h:380
CMD_RENAME_TOWN
@ CMD_RENAME_TOWN
rename a town
Definition: command_type.h:265
TownSize
TownSize
Supported initial town sizes.
Definition: town_type.h:19
CMD_LOCATION
@ CMD_LOCATION
the command has implicit location argument.
Definition: command_type.h:389
TileIndex
The index/ID of a Tile.
Definition: tile_type.h:85
TownLayout
TownLayout
Town Layouts.
Definition: town_type.h:80
CommandCallback
void CommandCallback(Commands cmd, const CommandCost &result, TileIndex tile)
Define a callback function for the client, after the command is finished.
Definition: command_type.h:465
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:18
CmdTownCargoGoal
CommandCost CmdTownCargoGoal(DoCommandFlag flags, TownID town_id, TownEffect te, uint32 goal)
Change the cargo goal of a town.
Definition: town_cmd.cpp:2817
DoCommandFlag
DoCommandFlag
List of flags for a command.
Definition: command_type.h:355
CMD_TOWN_CARGO_GOAL
@ CMD_TOWN_CARGO_GOAL
set the goal of a cargo for a town
Definition: command_type.h:267
CMD_DEITY
@ CMD_DEITY
the command may be executed by COMPANY_DEITY
Definition: command_type.h:386
TownEffect
TownEffect
Town growth effect when delivering cargo.
Definition: cargotype.h:26
CMD_TOWN_GROWTH_RATE
@ CMD_TOWN_GROWTH_RATE
set the town growth rate
Definition: command_type.h:268
CommandCost
Common return value for all commands.
Definition: command_type.h:24
CMDT_OTHER_MANAGEMENT
@ CMDT_OTHER_MANAGEMENT
Renaming stuff, changing company colours, placing signs, etc.
Definition: command_type.h:400
CMD_EXPAND_TOWN
@ CMD_EXPAND_TOWN
expand a town
Definition: command_type.h:271
CmdTownGrowthRate
CommandCost CmdTownGrowthRate(DoCommandFlag flags, TownID town_id, uint16 growth_rate)
Change the growth rate of the town.
Definition: town_cmd.cpp:2868
CmdDeleteTown
CommandCost CmdDeleteTown(DoCommandFlag flags, TownID town_id)
Delete a town (scenario editor or worldgen only).
Definition: town_cmd.cpp:2968
CmdDoTownAction
CommandCost CmdDoTownAction(DoCommandFlag flags, TownID town_id, uint8 action)
Do a town action.
Definition: town_cmd.cpp:3348
command_type.h
CmdTownSetText
CommandCost CmdTownSetText(DoCommandFlag flags, TownID town_id, const std::string &text)
Set a custom text in the Town window.
Definition: town_cmd.cpp:2846
CmdFoundTown
enum TownEffect byte std::tuple< CommandCost, Money, TownID > CmdFoundTown(DoCommandFlag flags, TileIndex tile, TownSize size, bool city, TownLayout layout, bool random_location, uint32 townnameparts, const std::string &text)
Create a new town.
Definition: town_cmd.cpp:1965
CMD_DELETE_TOWN
@ CMD_DELETE_TOWN
delete a town
Definition: command_type.h:272
CMD_NO_TEST
@ CMD_NO_TEST
the command's output may differ between test and execute due to town rating changes etc.
Definition: command_type.h:383
CmdExpandTown
CommandCost CmdExpandTown(DoCommandFlag flags, TownID town_id, uint32 grow_amount)
Expand a town (scenario editor only).
Definition: town_cmd.cpp:2931
OverflowSafeInt< int64 >
town_type.h
CMD_SERVER
@ CMD_SERVER
the command can only be initiated by the server
Definition: command_type.h:378
CMD_STR_CTRL
@ CMD_STR_CTRL
the command's string may contain control strings
Definition: command_type.h:387
CMD_TOWN_RATING
@ CMD_TOWN_RATING
set rating of a company in a town
Definition: command_type.h:269
CMD_FOUND_TOWN
@ CMD_FOUND_TOWN
found a town
Definition: command_type.h:264
CmdRenameTown
CommandCost CmdRenameTown(DoCommandFlag flags, TownID town_id, const std::string &text)
Rename a town (server-only).
Definition: town_cmd.cpp:2767
CMD_TOWN_SET_TEXT
@ CMD_TOWN_SET_TEXT
set the custom text of a town
Definition: command_type.h:270
company_type.h
CMDT_LANDSCAPE_CONSTRUCTION
@ CMDT_LANDSCAPE_CONSTRUCTION
Construction and destruction of objects on the map.
Definition: command_type.h:395