OpenTTD Source: src/command_type.h Source File

OpenTTD Source 15.0-RC2

command_type.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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef COMMAND_TYPE_H
11#define COMMAND_TYPE_H
12
13#include "company_type.h"
14#include "economy_type.h"
15#include "strings_type.h"
16#include "tile_type.h"
17
18struct GRFFile;
19
24 class CommandCost {
25 Money cost;
26 StringID message;
27 ExpensesType expense_type;
28 bool success;
29 Owner owner = CompanyID::Invalid();
30 StringID extra_message = INVALID_STRING_ID;
31 EncodedString encoded_message{};
32
33public:
37 CommandCost() : cost(0), message(INVALID_STRING_ID), expense_type(INVALID_EXPENSES), success(true) {}
38
42 explicit CommandCost(StringID msg, StringID extra_msg = INVALID_STRING_ID) : cost(0), message(msg), expense_type(INVALID_EXPENSES), success(false), extra_message(extra_msg) {}
43
48 explicit CommandCost(ExpensesType ex_t) : cost(0), message(INVALID_STRING_ID), expense_type(ex_t), success(true) {}
49
55 CommandCost(ExpensesType ex_t, const Money &cst) : cost(cst), message(INVALID_STRING_ID), expense_type(ex_t), success(true) {}
56
61 inline void SetErrorOwner(Owner owner)
62 {
63 this->owner = owner;
64 }
65
72 void SetEncodedMessage(EncodedString &&message)
73 {
74 this->encoded_message = std::move(message);
75 }
76
81 EncodedString &GetEncodedMessage()
82 {
83 return this->encoded_message;
84 }
85
89 inline CompanyID GetErrorOwner() const
90 {
91 return this->owner;
92 }
93
98 inline void AddCost(const Money &cost)
99 {
100 this->cost += cost;
101 }
102
103 void AddCost(CommandCost &&cmd_cost);
104
109 inline void MultiplyCost(int factor)
110 {
111 this->cost *= factor;
112 }
113
118 inline Money GetCost() const
119 {
120 return this->cost;
121 }
122
127 inline ExpensesType GetExpensesType() const
128 {
129 return this->expense_type;
130 }
131
136 void MakeError(StringID message)
137 {
138 assert(message != INVALID_STRING_ID);
139 this->success = false;
140 this->message = message;
141 this->extra_message = INVALID_STRING_ID;
142 }
143
148 StringID GetErrorMessage() const
149 {
150 if (this->success) return INVALID_STRING_ID;
151 return this->message;
152 }
153
158 StringID GetExtraErrorMessage() const
159 {
160 if (this->success) return INVALID_STRING_ID;
161 return this->extra_message;
162 }
163
168 inline bool Succeeded() const
169 {
170 return this->success;
171 }
172
177 inline bool Failed() const
178 {
179 return !this->success;
180 }
181};
182
183 CommandCost CommandCostWithParam(StringID str, uint64_t value);
184 CommandCost CommandCostWithParam(StringID str, ConvertibleThroughBase auto value) { return CommandCostWithParam(str, value.base()); }
185
196 enum Commands : uint8_t {
197 CMD_BUILD_RAILROAD_TRACK,
198 CMD_REMOVE_RAILROAD_TRACK,
199 CMD_BUILD_SINGLE_RAIL,
200 CMD_REMOVE_SINGLE_RAIL,
201 CMD_LANDSCAPE_CLEAR,
202 CMD_BUILD_BRIDGE,
203 CMD_BUILD_RAIL_STATION,
204 CMD_BUILD_TRAIN_DEPOT,
205 CMD_BUILD_SINGLE_SIGNAL,
206 CMD_REMOVE_SINGLE_SIGNAL,
207 CMD_TERRAFORM_LAND,
208 CMD_BUILD_OBJECT,
209 CMD_BUILD_OBJECT_AREA,
210 CMD_BUILD_TUNNEL,
211
212 CMD_REMOVE_FROM_RAIL_STATION,
213 CMD_CONVERT_RAIL,
214
215 CMD_BUILD_RAIL_WAYPOINT,
216 CMD_RENAME_WAYPOINT,
217 CMD_MOVE_WAYPOINT_NAME,
218 CMD_REMOVE_FROM_RAIL_WAYPOINT,
219
220 CMD_BUILD_ROAD_WAYPOINT,
221 CMD_REMOVE_FROM_ROAD_WAYPOINT,
222
223 CMD_BUILD_ROAD_STOP,
224 CMD_REMOVE_ROAD_STOP,
225 CMD_BUILD_LONG_ROAD,
226 CMD_REMOVE_LONG_ROAD,
227 CMD_BUILD_ROAD,
228 CMD_BUILD_ROAD_DEPOT,
229 CMD_CONVERT_ROAD,
230
231 CMD_BUILD_AIRPORT,
232
233 CMD_BUILD_DOCK,
234
235 CMD_BUILD_SHIP_DEPOT,
236 CMD_BUILD_BUOY,
237
238 CMD_PLANT_TREE,
239
240 CMD_BUILD_VEHICLE,
241 CMD_SELL_VEHICLE,
242 CMD_REFIT_VEHICLE,
243 CMD_SEND_VEHICLE_TO_DEPOT,
244 CMD_SET_VEHICLE_VISIBILITY,
245
246 CMD_MOVE_RAIL_VEHICLE,
247 CMD_FORCE_TRAIN_PROCEED,
248 CMD_REVERSE_TRAIN_DIRECTION,
249
250 CMD_CLEAR_ORDER_BACKUP,
251 CMD_MODIFY_ORDER,
252 CMD_SKIP_TO_ORDER,
253 CMD_DELETE_ORDER,
254 CMD_INSERT_ORDER,
255
256 CMD_CHANGE_SERVICE_INT,
257
258 CMD_BUILD_INDUSTRY,
259 CMD_INDUSTRY_SET_FLAGS,
260 CMD_INDUSTRY_SET_EXCLUSIVITY,
261 CMD_INDUSTRY_SET_TEXT,
262 CMD_INDUSTRY_SET_PRODUCTION,
263
264 CMD_SET_COMPANY_MANAGER_FACE,
265 CMD_SET_COMPANY_COLOUR,
266
267 CMD_INCREASE_LOAN,
268 CMD_DECREASE_LOAN,
269 CMD_SET_COMPANY_MAX_LOAN,
270
271 CMD_WANT_ENGINE_PREVIEW,
272 CMD_ENGINE_CTRL,
273
274 CMD_RENAME_VEHICLE,
275 CMD_RENAME_ENGINE,
276 CMD_RENAME_COMPANY,
277 CMD_RENAME_PRESIDENT,
278 CMD_RENAME_STATION,
279 CMD_MOVE_STATION_NAME,
280 CMD_RENAME_DEPOT,
281
282 CMD_PLACE_SIGN,
283 CMD_RENAME_SIGN,
284 CMD_MOVE_SIGN,
285
286 CMD_TURN_ROADVEH,
287
288 CMD_PAUSE,
289
290 CMD_BUY_COMPANY,
291
292 CMD_FOUND_TOWN,
293 CMD_RENAME_TOWN,
294 CMD_DO_TOWN_ACTION,
295 CMD_TOWN_CARGO_GOAL,
296 CMD_TOWN_GROWTH_RATE,
297 CMD_TOWN_RATING,
298 CMD_TOWN_SET_TEXT,
299 CMD_EXPAND_TOWN,
300 CMD_DELETE_TOWN,
301 CMD_PLACE_HOUSE,
302
303 CMD_ORDER_REFIT,
304 CMD_CLONE_ORDER,
305 CMD_CLEAR_AREA,
306
307 CMD_MONEY_CHEAT,
308 CMD_CHANGE_BANK_BALANCE,
309 CMD_BUILD_CANAL,
310
311 CMD_CREATE_SUBSIDY,
312 CMD_COMPANY_CTRL,
313 CMD_COMPANY_ALLOW_LIST_CTRL,
314 CMD_CUSTOM_NEWS_ITEM,
315 CMD_CREATE_GOAL,
316 CMD_REMOVE_GOAL,
317 CMD_SET_GOAL_DESTINATION,
318 CMD_SET_GOAL_TEXT,
319 CMD_SET_GOAL_PROGRESS,
320 CMD_SET_GOAL_COMPLETED,
321 CMD_GOAL_QUESTION,
322 CMD_GOAL_QUESTION_ANSWER,
323 CMD_CREATE_STORY_PAGE,
324 CMD_CREATE_STORY_PAGE_ELEMENT,
325 CMD_UPDATE_STORY_PAGE_ELEMENT,
326 CMD_SET_STORY_PAGE_TITLE,
327 CMD_SET_STORY_PAGE_DATE,
328 CMD_SHOW_STORY_PAGE,
329 CMD_REMOVE_STORY_PAGE,
330 CMD_REMOVE_STORY_PAGE_ELEMENT,
331 CMD_SCROLL_VIEWPORT,
332 CMD_STORY_PAGE_BUTTON,
333
334 CMD_LEVEL_LAND,
335
336 CMD_BUILD_LOCK,
337
338 CMD_BUILD_SIGNAL_TRACK,
339 CMD_REMOVE_SIGNAL_TRACK,
340
341 CMD_GIVE_MONEY,
342 CMD_CHANGE_SETTING,
343 CMD_CHANGE_COMPANY_SETTING,
344
345 CMD_SET_AUTOREPLACE,
346
347 CMD_CLONE_VEHICLE,
348 CMD_START_STOP_VEHICLE,
349 CMD_MASS_START_STOP,
350 CMD_AUTOREPLACE_VEHICLE,
351 CMD_DEPOT_SELL_ALL_VEHICLES,
352 CMD_DEPOT_MASS_AUTOREPLACE,
353
354 CMD_CREATE_GROUP,
355 CMD_DELETE_GROUP,
356 CMD_ALTER_GROUP,
357 CMD_ADD_VEHICLE_GROUP,
358 CMD_ADD_SHARED_VEHICLE_GROUP,
359 CMD_REMOVE_ALL_VEHICLES_GROUP,
360 CMD_SET_GROUP_FLAG,
361 CMD_SET_GROUP_LIVERY,
362
363 CMD_MOVE_ORDER,
364 CMD_CHANGE_TIMETABLE,
365 CMD_BULK_CHANGE_TIMETABLE,
366 CMD_SET_VEHICLE_ON_TIME,
367 CMD_AUTOFILL_TIMETABLE,
368 CMD_SET_TIMETABLE_START,
369
370 CMD_OPEN_CLOSE_AIRPORT,
371
372 CMD_CREATE_LEAGUE_TABLE,
373 CMD_CREATE_LEAGUE_TABLE_ELEMENT,
374 CMD_UPDATE_LEAGUE_TABLE_ELEMENT_DATA,
375 CMD_UPDATE_LEAGUE_TABLE_ELEMENT_SCORE,
376 CMD_REMOVE_LEAGUE_TABLE_ELEMENT,
377
378 CMD_END,
379};
380
386 enum class DoCommandFlag : uint8_t {
387 Execute,
388 Auto,
389 QueryCost,
390 NoWater,
391 NoTestTownRating,
392 Bankrupt,
393 AutoReplace,
394 NoCargoCapacityCheck,
395 AllTiles,
396 NoModifyTownRating,
397 ForceClearTile,
398};
399using DoCommandFlags = EnumBitSet<DoCommandFlag, uint16_t>;
400
406 enum class CommandFlag : uint8_t {
407 Server,
408 Spectator,
409 Offline,
410 Auto,
411 AllTiles,
412 NoTest,
413 NoWater,
414 ClientID,
415 Deity,
416 StrCtrl,
417 NoEst,
418 Location,
419};
420using CommandFlags = EnumBitSet<CommandFlag, uint16_t>;
421
423 enum class CommandType : uint8_t {
424 LandscapeConstruction,
425 VehicleConstruction,
426 MoneyManagement,
427 VehicleManagement,
428 RouteManagement,
429 OtherManagement,
430 CompanySetting,
431 ServerSetting,
432 Cheat,
433
434 End,
435};
436
439 enum class CommandPauseLevel : uint8_t {
440 NoActions,
441 NoConstruction,
442 NoLandscaping,
443 AllActions,
444};
445
446
447 template <typename T> struct CommandFunctionTraitHelper;
448template <typename... Targs>
449 struct CommandFunctionTraitHelper<CommandCost(*)(DoCommandFlags, Targs...)> {
450 using Args = std::tuple<std::decay_t<Targs>...>;
451 using RetTypes = void;
452 using CbArgs = Args;
453 using CbProcType = void(*)(Commands, const CommandCost &);
454};
455template <template <typename...> typename Tret, typename... Tretargs, typename... Targs>
456 struct CommandFunctionTraitHelper<Tret<CommandCost, Tretargs...>(*)(DoCommandFlags, Targs...)> {
457 using Args = std::tuple<std::decay_t<Targs>...>;
458 using RetTypes = std::tuple<std::decay_t<Tretargs>...>;
459 using CbArgs = std::tuple<std::decay_t<Tretargs>..., std::decay_t<Targs>...>;
460 using CbProcType = void(*)(Commands, const CommandCost &, Tretargs...);
461};
462
464 template <Commands Tcmd> struct CommandTraits;
465
466#define DEF_CMD_TRAIT(cmd_, proc_, flags_, type_) \
467 template <> struct CommandTraits<cmd_> { \
468 using ProcType = decltype(&proc_); \
469 using Args = typename CommandFunctionTraitHelper<ProcType>::Args; \
470 using RetTypes = typename CommandFunctionTraitHelper<ProcType>::RetTypes; \
471 using CbArgs = typename CommandFunctionTraitHelper<ProcType>::CbArgs; \
472 using RetCallbackProc = typename CommandFunctionTraitHelper<ProcType>::CbProcType; \
473 static constexpr Commands cmd = cmd_; \
474 static constexpr auto &proc = proc_; \
475 static constexpr CommandFlags flags = flags_; \
476 static constexpr CommandType type = type_; \
477 static inline constexpr std::string_view name = #proc_; \
478 };
479
481 typedef std::vector<uint8_t> CommandDataBuffer;
482
495 typedef void CommandCallback(Commands cmd, const CommandCost &result, TileIndex tile);
496
511 typedef void CommandCallbackData(Commands cmd, const CommandCost &result, const CommandDataBuffer &data, CommandDataBuffer result_data);
512
513#endif /* COMMAND_TYPE_H */
CommandCost
Common return value for all commands.
Definition command_type.h:24
CommandCost::GetExpensesType
ExpensesType GetExpensesType() const
The expense type of the cost.
Definition command_type.h:127
CommandCost::Succeeded
bool Succeeded() const
Did this command succeed?
Definition command_type.h:168
CommandCost::AddCost
void AddCost(const Money &cost)
Adds the given cost to the cost of the command.
Definition command_type.h:98
CommandCost::MakeError
void MakeError(StringID message)
Makes this CommandCost behave like an error command.
Definition command_type.h:136
CommandCost::cost
Money cost
The cost of this action.
Definition command_type.h:25
CommandCost::extra_message
StringID extra_message
Additional warning message for when success is unset.
Definition command_type.h:30
CommandCost::CommandCost
CommandCost(ExpensesType ex_t, const Money &cst)
Creates a command return value with the given start cost and expense type.
Definition command_type.h:55
CommandCost::GetCost
Money GetCost() const
The costs as made up to this moment.
Definition command_type.h:118
CommandCost::CommandCost
CommandCost(ExpensesType ex_t)
Creates a command cost with given expense type and start cost of 0.
Definition command_type.h:48
CommandCost::SetEncodedMessage
void SetEncodedMessage(EncodedString &&message)
Set the encoded message string.
Definition command_type.h:72
CommandCost::owner
Owner owner
Originator owner of error.
Definition command_type.h:29
CommandCost::CommandCost
CommandCost(StringID msg, StringID extra_msg=INVALID_STRING_ID)
Creates a command return value with one, or optionally two, error message strings.
Definition command_type.h:42
CommandCost::message
StringID message
Warning message for when success is unset.
Definition command_type.h:26
CommandCost::Failed
bool Failed() const
Did this command fail?
Definition command_type.h:177
CommandCost::GetEncodedMessage
EncodedString & GetEncodedMessage()
Get the last encoded error message.
Definition command_type.h:81
CommandCost::CommandCost
CommandCost()
Creates a command cost return with no cost and no error.
Definition command_type.h:37
CommandCost::MultiplyCost
void MultiplyCost(int factor)
Multiplies the cost of the command by the given factor.
Definition command_type.h:109
CommandCost::GetErrorMessage
StringID GetErrorMessage() const
Returns the error message of a command.
Definition command_type.h:148
CommandCost::SetErrorOwner
void SetErrorOwner(Owner owner)
Set the 'owner' (the originator) of this error message.
Definition command_type.h:61
CommandCost::success
bool success
Whether the command went fine up to this moment.
Definition command_type.h:28
CommandCost::GetErrorOwner
CompanyID GetErrorOwner() const
Get the originator owner for this error.
Definition command_type.h:89
CommandCost::expense_type
ExpensesType expense_type
the type of expense as shown on the finances view
Definition command_type.h:27
CommandCost::GetExtraErrorMessage
StringID GetExtraErrorMessage() const
Returns the extra error message of a command.
Definition command_type.h:158
CommandCost::encoded_message
EncodedString encoded_message
Encoded error message, used if the error message includes parameters.
Definition command_type.h:31
EncodedString
Container for an encoded string, created by GetEncodedString.
Definition strings_type.h:98
EnumBitSet
Enum-as-bit-set wrapper.
Definition enum_type.hpp:177
OverflowSafeInt< int64_t >
CommandType
CommandType
Types of commands we have.
Definition command_type.h:423
CommandType::VehicleConstruction
@ VehicleConstruction
Construction, modification (incl. refit) and destruction of vehicles.
CommandType::RouteManagement
@ RouteManagement
Modifications to route management (orders, groups, etc).
CommandType::Cheat
@ Cheat
A cheat of some sorts.
CommandType::OtherManagement
@ OtherManagement
Renaming stuff, changing company colours, placing signs, etc.
CommandType::End
@ End
End marker.
CommandType::LandscapeConstruction
@ LandscapeConstruction
Construction and destruction of objects on the map.
CommandType::MoneyManagement
@ MoneyManagement
Management of money, i.e. loans.
CommandType::CompanySetting
@ CompanySetting
Changing settings related to a company.
CommandType::VehicleManagement
@ VehicleManagement
Stopping, starting, sending to depot, turning around, replace orders etc.
CommandType::ServerSetting
@ ServerSetting
Pausing/removing companies/server settings.
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:495
DoCommandFlag
DoCommandFlag
List of flags for a command.
Definition command_type.h:386
DoCommandFlag::Auto
@ Auto
don't allow building on structures
DoCommandFlag::QueryCost
@ QueryCost
query cost only, don't build.
DoCommandFlag::NoModifyTownRating
@ NoModifyTownRating
do not change town rating
DoCommandFlag::NoWater
@ NoWater
don't allow building on water
DoCommandFlag::Execute
@ Execute
execute the given command
DoCommandFlag::Bankrupt
@ Bankrupt
company bankrupts, skip money check, skip vehicle on tile check in some cases
DoCommandFlag::AllTiles
@ AllTiles
allow this command also on MP_VOID tiles
DoCommandFlag::NoCargoCapacityCheck
@ NoCargoCapacityCheck
when autoreplace/autorenew is in progress, this shall prevent truncating the amount of cargo in the v...
DoCommandFlag::ForceClearTile
@ ForceClearTile
do not only remove the object on the tile, but also clear any water left on it
DoCommandFlag::AutoReplace
@ AutoReplace
autoreplace/autorenew is in progress, this shall disable vehicle limits when building,...
DoCommandFlag::NoTestTownRating
@ NoTestTownRating
town rating does not disallow you from building
CommandCostWithParam
CommandCost CommandCostWithParam(StringID str, uint64_t value)
Return an error status, with string and parameter.
Definition command.cpp:417
CommandFlag
CommandFlag
Command flags for the command table _command_proc_table.
Definition command_type.h:406
CommandFlag::NoEst
@ NoEst
the command is never estimated.
CommandFlag::Deity
@ Deity
the command may be executed by COMPANY_DEITY
CommandFlag::Spectator
@ Spectator
the command may be initiated by a spectator
CommandFlag::Offline
@ Offline
the command cannot be executed in a multiplayer game; single-player only
CommandFlag::Server
@ Server
the command can only be initiated by the server
CommandFlag::ClientID
@ ClientID
set p2 with the ClientID of the sending client.
CommandFlag::StrCtrl
@ StrCtrl
the command's string may contain control strings
CommandFlag::Location
@ Location
the command has implicit location argument.
CommandFlag::NoTest
@ NoTest
the command's output may differ between test and execute due to town rating changes etc.
CommandPauseLevel
CommandPauseLevel
Different command pause levels.
Definition command_type.h:439
CommandPauseLevel::NoLandscaping
@ NoLandscaping
No landscaping actions may be executed.
CommandPauseLevel::NoConstruction
@ NoConstruction
No construction actions may be executed.
CommandPauseLevel::NoActions
@ NoActions
No user actions may be executed.
CommandPauseLevel::AllActions
@ AllActions
All actions may be executed.
CommandCallbackData
void CommandCallbackData(Commands cmd, const CommandCost &result, const CommandDataBuffer &data, CommandDataBuffer result_data)
Define a callback function for the client, after the command is finished.
Definition command_type.h:511
CommandDataBuffer
std::vector< uint8_t > CommandDataBuffer
Storage buffer for serialized command data.
Definition command_type.h:481
Commands
Commands
List of commands.
Definition command_type.h:196
CMD_BUILD_LONG_ROAD
@ CMD_BUILD_LONG_ROAD
build a complete road (not a "half" one)
Definition command_type.h:225
CMD_REMOVE_FROM_RAIL_WAYPOINT
@ CMD_REMOVE_FROM_RAIL_WAYPOINT
remove a (rectangle of) tiles from a rail waypoint
Definition command_type.h:218
CMD_REMOVE_STORY_PAGE
@ CMD_REMOVE_STORY_PAGE
remove a story page
Definition command_type.h:329
CMD_OPEN_CLOSE_AIRPORT
@ CMD_OPEN_CLOSE_AIRPORT
open/close an airport to incoming aircraft
Definition command_type.h:370
CMD_WANT_ENGINE_PREVIEW
@ CMD_WANT_ENGINE_PREVIEW
confirm the preview of an engine
Definition command_type.h:271
CMD_GOAL_QUESTION_ANSWER
@ CMD_GOAL_QUESTION_ANSWER
answer(s) to CMD_GOAL_QUESTION
Definition command_type.h:322
CMD_CREATE_STORY_PAGE_ELEMENT
@ CMD_CREATE_STORY_PAGE_ELEMENT
create a new story page element
Definition command_type.h:324
CMD_BUILD_OBJECT_AREA
@ CMD_BUILD_OBJECT_AREA
build an area of objects
Definition command_type.h:209
CMD_BUILD_TRAIN_DEPOT
@ CMD_BUILD_TRAIN_DEPOT
build a train depot
Definition command_type.h:204
CMD_MASS_START_STOP
@ CMD_MASS_START_STOP
start/stop all vehicles (in a depot)
Definition command_type.h:349
CMD_UPDATE_LEAGUE_TABLE_ELEMENT_DATA
@ CMD_UPDATE_LEAGUE_TABLE_ELEMENT_DATA
update the data fields of a league table element
Definition command_type.h:374
CMD_REMOVE_SINGLE_RAIL
@ CMD_REMOVE_SINGLE_RAIL
remove a single rail track
Definition command_type.h:200
CMD_PAUSE
@ CMD_PAUSE
pause the game
Definition command_type.h:288
CMD_BUILD_ROAD
@ CMD_BUILD_ROAD
build a "half" road
Definition command_type.h:227
CMD_BUILD_BUOY
@ CMD_BUILD_BUOY
build a buoy
Definition command_type.h:236
CMD_SET_GOAL_DESTINATION
@ CMD_SET_GOAL_DESTINATION
update goal destination of a goal
Definition command_type.h:317
CMD_SHOW_STORY_PAGE
@ CMD_SHOW_STORY_PAGE
show a story page
Definition command_type.h:328
CMD_MONEY_CHEAT
@ CMD_MONEY_CHEAT
do the money cheat
Definition command_type.h:307
CMD_EXPAND_TOWN
@ CMD_EXPAND_TOWN
expand a town
Definition command_type.h:299
CMD_COMPANY_CTRL
@ CMD_COMPANY_CTRL
used in multiplayer to create a new companies etc.
Definition command_type.h:312
CMD_CONVERT_RAIL
@ CMD_CONVERT_RAIL
convert a rail type
Definition command_type.h:213
CMD_MODIFY_ORDER
@ CMD_MODIFY_ORDER
modify an order (like set full-load)
Definition command_type.h:251
CMD_BUILD_SIGNAL_TRACK
@ CMD_BUILD_SIGNAL_TRACK
add signals along a track (by dragging)
Definition command_type.h:338
CMD_ADD_SHARED_VEHICLE_GROUP
@ CMD_ADD_SHARED_VEHICLE_GROUP
add all other shared vehicles to a group which are missing
Definition command_type.h:358
CMD_GOAL_QUESTION
@ CMD_GOAL_QUESTION
ask a goal related question
Definition command_type.h:321
CMD_UPDATE_STORY_PAGE_ELEMENT
@ CMD_UPDATE_STORY_PAGE_ELEMENT
update a story page element
Definition command_type.h:325
CMD_MOVE_ORDER
@ CMD_MOVE_ORDER
move an order
Definition command_type.h:363
CMD_SELL_VEHICLE
@ CMD_SELL_VEHICLE
sell a vehicle
Definition command_type.h:241
CMD_CLONE_VEHICLE
@ CMD_CLONE_VEHICLE
clone a vehicle
Definition command_type.h:347
CMD_CREATE_STORY_PAGE
@ CMD_CREATE_STORY_PAGE
create a new story page
Definition command_type.h:323
CMD_DELETE_TOWN
@ CMD_DELETE_TOWN
delete a town
Definition command_type.h:300
CMD_MOVE_STATION_NAME
@ CMD_MOVE_STATION_NAME
move a station name
Definition command_type.h:279
CMD_SET_TIMETABLE_START
@ CMD_SET_TIMETABLE_START
set the date that a timetable should start
Definition command_type.h:368
CMD_CONVERT_ROAD
@ CMD_CONVERT_ROAD
convert a road type
Definition command_type.h:229
CMD_SET_VEHICLE_ON_TIME
@ CMD_SET_VEHICLE_ON_TIME
set the vehicle on time feature (timetable)
Definition command_type.h:366
CMD_BUILD_VEHICLE
@ CMD_BUILD_VEHICLE
build a vehicle
Definition command_type.h:240
CMD_MOVE_WAYPOINT_NAME
@ CMD_MOVE_WAYPOINT_NAME
move a waypoint name
Definition command_type.h:217
CMD_REMOVE_RAILROAD_TRACK
@ CMD_REMOVE_RAILROAD_TRACK
remove a rail track
Definition command_type.h:198
CMD_TOWN_SET_TEXT
@ CMD_TOWN_SET_TEXT
set the custom text of a town
Definition command_type.h:298
CMD_BUILD_OBJECT
@ CMD_BUILD_OBJECT
build an object
Definition command_type.h:208
CMD_SET_AUTOREPLACE
@ CMD_SET_AUTOREPLACE
set an autoreplace entry
Definition command_type.h:345
CMD_REMOVE_LEAGUE_TABLE_ELEMENT
@ CMD_REMOVE_LEAGUE_TABLE_ELEMENT
remove a league table element
Definition command_type.h:376
CMD_CREATE_LEAGUE_TABLE_ELEMENT
@ CMD_CREATE_LEAGUE_TABLE_ELEMENT
create a new element in a league table
Definition command_type.h:373
CMD_DEPOT_SELL_ALL_VEHICLES
@ CMD_DEPOT_SELL_ALL_VEHICLES
sell all vehicles which are in a given depot
Definition command_type.h:351
CMD_REMOVE_LONG_ROAD
@ CMD_REMOVE_LONG_ROAD
remove a complete road (not a "half" one)
Definition command_type.h:226
CMD_BUILD_SHIP_DEPOT
@ CMD_BUILD_SHIP_DEPOT
build a ship depot
Definition command_type.h:235
CMD_RENAME_COMPANY
@ CMD_RENAME_COMPANY
change the company name
Definition command_type.h:276
CMD_BUILD_DOCK
@ CMD_BUILD_DOCK
build a dock
Definition command_type.h:233
CMD_STORY_PAGE_BUTTON
@ CMD_STORY_PAGE_BUTTON
selection via story page button
Definition command_type.h:332
CMD_DECREASE_LOAN
@ CMD_DECREASE_LOAN
decrease the loan from the bank
Definition command_type.h:268
CMD_FOUND_TOWN
@ CMD_FOUND_TOWN
found a town
Definition command_type.h:292
CMD_PLACE_SIGN
@ CMD_PLACE_SIGN
place a sign
Definition command_type.h:282
CMD_REFIT_VEHICLE
@ CMD_REFIT_VEHICLE
refit the cargo space of a vehicle
Definition command_type.h:242
CMD_LEVEL_LAND
@ CMD_LEVEL_LAND
level land
Definition command_type.h:334
CMD_CREATE_GOAL
@ CMD_CREATE_GOAL
create a new goal
Definition command_type.h:315
CMD_SET_COMPANY_MANAGER_FACE
@ CMD_SET_COMPANY_MANAGER_FACE
set the manager's face of the company
Definition command_type.h:264
CMD_LANDSCAPE_CLEAR
@ CMD_LANDSCAPE_CLEAR
demolish a tile
Definition command_type.h:201
CMD_INDUSTRY_SET_FLAGS
@ CMD_INDUSTRY_SET_FLAGS
change industry control flags
Definition command_type.h:259
CMD_TURN_ROADVEH
@ CMD_TURN_ROADVEH
turn a road vehicle around
Definition command_type.h:286
CMD_CLEAR_AREA
@ CMD_CLEAR_AREA
clear an area
Definition command_type.h:305
CMD_ENGINE_CTRL
@ CMD_ENGINE_CTRL
control availability of the engine for companies
Definition command_type.h:272
CMD_INDUSTRY_SET_TEXT
@ CMD_INDUSTRY_SET_TEXT
change additional text for the industry
Definition command_type.h:261
CMD_FORCE_TRAIN_PROCEED
@ CMD_FORCE_TRAIN_PROCEED
proceed a train to pass a red signal
Definition command_type.h:247
CMD_DO_TOWN_ACTION
@ CMD_DO_TOWN_ACTION
do a action from the town detail window (like advertises or bribe)
Definition command_type.h:294
CMD_SET_STORY_PAGE_TITLE
@ CMD_SET_STORY_PAGE_TITLE
update title of a story page
Definition command_type.h:326
CMD_ADD_VEHICLE_GROUP
@ CMD_ADD_VEHICLE_GROUP
add a vehicle to a group
Definition command_type.h:357
CMD_BUILD_CANAL
@ CMD_BUILD_CANAL
build a canal
Definition command_type.h:309
CMD_CLONE_ORDER
@ CMD_CLONE_ORDER
clone (and share) an order
Definition command_type.h:304
CMD_BUILD_ROAD_WAYPOINT
@ CMD_BUILD_ROAD_WAYPOINT
build a road waypoint
Definition command_type.h:220
CMD_REMOVE_FROM_ROAD_WAYPOINT
@ CMD_REMOVE_FROM_ROAD_WAYPOINT
remove a (rectangle of) tiles from a road waypoint
Definition command_type.h:221
CMD_SKIP_TO_ORDER
@ CMD_SKIP_TO_ORDER
skip an order to the next of specific one
Definition command_type.h:252
CMD_INDUSTRY_SET_EXCLUSIVITY
@ CMD_INDUSTRY_SET_EXCLUSIVITY
change industry exclusive consumer/supplier
Definition command_type.h:260
CMD_INDUSTRY_SET_PRODUCTION
@ CMD_INDUSTRY_SET_PRODUCTION
change industry production
Definition command_type.h:262
CMD_REVERSE_TRAIN_DIRECTION
@ CMD_REVERSE_TRAIN_DIRECTION
turn a train around
Definition command_type.h:248
CMD_CREATE_SUBSIDY
@ CMD_CREATE_SUBSIDY
create a new subsidy
Definition command_type.h:311
CMD_RENAME_WAYPOINT
@ CMD_RENAME_WAYPOINT
rename a waypoint
Definition command_type.h:216
CMD_BUILD_RAIL_WAYPOINT
@ CMD_BUILD_RAIL_WAYPOINT
build a waypoint
Definition command_type.h:215
CMD_MOVE_SIGN
@ CMD_MOVE_SIGN
move a sign
Definition command_type.h:284
CMD_DELETE_ORDER
@ CMD_DELETE_ORDER
delete an order
Definition command_type.h:253
CMD_CHANGE_SETTING
@ CMD_CHANGE_SETTING
change a setting
Definition command_type.h:342
CMD_TOWN_RATING
@ CMD_TOWN_RATING
set rating of a company in a town
Definition command_type.h:297
CMD_END
@ CMD_END
Must ALWAYS be on the end of this list!! (period)
Definition command_type.h:378
CMD_BUY_COMPANY
@ CMD_BUY_COMPANY
buy a company which is bankrupt
Definition command_type.h:290
CMD_PLANT_TREE
@ CMD_PLANT_TREE
plant a tree
Definition command_type.h:238
CMD_ORDER_REFIT
@ CMD_ORDER_REFIT
change the refit information of an order (for "goto depot" )
Definition command_type.h:303
CMD_CLEAR_ORDER_BACKUP
@ CMD_CLEAR_ORDER_BACKUP
clear the order backup of a given user/tile
Definition command_type.h:250
CMD_SET_GOAL_COMPLETED
@ CMD_SET_GOAL_COMPLETED
update goal completed status of a goal
Definition command_type.h:320
CMD_BUILD_AIRPORT
@ CMD_BUILD_AIRPORT
build an airport
Definition command_type.h:231
CMD_TERRAFORM_LAND
@ CMD_TERRAFORM_LAND
terraform a tile
Definition command_type.h:207
CMD_BUILD_BRIDGE
@ CMD_BUILD_BRIDGE
build a bridge
Definition command_type.h:202
CMD_GIVE_MONEY
@ CMD_GIVE_MONEY
give money to another company
Definition command_type.h:341
CMD_RENAME_VEHICLE
@ CMD_RENAME_VEHICLE
rename a whole vehicle
Definition command_type.h:274
CMD_SET_STORY_PAGE_DATE
@ CMD_SET_STORY_PAGE_DATE
update date of a story page
Definition command_type.h:327
CMD_RENAME_PRESIDENT
@ CMD_RENAME_PRESIDENT
change the president name
Definition command_type.h:277
CMD_BUILD_LOCK
@ CMD_BUILD_LOCK
build a lock
Definition command_type.h:336
CMD_COMPANY_ALLOW_LIST_CTRL
@ CMD_COMPANY_ALLOW_LIST_CTRL
Used in multiplayer to add/remove a client's public key to/from the company's allow list.
Definition command_type.h:313
CMD_PLACE_HOUSE
@ CMD_PLACE_HOUSE
place a house
Definition command_type.h:301
CMD_CHANGE_TIMETABLE
@ CMD_CHANGE_TIMETABLE
change the timetable for a vehicle
Definition command_type.h:364
CMD_DEPOT_MASS_AUTOREPLACE
@ CMD_DEPOT_MASS_AUTOREPLACE
force the autoreplace to take action in a given depot
Definition command_type.h:352
CMD_CHANGE_COMPANY_SETTING
@ CMD_CHANGE_COMPANY_SETTING
change a company setting
Definition command_type.h:343
CMD_CUSTOM_NEWS_ITEM
@ CMD_CUSTOM_NEWS_ITEM
create a custom news message
Definition command_type.h:314
CMD_BUILD_RAILROAD_TRACK
@ CMD_BUILD_RAILROAD_TRACK
build a rail track
Definition command_type.h:197
CMD_CREATE_LEAGUE_TABLE
@ CMD_CREATE_LEAGUE_TABLE
create a new league table
Definition command_type.h:372
CMD_ALTER_GROUP
@ CMD_ALTER_GROUP
alter a group
Definition command_type.h:356
CMD_RENAME_SIGN
@ CMD_RENAME_SIGN
rename a sign
Definition command_type.h:283
CMD_INCREASE_LOAN
@ CMD_INCREASE_LOAN
increase the loan from the bank
Definition command_type.h:267
CMD_BUILD_ROAD_DEPOT
@ CMD_BUILD_ROAD_DEPOT
build a road depot
Definition command_type.h:228
CMD_SCROLL_VIEWPORT
@ CMD_SCROLL_VIEWPORT
scroll main viewport of players
Definition command_type.h:331
CMD_SET_COMPANY_MAX_LOAN
@ CMD_SET_COMPANY_MAX_LOAN
sets the max loan for the company
Definition command_type.h:269
CMD_BUILD_INDUSTRY
@ CMD_BUILD_INDUSTRY
build a new industry
Definition command_type.h:258
CMD_SEND_VEHICLE_TO_DEPOT
@ CMD_SEND_VEHICLE_TO_DEPOT
send a vehicle to a depot
Definition command_type.h:243
CMD_SET_VEHICLE_VISIBILITY
@ CMD_SET_VEHICLE_VISIBILITY
hide or unhide a vehicle in the build vehicle and autoreplace GUIs
Definition command_type.h:244
CMD_SET_GROUP_FLAG
@ CMD_SET_GROUP_FLAG
set/clear a flag for a group
Definition command_type.h:360
CMD_BUILD_ROAD_STOP
@ CMD_BUILD_ROAD_STOP
build a road stop
Definition command_type.h:223
CMD_SET_GOAL_TEXT
@ CMD_SET_GOAL_TEXT
update goal text of a goal
Definition command_type.h:318
CMD_START_STOP_VEHICLE
@ CMD_START_STOP_VEHICLE
start or stop a vehicle
Definition command_type.h:348
CMD_MOVE_RAIL_VEHICLE
@ CMD_MOVE_RAIL_VEHICLE
move a rail vehicle (in the depot)
Definition command_type.h:246
CMD_SET_GOAL_PROGRESS
@ CMD_SET_GOAL_PROGRESS
update goal progress text of a goal
Definition command_type.h:319
CMD_CHANGE_BANK_BALANCE
@ CMD_CHANGE_BANK_BALANCE
change bank balance to charge costs or give money from a GS
Definition command_type.h:308
CMD_RENAME_DEPOT
@ CMD_RENAME_DEPOT
rename a depot
Definition command_type.h:280
CMD_RENAME_ENGINE
@ CMD_RENAME_ENGINE
rename a engine (in the engine list)
Definition command_type.h:275
CMD_INSERT_ORDER
@ CMD_INSERT_ORDER
insert a new order
Definition command_type.h:254
CMD_TOWN_GROWTH_RATE
@ CMD_TOWN_GROWTH_RATE
set the town growth rate
Definition command_type.h:296
CMD_SET_GROUP_LIVERY
@ CMD_SET_GROUP_LIVERY
set the livery for a group
Definition command_type.h:361
CMD_CREATE_GROUP
@ CMD_CREATE_GROUP
create a new group
Definition command_type.h:354
CMD_BUILD_SINGLE_SIGNAL
@ CMD_BUILD_SINGLE_SIGNAL
build a signal
Definition command_type.h:205
CMD_RENAME_TOWN
@ CMD_RENAME_TOWN
rename a town
Definition command_type.h:293
CMD_REMOVE_SIGNAL_TRACK
@ CMD_REMOVE_SIGNAL_TRACK
remove signals along a track (by dragging)
Definition command_type.h:339
CMD_BUILD_RAIL_STATION
@ CMD_BUILD_RAIL_STATION
build a rail station
Definition command_type.h:203
CMD_AUTOREPLACE_VEHICLE
@ CMD_AUTOREPLACE_VEHICLE
replace/renew a vehicle while it is in a depot
Definition command_type.h:350
CMD_BUILD_SINGLE_RAIL
@ CMD_BUILD_SINGLE_RAIL
build a single rail track
Definition command_type.h:199
CMD_REMOVE_GOAL
@ CMD_REMOVE_GOAL
remove a goal
Definition command_type.h:316
CMD_REMOVE_SINGLE_SIGNAL
@ CMD_REMOVE_SINGLE_SIGNAL
remove a signal
Definition command_type.h:206
CMD_RENAME_STATION
@ CMD_RENAME_STATION
rename a station
Definition command_type.h:278
CMD_BUILD_TUNNEL
@ CMD_BUILD_TUNNEL
build a tunnel
Definition command_type.h:210
CMD_SET_COMPANY_COLOUR
@ CMD_SET_COMPANY_COLOUR
set the colour of the company
Definition command_type.h:265
CMD_REMOVE_STORY_PAGE_ELEMENT
@ CMD_REMOVE_STORY_PAGE_ELEMENT
remove a story page element
Definition command_type.h:330
CMD_TOWN_CARGO_GOAL
@ CMD_TOWN_CARGO_GOAL
set the goal of a cargo for a town
Definition command_type.h:295
CMD_REMOVE_FROM_RAIL_STATION
@ CMD_REMOVE_FROM_RAIL_STATION
remove a (rectangle of) tiles from a rail station
Definition command_type.h:212
CMD_REMOVE_ALL_VEHICLES_GROUP
@ CMD_REMOVE_ALL_VEHICLES_GROUP
remove all vehicles from a group
Definition command_type.h:359
CMD_REMOVE_ROAD_STOP
@ CMD_REMOVE_ROAD_STOP
remove a road stop
Definition command_type.h:224
CMD_CHANGE_SERVICE_INT
@ CMD_CHANGE_SERVICE_INT
change the server interval of a vehicle
Definition command_type.h:256
CMD_UPDATE_LEAGUE_TABLE_ELEMENT_SCORE
@ CMD_UPDATE_LEAGUE_TABLE_ELEMENT_SCORE
update the score of a league table element
Definition command_type.h:375
CMD_DELETE_GROUP
@ CMD_DELETE_GROUP
delete a group
Definition command_type.h:355
CMD_AUTOFILL_TIMETABLE
@ CMD_AUTOFILL_TIMETABLE
autofill the timetable
Definition command_type.h:367
CMD_BULK_CHANGE_TIMETABLE
@ CMD_BULK_CHANGE_TIMETABLE
change the timetable for all orders of a vehicle
Definition command_type.h:365
company_type.h
Types related to companies.
ConvertibleThroughBase
A type is considered 'convertible through base()' when it has a 'base()' function that returns someth...
Definition convertible_through_base.hpp:19
economy_type.h
Types related to the economy.
ExpensesType
ExpensesType
Types of expenses.
Definition economy_type.h:178
INVALID_EXPENSES
@ INVALID_EXPENSES
Invalid expense type.
Definition economy_type.h:193
strings_type.h
Types related to strings.
StringID
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Definition strings_type.h:19
INVALID_STRING_ID
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
Definition strings_type.h:20
CommandFunctionTraitHelper
Definition command_type.h:447
CommandTraits
Defines the traits of a command.
Definition command_type.h:464
GRFFile
Dynamic data of a loaded NewGRF.
Definition newgrf.h:114
PoolID< uint8_t, struct CompanyIDTag, 0xF, 0xFF >
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
tile_type.h
Types related to tiles.