OpenTTD Source: src/town_cmd.h Source File

OpenTTD Source 15.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
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);
21 CommandCost CmdRenameTown(DoCommandFlag flags, TownID town_id, const std::string &text);
22 CommandCost CmdDoTownAction(DoCommandFlag flags, TownID town_id, uint8_t action);
23 CommandCost CmdTownGrowthRate(DoCommandFlag flags, TownID town_id, uint16_t growth_rate);
24 CommandCost CmdTownRating(DoCommandFlag flags, TownID town_id, CompanyID company_id, int16_t rating);
25 CommandCost CmdTownCargoGoal(DoCommandFlag flags, TownID town_id, TownAcceptanceEffect tae, uint32_t goal);
26 CommandCost CmdTownSetText(DoCommandFlag flags, TownID town_id, const std::string &text);
27 CommandCost CmdExpandTown(DoCommandFlag flags, TownID town_id, uint32_t grow_amount);
28 CommandCost CmdDeleteTown(DoCommandFlag flags, TownID town_id);
29 CommandCost 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
32DEF_CMD_TRAIT(CMD_RENAME_TOWN, CmdRenameTown, CMD_DEITY | CMD_SERVER, CMDT_OTHER_MANAGEMENT)
33DEF_CMD_TRAIT(CMD_DO_TOWN_ACTION, CmdDoTownAction, CMD_LOCATION, CMDT_LANDSCAPE_CONSTRUCTION)
34DEF_CMD_TRAIT(CMD_TOWN_CARGO_GOAL, CmdTownCargoGoal, CMD_DEITY, CMDT_OTHER_MANAGEMENT)
35DEF_CMD_TRAIT(CMD_TOWN_GROWTH_RATE, CmdTownGrowthRate, CMD_DEITY, CMDT_OTHER_MANAGEMENT)
36DEF_CMD_TRAIT(CMD_TOWN_RATING, CmdTownRating, CMD_DEITY, CMDT_OTHER_MANAGEMENT)
37DEF_CMD_TRAIT(CMD_TOWN_SET_TEXT, CmdTownSetText, CMD_DEITY | CMD_STR_CTRL, CMDT_OTHER_MANAGEMENT)
38DEF_CMD_TRAIT(CMD_EXPAND_TOWN, CmdExpandTown, CMD_DEITY, CMDT_LANDSCAPE_CONSTRUCTION)
39DEF_CMD_TRAIT(CMD_DELETE_TOWN, CmdDeleteTown, CMD_OFFLINE, CMDT_LANDSCAPE_CONSTRUCTION)
40DEF_CMD_TRAIT(CMD_PLACE_HOUSE, CmdPlaceHouse, CMD_DEITY, CMDT_OTHER_MANAGEMENT)
41
42 CommandCallback CcFoundTown;
43void CcFoundRandomTown(Commands cmd, const CommandCost &result, Money, TownID town_id);
44
45#endif /* TOWN_CMD_H */
TownAcceptanceEffect
TownAcceptanceEffect
Town growth effect when delivering cargo.
Definition cargotype.h:21
CommandCost
Common return value for all commands.
Definition command_type.h:23
OverflowSafeInt< int64_t >
command_type.h
Types related to commands.
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:484
CMDT_LANDSCAPE_CONSTRUCTION
@ CMDT_LANDSCAPE_CONSTRUCTION
Construction and destruction of objects on the map.
Definition command_type.h:414
CMDT_OTHER_MANAGEMENT
@ CMDT_OTHER_MANAGEMENT
Renaming stuff, changing company colours, placing signs, etc.
Definition command_type.h:419
DoCommandFlag
DoCommandFlag
List of flags for a command.
Definition command_type.h:374
Commands
Commands
List of commands.
Definition command_type.h:187
CMD_EXPAND_TOWN
@ CMD_EXPAND_TOWN
expand a town
Definition command_type.h:287
CMD_DELETE_TOWN
@ CMD_DELETE_TOWN
delete a town
Definition command_type.h:288
CMD_TOWN_SET_TEXT
@ CMD_TOWN_SET_TEXT
set the custom text of a town
Definition command_type.h:286
CMD_FOUND_TOWN
@ CMD_FOUND_TOWN
found a town
Definition command_type.h:280
CMD_DO_TOWN_ACTION
@ CMD_DO_TOWN_ACTION
do a action from the town detail window (like advertises or bribe)
Definition command_type.h:282
CMD_TOWN_RATING
@ CMD_TOWN_RATING
set rating of a company in a town
Definition command_type.h:285
CMD_PLACE_HOUSE
@ CMD_PLACE_HOUSE
place a house
Definition command_type.h:289
CMD_TOWN_GROWTH_RATE
@ CMD_TOWN_GROWTH_RATE
set the town growth rate
Definition command_type.h:284
CMD_RENAME_TOWN
@ CMD_RENAME_TOWN
rename a town
Definition command_type.h:281
CMD_TOWN_CARGO_GOAL
@ CMD_TOWN_CARGO_GOAL
set the goal of a cargo for a town
Definition command_type.h:283
CMD_LOCATION
@ CMD_LOCATION
the command has implicit location argument.
Definition command_type.h:408
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:402
CMD_SERVER
@ CMD_SERVER
the command can only be initiated by the server
Definition command_type.h:397
CMD_STR_CTRL
@ CMD_STR_CTRL
the command's string may contain control strings
Definition command_type.h:406
CMD_DEITY
@ CMD_DEITY
the command may be executed by COMPANY_DEITY
Definition command_type.h:405
CMD_OFFLINE
@ CMD_OFFLINE
the command cannot be executed in a multiplayer game; single-player only
Definition command_type.h:399
company_type.h
Types related to companies.
Owner
Owner
Enum for all companies/owners.
Definition company_type.h:18
HouseID
uint16_t HouseID
OpenTTD ID of house types.
Definition house_type.h:13
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
CmdFoundTown
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:2142
CmdRenameTown
CommandCost CmdRenameTown(DoCommandFlag flags, TownID town_id, const std::string &text)
Rename a town (server-only).
Definition town_cmd.cpp:3018
CmdTownGrowthRate
CommandCost CmdTownGrowthRate(DoCommandFlag flags, TownID town_id, uint16_t growth_rate)
Change the growth rate of the town.
Definition town_cmd.cpp:3119
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:3157
CmdTownCargoGoal
CommandCost CmdTownCargoGoal(DoCommandFlag flags, TownID town_id, TownAcceptanceEffect tae, uint32_t goal)
Change the cargo goal of a town.
Definition town_cmd.cpp:3068
CmdDeleteTown
CommandCost CmdDeleteTown(DoCommandFlag flags, TownID town_id)
Delete a town (scenario editor or worldgen only).
Definition town_cmd.cpp:3219
CmdDoTownAction
CommandCost CmdDoTownAction(DoCommandFlag flags, TownID town_id, uint8_t action)
Do a town action.
Definition town_cmd.cpp:3662
CmdExpandTown
CommandCost CmdExpandTown(DoCommandFlag flags, TownID town_id, uint32_t grow_amount)
Expand a town (scenario editor only).
Definition town_cmd.cpp:3182
CmdTownSetText
CommandCost CmdTownSetText(DoCommandFlag flags, TownID town_id, const std::string &text)
Set a custom text in the Town window.
Definition town_cmd.cpp:3097
town_type.h
Types related to towns.
TownLayout
TownLayout
Town Layouts.
Definition town_type.h:79
TownSize
TownSize
Supported initial town sizes.
Definition town_type.h:19