OpenTTD Source  14.0-beta1
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 TownAcceptanceEffect : byte;
18 
19 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);
20 CommandCost CmdRenameTown(DoCommandFlag flags, TownID town_id, const std::string &text);
21 CommandCost CmdDoTownAction(DoCommandFlag flags, TownID town_id, uint8_t action);
22 CommandCost CmdTownGrowthRate(DoCommandFlag flags, TownID town_id, uint16_t growth_rate);
23 CommandCost CmdTownRating(DoCommandFlag flags, TownID town_id, CompanyID company_id, int16_t rating);
24 CommandCost CmdTownCargoGoal(DoCommandFlag flags, TownID town_id, TownAcceptanceEffect tae, uint32_t goal);
25 CommandCost CmdTownSetText(DoCommandFlag flags, TownID town_id, const std::string &text);
26 CommandCost CmdExpandTown(DoCommandFlag flags, TownID town_id, uint32_t 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
38 
39 CommandCallback CcFoundTown;
40 void CcFoundRandomTown(Commands cmd, const CommandCost &result, Money, TownID town_id);
41 
42 #endif /* TOWN_CMD_H */
CmdExpandTown
CommandCost CmdExpandTown(DoCommandFlag flags, TownID town_id, uint32_t grow_amount)
Expand a town (scenario editor only).
Definition: town_cmd.cpp:3039
CMD_OFFLINE
@ CMD_OFFLINE
the command cannot be executed in a multiplayer game; single-player only
Definition: command_type.h:394
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:403
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
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:479
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:18
DoCommandFlag
DoCommandFlag
List of flags for a command.
Definition: command_type.h:369
CMD_DEITY
@ CMD_DEITY
the command may be executed by COMPANY_DEITY
Definition: command_type.h:400
CmdTownCargoGoal
CommandCost CmdTownCargoGoal(DoCommandFlag flags, TownID town_id, TownAcceptanceEffect tae, uint32_t goal)
Change the cargo goal of a town.
Definition: town_cmd.cpp:2925
CommandCost
Common return value for all commands.
Definition: command_type.h:23
CMDT_OTHER_MANAGEMENT
@ CMDT_OTHER_MANAGEMENT
Renaming stuff, changing company colours, placing signs, etc.
Definition: command_type.h:414
TownAcceptanceEffect
TownAcceptanceEffect
Town growth effect when delivering cargo.
Definition: cargotype.h:24
CMD_TOWN_GROWTH_RATE
@ CMD_TOWN_GROWTH_RATE
set the town growth rate
Definition: command_type.h:281
CmdTownGrowthRate
CommandCost CmdTownGrowthRate(DoCommandFlag flags, TownID town_id, uint16_t growth_rate)
Change the growth rate of the town.
Definition: town_cmd.cpp:2976
CMD_TOWN_RATING
@ CMD_TOWN_RATING
set rating of a company in a town
Definition: command_type.h:282
CMD_TOWN_CARGO_GOAL
@ CMD_TOWN_CARGO_GOAL
set the goal of a cargo for a town
Definition: command_type.h:280
CmdDeleteTown
CommandCost CmdDeleteTown(DoCommandFlag flags, TownID town_id)
Delete a town (scenario editor or worldgen only).
Definition: town_cmd.cpp:3076
CMD_FOUND_TOWN
@ CMD_FOUND_TOWN
found a town
Definition: command_type.h:277
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:2954
CmdDoTownAction
CommandCost CmdDoTownAction(DoCommandFlag flags, TownID town_id, uint8_t action)
Do a town action.
Definition: town_cmd.cpp:3510
CMD_TOWN_SET_TEXT
@ CMD_TOWN_SET_TEXT
set the custom text of a town
Definition: command_type.h:283
CMD_DO_TOWN_ACTION
@ CMD_DO_TOWN_ACTION
do a action from the town detail window (like advertises or bribe)
Definition: command_type.h:279
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:397
CMD_EXPAND_TOWN
@ CMD_EXPAND_TOWN
expand a town
Definition: command_type.h:284
OverflowSafeInt< int64_t >
CmdFoundTown
enum TownAcceptanceEffect byte 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.
Definition: town_cmd.cpp:2058
Commands
Commands
List of commands.
Definition: command_type.h:187
town_type.h
CMD_SERVER
@ CMD_SERVER
the command can only be initiated by the server
Definition: command_type.h:392
CMD_STR_CTRL
@ CMD_STR_CTRL
the command's string may contain control strings
Definition: command_type.h:401
CmdRenameTown
CommandCost CmdRenameTown(DoCommandFlag flags, TownID town_id, const std::string &text)
Rename a town (server-only).
Definition: town_cmd.cpp:2875
company_type.h
CmdTownRating
CommandCost CmdTownRating(DoCommandFlag flags, TownID town_id, CompanyID company_id, int16_t rating)
Change the rating of a company in a town.
Definition: town_cmd.cpp:3014
CMD_RENAME_TOWN
@ CMD_RENAME_TOWN
rename a town
Definition: command_type.h:278
CMDT_LANDSCAPE_CONSTRUCTION
@ CMDT_LANDSCAPE_CONSTRUCTION
Construction and destruction of objects on the map.
Definition: command_type.h:409
CMD_DELETE_TOWN
@ CMD_DELETE_TOWN
delete a town
Definition: command_type.h:285