annotate src/command_type.h @ 11436:caf4456fbbf3 draft

(svn r15794) -Codechange: remove the DoDrawString part of the old text drawing API
author rubidium <rubidium@openttd.org>
date Sat, 21 Mar 2009 22:46:17 +0000
parents ada4c4d48050
children 6258c029db2d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
1 /* $Id$ */
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
2
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
3 /** @file command_type.h Types related to commands. */
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
4
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
5 #ifndef COMMAND_TYPE_H
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
6 #define COMMAND_TYPE_H
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
7
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
8 #include "economy_type.h"
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
9 #include "strings_type.h"
8123
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents: 8116
diff changeset
10 #include "tile_type.h"
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
11
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
12 /**
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
13 * Common return value for all commands. Wraps the cost and
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
14 * a possible error message/state together.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
15 */
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
16 class CommandCost {
8230
5b61305fcdd4 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium <rubidium@openttd.org>
parents: 8123
diff changeset
17 ExpensesType expense_type; ///< the type of expence as shown on the finances view
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
18 Money cost; ///< The cost of this action
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
19 StringID message; ///< Warning message for when success is unset
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
20 bool success; ///< Whether the comment went fine up to this moment
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
21
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
22 public:
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
23 /**
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
24 * Creates a command cost return with no cost and no error
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
25 */
8230
5b61305fcdd4 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium <rubidium@openttd.org>
parents: 8123
diff changeset
26 CommandCost() : expense_type(INVALID_EXPENSES), cost(0), message(INVALID_STRING_ID), success(true) {}
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
27
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
28 /**
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
29 * Creates a command return value the is failed with the given message
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
30 */
8230
5b61305fcdd4 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium <rubidium@openttd.org>
parents: 8123
diff changeset
31 CommandCost(StringID msg) : expense_type(INVALID_EXPENSES), cost(0), message(msg), success(false) {}
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
32
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
33 /**
8230
5b61305fcdd4 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium <rubidium@openttd.org>
parents: 8123
diff changeset
34 * Creates a command cost with given expense type and start cost of 0
5b61305fcdd4 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium <rubidium@openttd.org>
parents: 8123
diff changeset
35 * @param ex_t the expense type
5b61305fcdd4 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium <rubidium@openttd.org>
parents: 8123
diff changeset
36 */
5b61305fcdd4 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium <rubidium@openttd.org>
parents: 8123
diff changeset
37 CommandCost(ExpensesType ex_t) : expense_type(ex_t), cost(0), message(INVALID_STRING_ID), success(true) {}
5b61305fcdd4 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium <rubidium@openttd.org>
parents: 8123
diff changeset
38
5b61305fcdd4 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium <rubidium@openttd.org>
parents: 8123
diff changeset
39 /**
5b61305fcdd4 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium <rubidium@openttd.org>
parents: 8123
diff changeset
40 * Creates a command return value with the given start cost and expense type
5b61305fcdd4 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium <rubidium@openttd.org>
parents: 8123
diff changeset
41 * @param ex_t the expense type
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
42 * @param cst the initial cost of this command
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
43 */
8230
5b61305fcdd4 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium <rubidium@openttd.org>
parents: 8123
diff changeset
44 CommandCost(ExpensesType ex_t, Money cst) : expense_type(ex_t), cost(cst), message(INVALID_STRING_ID), success(true) {}
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
45
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
46 /**
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
47 * Adds the cost of the given command return value to this cost.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
48 * Also takes a possible error message when it is set.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
49 * @param ret the command to add the cost of.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
50 * @return this class.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
51 */
8854
855ce528445f (svn r12616) -Codechange: r12591 didn't work as expected for NDS, move one function back to cpp
smatz <smatz@openttd.org>
parents: 8841
diff changeset
52 CommandCost AddCost(CommandCost ret);
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
53
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
54 /**
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
55 * Adds the given cost to the cost of the command.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
56 * @param cost the cost to add
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
57 * @return this class.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
58 */
8841
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
59 CommandCost AddCost(Money cost)
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
60 {
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
61 this->cost += cost;
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
62 return *this;
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
63 }
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
64
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
65 /**
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
66 * Multiplies the cost of the command by the given factor.
10238
12805d675e85 (svn r14466) -Doc: remove some obsolete parameters, fix a few parameter names in comments and add a little more doxygen documentation.
rubidium <rubidium@openttd.org>
parents: 10207
diff changeset
67 * @param factor factor to multiply the costs with
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
68 * @return this class
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
69 */
8841
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
70 CommandCost MultiplyCost(int factor)
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
71 {
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
72 this->cost *= factor;
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
73 return *this;
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
74 }
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
75
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
76 /**
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
77 * The costs as made up to this moment
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
78 * @return the costs
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
79 */
8841
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
80 Money GetCost() const
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
81 {
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
82 return this->cost;
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
83 }
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
84
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
85 /**
8230
5b61305fcdd4 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium <rubidium@openttd.org>
parents: 8123
diff changeset
86 * The expense type of the cost
5b61305fcdd4 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium <rubidium@openttd.org>
parents: 8123
diff changeset
87 * @return the expense type
5b61305fcdd4 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium <rubidium@openttd.org>
parents: 8123
diff changeset
88 */
8841
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
89 ExpensesType GetExpensesType() const
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
90 {
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
91 return this->expense_type;
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
92 }
8230
5b61305fcdd4 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium <rubidium@openttd.org>
parents: 8123
diff changeset
93
5b61305fcdd4 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium <rubidium@openttd.org>
parents: 8123
diff changeset
94 /**
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
95 * Sets the global error message *if* this class has one.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
96 */
8841
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
97 void SetGlobalErrorMessage() const
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
98 {
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
99 extern StringID _error_message;
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
100 if (this->message != INVALID_STRING_ID) _error_message = this->message;
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
101 }
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
102
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
103 /**
9928
0cc9c6c36c43 (svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch <frosch@openttd.org>
parents: 9921
diff changeset
104 * Returns the error message of a command
0cc9c6c36c43 (svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch <frosch@openttd.org>
parents: 9921
diff changeset
105 * @return the error message, if succeeded INVALID_STRING_ID
0cc9c6c36c43 (svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch <frosch@openttd.org>
parents: 9921
diff changeset
106 */
0cc9c6c36c43 (svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch <frosch@openttd.org>
parents: 9921
diff changeset
107 StringID GetErrorMessage() const
0cc9c6c36c43 (svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch <frosch@openttd.org>
parents: 9921
diff changeset
108 {
0cc9c6c36c43 (svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch <frosch@openttd.org>
parents: 9921
diff changeset
109 extern StringID _error_message;
0cc9c6c36c43 (svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch <frosch@openttd.org>
parents: 9921
diff changeset
110
0cc9c6c36c43 (svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch <frosch@openttd.org>
parents: 9921
diff changeset
111 if (this->success) return INVALID_STRING_ID;
0cc9c6c36c43 (svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch <frosch@openttd.org>
parents: 9921
diff changeset
112 if (this->message != INVALID_STRING_ID) return this->message;
0cc9c6c36c43 (svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch <frosch@openttd.org>
parents: 9921
diff changeset
113 return _error_message;
0cc9c6c36c43 (svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch <frosch@openttd.org>
parents: 9921
diff changeset
114 }
0cc9c6c36c43 (svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch <frosch@openttd.org>
parents: 9921
diff changeset
115
0cc9c6c36c43 (svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch <frosch@openttd.org>
parents: 9921
diff changeset
116 /**
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
117 * Did this command succeed?
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
118 * @return true if and only if it succeeded
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
119 */
8841
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
120 bool Succeeded() const
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
121 {
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
122 return this->success;
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
123 }
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
124
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
125 /**
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
126 * Did this command fail?
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
127 * @return true if and only if it failed
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
128 */
8841
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
129 bool Failed() const
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
130 {
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
131 return !this->success;
9be57bb87608 (svn r12591) -Codechange: move CommandCost accessors to header file, 8kB of binary size saved
smatz <smatz@openttd.org>
parents: 8519
diff changeset
132 }
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
133 };
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
134
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
135 /**
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
136 * List of commands.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
137 *
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
138 * This enum defines all possible commands which can be executed to the game
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
139 * engine. Observing the game like the query-tool or checking the profit of a
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
140 * vehicle don't result in a command which should be executed in the engine
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
141 * nor send to the server in a network game.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
142 *
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
143 * @see _command_proc_table
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
144 */
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
145 enum {
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
146 CMD_BUILD_RAILROAD_TRACK, ///< build a rail track
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
147 CMD_REMOVE_RAILROAD_TRACK, ///< remove a rail track
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
148 CMD_BUILD_SINGLE_RAIL, ///< build a single rail track
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
149 CMD_REMOVE_SINGLE_RAIL, ///< remove a single rail track
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
150 CMD_LANDSCAPE_CLEAR, ///< demolish a tile
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
151 CMD_BUILD_BRIDGE, ///< build a bridge
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
152 CMD_BUILD_RAILROAD_STATION, ///< build a railroad station
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
153 CMD_BUILD_TRAIN_DEPOT, ///< build a train depot
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
154 CMD_BUILD_SIGNALS, ///< build a signal
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
155 CMD_REMOVE_SIGNALS, ///< remove a signal
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
156 CMD_TERRAFORM_LAND, ///< terraform a tile
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
157 CMD_PURCHASE_LAND_AREA, ///< purchase a tile
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
158 CMD_SELL_LAND_AREA, ///< sell a bought tile before
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
159 CMD_BUILD_TUNNEL, ///< build a tunnel
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
160
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
161 CMD_REMOVE_FROM_RAILROAD_STATION, ///< remove a tile station
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
162 CMD_CONVERT_RAIL, ///< convert a rail type
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
163
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
164 CMD_BUILD_TRAIN_WAYPOINT, ///< build a waypoint
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
165 CMD_RENAME_WAYPOINT, ///< rename a waypoint
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
166 CMD_REMOVE_TRAIN_WAYPOINT, ///< remove a waypoint
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
167
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
168 CMD_BUILD_ROAD_STOP, ///< build a road stop
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
169 CMD_REMOVE_ROAD_STOP, ///< remove a road stop
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
170 CMD_BUILD_LONG_ROAD, ///< build a complete road (not a "half" one)
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
171 CMD_REMOVE_LONG_ROAD, ///< remove a complete road (not a "half" one)
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
172 CMD_BUILD_ROAD, ///< build a "half" road
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
173 CMD_REMOVE_ROAD, ///< remove a "half" road
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
174 CMD_BUILD_ROAD_DEPOT, ///< build a road depot
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
175
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
176 CMD_BUILD_AIRPORT, ///< build an airport
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
177
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
178 CMD_BUILD_DOCK, ///< build a dock
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
179
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
180 CMD_BUILD_SHIP_DEPOT, ///< build a ship depot
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
181 CMD_BUILD_BUOY, ///< build a buoy
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
182
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
183 CMD_PLANT_TREE, ///< plant a tree
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
184
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
185 CMD_BUILD_RAIL_VEHICLE, ///< build a rail vehicle
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
186 CMD_MOVE_RAIL_VEHICLE, ///< move a rail vehicle (in the depot)
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
187
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
188 CMD_SELL_RAIL_WAGON, ///< sell a rail wagon
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
189
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
190 CMD_SEND_TRAIN_TO_DEPOT, ///< send a train to a depot
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
191 CMD_FORCE_TRAIN_PROCEED, ///< proceed a train to pass a red signal
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
192 CMD_REVERSE_TRAIN_DIRECTION, ///< turn a train around
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
193
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
194 CMD_MODIFY_ORDER, ///< modify an order (like set full-load)
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
195 CMD_SKIP_TO_ORDER, ///< skip an order to the next of specific one
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
196 CMD_DELETE_ORDER, ///< delete an order
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
197 CMD_INSERT_ORDER, ///< insert a new order
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
198
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
199 CMD_CHANGE_SERVICE_INT, ///< change the server interval of a vehicle
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
200
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
201 CMD_BUILD_INDUSTRY, ///< build a new industry
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
202
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
203 CMD_BUILD_COMPANY_HQ, ///< build the company headquarter
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10151
diff changeset
204 CMD_SET_COMPANY_MANAGER_FACE, ///< set the manager's face of the company
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 11069
diff changeset
205 CMD_SET_COMPANY_COLOUR, ///< set the colour of the company
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
206
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
207 CMD_INCREASE_LOAN, ///< increase the loan from the bank
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
208 CMD_DECREASE_LOAN, ///< decrease the loan from the bank
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
209
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
210 CMD_WANT_ENGINE_PREVIEW, ///< confirm the preview of an engine
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
211
10151
8a25a93ea7b4 (svn r14337) -Codechange: use CmdRename* and CMD_RENAME_* for vehicle, president and company renaming commands, too
smatz <smatz@openttd.org>
parents: 9928
diff changeset
212 CMD_RENAME_VEHICLE, ///< rename a whole vehicle
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
213 CMD_RENAME_ENGINE, ///< rename a engine (in the engine list)
10151
8a25a93ea7b4 (svn r14337) -Codechange: use CmdRename* and CMD_RENAME_* for vehicle, president and company renaming commands, too
smatz <smatz@openttd.org>
parents: 9928
diff changeset
214 CMD_RENAME_COMPANY, ///< change the company name
8a25a93ea7b4 (svn r14337) -Codechange: use CmdRename* and CMD_RENAME_* for vehicle, president and company renaming commands, too
smatz <smatz@openttd.org>
parents: 9928
diff changeset
215 CMD_RENAME_PRESIDENT, ///< change the president name
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
216 CMD_RENAME_STATION, ///< rename a station
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
217
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
218 CMD_SELL_AIRCRAFT, ///< sell an aircraft
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
219 CMD_BUILD_AIRCRAFT, ///< build an aircraft
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
220 CMD_SEND_AIRCRAFT_TO_HANGAR, ///< send an aircraft to a hanger
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
221 CMD_REFIT_AIRCRAFT, ///< refit the cargo space of an aircraft
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
222
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
223 CMD_PLACE_SIGN, ///< place a sign
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
224 CMD_RENAME_SIGN, ///< rename a sign
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
225
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
226 CMD_BUILD_ROAD_VEH, ///< build a road vehicle
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
227 CMD_SELL_ROAD_VEH, ///< sell a road vehicle
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
228 CMD_SEND_ROADVEH_TO_DEPOT, ///< send a road vehicle to the depot
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
229 CMD_TURN_ROADVEH, ///< turn a road vehicle around
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
230 CMD_REFIT_ROAD_VEH, ///< refit the cargo space of a road vehicle
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
231
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
232 CMD_PAUSE, ///< pause the game
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
233
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
234 CMD_BUY_SHARE_IN_COMPANY, ///< buy a share from a company
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
235 CMD_SELL_SHARE_IN_COMPANY, ///< sell a share from a company
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
236 CMD_BUY_COMPANY, ///< buy a company which is bankrupt
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
237
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
238 CMD_BUILD_TOWN, ///< build a town
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
239
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
240 CMD_RENAME_TOWN, ///< rename a town
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
241 CMD_DO_TOWN_ACTION, ///< do a action from the town detail window (like advertises or bribe)
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
242
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
243 CMD_SELL_SHIP, ///< sell a ship
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
244 CMD_BUILD_SHIP, ///< build a new ship
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
245 CMD_SEND_SHIP_TO_DEPOT, ///< send a ship to a depot
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
246 CMD_REFIT_SHIP, ///< refit the cargo space of a ship
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
247
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
248 CMD_ORDER_REFIT, ///< change the refit informaction of an order (for "goto depot" )
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
249 CMD_CLONE_ORDER, ///< clone (and share) an order
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
250 CMD_CLEAR_AREA, ///< clear an area
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
251
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
252 CMD_MONEY_CHEAT, ///< do the money cheat
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
253 CMD_BUILD_CANAL, ///< build a canal
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
254
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10151
diff changeset
255 CMD_COMPANY_CTRL, ///< used in multiplayer to create a new companies etc.
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
256 CMD_LEVEL_LAND, ///< level land
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
257
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
258 CMD_REFIT_RAIL_VEHICLE, ///< refit the cargo space of a train
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
259 CMD_RESTORE_ORDER_INDEX, ///< restore vehicle order-index and service interval
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
260 CMD_BUILD_LOCK, ///< build a lock
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
261
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
262 CMD_BUILD_SIGNAL_TRACK, ///< add signals along a track (by dragging)
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
263 CMD_REMOVE_SIGNAL_TRACK, ///< remove signals along a track (by dragging)
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
264
10207
c54d140df948 (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents: 10151
diff changeset
265 CMD_GIVE_MONEY, ///< give money to another company
11069
36d798171bfd (svn r15410) -Cleanup: get rid of most of the references to the 'patches' except where it's used for backward compatability.
rubidium <rubidium@openttd.org>
parents: 11055
diff changeset
266 CMD_CHANGE_SETTING, ///< change a setting
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
267
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
268 CMD_SET_AUTOREPLACE, ///< set an autoreplace entry
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
269
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
270 CMD_CLONE_VEHICLE, ///< clone a vehicle
9921
29d461128c75 (svn r14076) -Codechange: Merge the four start/stop commands into a single CMD_START_STOP_VEHICLE.
frosch <frosch@openttd.org>
parents: 9628
diff changeset
271 CMD_START_STOP_VEHICLE, ///< start or stop a vehicle
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
272 CMD_MASS_START_STOP, ///< start/stop all vehicles (in a depot)
9928
0cc9c6c36c43 (svn r14083) -Fix [FS#1264, FS#2037, FS#2038, FS#2110]: Rewrite the autoreplace kernel.
frosch <frosch@openttd.org>
parents: 9921
diff changeset
273 CMD_AUTOREPLACE_VEHICLE, ///< replace/renew a vehicle while it is in a depot
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
274 CMD_DEPOT_SELL_ALL_VEHICLES, ///< sell all vehicles which are in a given depot
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
275 CMD_DEPOT_MASS_AUTOREPLACE, ///< force the autoreplace to take action in a given depot
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
276
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
277 CMD_CREATE_GROUP, ///< create a new group
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
278 CMD_DELETE_GROUP, ///< delete a group
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
279 CMD_RENAME_GROUP, ///< rename a group
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
280 CMD_ADD_VEHICLE_GROUP, ///< add a vehicle to a group
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
281 CMD_ADD_SHARED_VEHICLE_GROUP, ///< add all other shared vehicles to a group which are missing
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
282 CMD_REMOVE_ALL_VEHICLES_GROUP, ///< remove all vehicles from a group
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
283 CMD_SET_GROUP_REPLACE_PROTECTION, ///< set the autoreplace-protection for a group
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
284
8500
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
285 CMD_MOVE_ORDER, ///< move an order
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
286 CMD_CHANGE_TIMETABLE, ///< change the timetable for a vehicle
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
287 CMD_SET_VEHICLE_ON_TIME, ///< set the vehicle on time feature (timetable)
83450457346b (svn r12075) -Codechange: Remove explicit numbering on command enum, and remove blanks from command list where old commands have been removed.
peter1138 <peter1138@openttd.org>
parents: 8486
diff changeset
288 CMD_AUTOFILL_TIMETABLE, ///< autofill the timetable
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
289 };
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
290
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
291 /**
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
292 * List of flags for a command.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
293 *
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
294 * This enums defines some flags which can be used for the commands.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
295 */
11090
df23c4e04638 (svn r15434) -Codechange: bit of type safety for the DC_xxx flags.
rubidium <rubidium@openttd.org>
parents: 11085
diff changeset
296 enum DoCommandFlag {
11103
5980315ec1f3 (svn r15449) -Codechange: Rename DC_NO_TOWN_RATING to DC_NO_TEST_TOWN_RATING as that is what it does.
frosch <frosch@openttd.org>
parents: 11090
diff changeset
297 DC_NONE = 0x000, ///< no flag is set
5980315ec1f3 (svn r15449) -Codechange: Rename DC_NO_TOWN_RATING to DC_NO_TEST_TOWN_RATING as that is what it does.
frosch <frosch@openttd.org>
parents: 11090
diff changeset
298 DC_EXEC = 0x001, ///< execute the given command
5980315ec1f3 (svn r15449) -Codechange: Rename DC_NO_TOWN_RATING to DC_NO_TEST_TOWN_RATING as that is what it does.
frosch <frosch@openttd.org>
parents: 11090
diff changeset
299 DC_AUTO = 0x002, ///< don't allow building on structures
5980315ec1f3 (svn r15449) -Codechange: Rename DC_NO_TOWN_RATING to DC_NO_TEST_TOWN_RATING as that is what it does.
frosch <frosch@openttd.org>
parents: 11090
diff changeset
300 DC_QUERY_COST = 0x004, ///< query cost only, don't build.
5980315ec1f3 (svn r15449) -Codechange: Rename DC_NO_TOWN_RATING to DC_NO_TEST_TOWN_RATING as that is what it does.
frosch <frosch@openttd.org>
parents: 11090
diff changeset
301 DC_NO_WATER = 0x008, ///< don't allow building on water
5980315ec1f3 (svn r15449) -Codechange: Rename DC_NO_TOWN_RATING to DC_NO_TEST_TOWN_RATING as that is what it does.
frosch <frosch@openttd.org>
parents: 11090
diff changeset
302 DC_NO_RAIL_OVERLAP = 0x010, ///< don't allow overlap of rails (used in buildrail)
5980315ec1f3 (svn r15449) -Codechange: Rename DC_NO_TOWN_RATING to DC_NO_TEST_TOWN_RATING as that is what it does.
frosch <frosch@openttd.org>
parents: 11090
diff changeset
303 DC_NO_TEST_TOWN_RATING = 0x020, ///< town rating does not disallow you from building
5980315ec1f3 (svn r15449) -Codechange: Rename DC_NO_TOWN_RATING to DC_NO_TEST_TOWN_RATING as that is what it does.
frosch <frosch@openttd.org>
parents: 11090
diff changeset
304 DC_BANKRUPT = 0x040, ///< company bankrupts, skip money check, skip vehicle on tile check in some cases
5980315ec1f3 (svn r15449) -Codechange: Rename DC_NO_TOWN_RATING to DC_NO_TEST_TOWN_RATING as that is what it does.
frosch <frosch@openttd.org>
parents: 11090
diff changeset
305 DC_AUTOREPLACE = 0x080, ///< autoreplace/autorenew is in progress, this shall disable vehicle limits when building, and ignore certain restrictions when undoing things (like vehicle attach callback)
5980315ec1f3 (svn r15449) -Codechange: Rename DC_NO_TOWN_RATING to DC_NO_TEST_TOWN_RATING as that is what it does.
frosch <frosch@openttd.org>
parents: 11090
diff changeset
306 DC_ALL_TILES = 0x100, ///< allow this command also on MP_VOID tiles
11106
ada4c4d48050 (svn r15452) -Codechange: Add DC_NO_MODIFY_TOWN_RATING.
frosch <frosch@openttd.org>
parents: 11103
diff changeset
307 DC_NO_MODIFY_TOWN_RATING = 0x200, ///< do not change town rating
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
308 };
11090
df23c4e04638 (svn r15434) -Codechange: bit of type safety for the DC_xxx flags.
rubidium <rubidium@openttd.org>
parents: 11085
diff changeset
309 DECLARE_ENUM_AS_BIT_SET(DoCommandFlag);
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
310
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
311 /**
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
312 * Used to combine a StringID with the command.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
313 *
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
314 * This macro can be used to add a StringID (the error message to show) on a command-id
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
315 * (CMD_xxx). Use the binary or-operator "|" to combine the command with the result from
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
316 * this macro.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
317 *
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
318 * @param x The StringID to combine with a command-id
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
319 */
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
320 #define CMD_MSG(x) ((x) << 16)
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
321
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
322 /**
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
323 * Defines some flags.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
324 *
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
325 * This enumeration defines some flags which are binary-or'ed on a command.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
326 */
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
327 enum {
10607
e3b26a6536ae (svn r14896) -Codechange: remove an unused constant and the related dead code.
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
328 CMD_NETWORK_COMMAND = 0x0100, ///< execute the command without sending it on the network
e3b26a6536ae (svn r14896) -Codechange: remove an unused constant and the related dead code.
rubidium <rubidium@openttd.org>
parents: 10606
diff changeset
329 CMD_NO_TEST_IF_IN_NETWORK = 0x0200, ///< When enabled, the command will bypass the no-DC_EXEC round if in network
10604
ec12a7f3eef8 (svn r14889) -Codechange: replace some magic numbers with constants.
rubidium <rubidium@openttd.org>
parents: 10499
diff changeset
330 CMD_FLAGS_MASK = 0xFF00, ///< mask for all command flags
ec12a7f3eef8 (svn r14889) -Codechange: replace some magic numbers with constants.
rubidium <rubidium@openttd.org>
parents: 10499
diff changeset
331 CMD_ID_MASK = 0x00FF, ///< mask for the command ID
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
332 };
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
333
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
334 /**
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
335 * Command flags for the command table _command_proc_table.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
336 *
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
337 * This enumeration defines flags for the _command_proc_table.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
338 */
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
339 enum {
11055
4c8d23865b6d (svn r15395) -Fix [FS#2611] (r15377): one couldn't reset companies anymore in a 'dedicated' server.
rubidium <rubidium@openttd.org>
parents: 10995
diff changeset
340 CMD_SERVER = 0x01, ///< the command can only be initiated by the server
4c8d23865b6d (svn r15395) -Fix [FS#2611] (r15377): one couldn't reset companies anymore in a 'dedicated' server.
rubidium <rubidium@openttd.org>
parents: 10995
diff changeset
341 CMD_SPECTATOR = 0x02, ///< the command may be initiated by a spectator
4c8d23865b6d (svn r15395) -Fix [FS#2611] (r15377): one couldn't reset companies anymore in a 'dedicated' server.
rubidium <rubidium@openttd.org>
parents: 10995
diff changeset
342 CMD_OFFLINE = 0x04, ///< the command cannot be executed in a multiplayer game; single-player only
4c8d23865b6d (svn r15395) -Fix [FS#2611] (r15377): one couldn't reset companies anymore in a 'dedicated' server.
rubidium <rubidium@openttd.org>
parents: 10995
diff changeset
343 CMD_AUTO = 0x08, ///< set the DC_AUTO flag on this command
4c8d23865b6d (svn r15395) -Fix [FS#2611] (r15377): one couldn't reset companies anymore in a 'dedicated' server.
rubidium <rubidium@openttd.org>
parents: 10995
diff changeset
344 CMD_ALL_TILES = 0x10, ///< allow this command also on MP_VOID tiles
4c8d23865b6d (svn r15395) -Fix [FS#2611] (r15377): one couldn't reset companies anymore in a 'dedicated' server.
rubidium <rubidium@openttd.org>
parents: 10995
diff changeset
345 CMD_NO_TEST = 0x20, ///< the command's output may differ between test and execute due to town rating changes etc.
4c8d23865b6d (svn r15395) -Fix [FS#2611] (r15377): one couldn't reset companies anymore in a 'dedicated' server.
rubidium <rubidium@openttd.org>
parents: 10995
diff changeset
346 CMD_NO_WATER = 0x40, ///< set the DC_NO_WATER flag on this command
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
347 };
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
348
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
349 /**
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
350 * Defines the callback type for all command handler functions.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
351 *
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
352 * This type defines the function header for all functions which handles a CMD_* command.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
353 * A command handler use the parameters to act according to the meaning of the command.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
354 * The tile parameter defines the tile to perform an action on.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
355 * The flag parameter is filled with flags from the DC_* enumeration. The parameters
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
356 * p1 and p2 are filled with parameters for the command like "which road type", "which
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
357 * order" or "direction". Each function should mentioned in there doxygen comments
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
358 * the usage of these parameters.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
359 *
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
360 * @param tile The tile to apply a command on
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
361 * @param flags Flags for the command, from the DC_* enumeration
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
362 * @param p1 Additional data for the command
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
363 * @param p2 Additional data for the command
10499
45ca88a8de7d (svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents: 10238
diff changeset
364 * @param text Additional text
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
365 * @return The CommandCost of the command, which can be succeeded or failed.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
366 */
11090
df23c4e04638 (svn r15434) -Codechange: bit of type safety for the DC_xxx flags.
rubidium <rubidium@openttd.org>
parents: 11085
diff changeset
367 typedef CommandCost CommandProc(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text);
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
368
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
369 /**
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
370 * Define a command with the flags which belongs to it.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
371 *
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
372 * This struct connect a command handler function with the flags created with
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
373 * the #CMD_AUTO, #CMD_OFFLINE and #CMD_SERVER values.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
374 */
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
375 struct Command {
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
376 CommandProc *proc;
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
377 byte flags;
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
378 };
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
379
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
380 /**
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
381 * Define a callback function for the client, after the command is finished.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
382 *
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
383 * Functions of this type are called after the command is finished. The parameters
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
384 * are from the #CommandProc callback type. The boolean parameter indicates if the
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
385 * command succeeded or failed.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
386 *
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
387 * @param success If the command succeeded or not.
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
388 * @param tile The tile of the command action
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
389 * @param p1 Additional data of the command
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
390 * @param p1 Additional data of the command
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
391 * @see CommandProc
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
392 */
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
393 typedef void CommandCallback(bool success, TileIndex tile, uint32 p1, uint32 p2);
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
394
10623
391c06627b17 (svn r14915) -Codechange: unify the receiving and sending of commands, and thus unifying most of the validity checking too.
rubidium <rubidium@openttd.org>
parents: 10607
diff changeset
395 /**
391c06627b17 (svn r14915) -Codechange: unify the receiving and sending of commands, and thus unifying most of the validity checking too.
rubidium <rubidium@openttd.org>
parents: 10607
diff changeset
396 * Structure for buffering the build command when selecting a station to join.
391c06627b17 (svn r14915) -Codechange: unify the receiving and sending of commands, and thus unifying most of the validity checking too.
rubidium <rubidium@openttd.org>
parents: 10607
diff changeset
397 */
391c06627b17 (svn r14915) -Codechange: unify the receiving and sending of commands, and thus unifying most of the validity checking too.
rubidium <rubidium@openttd.org>
parents: 10607
diff changeset
398 struct CommandContainer {
391c06627b17 (svn r14915) -Codechange: unify the receiving and sending of commands, and thus unifying most of the validity checking too.
rubidium <rubidium@openttd.org>
parents: 10607
diff changeset
399 TileIndex tile; ///< tile command being executed on
391c06627b17 (svn r14915) -Codechange: unify the receiving and sending of commands, and thus unifying most of the validity checking too.
rubidium <rubidium@openttd.org>
parents: 10607
diff changeset
400 uint32 p1; ///< parameter p1
391c06627b17 (svn r14915) -Codechange: unify the receiving and sending of commands, and thus unifying most of the validity checking too.
rubidium <rubidium@openttd.org>
parents: 10607
diff changeset
401 uint32 p2; ///< parameter p2
391c06627b17 (svn r14915) -Codechange: unify the receiving and sending of commands, and thus unifying most of the validity checking too.
rubidium <rubidium@openttd.org>
parents: 10607
diff changeset
402 uint32 cmd; ///< command being executed
391c06627b17 (svn r14915) -Codechange: unify the receiving and sending of commands, and thus unifying most of the validity checking too.
rubidium <rubidium@openttd.org>
parents: 10607
diff changeset
403 CommandCallback *callback; ///< any callback function executed upon successful completion of the command
391c06627b17 (svn r14915) -Codechange: unify the receiving and sending of commands, and thus unifying most of the validity checking too.
rubidium <rubidium@openttd.org>
parents: 10607
diff changeset
404 char text[80]; ///< possible text sent for name changes etc
391c06627b17 (svn r14915) -Codechange: unify the receiving and sending of commands, and thus unifying most of the validity checking too.
rubidium <rubidium@openttd.org>
parents: 10607
diff changeset
405 };
391c06627b17 (svn r14915) -Codechange: unify the receiving and sending of commands, and thus unifying most of the validity checking too.
rubidium <rubidium@openttd.org>
parents: 10607
diff changeset
406
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
diff changeset
407 #endif /* COMMAND_TYPE_H */