OpenTTD Source: src/command_type.h Source File

OpenTTD Source 1.11.0-RC1

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 <http://www.gnu.org/licenses/>.
6 */
7
10 #ifndef COMMAND_TYPE_H
11 #define COMMAND_TYPE_H
12
13 #include "economy_type.h"
14 #include "strings_type.h"
15 #include "tile_type.h"
16
17 struct GRFFile;
18
23 class CommandCost {
24 ExpensesType expense_type;
25 Money cost;
26 StringID message;
27 bool success;
28 const GRFFile *textref_stack_grffile;
29 uint textref_stack_size;
30
31 static uint32 textref_stack[16];
32
33 public:
37 CommandCost() : expense_type(INVALID_EXPENSES), cost(0), message(INVALID_STRING_ID), success(true), textref_stack_grffile(nullptr), textref_stack_size(0) {}
38
42 explicit CommandCost(StringID msg) : expense_type(INVALID_EXPENSES), cost(0), message(msg), success(false), textref_stack_grffile(nullptr), textref_stack_size(0) {}
43
48 explicit CommandCost(ExpensesType ex_t) : expense_type(ex_t), cost(0), message(INVALID_STRING_ID), success(true), textref_stack_grffile(nullptr), textref_stack_size(0) {}
49
55 CommandCost(ExpensesType ex_t, const Money &cst) : expense_type(ex_t), cost(cst), message(INVALID_STRING_ID), success(true), textref_stack_grffile(nullptr), textref_stack_size(0) {}
56
57
62 inline void AddCost(const Money &cost)
63 {
64 this->cost += cost;
65 }
66
67 void AddCost(const CommandCost &cmd_cost);
68
73 inline void MultiplyCost(int factor)
74 {
75 this->cost *= factor;
76 }
77
82 inline Money GetCost() const
83 {
84 return this->cost;
85 }
86
91 inline ExpensesType GetExpensesType() const
92 {
93 return this->expense_type;
94 }
95
100 void MakeError(StringID message)
101 {
102 assert(message != INVALID_STRING_ID);
103 this->success = false;
104 this->message = message;
105 }
106
107 void UseTextRefStack(const GRFFile *grffile, uint num_registers);
108
113 const GRFFile *GetTextRefStackGRF() const
114 {
115 return this->textref_stack_grffile;
116 }
117
122 uint GetTextRefStackSize() const
123 {
124 return this->textref_stack_size;
125 }
126
131 const uint32 *GetTextRefStack() const
132 {
133 return textref_stack;
134 }
135
140 StringID GetErrorMessage() const
141 {
142 if (this->success) return INVALID_STRING_ID;
143 return this->message;
144 }
145
150 inline bool Succeeded() const
151 {
152 return this->success;
153 }
154
159 inline bool Failed() const
160 {
161 return !this->success;
162 }
163 };
164
175 enum Commands {
176 CMD_BUILD_RAILROAD_TRACK,
177 CMD_REMOVE_RAILROAD_TRACK,
178 CMD_BUILD_SINGLE_RAIL,
179 CMD_REMOVE_SINGLE_RAIL,
180 CMD_LANDSCAPE_CLEAR,
181 CMD_BUILD_BRIDGE,
182 CMD_BUILD_RAIL_STATION,
183 CMD_BUILD_TRAIN_DEPOT,
184 CMD_BUILD_SIGNALS,
185 CMD_REMOVE_SIGNALS,
186 CMD_TERRAFORM_LAND,
187 CMD_BUILD_OBJECT,
188 CMD_BUILD_TUNNEL,
189
190 CMD_REMOVE_FROM_RAIL_STATION,
191 CMD_CONVERT_RAIL,
192
193 CMD_BUILD_RAIL_WAYPOINT,
194 CMD_RENAME_WAYPOINT,
195 CMD_REMOVE_FROM_RAIL_WAYPOINT,
196
197 CMD_BUILD_ROAD_STOP,
198 CMD_REMOVE_ROAD_STOP,
199 CMD_BUILD_LONG_ROAD,
200 CMD_REMOVE_LONG_ROAD,
201 CMD_BUILD_ROAD,
202 CMD_BUILD_ROAD_DEPOT,
203 CMD_CONVERT_ROAD,
204
205 CMD_BUILD_AIRPORT,
206
207 CMD_BUILD_DOCK,
208
209 CMD_BUILD_SHIP_DEPOT,
210 CMD_BUILD_BUOY,
211
212 CMD_PLANT_TREE,
213
214 CMD_BUILD_VEHICLE,
215 CMD_SELL_VEHICLE,
216 CMD_REFIT_VEHICLE,
217 CMD_SEND_VEHICLE_TO_DEPOT,
218 CMD_SET_VEHICLE_VISIBILITY,
219
220 CMD_MOVE_RAIL_VEHICLE,
221 CMD_FORCE_TRAIN_PROCEED,
222 CMD_REVERSE_TRAIN_DIRECTION,
223
224 CMD_CLEAR_ORDER_BACKUP,
225 CMD_MODIFY_ORDER,
226 CMD_SKIP_TO_ORDER,
227 CMD_DELETE_ORDER,
228 CMD_INSERT_ORDER,
229
230 CMD_CHANGE_SERVICE_INT,
231
232 CMD_BUILD_INDUSTRY,
233 CMD_INDUSTRY_CTRL,
234
235 CMD_SET_COMPANY_MANAGER_FACE,
236 CMD_SET_COMPANY_COLOUR,
237
238 CMD_INCREASE_LOAN,
239 CMD_DECREASE_LOAN,
240
241 CMD_WANT_ENGINE_PREVIEW,
242 CMD_ENGINE_CTRL,
243
244 CMD_RENAME_VEHICLE,
245 CMD_RENAME_ENGINE,
246 CMD_RENAME_COMPANY,
247 CMD_RENAME_PRESIDENT,
248 CMD_RENAME_STATION,
249 CMD_RENAME_DEPOT,
250
251 CMD_PLACE_SIGN,
252 CMD_RENAME_SIGN,
253
254 CMD_TURN_ROADVEH,
255
256 CMD_PAUSE,
257
258 CMD_BUY_SHARE_IN_COMPANY,
259 CMD_SELL_SHARE_IN_COMPANY,
260 CMD_BUY_COMPANY,
261
262 CMD_FOUND_TOWN,
263 CMD_RENAME_TOWN,
264 CMD_DO_TOWN_ACTION,
265 CMD_TOWN_CARGO_GOAL,
266 CMD_TOWN_GROWTH_RATE,
267 CMD_TOWN_RATING,
268 CMD_TOWN_SET_TEXT,
269 CMD_EXPAND_TOWN,
270 CMD_DELETE_TOWN,
271
272 CMD_ORDER_REFIT,
273 CMD_CLONE_ORDER,
274 CMD_CLEAR_AREA,
275
276 CMD_MONEY_CHEAT,
277 CMD_CHANGE_BANK_BALANCE,
278 CMD_BUILD_CANAL,
279
280 CMD_CREATE_SUBSIDY,
281 CMD_COMPANY_CTRL,
282 CMD_CUSTOM_NEWS_ITEM,
283 CMD_CREATE_GOAL,
284 CMD_REMOVE_GOAL,
285 CMD_SET_GOAL_TEXT,
286 CMD_SET_GOAL_PROGRESS,
287 CMD_SET_GOAL_COMPLETED,
288 CMD_GOAL_QUESTION,
289 CMD_GOAL_QUESTION_ANSWER,
290 CMD_CREATE_STORY_PAGE,
291 CMD_CREATE_STORY_PAGE_ELEMENT,
292 CMD_UPDATE_STORY_PAGE_ELEMENT,
293 CMD_SET_STORY_PAGE_TITLE,
294 CMD_SET_STORY_PAGE_DATE,
295 CMD_SHOW_STORY_PAGE,
296 CMD_REMOVE_STORY_PAGE,
297 CMD_REMOVE_STORY_PAGE_ELEMENT,
298 CMD_SCROLL_VIEWPORT,
299 CMD_STORY_PAGE_BUTTON,
300
301 CMD_LEVEL_LAND,
302
303 CMD_BUILD_LOCK,
304
305 CMD_BUILD_SIGNAL_TRACK,
306 CMD_REMOVE_SIGNAL_TRACK,
307
308 CMD_GIVE_MONEY,
309 CMD_CHANGE_SETTING,
310 CMD_CHANGE_COMPANY_SETTING,
311
312 CMD_SET_AUTOREPLACE,
313
314 CMD_CLONE_VEHICLE,
315 CMD_START_STOP_VEHICLE,
316 CMD_MASS_START_STOP,
317 CMD_AUTOREPLACE_VEHICLE,
318 CMD_DEPOT_SELL_ALL_VEHICLES,
319 CMD_DEPOT_MASS_AUTOREPLACE,
320
321 CMD_CREATE_GROUP,
322 CMD_DELETE_GROUP,
323 CMD_ALTER_GROUP,
324 CMD_ADD_VEHICLE_GROUP,
325 CMD_ADD_SHARED_VEHICLE_GROUP,
326 CMD_REMOVE_ALL_VEHICLES_GROUP,
327 CMD_SET_GROUP_REPLACE_PROTECTION,
328 CMD_SET_GROUP_LIVERY,
329
330 CMD_MOVE_ORDER,
331 CMD_CHANGE_TIMETABLE,
332 CMD_SET_VEHICLE_ON_TIME,
333 CMD_AUTOFILL_TIMETABLE,
334 CMD_SET_TIMETABLE_START,
335
336 CMD_OPEN_CLOSE_AIRPORT,
337
338 CMD_END,
339 };
340
346 enum DoCommandFlag {
347 DC_NONE = 0x000,
348 DC_EXEC = 0x001,
349 DC_AUTO = 0x002,
350 DC_QUERY_COST = 0x004,
351 DC_NO_WATER = 0x008,
352 // 0x010 is unused
353 DC_NO_TEST_TOWN_RATING = 0x020,
354 DC_BANKRUPT = 0x040,
355 DC_AUTOREPLACE = 0x080,
356 DC_NO_CARGO_CAP_CHECK = 0x100,
357 DC_ALL_TILES = 0x200,
358 DC_NO_MODIFY_TOWN_RATING = 0x400,
359 DC_FORCE_CLEAR_TILE = 0x800,
360 };
361 DECLARE_ENUM_AS_BIT_SET(DoCommandFlag)
362
363
372 #define CMD_MSG(x) ((x) << 16)
373
379 enum FlaggedCommands {
380 CMD_NETWORK_COMMAND = 0x0100,
381 CMD_FLAGS_MASK = 0xFF00,
382 CMD_ID_MASK = 0x00FF,
383 };
384
390 enum CommandFlags {
391 CMD_SERVER = 0x001,
392 CMD_SPECTATOR = 0x002,
393 CMD_OFFLINE = 0x004,
394 CMD_AUTO = 0x008,
395 CMD_ALL_TILES = 0x010,
396 CMD_NO_TEST = 0x020,
397 CMD_NO_WATER = 0x040,
398 CMD_CLIENT_ID = 0x080,
399 CMD_DEITY = 0x100,
400 CMD_STR_CTRL = 0x200,
401 CMD_NO_EST = 0x400,
402 };
403 DECLARE_ENUM_AS_BIT_SET(CommandFlags)
404
405
406 enum CommandType {
407 CMDT_LANDSCAPE_CONSTRUCTION,
408 CMDT_VEHICLE_CONSTRUCTION,
409 CMDT_MONEY_MANAGEMENT,
410 CMDT_VEHICLE_MANAGEMENT,
411 CMDT_ROUTE_MANAGEMENT,
412 CMDT_OTHER_MANAGEMENT,
413 CMDT_COMPANY_SETTING,
414 CMDT_SERVER_SETTING,
415 CMDT_CHEAT,
416
417 CMDT_END,
418 };
419
421 enum CommandPauseLevel {
422 CMDPL_NO_ACTIONS,
423 CMDPL_NO_CONSTRUCTION,
424 CMDPL_NO_LANDSCAPING,
425 CMDPL_ALL_ACTIONS,
426 };
427
446 typedef CommandCost CommandProc(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text);
447
454 struct Command {
455 CommandProc *proc;
456 const char *name;
457 CommandFlags flags;
458 CommandType type;
459 };
460
474 typedef void CommandCallback(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd);
475
479 struct CommandContainer {
480 TileIndex tile;
481 uint32 p1;
482 uint32 p2;
483 uint32 cmd;
484 CommandCallback *callback;
485 char text[32 * MAX_CHAR_LENGTH];
486 };
487
488 #endif /* COMMAND_TYPE_H */
TileIndex
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:78
CommandContainer::cmd
uint32 cmd
command being executed.
Definition: command_type.h:483
CMD_AUTOFILL_TIMETABLE
@ CMD_AUTOFILL_TIMETABLE
autofill the timetable
Definition: command_type.h:333
CMD_REFIT_VEHICLE
@ CMD_REFIT_VEHICLE
refit the cargo space of a vehicle
Definition: command_type.h:216
CMD_CLEAR_AREA
@ CMD_CLEAR_AREA
clear an area
Definition: command_type.h:274
INVALID_EXPENSES
@ INVALID_EXPENSES
Invalid expense type.
Definition: economy_type.h:172
CommandCost::MakeError
void MakeError(StringID message)
Makes this CommandCost behave like an error command.
Definition: command_type.h:100
CMD_REVERSE_TRAIN_DIRECTION
@ CMD_REVERSE_TRAIN_DIRECTION
turn a train around
Definition: command_type.h:222
CMD_SKIP_TO_ORDER
@ CMD_SKIP_TO_ORDER
skip an order to the next of specific one
Definition: command_type.h:226
CMDPL_NO_ACTIONS
@ CMDPL_NO_ACTIONS
No user actions may be executed.
Definition: command_type.h:422
CMD_ORDER_REFIT
@ CMD_ORDER_REFIT
change the refit information of an order (for "goto depot" )
Definition: command_type.h:272
CMD_ADD_VEHICLE_GROUP
@ CMD_ADD_VEHICLE_GROUP
add a vehicle to a group
Definition: command_type.h:324
CMD_MOVE_RAIL_VEHICLE
@ CMD_MOVE_RAIL_VEHICLE
move a rail vehicle (in the depot)
Definition: command_type.h:220
CMD_DO_TOWN_ACTION
@ CMD_DO_TOWN_ACTION
do a action from the town detail window (like advertises or bribe)
Definition: command_type.h:264
CMD_SET_AUTOREPLACE
@ CMD_SET_AUTOREPLACE
set an autoreplace entry
Definition: command_type.h:312
CMD_SCROLL_VIEWPORT
@ CMD_SCROLL_VIEWPORT
scroll main viewport of players
Definition: command_type.h:298
CMD_REMOVE_STORY_PAGE_ELEMENT
@ CMD_REMOVE_STORY_PAGE_ELEMENT
remove a story page element
Definition: command_type.h:297
CMD_DECREASE_LOAN
@ CMD_DECREASE_LOAN
decrease the loan from the bank
Definition: command_type.h:239
CommandCost::MultiplyCost
void MultiplyCost(int factor)
Multiplies the cost of the command by the given factor.
Definition: command_type.h:73
CMD_REMOVE_ALL_VEHICLES_GROUP
@ CMD_REMOVE_ALL_VEHICLES_GROUP
remove all vehicles from a group
Definition: command_type.h:326
CMD_BUILD_INDUSTRY
@ CMD_BUILD_INDUSTRY
build a new industry
Definition: command_type.h:232
CMD_OFFLINE
@ CMD_OFFLINE
the command cannot be executed in a multiplayer game; single-player only
Definition: command_type.h:393
CMDT_VEHICLE_CONSTRUCTION
@ CMDT_VEHICLE_CONSTRUCTION
Construction, modification (incl. refit) and destruction of vehicles.
Definition: command_type.h:408
CMD_REMOVE_SIGNALS
@ CMD_REMOVE_SIGNALS
remove a signal
Definition: command_type.h:185
CMD_TOWN_GROWTH_RATE
@ CMD_TOWN_GROWTH_RATE
set the town growth rate
Definition: command_type.h:266
CMD_CUSTOM_NEWS_ITEM
@ CMD_CUSTOM_NEWS_ITEM
create a custom news message
Definition: command_type.h:282
CMD_SET_GOAL_TEXT
@ CMD_SET_GOAL_TEXT
update goal text of a goal
Definition: command_type.h:285
CMD_REMOVE_RAILROAD_TRACK
@ CMD_REMOVE_RAILROAD_TRACK
remove a rail track
Definition: command_type.h:177
CommandType
CommandType
Types of commands we have.
Definition: command_type.h:406
CMD_SEND_VEHICLE_TO_DEPOT
@ CMD_SEND_VEHICLE_TO_DEPOT
send a vehicle to a depot
Definition: command_type.h:217
CMD_BUILD_SINGLE_RAIL
@ CMD_BUILD_SINGLE_RAIL
build a single rail track
Definition: command_type.h:178
CMD_SET_VEHICLE_VISIBILITY
@ CMD_SET_VEHICLE_VISIBILITY
hide or unhide a vehicle in the build vehicle and autoreplace GUIs
Definition: command_type.h:218
CMD_MOVE_ORDER
@ CMD_MOVE_ORDER
move an order
Definition: command_type.h:330
CMD_RENAME_ENGINE
@ CMD_RENAME_ENGINE
rename a engine (in the engine list)
Definition: command_type.h:245
CommandCallback
void CommandCallback(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd)
Define a callback function for the client, after the command is finished.
Definition: command_type.h:474
CMD_NO_EST
@ CMD_NO_EST
the command is never estimated.
Definition: command_type.h:401
CommandContainer::p2
uint32 p2
parameter p2.
Definition: command_type.h:482
CMD_BUILD_BRIDGE
@ CMD_BUILD_BRIDGE
build a bridge
Definition: command_type.h:181
CommandContainer
Structure for buffering the build command when selecting a station to join.
Definition: command_type.h:479
CommandContainer::text
char text[32 *MAX_CHAR_LENGTH]
possible text sent for name changes etc, in bytes including '\0'.
Definition: command_type.h:485
CMD_RENAME_TOWN
@ CMD_RENAME_TOWN
rename a town
Definition: command_type.h:263
CMD_BUILD_SIGNALS
@ CMD_BUILD_SIGNALS
build a signal
Definition: command_type.h:184
Command::flags
CommandFlags flags
The (command) flags to that apply to this command.
Definition: command_type.h:457
DC_NO_WATER
@ DC_NO_WATER
don't allow building on water
Definition: command_type.h:351
CMD_SET_COMPANY_COLOUR
@ CMD_SET_COMPANY_COLOUR
set the colour of the company
Definition: command_type.h:236
DC_ALL_TILES
@ DC_ALL_TILES
allow this command also on MP_VOID tiles
Definition: command_type.h:357
CMD_REMOVE_FROM_RAIL_WAYPOINT
@ CMD_REMOVE_FROM_RAIL_WAYPOINT
remove a (rectangle of) tiles from a rail waypoint
Definition: command_type.h:195
CMD_INSERT_ORDER
@ CMD_INSERT_ORDER
insert a new order
Definition: command_type.h:228
CMDT_CHEAT
@ CMDT_CHEAT
A cheat of some sorts.
Definition: command_type.h:415
CMDT_COMPANY_SETTING
@ CMDT_COMPANY_SETTING
Changing settings related to a company.
Definition: command_type.h:413
strings_type.h
CommandCost::GetTextRefStack
const uint32 * GetTextRefStack() const
Returns a pointer to the values for the TextRefStack of the error message.
Definition: command_type.h:131
CMD_TURN_ROADVEH
@ CMD_TURN_ROADVEH
turn a road vehicle around
Definition: command_type.h:254
CMD_CLEAR_ORDER_BACKUP
@ CMD_CLEAR_ORDER_BACKUP
clear the order backup of a given user/tile
Definition: command_type.h:224
DC_EXEC
@ DC_EXEC
execute the given command
Definition: command_type.h:348
CommandCost::GetErrorMessage
StringID GetErrorMessage() const
Returns the error message of a command.
Definition: command_type.h:140
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::textref_stack
static uint32 textref_stack[16]
Values to put on the TextRefStack for the error message.
Definition: command_type.h:31
CMD_ENGINE_CTRL
@ CMD_ENGINE_CTRL
control availability of the engine for companies
Definition: command_type.h:242
DoCommandFlag
DoCommandFlag
List of flags for a command.
Definition: command_type.h:346
CMD_REMOVE_SIGNAL_TRACK
@ CMD_REMOVE_SIGNAL_TRACK
remove signals along a track (by dragging)
Definition: command_type.h:306
CMD_BUILD_RAILROAD_TRACK
@ CMD_BUILD_RAILROAD_TRACK
build a rail track
Definition: command_type.h:176
CMD_BUILD_TUNNEL
@ CMD_BUILD_TUNNEL
build a tunnel
Definition: command_type.h:188
CMD_BUILD_SHIP_DEPOT
@ CMD_BUILD_SHIP_DEPOT
build a ship depot
Definition: command_type.h:209
CMD_TOWN_CARGO_GOAL
@ CMD_TOWN_CARGO_GOAL
set the goal of a cargo for a town
Definition: command_type.h:265
CommandCost::Succeeded
bool Succeeded() const
Did this command succeed?
Definition: command_type.h:150
CMD_SELL_VEHICLE
@ CMD_SELL_VEHICLE
sell a vehicle
Definition: command_type.h:215
CMD_DEITY
@ CMD_DEITY
the command may be executed by COMPANY_DEITY
Definition: command_type.h:399
MAX_CHAR_LENGTH
static const int MAX_CHAR_LENGTH
Max. length of UTF-8 encoded unicode character.
Definition: strings_type.h:18
CMDT_END
@ CMDT_END
Magic end marker.
Definition: command_type.h:417
CMD_BUILD_DOCK
@ CMD_BUILD_DOCK
build a dock
Definition: command_type.h:207
CMD_OPEN_CLOSE_AIRPORT
@ CMD_OPEN_CLOSE_AIRPORT
open/close an airport to incoming aircraft
Definition: command_type.h:336
CommandCost::expense_type
ExpensesType expense_type
the type of expence as shown on the finances view
Definition: command_type.h:24
CMD_DEPOT_MASS_AUTOREPLACE
@ CMD_DEPOT_MASS_AUTOREPLACE
force the autoreplace to take action in a given depot
Definition: command_type.h:319
CommandFlags
CommandFlags
Command flags for the command table _command_proc_table.
Definition: command_type.h:390
CMD_SET_GROUP_LIVERY
@ CMD_SET_GROUP_LIVERY
set the livery for a group
Definition: command_type.h:328
CommandContainer::p1
uint32 p1
parameter p1.
Definition: command_type.h:481
CMD_SET_GOAL_COMPLETED
@ CMD_SET_GOAL_COMPLETED
update goal completed status of a goal
Definition: command_type.h:287
CMD_WANT_ENGINE_PREVIEW
@ CMD_WANT_ENGINE_PREVIEW
confirm the preview of an engine
Definition: command_type.h:241
CommandCost::UseTextRefStack
void UseTextRefStack(const GRFFile *grffile, uint num_registers)
Activate usage of the NewGRF TextRefStack for the error message.
Definition: command.cpp:802
CommandCost
Common return value for all commands.
Definition: command_type.h:23
CommandCost::textref_stack_size
uint textref_stack_size
Number of uint32 values to put on the TextRefStack for the error message.
Definition: command_type.h:29
CMDT_OTHER_MANAGEMENT
@ CMDT_OTHER_MANAGEMENT
Renaming stuff, changing company colours, placing signs, etc.
Definition: command_type.h:412
CMD_TERRAFORM_LAND
@ CMD_TERRAFORM_LAND
terraform a tile
Definition: command_type.h:186
CMD_BUILD_ROAD
@ CMD_BUILD_ROAD
build a "half" road
Definition: command_type.h:201
CMD_GOAL_QUESTION
@ CMD_GOAL_QUESTION
ask a goal related question
Definition: command_type.h:288
CommandCost::GetExpensesType
ExpensesType GetExpensesType() const
The expense type of the cost.
Definition: command_type.h:91
CMD_PAUSE
@ CMD_PAUSE
pause the game
Definition: command_type.h:256
CMD_SET_GOAL_PROGRESS
@ CMD_SET_GOAL_PROGRESS
update goal progress text of a goal
Definition: command_type.h:286
CMD_AUTO
@ CMD_AUTO
set the DC_AUTO flag on this command
Definition: command_type.h:394
Command
Define a command with the flags which belongs to it.
Definition: command_type.h:454
CMD_CHANGE_TIMETABLE
@ CMD_CHANGE_TIMETABLE
change the timetable for a vehicle
Definition: command_type.h:331
CMD_REMOVE_LONG_ROAD
@ CMD_REMOVE_LONG_ROAD
remove a complete road (not a "half" one)
Definition: command_type.h:200
CommandCost::GetTextRefStackSize
uint GetTextRefStackSize() const
Returns the number of uint32 values for the TextRefStack of the error message.
Definition: command_type.h:122
CMD_BUILD_ROAD_STOP
@ CMD_BUILD_ROAD_STOP
build a road stop
Definition: command_type.h:197
CMD_CHANGE_BANK_BALANCE
@ CMD_CHANGE_BANK_BALANCE
change bank balance to charge costs or give money from a GS
Definition: command_type.h:277
CMD_CHANGE_SERVICE_INT
@ CMD_CHANGE_SERVICE_INT
change the server interval of a vehicle
Definition: command_type.h:230
CMD_RENAME_STATION
@ CMD_RENAME_STATION
rename a station
Definition: command_type.h:248
CMD_BUILD_ROAD_DEPOT
@ CMD_BUILD_ROAD_DEPOT
build a road depot
Definition: command_type.h:202
CMD_BUILD_RAIL_WAYPOINT
@ CMD_BUILD_RAIL_WAYPOINT
build a waypoint
Definition: command_type.h:193
CMD_RENAME_WAYPOINT
@ CMD_RENAME_WAYPOINT
rename a waypoint
Definition: command_type.h:194
Command::type
CommandType type
The type of command.
Definition: command_type.h:458
CommandCost::Failed
bool Failed() const
Did this command fail?
Definition: command_type.h:159
CMDPL_NO_LANDSCAPING
@ CMDPL_NO_LANDSCAPING
No landscaping actions may be executed.
Definition: command_type.h:424
CommandCost::GetTextRefStackGRF
const GRFFile * GetTextRefStackGRF() const
Returns the NewGRF providing the TextRefStack of the error message.
Definition: command_type.h:113
CMD_UPDATE_STORY_PAGE_ELEMENT
@ CMD_UPDATE_STORY_PAGE_ELEMENT
update a story page element
Definition: command_type.h:292
CMDT_ROUTE_MANAGEMENT
@ CMDT_ROUTE_MANAGEMENT
Modifications to route management (orders, groups, etc).
Definition: command_type.h:411
CMD_SELL_SHARE_IN_COMPANY
@ CMD_SELL_SHARE_IN_COMPANY
sell a share from a company
Definition: command_type.h:259
CommandCost::CommandCost
CommandCost(StringID msg)
Creates a command return value the is failed with the given message.
Definition: command_type.h:42
DC_AUTOREPLACE
@ DC_AUTOREPLACE
autoreplace/autorenew is in progress, this shall disable vehicle limits when building,...
Definition: command_type.h:355
CMD_BUILD_LONG_ROAD
@ CMD_BUILD_LONG_ROAD
build a complete road (not a "half" one)
Definition: command_type.h:199
CMD_CREATE_STORY_PAGE
@ CMD_CREATE_STORY_PAGE
create a new story page
Definition: command_type.h:290
CMD_GOAL_QUESTION_ANSWER
@ CMD_GOAL_QUESTION_ANSWER
answer(s) to CMD_GOAL_QUESTION
Definition: command_type.h:289
CMD_BUILD_CANAL
@ CMD_BUILD_CANAL
build a canal
Definition: command_type.h:278
CMD_CLIENT_ID
@ CMD_CLIENT_ID
set p2 with the ClientID of the sending client.
Definition: command_type.h:398
CMD_ALTER_GROUP
@ CMD_ALTER_GROUP
alter a group
Definition: command_type.h:323
CommandCost::GetCost
Money GetCost() const
The costs as made up to this moment.
Definition: command_type.h:82
CMD_INDUSTRY_CTRL
@ CMD_INDUSTRY_CTRL
change industry properties
Definition: command_type.h:233
CMD_REMOVE_SINGLE_RAIL
@ CMD_REMOVE_SINGLE_RAIL
remove a single rail track
Definition: command_type.h:179
CMD_SET_GROUP_REPLACE_PROTECTION
@ CMD_SET_GROUP_REPLACE_PROTECTION
set the autoreplace-protection for a group
Definition: command_type.h:327
DC_NO_TEST_TOWN_RATING
@ DC_NO_TEST_TOWN_RATING
town rating does not disallow you from building
Definition: command_type.h:353
CommandProc
CommandCost CommandProc(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Defines the callback type for all command handler functions.
Definition: command_type.h:446
CMD_STORY_PAGE_BUTTON
@ CMD_STORY_PAGE_BUTTON
selection via story page button
Definition: command_type.h:299
CMD_FLAGS_MASK
@ CMD_FLAGS_MASK
mask for all command flags
Definition: command_type.h:381
CommandCost::AddCost
void AddCost(const Money &cost)
Adds the given cost to the cost of the command.
Definition: command_type.h:62
CMD_BUILD_TRAIN_DEPOT
@ CMD_BUILD_TRAIN_DEPOT
build a train depot
Definition: command_type.h:183
CMD_DELETE_GROUP
@ CMD_DELETE_GROUP
delete a group
Definition: command_type.h:322
CMD_REMOVE_FROM_RAIL_STATION
@ CMD_REMOVE_FROM_RAIL_STATION
remove a (rectangle of) tiles from a rail station
Definition: command_type.h:190
CMD_TOWN_SET_TEXT
@ CMD_TOWN_SET_TEXT
set the custom text of a town
Definition: command_type.h:268
DC_BANKRUPT
@ DC_BANKRUPT
company bankrupts, skip money check, skip vehicle on tile check in some cases
Definition: command_type.h:354
CMD_CONVERT_ROAD
@ CMD_CONVERT_ROAD
convert a road type
Definition: command_type.h:203
CMD_LEVEL_LAND
@ CMD_LEVEL_LAND
level land
Definition: command_type.h:301
CMD_CREATE_STORY_PAGE_ELEMENT
@ CMD_CREATE_STORY_PAGE_ELEMENT
create a new story page element
Definition: command_type.h:291
CommandContainer::callback
CommandCallback * callback
any callback function executed upon successful completion of the command.
Definition: command_type.h:484
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:325
CMD_START_STOP_VEHICLE
@ CMD_START_STOP_VEHICLE
start or stop a vehicle
Definition: command_type.h:315
CommandCost::textref_stack_grffile
const GRFFile * textref_stack_grffile
NewGRF providing the TextRefStack content.
Definition: command_type.h:28
FlaggedCommands
FlaggedCommands
Defines some flags.
Definition: command_type.h:379
CMD_REMOVE_STORY_PAGE
@ CMD_REMOVE_STORY_PAGE
remove a story page
Definition: command_type.h:296
CommandPauseLevel
CommandPauseLevel
Different command pause levels.
Definition: command_type.h:421
StringID
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
CMD_CREATE_GROUP
@ CMD_CREATE_GROUP
create a new group
Definition: command_type.h:321
CMDT_VEHICLE_MANAGEMENT
@ CMDT_VEHICLE_MANAGEMENT
Stopping, starting, sending to depot, turning around, replace orders etc.
Definition: command_type.h:410
CMD_FORCE_TRAIN_PROCEED
@ CMD_FORCE_TRAIN_PROCEED
proceed a train to pass a red signal
Definition: command_type.h:221
CMD_CLONE_VEHICLE
@ CMD_CLONE_VEHICLE
clone a vehicle
Definition: command_type.h:314
CMD_NO_WATER
@ CMD_NO_WATER
set the DC_NO_WATER flag on this command
Definition: command_type.h:397
DC_FORCE_CLEAR_TILE
@ DC_FORCE_CLEAR_TILE
do not only remove the object on the tile, but also clear any water left on it
Definition: command_type.h:359
CMD_NETWORK_COMMAND
@ CMD_NETWORK_COMMAND
execute the command without sending it on the network
Definition: command_type.h:380
CommandCost::message
StringID message
Warning message for when success is unset.
Definition: command_type.h:26
CMD_MASS_START_STOP
@ CMD_MASS_START_STOP
start/stop all vehicles (in a depot)
Definition: command_type.h:316
CMD_EXPAND_TOWN
@ CMD_EXPAND_TOWN
expand a town
Definition: command_type.h:269
CMD_ALL_TILES
@ CMD_ALL_TILES
allow this command also on MP_VOID tiles
Definition: command_type.h:395
CMD_ID_MASK
@ CMD_ID_MASK
mask for the command ID
Definition: command_type.h:382
CMD_INCREASE_LOAN
@ CMD_INCREASE_LOAN
increase the loan from the bank
Definition: command_type.h:238
CMD_RENAME_COMPANY
@ CMD_RENAME_COMPANY
change the company name
Definition: command_type.h:246
tile_type.h
CMD_REMOVE_GOAL
@ CMD_REMOVE_GOAL
remove a goal
Definition: command_type.h:284
CMD_BUILD_LOCK
@ CMD_BUILD_LOCK
build a lock
Definition: command_type.h:303
DC_NO_CARGO_CAP_CHECK
@ DC_NO_CARGO_CAP_CHECK
when autoreplace/autorenew is in progress, this shall prevent truncating the amount of cargo in the v...
Definition: command_type.h:356
CMD_BUILD_AIRPORT
@ CMD_BUILD_AIRPORT
build an airport
Definition: command_type.h:205
CMD_AUTOREPLACE_VEHICLE
@ CMD_AUTOREPLACE_VEHICLE
replace/renew a vehicle while it is in a depot
Definition: command_type.h:317
CMD_REMOVE_ROAD_STOP
@ CMD_REMOVE_ROAD_STOP
remove a road stop
Definition: command_type.h:198
CMD_MODIFY_ORDER
@ CMD_MODIFY_ORDER
modify an order (like set full-load)
Definition: command_type.h:225
CMD_DELETE_ORDER
@ CMD_DELETE_ORDER
delete an order
Definition: command_type.h:227
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
CMD_BUY_SHARE_IN_COMPANY
@ CMD_BUY_SHARE_IN_COMPANY
buy a share from a company
Definition: command_type.h:258
CMDT_SERVER_SETTING
@ CMDT_SERVER_SETTING
Pausing/removing companies/server settings.
Definition: command_type.h:414
CMD_BUILD_OBJECT
@ CMD_BUILD_OBJECT
build an object
Definition: command_type.h:187
CommandCost::CommandCost
CommandCost()
Creates a command cost return with no cost and no error.
Definition: command_type.h:37
DC_AUTO
@ DC_AUTO
don't allow building on structures
Definition: command_type.h:349
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:396
DC_NO_MODIFY_TOWN_RATING
@ DC_NO_MODIFY_TOWN_RATING
do not change town rating
Definition: command_type.h:358
CMD_SET_TIMETABLE_START
@ CMD_SET_TIMETABLE_START
set the date that a timetable should start
Definition: command_type.h:334
CMD_SHOW_STORY_PAGE
@ CMD_SHOW_STORY_PAGE
show a story page
Definition: command_type.h:295
CMD_RENAME_DEPOT
@ CMD_RENAME_DEPOT
rename a depot
Definition: command_type.h:249
CMD_COMPANY_CTRL
@ CMD_COMPANY_CTRL
used in multiplayer to create a new companies etc.
Definition: command_type.h:281
DECLARE_ENUM_AS_BIT_SET
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
Definition: company_manager_face.h:29
CMD_CREATE_GOAL
@ CMD_CREATE_GOAL
create a new goal
Definition: command_type.h:283
CommandCost::cost
Money cost
The cost of this action.
Definition: command_type.h:25
CMD_CONVERT_RAIL
@ CMD_CONVERT_RAIL
convert a rail type
Definition: command_type.h:191
CMD_FOUND_TOWN
@ CMD_FOUND_TOWN
found a town
Definition: command_type.h:262
CMD_CHANGE_SETTING
@ CMD_CHANGE_SETTING
change a setting
Definition: command_type.h:309
CMDPL_ALL_ACTIONS
@ CMDPL_ALL_ACTIONS
All actions may be executed.
Definition: command_type.h:425
OverflowSafeInt< int64, INT64_MAX, INT64_MIN >
CMD_SET_VEHICLE_ON_TIME
@ CMD_SET_VEHICLE_ON_TIME
set the vehicle on time feature (timetable)
Definition: command_type.h:332
Command::name
const char * name
A human readable name for the procedure.
Definition: command_type.h:456
CMD_MONEY_CHEAT
@ CMD_MONEY_CHEAT
do the money cheat
Definition: command_type.h:276
CMD_PLANT_TREE
@ CMD_PLANT_TREE
plant a tree
Definition: command_type.h:212
CMD_SET_STORY_PAGE_TITLE
@ CMD_SET_STORY_PAGE_TITLE
update title of a story page
Definition: command_type.h:293
CMD_BUILD_VEHICLE
@ CMD_BUILD_VEHICLE
build a vehicle
Definition: command_type.h:214
DC_NONE
@ DC_NONE
no flag is set
Definition: command_type.h:347
CMD_END
@ CMD_END
Must ALWAYS be on the end of this list!! (period)
Definition: command_type.h:338
CMD_SERVER
@ CMD_SERVER
the command can only be initiated by the server
Definition: command_type.h:391
CMD_SPECTATOR
@ CMD_SPECTATOR
the command may be initiated by a spectator
Definition: command_type.h:392
DC_QUERY_COST
@ DC_QUERY_COST
query cost only, don't build.
Definition: command_type.h:350
CommandContainer::tile
TileIndex tile
tile command being executed on.
Definition: command_type.h:480
CMD_STR_CTRL
@ CMD_STR_CTRL
the command's string may contain control strings
Definition: command_type.h:400
CMD_SET_COMPANY_MANAGER_FACE
@ CMD_SET_COMPANY_MANAGER_FACE
set the manager's face of the company
Definition: command_type.h:235
ExpensesType
ExpensesType
Types of expenses.
Definition: economy_type.h:157
economy_type.h
CMD_DELETE_TOWN
@ CMD_DELETE_TOWN
delete a town
Definition: command_type.h:270
CMD_RENAME_SIGN
@ CMD_RENAME_SIGN
rename a sign
Definition: command_type.h:252
CMD_RENAME_PRESIDENT
@ CMD_RENAME_PRESIDENT
change the president name
Definition: command_type.h:247
CMDPL_NO_CONSTRUCTION
@ CMDPL_NO_CONSTRUCTION
No construction actions may be executed.
Definition: command_type.h:423
CMD_RENAME_VEHICLE
@ CMD_RENAME_VEHICLE
rename a whole vehicle
Definition: command_type.h:244
CMD_CHANGE_COMPANY_SETTING
@ CMD_CHANGE_COMPANY_SETTING
change a company setting
Definition: command_type.h:310
CMDT_MONEY_MANAGEMENT
@ CMDT_MONEY_MANAGEMENT
Management of money, i.e. loans and shares.
Definition: command_type.h:409
CMD_BUILD_RAIL_STATION
@ CMD_BUILD_RAIL_STATION
build a rail station
Definition: command_type.h:182
CMD_PLACE_SIGN
@ CMD_PLACE_SIGN
place a sign
Definition: command_type.h:251
CMD_GIVE_MONEY
@ CMD_GIVE_MONEY
give money to another company
Definition: command_type.h:308
CMD_BUY_COMPANY
@ CMD_BUY_COMPANY
buy a company which is bankrupt
Definition: command_type.h:260
CMD_BUILD_SIGNAL_TRACK
@ CMD_BUILD_SIGNAL_TRACK
add signals along a track (by dragging)
Definition: command_type.h:305
CMDT_LANDSCAPE_CONSTRUCTION
@ CMDT_LANDSCAPE_CONSTRUCTION
Construction and destruction of objects on the map.
Definition: command_type.h:407
CMD_DEPOT_SELL_ALL_VEHICLES
@ CMD_DEPOT_SELL_ALL_VEHICLES
sell all vehicles which are in a given depot
Definition: command_type.h:318
CMD_LANDSCAPE_CLEAR
@ CMD_LANDSCAPE_CLEAR
demolish a tile
Definition: command_type.h:180
CMD_SET_STORY_PAGE_DATE
@ CMD_SET_STORY_PAGE_DATE
update date of a story page
Definition: command_type.h:294
CMD_BUILD_BUOY
@ CMD_BUILD_BUOY
build a buoy
Definition: command_type.h:210
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:17
GRFFile
Dynamic data of a loaded NewGRF.
Definition: newgrf.h:105
Command::proc
CommandProc * proc
The procedure to actually executing.
Definition: command_type.h:455
CMD_CREATE_SUBSIDY
@ CMD_CREATE_SUBSIDY
create a new subsidy
Definition: command_type.h:280
CommandCost::success
bool success
Whether the comment went fine up to this moment.
Definition: command_type.h:27
CMD_CLONE_ORDER
@ CMD_CLONE_ORDER
clone (and share) an order
Definition: command_type.h:273
CMD_TOWN_RATING
@ CMD_TOWN_RATING
set rating of a company in a town
Definition: command_type.h:267
Commands
Commands
List of commands.
Definition: command_type.h:175