Mercurial > hg > openttd
annotate src/command.cpp @ 17152:c62cecf4dade draft
(svn r21890) -Cleanup: remove some unneeded includes
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sat, 22 Jan 2011 14:52:20 +0000 |
parents | 857a686bb953 |
children | 9efba2c3774d |
rev | line source |
---|---|
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1 /* $Id$ */ |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2 |
12778
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12552
diff
changeset
|
3 /* |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12552
diff
changeset
|
4 * This file is part of OpenTTD. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12552
diff
changeset
|
5 * 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. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12552
diff
changeset
|
6 * 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. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12552
diff
changeset
|
7 * 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/>. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12552
diff
changeset
|
8 */ |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12552
diff
changeset
|
9 |
9111
d48433370037
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium <rubidium@openttd.org>
parents:
9061
diff
changeset
|
10 /** @file command.cpp Handling of commands. */ |
6123
595dc16a6fd8
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas <belugas@openttd.org>
parents:
6012
diff
changeset
|
11 |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
12 #include "stdafx.h" |
6453
666fc3ef3174
(svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros <maedhros@openttd.org>
parents:
6444
diff
changeset
|
13 #include "landscape.h" |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
14 #include "gui.h" |
8116
9cc845deddfe
(svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents:
8114
diff
changeset
|
15 #include "command_func.h" |
15860
bb167d01deb9
(svn r20542) -Codechange: generalise the setting of "p2" to the ClientID.
rubidium <rubidium@openttd.org>
parents:
15854
diff
changeset
|
16 #include "network/network_type.h" |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
17 #include "network/network.h" |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
18 #include "genworld.h" |
7609
9e4c3b886ccb
(svn r11138) -Codechange: prepare some subsystems for persistent storage for NewGRFs.
rubidium <rubidium@openttd.org>
parents:
7559
diff
changeset
|
19 #include "newgrf_storage.h" |
8114
2d6af5d7a142
(svn r11675) -Codechange: split the string types from the string functions.
rubidium <rubidium@openttd.org>
parents:
8108
diff
changeset
|
20 #include "strings_func.h" |
8123
c26c28875749
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents:
8116
diff
changeset
|
21 #include "gfx_func.h" |
8131
e300ac8001ae
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium <rubidium@openttd.org>
parents:
8123
diff
changeset
|
22 #include "functions.h" |
8232
cca79a4335e0
(svn r11795) -Fix [FS#1616]: take town rating into account when testing if a command can be executed.
glx <glx@openttd.org>
parents:
8230
diff
changeset
|
23 #include "town.h" |
8247
c0449b1df5e1
(svn r11811) -Fix: make compilation without networking work again (and thus move the debugdumpcommand stuff out of the network 'area').
rubidium <rubidium@openttd.org>
parents:
8232
diff
changeset
|
24 #include "date_func.h" |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
10207
diff
changeset
|
25 #include "company_func.h" |
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
10207
diff
changeset
|
26 #include "company_base.h" |
8306
ea2c123b3655
(svn r11871) -Fix [FS#1074]: do not update signals after each tile when building/removing a large block of track/signals/station
smatz <smatz@openttd.org>
parents:
8275
diff
changeset
|
27 #include "signal_func.h" |
15294
c3d64c33d3d4
(svn r19933) -Fix [FS#3804]: Keep _current_company and _local_company in sync during GUI operation.
frosch <frosch@openttd.org>
parents:
15172
diff
changeset
|
28 #include "core/backup_type.hpp" |
16036
86c457462b35
(svn r20729) -Fix [FS#4107]: assert when overbuilding object
yexo <yexo@openttd.org>
parents:
15944
diff
changeset
|
29 #include "object_base.h" |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
30 |
8264
2495310e220f
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents:
8254
diff
changeset
|
31 #include "table/strings.h" |
2495310e220f
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents:
8254
diff
changeset
|
32 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
33 CommandProc CmdBuildRailroadTrack; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
34 CommandProc CmdRemoveRailroadTrack; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
35 CommandProc CmdBuildSingleRail; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
36 CommandProc CmdRemoveSingleRail; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
37 |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
38 CommandProc CmdLandscapeClear; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
39 |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
40 CommandProc CmdBuildBridge; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
41 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
42 CommandProc CmdBuildRailStation; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
43 CommandProc CmdRemoveFromRailStation; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
44 CommandProc CmdConvertRail; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
45 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
46 CommandProc CmdBuildSingleSignal; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
47 CommandProc CmdRemoveSingleSignal; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
48 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
49 CommandProc CmdTerraformLand; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
50 |
15744
f9e8032ac213
(svn r20411) -Codechange: rename unmovables as quite a lot of them are actually movable; e.g. HQ and owned land are pretty movable.
rubidium <rubidium@openttd.org>
parents:
15663
diff
changeset
|
51 CommandProc CmdBuildObject; |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
52 CommandProc CmdSellLandArea; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
53 |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
54 CommandProc CmdBuildTunnel; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
55 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
56 CommandProc CmdBuildTrainDepot; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
57 CommandProc CmdBuildRailWaypoint; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
58 CommandProc CmdRenameWaypoint; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
59 CommandProc CmdRemoveFromRailWaypoint; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
60 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
61 CommandProc CmdBuildRoadStop; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
62 CommandProc CmdRemoveRoadStop; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
63 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
64 CommandProc CmdBuildLongRoad; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
65 CommandProc CmdRemoveLongRoad; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
66 CommandProc CmdBuildRoad; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
67 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
68 CommandProc CmdBuildRoadDepot; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
69 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
70 CommandProc CmdBuildAirport; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
71 |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
72 CommandProc CmdBuildDock; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
73 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
74 CommandProc CmdBuildShipDepot; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
75 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
76 CommandProc CmdBuildBuoy; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
77 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
78 CommandProc CmdPlantTree; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
79 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
80 CommandProc CmdMoveRailVehicle; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
81 |
15849
f4ed8e905fee
(svn r20531) -Codechange: unify quite a bit of the vehicle building commands
rubidium <rubidium@openttd.org>
parents:
15744
diff
changeset
|
82 CommandProc CmdBuildVehicle; |
15850
efc03d77eb93
(svn r20532) -Codechange: unify selling of vehicles a bit
rubidium <rubidium@openttd.org>
parents:
15849
diff
changeset
|
83 CommandProc CmdSellVehicle; |
15854
43d172eac154
(svn r20536) -Codechange: unify the refitting of vehicles
rubidium <rubidium@openttd.org>
parents:
15850
diff
changeset
|
84 CommandProc CmdRefitVehicle; |
16075
ab8c26c4d456
(svn r20768) -Codechange: unify send-to-depot commands
rubidium <rubidium@openttd.org>
parents:
16053
diff
changeset
|
85 CommandProc CmdSendVehicleToDepot; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
86 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
87 CommandProc CmdForceTrainProceed; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
88 CommandProc CmdReverseTrainDirection; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
89 |
15865
270f9b0689cc
(svn r20547) -Change: the way order backups are performed. Now restoring an order doesn't require up to 765 commands.
rubidium <rubidium@openttd.org>
parents:
15864
diff
changeset
|
90 CommandProc CmdClearOrderBackup; |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
91 CommandProc CmdModifyOrder; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
92 CommandProc CmdSkipToOrder; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
93 CommandProc CmdDeleteOrder; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
94 CommandProc CmdInsertOrder; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
95 CommandProc CmdChangeServiceInt; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
96 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
97 CommandProc CmdBuildIndustry; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
98 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
99 CommandProc CmdSetCompanyManagerFace; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
100 CommandProc CmdSetCompanyColour; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
101 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
102 CommandProc CmdIncreaseLoan; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
103 CommandProc CmdDecreaseLoan; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
104 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
105 CommandProc CmdWantEnginePreview; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
106 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
107 CommandProc CmdRenameVehicle; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
108 CommandProc CmdRenameEngine; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
109 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
110 CommandProc CmdRenameCompany; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
111 CommandProc CmdRenamePresident; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
112 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
113 CommandProc CmdRenameStation; |
15172
e9741bd69a65
(svn r19801) -Add [FS#3691]: custom naming of depots. Based on work by sbr
rubidium <rubidium@openttd.org>
parents:
15046
diff
changeset
|
114 CommandProc CmdRenameDepot; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
115 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
116 CommandProc CmdPlaceSign; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
117 CommandProc CmdRenameSign; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
118 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
119 CommandProc CmdTurnRoadVeh; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
120 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
121 CommandProc CmdPause; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
122 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
123 CommandProc CmdBuyShareInCompany; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
124 CommandProc CmdSellShareInCompany; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
125 CommandProc CmdBuyCompany; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
126 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
127 CommandProc CmdFoundTown; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
128 CommandProc CmdRenameTown; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
129 CommandProc CmdDoTownAction; |
15657
ddfeab1a0a88
(svn r20322) -Codechange: Move Expand town code to a command.
terkhen <terkhen@openttd.org>
parents:
15370
diff
changeset
|
130 CommandProc CmdExpandTown; |
15658
52010e085f5e
(svn r20323) -Codechange: Move Delete town code to a command.
terkhen <terkhen@openttd.org>
parents:
15657
diff
changeset
|
131 CommandProc CmdDeleteTown; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
132 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
133 CommandProc CmdChangeSetting; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
134 CommandProc CmdChangeCompanySetting; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
135 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
136 CommandProc CmdOrderRefit; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
137 CommandProc CmdCloneOrder; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
138 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
139 CommandProc CmdClearArea; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
140 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
141 CommandProc CmdGiveMoney; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
142 CommandProc CmdMoneyCheat; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
143 CommandProc CmdBuildCanal; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
144 CommandProc CmdBuildLock; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
145 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
146 CommandProc CmdCompanyCtrl; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
147 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
148 CommandProc CmdLevelLand; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
149 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
150 CommandProc CmdBuildSignalTrack; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
151 CommandProc CmdRemoveSignalTrack; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
152 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
153 CommandProc CmdSetAutoReplace; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
154 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
155 CommandProc CmdCloneVehicle; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
156 CommandProc CmdStartStopVehicle; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
157 CommandProc CmdMassStartStopVehicle; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
158 CommandProc CmdAutoreplaceVehicle; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
159 CommandProc CmdDepotSellAllVehicles; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
160 CommandProc CmdDepotMassAutoReplace; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
161 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
162 CommandProc CmdCreateGroup; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
163 CommandProc CmdRenameGroup; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
164 CommandProc CmdDeleteGroup; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
165 CommandProc CmdAddVehicleGroup; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
166 CommandProc CmdAddSharedVehicleGroup; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
167 CommandProc CmdRemoveAllVehiclesGroup; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
168 CommandProc CmdSetGroupReplaceProtection; |
6667
12d521513434
(svn r9898) -Fix (r9874): Many...
peter1138 <peter1138@openttd.org>
parents:
6643
diff
changeset
|
169 |
14237
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
170 CommandProc CmdMoveOrder; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
171 CommandProc CmdChangeTimetable; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
172 CommandProc CmdSetVehicleOnTime; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
173 CommandProc CmdAutofillTimetable; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
174 CommandProc CmdSetTimetableStart; |
6832
17319fb8c1c3
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium <rubidium@openttd.org>
parents:
6794
diff
changeset
|
175 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
176 #define DEF_CMD(proc, flags, type) {proc, #proc, flags, type} |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
177 |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
178 /** |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
179 * The master command table |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
180 * |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
181 * This table contains all possible CommandProc functions with |
14823
a6fd991f209d
(svn r19414) -Doc: Several doxygen additions and corrections.
alberth <alberth@openttd.org>
parents:
14645
diff
changeset
|
182 * the flags which belongs to it. The indices are the same |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
183 * as the value from the CMD_* enums. |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
184 */ |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
185 static const Command _command_proc_table[] = { |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
186 DEF_CMD(CmdBuildRailroadTrack, CMD_NO_WATER | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_RAILROAD_TRACK |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
187 DEF_CMD(CmdRemoveRailroadTrack, CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_REMOVE_RAILROAD_TRACK |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
188 DEF_CMD(CmdBuildSingleRail, CMD_NO_WATER | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_SINGLE_RAIL |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
189 DEF_CMD(CmdRemoveSingleRail, CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_REMOVE_SINGLE_RAIL |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
190 DEF_CMD(CmdLandscapeClear, 0, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_LANDSCAPE_CLEAR |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
191 DEF_CMD(CmdBuildBridge, CMD_NO_WATER | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_BRIDGE |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
192 DEF_CMD(CmdBuildRailStation, CMD_NO_WATER | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_RAIL_STATION |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
193 DEF_CMD(CmdBuildTrainDepot, CMD_NO_WATER | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_TRAIN_DEPOT |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
194 DEF_CMD(CmdBuildSingleSignal, CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_SIGNALS |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
195 DEF_CMD(CmdRemoveSingleSignal, CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_REMOVE_SIGNALS |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
196 DEF_CMD(CmdTerraformLand, CMD_ALL_TILES | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_TERRAFORM_LAND |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
197 DEF_CMD(CmdBuildObject, CMD_NO_WATER | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_OBJECT |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
198 DEF_CMD(CmdBuildTunnel, CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_TUNNEL |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
199 DEF_CMD(CmdRemoveFromRailStation, 0, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_REMOVE_FROM_RAIL_STATION |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
200 DEF_CMD(CmdConvertRail, 0, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_CONVERT_RAILD |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
201 DEF_CMD(CmdBuildRailWaypoint, 0, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_RAIL_WAYPOINT |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
202 DEF_CMD(CmdRenameWaypoint, 0, CMDT_OTHER_MANAGEMENT ), // CMD_RENAME_WAYPOINT |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
203 DEF_CMD(CmdRemoveFromRailWaypoint, 0, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_REMOVE_FROM_RAIL_WAYPOINT |
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
|
204 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
205 DEF_CMD(CmdBuildRoadStop, CMD_NO_WATER | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_ROAD_STOP |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
206 DEF_CMD(CmdRemoveRoadStop, 0, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_REMOVE_ROAD_STOP |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
207 DEF_CMD(CmdBuildLongRoad, CMD_NO_WATER | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_LONG_ROAD |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
208 DEF_CMD(CmdRemoveLongRoad, CMD_NO_TEST | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_REMOVE_LONG_ROAD; towns may disallow removing road bits (as they are connected) in test, but in exec they're removed and thus removing is allowed. |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
209 DEF_CMD(CmdBuildRoad, CMD_NO_WATER | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_ROAD |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
210 DEF_CMD(CmdBuildRoadDepot, CMD_NO_WATER | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_ROAD_DEPOT |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
211 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
212 DEF_CMD(CmdBuildAirport, CMD_NO_WATER | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_AIRPORT |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
213 DEF_CMD(CmdBuildDock, CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_DOCK |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
214 DEF_CMD(CmdBuildShipDepot, CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_SHIP_DEPOT |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
215 DEF_CMD(CmdBuildBuoy, CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_BUOY |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
216 DEF_CMD(CmdPlantTree, CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_PLANT_TREE |
15854
43d172eac154
(svn r20536) -Codechange: unify the refitting of vehicles
rubidium <rubidium@openttd.org>
parents:
15850
diff
changeset
|
217 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
218 DEF_CMD(CmdBuildVehicle, CMD_CLIENT_ID, CMDT_VEHICLE_CONSTRUCTION ), // CMD_BUILD_VEHICLE |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
219 DEF_CMD(CmdSellVehicle, CMD_CLIENT_ID, CMDT_VEHICLE_CONSTRUCTION ), // CMD_SELL_VEHICLE |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
220 DEF_CMD(CmdRefitVehicle, 0, CMDT_VEHICLE_CONSTRUCTION ), // CMD_REFIT_VEHICLE |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
221 DEF_CMD(CmdSendVehicleToDepot, 0, CMDT_VEHICLE_MANAGEMENT ), // CMD_SEND_VEHICLE_TO_DEPOT |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
222 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
223 DEF_CMD(CmdMoveRailVehicle, 0, CMDT_VEHICLE_CONSTRUCTION ), // CMD_MOVE_RAIL_VEHICLE |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
224 DEF_CMD(CmdForceTrainProceed, 0, CMDT_VEHICLE_MANAGEMENT ), // CMD_FORCE_TRAIN_PROCEED |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
225 DEF_CMD(CmdReverseTrainDirection, 0, CMDT_VEHICLE_MANAGEMENT ), // CMD_REVERSE_TRAIN_DIRECTION |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
226 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
227 DEF_CMD(CmdClearOrderBackup, CMD_CLIENT_ID, CMDT_ROUTE_MANAGEMENT ), // CMD_CLEAR_ORDER_BACKUP |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
228 DEF_CMD(CmdModifyOrder, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_MODIFY_ORDER |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
229 DEF_CMD(CmdSkipToOrder, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_SKIP_TO_ORDER |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
230 DEF_CMD(CmdDeleteOrder, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_DELETE_ORDER |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
231 DEF_CMD(CmdInsertOrder, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_INSERT_ORDER |
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 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
233 DEF_CMD(CmdChangeServiceInt, 0, CMDT_VEHICLE_MANAGEMENT ), // CMD_CHANGE_SERVICE_INT |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
234 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
235 DEF_CMD(CmdBuildIndustry, 0, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_INDUSTRY |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
236 DEF_CMD(CmdSetCompanyManagerFace, 0, CMDT_OTHER_MANAGEMENT ), // CMD_SET_COMPANY_MANAGER_FACE |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
237 DEF_CMD(CmdSetCompanyColour, 0, CMDT_OTHER_MANAGEMENT ), // CMD_SET_COMPANY_COLOUR |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
238 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
239 DEF_CMD(CmdIncreaseLoan, 0, CMDT_MONEY_MANAGEMENT ), // CMD_INCREASE_LOAN |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
240 DEF_CMD(CmdDecreaseLoan, 0, CMDT_MONEY_MANAGEMENT ), // CMD_DECREASE_LOAN |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
241 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
242 DEF_CMD(CmdWantEnginePreview, 0, CMDT_VEHICLE_MANAGEMENT ), // CMD_WANT_ENGINE_PREVIEW |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
243 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
244 DEF_CMD(CmdRenameVehicle, 0, CMDT_OTHER_MANAGEMENT ), // CMD_RENAME_VEHICLE |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
245 DEF_CMD(CmdRenameEngine, 0, CMDT_OTHER_MANAGEMENT ), // CMD_RENAME_ENGINE |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
246 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
247 DEF_CMD(CmdRenameCompany, 0, CMDT_OTHER_MANAGEMENT ), // CMD_RENAME_COMPANY |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
248 DEF_CMD(CmdRenamePresident, 0, CMDT_OTHER_MANAGEMENT ), // CMD_RENAME_PRESIDENT |
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
|
249 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
250 DEF_CMD(CmdRenameStation, 0, CMDT_OTHER_MANAGEMENT ), // CMD_RENAME_STATION |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
251 DEF_CMD(CmdRenameDepot, 0, CMDT_OTHER_MANAGEMENT ), // CMD_RENAME_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
|
252 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
253 DEF_CMD(CmdPlaceSign, 0, CMDT_OTHER_MANAGEMENT ), // CMD_PLACE_SIGN |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
254 DEF_CMD(CmdRenameSign, 0, CMDT_OTHER_MANAGEMENT ), // CMD_RENAME_SIGN |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
255 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
256 DEF_CMD(CmdTurnRoadVeh, 0, CMDT_VEHICLE_MANAGEMENT ), // CMD_TURN_ROADVEH |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
257 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
258 DEF_CMD(CmdPause, CMD_SERVER, CMDT_SERVER_SETTING ), // CMD_PAUSE |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
259 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
260 DEF_CMD(CmdBuyShareInCompany, 0, CMDT_MONEY_MANAGEMENT ), // CMD_BUY_SHARE_IN_COMPANY |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
261 DEF_CMD(CmdSellShareInCompany, 0, CMDT_MONEY_MANAGEMENT ), // CMD_SELL_SHARE_IN_COMPANY |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
262 DEF_CMD(CmdBuyCompany, 0, CMDT_MONEY_MANAGEMENT ), // CMD_BUY_COMANY |
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
|
263 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
264 DEF_CMD(CmdFoundTown, CMD_NO_TEST, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_FOUND_TOWN; founding random town can fail only in exec run |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
265 DEF_CMD(CmdRenameTown, CMD_SERVER, CMDT_OTHER_MANAGEMENT ), // CMD_RENAME_TOWN |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
266 DEF_CMD(CmdDoTownAction, 0, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_DO_TOWN_ACTION |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
267 DEF_CMD(CmdExpandTown, CMD_OFFLINE, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_EXPAND_TOWN |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
268 DEF_CMD(CmdDeleteTown, CMD_OFFLINE, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_DELETE_TOWN |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
269 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
270 DEF_CMD(CmdOrderRefit, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_ORDER_REFIT |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
271 DEF_CMD(CmdCloneOrder, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_CLONE_ORDER |
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 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
273 DEF_CMD(CmdClearArea, CMD_NO_TEST, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_CLEAR_AREA; destroying multi-tile houses makes town rating differ between test and execution |
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 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
275 DEF_CMD(CmdMoneyCheat, CMD_OFFLINE, CMDT_MONEY_MANAGEMENT ), // CMD_MONEY_CHEAT |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
276 DEF_CMD(CmdBuildCanal, CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_CANAL |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
277 DEF_CMD(CmdCompanyCtrl, CMD_SPECTATOR | CMD_CLIENT_ID, CMDT_SERVER_SETTING ), // CMD_COMPANY_CTRL |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
278 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
279 DEF_CMD(CmdLevelLand, CMD_ALL_TILES | CMD_NO_TEST | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_LEVEL_LAND; test run might clear tiles multiple times, in execution that only happens once |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
280 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
281 DEF_CMD(CmdBuildLock, CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_LOCK |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
282 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
283 DEF_CMD(CmdBuildSignalTrack, CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_BUILD_SIGNAL_TRACK |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
284 DEF_CMD(CmdRemoveSignalTrack, CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_REMOVE_SIGNAL_TRACK |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
285 |
16693
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
286 DEF_CMD(CmdGiveMoney, 0, CMDT_MONEY_MANAGEMENT ), // CMD_GIVE_MONEY |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
287 DEF_CMD(CmdChangeSetting, CMD_SERVER, CMDT_SERVER_SETTING ), // CMD_CHANGE_SETTING |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
288 DEF_CMD(CmdChangeCompanySetting, 0, CMDT_COMPANY_SETTING ), // CMD_CHANGE_COMPANY_SETTING |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
289 DEF_CMD(CmdSetAutoReplace, 0, CMDT_VEHICLE_MANAGEMENT ), // CMD_SET_AUTOREPLACE |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
290 DEF_CMD(CmdCloneVehicle, CMD_NO_TEST, CMDT_VEHICLE_CONSTRUCTION ), // CMD_CLONE_VEHICLE; NewGRF callbacks influence building and refitting making it impossible to correctly estimate the cost |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
291 DEF_CMD(CmdStartStopVehicle, 0, CMDT_VEHICLE_MANAGEMENT ), // CMD_START_STOP_VEHICLE |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
292 DEF_CMD(CmdMassStartStopVehicle, 0, CMDT_VEHICLE_MANAGEMENT ), // CMD_MASS_START_STOP |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
293 DEF_CMD(CmdAutoreplaceVehicle, 0, CMDT_VEHICLE_MANAGEMENT ), // CMD_AUTOREPLACE_VEHICLE |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
294 DEF_CMD(CmdDepotSellAllVehicles, 0, CMDT_VEHICLE_CONSTRUCTION ), // CMD_DEPOT_SELL_ALL_VEHICLES |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
295 DEF_CMD(CmdDepotMassAutoReplace, 0, CMDT_VEHICLE_CONSTRUCTION ), // CMD_DEPOT_MASS_AUTOREPLACE |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
296 DEF_CMD(CmdCreateGroup, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_CREATE_GROUP |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
297 DEF_CMD(CmdDeleteGroup, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_DELETE_GROUP |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
298 DEF_CMD(CmdRenameGroup, 0, CMDT_OTHER_MANAGEMENT ), // CMD_RENAME_GROUP |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
299 DEF_CMD(CmdAddVehicleGroup, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_ADD_VEHICLE_GROUP |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
300 DEF_CMD(CmdAddSharedVehicleGroup, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_ADD_SHARE_VEHICLE_GROUP |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
301 DEF_CMD(CmdRemoveAllVehiclesGroup, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_REMOVE_ALL_VEHICLES_GROUP |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
302 DEF_CMD(CmdSetGroupReplaceProtection, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_SET_GROUP_REPLACE_PROTECTION |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
303 DEF_CMD(CmdMoveOrder, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_MOVE_ORDER |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
304 DEF_CMD(CmdChangeTimetable, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_CHANGE_TIMETABLE |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
305 DEF_CMD(CmdSetVehicleOnTime, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_SET_VEHICLE_ON_TIME |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
306 DEF_CMD(CmdAutofillTimetable, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_AUTOFILL_TIMETABLE |
4088e343b147
(svn r21425) -Codechange: add "command types" to all commands
rubidium <rubidium@openttd.org>
parents:
16628
diff
changeset
|
307 DEF_CMD(CmdSetTimetableStart, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_SET_TIMETABLE_START |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
308 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
309 |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
310 /*! |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
311 * This function range-checks a cmd, and checks if the cmd is not NULL |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
312 * |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
313 * @param cmd The integervalue of a command |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
314 * @return true if the command is valid (and got a CommandProc function) |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
315 */ |
10237
d39d46dc7057
(svn r14465) -Codechange: minor code style of command.cpp.
rubidium <rubidium@openttd.org>
parents:
10225
diff
changeset
|
316 bool IsValidCommand(uint32 cmd) |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
317 { |
10604
ec12a7f3eef8
(svn r14889) -Codechange: replace some magic numbers with constants.
rubidium <rubidium@openttd.org>
parents:
10515
diff
changeset
|
318 cmd &= CMD_ID_MASK; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
319 |
16547
a11cd939c335
(svn r21273) -Codechange: Return values should start at the same line.
alberth <alberth@openttd.org>
parents:
16075
diff
changeset
|
320 return cmd < lengthof(_command_proc_table) && _command_proc_table[cmd].proc != NULL; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
321 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
322 |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
323 /*! |
10604
ec12a7f3eef8
(svn r14889) -Codechange: replace some magic numbers with constants.
rubidium <rubidium@openttd.org>
parents:
10515
diff
changeset
|
324 * This function mask the parameter with CMD_ID_MASK and returns |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
325 * the flags which belongs to the given command. |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
326 * |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
327 * @param cmd The integer value of the command |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
328 * @return The flags for this command |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
329 */ |
10237
d39d46dc7057
(svn r14465) -Codechange: minor code style of command.cpp.
rubidium <rubidium@openttd.org>
parents:
10225
diff
changeset
|
330 byte GetCommandFlags(uint32 cmd) |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
331 { |
10237
d39d46dc7057
(svn r14465) -Codechange: minor code style of command.cpp.
rubidium <rubidium@openttd.org>
parents:
10225
diff
changeset
|
332 assert(IsValidCommand(cmd)); |
d39d46dc7057
(svn r14465) -Codechange: minor code style of command.cpp.
rubidium <rubidium@openttd.org>
parents:
10225
diff
changeset
|
333 |
10604
ec12a7f3eef8
(svn r14889) -Codechange: replace some magic numbers with constants.
rubidium <rubidium@openttd.org>
parents:
10515
diff
changeset
|
334 return _command_proc_table[cmd & CMD_ID_MASK].flags; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
335 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
336 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
337 /*! |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
338 * This function mask the parameter with CMD_ID_MASK and returns |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
339 * the name which belongs to the given command. |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
340 * |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
341 * @param cmd The integer value of the command |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
342 * @return The name for this command |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
343 */ |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
344 const char *GetCommandName(uint32 cmd) |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
345 { |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
346 assert(IsValidCommand(cmd)); |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
347 |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
348 return _command_proc_table[cmd & CMD_ID_MASK].name; |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
349 } |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
350 |
16695
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
351 /** |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
352 * Returns whether the command is allowed while the game is paused. |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
353 * @param cmd The command to check. |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
354 * @return True if the command is allowed while paused, false otherwise. |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
355 */ |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
356 bool IsCommandAllowedWhilePaused(uint32 cmd) |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
357 { |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
358 /* Lookup table for the command types that are allowed for a given pause level setting. */ |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
359 static const int command_type_lookup[] = { |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
360 CMDPL_ALL_ACTIONS, ///< CMDT_LANDSCAPE_CONSTRUCTION |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
361 CMDPL_NO_LANDSCAPING, ///< CMDT_VEHICLE_CONSTRUCTION |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
362 CMDPL_NO_LANDSCAPING, ///< CMDT_MONEY_MANAGEMENT |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
363 CMDPL_NO_CONSTRUCTION, ///< CMDT_VEHICLE_MANAGEMENT |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
364 CMDPL_NO_CONSTRUCTION, ///< CMDT_ROUTE_MANAGEMENT |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
365 CMDPL_NO_CONSTRUCTION, ///< CMDT_OTHER_MANAGEMENT |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
366 CMDPL_NO_CONSTRUCTION, ///< CMDT_COMPANY_SETTING |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
367 CMDPL_NO_ACTIONS, ///< CMDT_SERVER_SETTING |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
368 }; |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
369 assert_compile(lengthof(command_type_lookup) == CMDT_END); |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
370 |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
371 assert(IsValidCommand(cmd)); |
16698
857a686bb953
(svn r21430) -Feature [FS#1521]: building while paused always works in the scenario editor
rubidium <rubidium@openttd.org>
parents:
16696
diff
changeset
|
372 return _game_mode == GM_EDITOR || command_type_lookup[_command_proc_table[cmd & CMD_ID_MASK].type] <= _settings_game.construction.command_pause_level; |
16695
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
373 } |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
374 |
867a49c71d12
(svn r21427) -Add: helper function to determine whether a command may be executed
rubidium <rubidium@openttd.org>
parents:
16693
diff
changeset
|
375 |
8232
cca79a4335e0
(svn r11795) -Fix [FS#1616]: take town rating into account when testing if a command can be executed.
glx <glx@openttd.org>
parents:
8230
diff
changeset
|
376 static int _docommand_recursive = 0; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
377 |
10624
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
378 /** |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
379 * Shorthand for calling the long DoCommand with a container. |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
380 * |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
381 * @param container Container with (almost) all information |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
382 * @param flags Flags for the command and how to execute the command |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
383 * @see CommandProc |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
384 * @return the cost |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
385 */ |
11090
df23c4e04638
(svn r15434) -Codechange: bit of type safety for the DC_xxx flags.
rubidium <rubidium@openttd.org>
parents:
11085
diff
changeset
|
386 CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags) |
10624
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
387 { |
10626
3189a053f43a
(svn r14919) -Feature: distant joining of stations (Frostregen and PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10624
diff
changeset
|
388 return DoCommand(container->tile, container->p1, container->p2, flags, container->cmd & CMD_ID_MASK, container->text); |
10624
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
389 } |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
390 |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
391 /*! |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
392 * This function executes a given command with the parameters from the #CommandProc parameter list. |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
393 * Depending on the flags parameter it execute or test a command. |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
394 * |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
395 * @param tile The tile to apply the command on (for the #CommandProc) |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
396 * @param p1 Additional data for the command (for the #CommandProc) |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
397 * @param p2 Additional data for the command (for the #CommandProc) |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
398 * @param flags Flags for the command and how to execute the command |
10499
45ca88a8de7d
(svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents:
10237
diff
changeset
|
399 * @param cmd The command-id to execute (a value of the CMD_* enums) |
13067
082cdb4504ac
(svn r17567) -Fix: some doxygen warnings
rubidium <rubidium@openttd.org>
parents:
12778
diff
changeset
|
400 * @param text The text to pass |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
401 * @see CommandProc |
10624
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
402 * @return the cost |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
403 */ |
11090
df23c4e04638
(svn r15434) -Codechange: bit of type safety for the DC_xxx flags.
rubidium <rubidium@openttd.org>
parents:
11085
diff
changeset
|
404 CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, DoCommandFlag flags, uint32 cmd, const char *text) |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
405 { |
6943
fd42cb9816c6
(svn r10197) -Codechange: replace int32 with CommandCost where appropriate.
rubidium <rubidium@openttd.org>
parents:
6832
diff
changeset
|
406 CommandCost res; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
407 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
408 /* Do not even think about executing out-of-bounds tile-commands */ |
10855
7881d9cd55ab
(svn r15190) -Feature: Allow terraforming of the tiles at the edges of the map.
Yexo <Yexo@openttd.org>
parents:
10707
diff
changeset
|
409 if (tile != 0 && (tile >= MapSize() || (!IsValidTile(tile) && (flags & DC_ALL_TILES) == 0))) return CMD_ERROR; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
410 |
12485
cf4a59021c9d
(svn r16922) -Codechange: unduplicate some vehicle CMD_*s and move the setting of the error message to a single place
rubidium <rubidium@openttd.org>
parents:
12094
diff
changeset
|
411 /* Chop of any CMD_MSG or other flags; we don't need those here */ |
cf4a59021c9d
(svn r16922) -Codechange: unduplicate some vehicle CMD_*s and move the setting of the error message to a single place
rubidium <rubidium@openttd.org>
parents:
12094
diff
changeset
|
412 CommandProc *proc = _command_proc_table[cmd & CMD_ID_MASK].proc; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
413 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
414 _docommand_recursive++; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
415 |
6123
595dc16a6fd8
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas <belugas@openttd.org>
parents:
6012
diff
changeset
|
416 /* only execute the test call if it's toplevel, or we're not execing. */ |
8486
99f058177c49
(svn r12061) -Cleanup: since r12060, DC_FORCETEST is not used anymore
smatz <smatz@openttd.org>
parents:
8442
diff
changeset
|
417 if (_docommand_recursive == 1 || !(flags & DC_EXEC) ) { |
16036
86c457462b35
(svn r20729) -Fix [FS#4107]: assert when overbuilding object
yexo <yexo@openttd.org>
parents:
15944
diff
changeset
|
418 if (_docommand_recursive == 1) _cleared_object_areas.Clear(); |
8232
cca79a4335e0
(svn r11795) -Fix [FS#1616]: take town rating into account when testing if a command can be executed.
glx <glx@openttd.org>
parents:
8230
diff
changeset
|
419 SetTownRatingTestMode(true); |
10499
45ca88a8de7d
(svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents:
10237
diff
changeset
|
420 res = proc(tile, flags & ~DC_EXEC, p1, p2, text); |
8232
cca79a4335e0
(svn r11795) -Fix [FS#1616]: take town rating into account when testing if a command can be executed.
glx <glx@openttd.org>
parents:
8230
diff
changeset
|
421 SetTownRatingTestMode(false); |
14314
60d313b887b8
(svn r18866) -Codechange: remove the CmdFailed(ret)/CmdSucceeded(ret) wrapper functions
rubidium <rubidium@openttd.org>
parents:
14237
diff
changeset
|
422 if (res.Failed()) { |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
423 goto error; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
424 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
425 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
426 if (_docommand_recursive == 1 && |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
427 !(flags & DC_QUERY_COST) && |
8519
0e4b2a37af1f
(svn r12094) -Codechange: use DC_BANKRUPT command flag when removing player property to allow further fixes
smatz <smatz@openttd.org>
parents:
8500
diff
changeset
|
428 !(flags & DC_BANKRUPT) && |
14824
fa89f804ec0f
(svn r19415) -Codechange: Forward CommandCost with an error back to the caller.
alberth <alberth@openttd.org>
parents:
14823
diff
changeset
|
429 !CheckCompanyHasMoney(res)) { // CheckCompanyHasMoney() modifies 'res' to an error if it fails. |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
430 goto error; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
431 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
432 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
433 if (!(flags & DC_EXEC)) { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
434 _docommand_recursive--; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
435 return res; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
436 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
437 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
438 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
439 /* Execute the command here. All cost-relevant functions set the expenses type |
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:
8199
diff
changeset
|
440 * themselves to the cost object at some point */ |
16036
86c457462b35
(svn r20729) -Fix [FS#4107]: assert when overbuilding object
yexo <yexo@openttd.org>
parents:
15944
diff
changeset
|
441 if (_docommand_recursive == 1) _cleared_object_areas.Clear(); |
10499
45ca88a8de7d
(svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents:
10237
diff
changeset
|
442 res = proc(tile, flags, p1, p2, text); |
14314
60d313b887b8
(svn r18866) -Codechange: remove the CmdFailed(ret)/CmdSucceeded(ret) wrapper functions
rubidium <rubidium@openttd.org>
parents:
14237
diff
changeset
|
443 if (res.Failed()) { |
14232
860ea22258ba
(svn r18783) -Codechange: make CheckCompanyHasMoney set an error on the CommandCost it tests when you don't have enough money instead of setting a global variable.
rubidium <rubidium@openttd.org>
parents:
14230
diff
changeset
|
444 error: |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
445 _docommand_recursive--; |
14824
fa89f804ec0f
(svn r19415) -Codechange: Forward CommandCost with an error back to the caller.
alberth <alberth@openttd.org>
parents:
14823
diff
changeset
|
446 return res; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
447 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
448 |
6123
595dc16a6fd8
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas <belugas@openttd.org>
parents:
6012
diff
changeset
|
449 /* if toplevel, subtract the money. */ |
8519
0e4b2a37af1f
(svn r12094) -Codechange: use DC_BANKRUPT command flag when removing player property to allow further fixes
smatz <smatz@openttd.org>
parents:
8500
diff
changeset
|
450 if (--_docommand_recursive == 0 && !(flags & DC_BANKRUPT)) { |
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
|
451 SubtractMoneyFromCompany(res); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
452 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
453 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
454 return res; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
455 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
456 |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
457 /*! |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
458 * This functions returns the money which can be used to execute a command. |
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
|
459 * This is either the money of the current company or INT64_MAX if there |
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
|
460 * is no such a company "at the moment" like the server itself. |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
461 * |
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
|
462 * @return The available money of a company or INT64_MAX |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
463 */ |
6990
a19700261804
(svn r10246) -Fix (r10297): some forgotten money conversions and truncation issues. Thanks to benc for providing the patch.
rubidium <rubidium@openttd.org>
parents:
6980
diff
changeset
|
464 Money GetAvailableMoneyForCommand() |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
465 { |
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
|
466 CompanyID company = _current_company; |
11924
fccc9cea27a7
(svn r16327) -Codechange: replace IsValidPoolItemID(index) by PoolItem::IsValidID(index)
smatz <smatz@openttd.org>
parents:
11922
diff
changeset
|
467 if (!Company::IsValidID(company)) return INT64_MAX; |
11922
0a4b63f3f3c3
(svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents:
11730
diff
changeset
|
468 return Company::Get(company)->money; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
469 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
470 |
10624
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
471 /** |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
472 * Shortcut for the long DoCommandP when having a container with the data. |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
473 * @param container the container with information. |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
474 * @param my_cmd indicator if the command is from a company or server (to display error messages for a user) |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
475 * @return true if the command succeeded, else false |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
476 */ |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
477 bool DoCommandP(const CommandContainer *container, bool my_cmd) |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
478 { |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
479 return DoCommandP(container->tile, container->p1, container->p2, container->cmd, container->callback, container->text, my_cmd); |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
480 } |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
481 |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
482 /*! |
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
|
483 * Toplevel network safe docommand function for the current company. Must not be called recursively. |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
484 * The callback is called when the command succeeded or failed. The parameters |
14823
a6fd991f209d
(svn r19414) -Doc: Several doxygen additions and corrections.
alberth <alberth@openttd.org>
parents:
14645
diff
changeset
|
485 * \a tile, \a p1, and \a p2 are from the #CommandProc function. The parameter \a cmd is the command to execute. |
a6fd991f209d
(svn r19414) -Doc: Several doxygen additions and corrections.
alberth <alberth@openttd.org>
parents:
14645
diff
changeset
|
486 * The parameter \a my_cmd is used to indicate if the command is from a company or the server. |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
487 * |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
488 * @param tile The tile to perform a command on (see #CommandProc) |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
489 * @param p1 Additional data for the command (see #CommandProc) |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
490 * @param p2 Additional data for the command (see #CommandProc) |
10499
45ca88a8de7d
(svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents:
10237
diff
changeset
|
491 * @param cmd The command to execute (a CMD_* value) |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
492 * @param callback A callback function to call after the command is finished |
10499
45ca88a8de7d
(svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents:
10237
diff
changeset
|
493 * @param text The text to pass |
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
|
494 * @param my_cmd indicator if the command is from a company or server (to display error messages for a user) |
14823
a6fd991f209d
(svn r19414) -Doc: Several doxygen additions and corrections.
alberth <alberth@openttd.org>
parents:
14645
diff
changeset
|
495 * @return \c true if the command succeeded, else \c false. |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
496 */ |
10499
45ca88a8de7d
(svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents:
10237
diff
changeset
|
497 bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, bool my_cmd) |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
498 { |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
499 /* Cost estimation is generally only done when the |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
500 * local user presses shift while doing somthing. |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
501 * However, in case of incoming network commands, |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
502 * map generation of the pause button we do want |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
503 * to execute. */ |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
504 bool estimate_only = _shift_pressed && IsLocalCompany() && |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
505 !IsGeneratingWorld() && |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
506 !(cmd & CMD_NETWORK_COMMAND) && |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
507 (cmd & CMD_ID_MASK) != CMD_PAUSE; |
10605
32ba3eb6d7c9
(svn r14890) -Codechange: move the notest information into the command table.
rubidium <rubidium@openttd.org>
parents:
10604
diff
changeset
|
508 |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
509 /* We're only sending the command, so don't do |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
510 * fancy things for 'success'. */ |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
511 bool only_sending = _networking && !(cmd & CMD_NETWORK_COMMAND); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
512 |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
513 /* Where to show the message? */ |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
514 int x = TileX(tile) * TILE_SIZE; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
515 int y = TileY(tile) * TILE_SIZE; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
516 |
16696
5e2e046a1886
(svn r21428) -Fix [FS#4021]: vehicles could be built while the game it paused. Now you can enable or disable that with a setting
rubidium <rubidium@openttd.org>
parents:
16695
diff
changeset
|
517 if (_pause_mode != PM_UNPAUSED && !IsCommandAllowedWhilePaused(cmd)) { |
5e2e046a1886
(svn r21428) -Fix [FS#4021]: vehicles could be built while the game it paused. Now you can enable or disable that with a setting
rubidium <rubidium@openttd.org>
parents:
16695
diff
changeset
|
518 ShowErrorMessage(GB(cmd, 16, 16), STR_ERROR_NOT_ALLOWED_WHILE_PAUSED, WL_INFO, x, y); |
5e2e046a1886
(svn r21428) -Fix [FS#4021]: vehicles could be built while the game it paused. Now you can enable or disable that with a setting
rubidium <rubidium@openttd.org>
parents:
16695
diff
changeset
|
519 return false; |
5e2e046a1886
(svn r21428) -Fix [FS#4021]: vehicles could be built while the game it paused. Now you can enable or disable that with a setting
rubidium <rubidium@openttd.org>
parents:
16695
diff
changeset
|
520 } |
5e2e046a1886
(svn r21428) -Fix [FS#4021]: vehicles could be built while the game it paused. Now you can enable or disable that with a setting
rubidium <rubidium@openttd.org>
parents:
16695
diff
changeset
|
521 |
15860
bb167d01deb9
(svn r20542) -Codechange: generalise the setting of "p2" to the ClientID.
rubidium <rubidium@openttd.org>
parents:
15854
diff
changeset
|
522 #ifdef ENABLE_NETWORK |
15864
1ce9c097ee89
(svn r20546) -Fix (r20542): starting AIs shouldn't cause an assertion to trigger
rubidium <rubidium@openttd.org>
parents:
15860
diff
changeset
|
523 /* Only set p2 when the command does not come from the network. */ |
15865
270f9b0689cc
(svn r20547) -Change: the way order backups are performed. Now restoring an order doesn't require up to 765 commands.
rubidium <rubidium@openttd.org>
parents:
15864
diff
changeset
|
524 if (!(cmd & CMD_NETWORK_COMMAND) && GetCommandFlags(cmd) & CMD_CLIENT_ID && p2 == 0) p2 = CLIENT_ID_SERVER; |
15860
bb167d01deb9
(svn r20542) -Codechange: generalise the setting of "p2" to the ClientID.
rubidium <rubidium@openttd.org>
parents:
15854
diff
changeset
|
525 #endif |
bb167d01deb9
(svn r20542) -Codechange: generalise the setting of "p2" to the ClientID.
rubidium <rubidium@openttd.org>
parents:
15854
diff
changeset
|
526 |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
527 CommandCost res = DoCommandPInternal(tile, p1, p2, cmd, callback, text, my_cmd, estimate_only); |
14314
60d313b887b8
(svn r18866) -Codechange: remove the CmdFailed(ret)/CmdSucceeded(ret) wrapper functions
rubidium <rubidium@openttd.org>
parents:
14237
diff
changeset
|
528 if (res.Failed()) { |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
529 /* Only show the error when it's for us. */ |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
530 StringID error_part1 = GB(cmd, 16, 16); |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
531 if (estimate_only || (IsLocalCompany() && error_part1 != 0 && my_cmd)) { |
14828
80fbad0a9f77
(svn r19419) -Codechange: Use failed CommandCost object to retrieve message instead of _error_message.
alberth <alberth@openttd.org>
parents:
14824
diff
changeset
|
532 ShowErrorMessage(error_part1, res.GetErrorMessage(), WL_INFO, x, y); |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
533 } |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
534 } else if (estimate_only) { |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
535 ShowEstimatedCostOrIncome(res.GetCost(), x, y); |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
536 } else if (!only_sending && res.GetCost() != 0 && tile != 0 && IsLocalCompany() && _game_mode != GM_EDITOR) { |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
537 /* Only show the cost animation when we did actually |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
538 * execute the command, i.e. we're not sending it to |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
539 * the server, when it has cost the local company |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
540 * something. Furthermore in the editor there is no |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
541 * concept of cost, so don't show it there either. */ |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
542 ShowCostOrIncomeAnimation(x, y, GetSlopeZ(x, y), res.GetCost()); |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
543 } |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
544 |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
545 if (!estimate_only && !only_sending && callback != NULL) { |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
546 callback(res, tile, p1, p2); |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
547 } |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
548 |
14314
60d313b887b8
(svn r18866) -Codechange: remove the CmdFailed(ret)/CmdSucceeded(ret) wrapper functions
rubidium <rubidium@openttd.org>
parents:
14237
diff
changeset
|
549 return res.Succeeded(); |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
550 } |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
551 |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
552 |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
553 /** |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
554 * Helper to deduplicate the code for returning. |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
555 * @param cmd the command cost to return. |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
556 * @param clear whether to keep the storage changes or not. |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
557 */ |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
558 #define return_dcpi(cmd, clear) { _docommand_recursive = 0; ClearStorageChanges(clear); return cmd; } |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
559 |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
560 /*! |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
561 * Helper function for the toplevel network safe docommand function for the current company. |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
562 * |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
563 * @param tile The tile to perform a command on (see #CommandProc) |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
564 * @param p1 Additional data for the command (see #CommandProc) |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
565 * @param p2 Additional data for the command (see #CommandProc) |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
566 * @param cmd The command to execute (a CMD_* value) |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
567 * @param callback A callback function to call after the command is finished |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
568 * @param text The text to pass |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
569 * @param my_cmd indicator if the command is from a company or server (to display error messages for a user) |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
570 * @param estimate_only whether to give only the estimate or also execute the command |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
571 * @return the command cost of this function. |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
572 */ |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
573 CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, bool my_cmd, bool estimate_only) |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
574 { |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
575 /* Prevent recursion; it gives a mess over the network */ |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
576 assert(_docommand_recursive == 0); |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
577 _docommand_recursive = 1; |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
578 |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
579 /* Reset the state. */ |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
580 _additional_cash_required = 0; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
581 |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
582 /* Get pointer to command handler */ |
10604
ec12a7f3eef8
(svn r14889) -Codechange: replace some magic numbers with constants.
rubidium <rubidium@openttd.org>
parents:
10515
diff
changeset
|
583 byte cmd_id = cmd & CMD_ID_MASK; |
ec12a7f3eef8
(svn r14889) -Codechange: replace some magic numbers with constants.
rubidium <rubidium@openttd.org>
parents:
10515
diff
changeset
|
584 assert(cmd_id < lengthof(_command_proc_table)); |
10605
32ba3eb6d7c9
(svn r14890) -Codechange: move the notest information into the command table.
rubidium <rubidium@openttd.org>
parents:
10604
diff
changeset
|
585 |
32ba3eb6d7c9
(svn r14890) -Codechange: move the notest information into the command table.
rubidium <rubidium@openttd.org>
parents:
10604
diff
changeset
|
586 CommandProc *proc = _command_proc_table[cmd_id].proc; |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
587 /* Shouldn't happen, but you never know when someone adds |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
588 * NULLs to the _command_proc_table. */ |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
589 assert(proc != NULL); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
590 |
10605
32ba3eb6d7c9
(svn r14890) -Codechange: move the notest information into the command table.
rubidium <rubidium@openttd.org>
parents:
10604
diff
changeset
|
591 /* Command flags are used internally */ |
32ba3eb6d7c9
(svn r14890) -Codechange: move the notest information into the command table.
rubidium <rubidium@openttd.org>
parents:
10604
diff
changeset
|
592 uint cmd_flags = GetCommandFlags(cmd); |
10692
0b7e235f99df
(svn r15014) -Codechange: Add a helper function to get the needed DC_xxx flags from the result of GetCommandFlags().
frosch <frosch@openttd.org>
parents:
10626
diff
changeset
|
593 /* Flags get send to the DoCommand */ |
11090
df23c4e04638
(svn r15434) -Codechange: bit of type safety for the DC_xxx flags.
rubidium <rubidium@openttd.org>
parents:
11085
diff
changeset
|
594 DoCommandFlag flags = CommandFlagsToDCFlags(cmd_flags); |
7521
f5b39ff47e0e
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium <rubidium@openttd.org>
parents:
7506
diff
changeset
|
595 |
15860
bb167d01deb9
(svn r20542) -Codechange: generalise the setting of "p2" to the ClientID.
rubidium <rubidium@openttd.org>
parents:
15854
diff
changeset
|
596 #ifdef ENABLE_NETWORK |
bb167d01deb9
(svn r20542) -Codechange: generalise the setting of "p2" to the ClientID.
rubidium <rubidium@openttd.org>
parents:
15854
diff
changeset
|
597 /* Make sure p2 is properly set to a ClientID. */ |
bb167d01deb9
(svn r20542) -Codechange: generalise the setting of "p2" to the ClientID.
rubidium <rubidium@openttd.org>
parents:
15854
diff
changeset
|
598 assert(!(cmd_flags & CMD_CLIENT_ID) || p2 != 0); |
bb167d01deb9
(svn r20542) -Codechange: generalise the setting of "p2" to the ClientID.
rubidium <rubidium@openttd.org>
parents:
15854
diff
changeset
|
599 #endif |
bb167d01deb9
(svn r20542) -Codechange: generalise the setting of "p2" to the ClientID.
rubidium <rubidium@openttd.org>
parents:
15854
diff
changeset
|
600 |
10855
7881d9cd55ab
(svn r15190) -Feature: Allow terraforming of the tiles at the edges of the map.
Yexo <Yexo@openttd.org>
parents:
10707
diff
changeset
|
601 /* Do not even think about executing out-of-bounds tile-commands */ |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
602 if (tile != 0 && (tile >= MapSize() || (!IsValidTile(tile) && (cmd_flags & CMD_ALL_TILES) == 0))) return_dcpi(CMD_ERROR, false); |
10855
7881d9cd55ab
(svn r15190) -Feature: Allow terraforming of the tiles at the edges of the map.
Yexo <Yexo@openttd.org>
parents:
10707
diff
changeset
|
603 |
12029
e54c72d34d74
(svn r16436) -Codechange: always execute 'spectator'/'server' commands as spectator. This to reduce the difference between dedicated and non-dedicated servers and normal clients.
rubidium <rubidium@openttd.org>
parents:
12028
diff
changeset
|
604 /* Always execute server and spectator commands as spectator */ |
15370
a7ff8375c2c4
(svn r20013) -Fix [FS#3890]: silence some warnings / take the advice of the warnings into account
rubidium <rubidium@openttd.org>
parents:
15294
diff
changeset
|
605 bool exec_as_spectator = (cmd_flags & (CMD_SPECTATOR | CMD_SERVER)) != 0; |
12031
34d22b1974a4
(svn r16438) -Fix (r16436): set 'old_company' after modifying '_current_company'
smatz <smatz@openttd.org>
parents:
12029
diff
changeset
|
606 |
12028
1a9da6452071
(svn r16435) -Codechange: don't require the 'user company 0' hack for commands.
rubidium <rubidium@openttd.org>
parents:
12022
diff
changeset
|
607 /* If the company isn't valid it may only do server command or start a new company! |
1a9da6452071
(svn r16435) -Codechange: don't require the 'user company 0' hack for commands.
rubidium <rubidium@openttd.org>
parents:
12022
diff
changeset
|
608 * The server will ditch any server commands a client sends to it, so effectively |
1a9da6452071
(svn r16435) -Codechange: don't require the 'user company 0' hack for commands.
rubidium <rubidium@openttd.org>
parents:
12022
diff
changeset
|
609 * this guards the server from executing functions for an invalid company. */ |
15294
c3d64c33d3d4
(svn r19933) -Fix [FS#3804]: Keep _current_company and _local_company in sync during GUI operation.
frosch <frosch@openttd.org>
parents:
15172
diff
changeset
|
610 if (_game_mode == GM_NORMAL && !exec_as_spectator && !Company::IsValidID(_current_company)) { |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
611 return_dcpi(CMD_ERROR, false); |
12028
1a9da6452071
(svn r16435) -Codechange: don't require the 'user company 0' hack for commands.
rubidium <rubidium@openttd.org>
parents:
12022
diff
changeset
|
612 } |
10997
0692d0966f52
(svn r15337) -Fix: don't allow a spectating server to build stuff.
rubidium <rubidium@openttd.org>
parents:
10995
diff
changeset
|
613 |
15294
c3d64c33d3d4
(svn r19933) -Fix [FS#3804]: Keep _current_company and _local_company in sync during GUI operation.
frosch <frosch@openttd.org>
parents:
15172
diff
changeset
|
614 Backup<CompanyByte> cur_company(_current_company, FILE_LINE); |
c3d64c33d3d4
(svn r19933) -Fix [FS#3804]: Keep _current_company and _local_company in sync during GUI operation.
frosch <frosch@openttd.org>
parents:
15172
diff
changeset
|
615 if (exec_as_spectator) cur_company.Change(COMPANY_SPECTATOR); |
c3d64c33d3d4
(svn r19933) -Fix [FS#3804]: Keep _current_company and _local_company in sync during GUI operation.
frosch <frosch@openttd.org>
parents:
15172
diff
changeset
|
616 |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
617 bool test_and_exec_can_differ = (cmd_flags & CMD_NO_TEST) != 0; |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
618 bool skip_test = _networking && (cmd & CMD_NO_TEST_IF_IN_NETWORK) != 0; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
619 |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
620 /* Do we need to do a test run? |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
621 * Basically we need to always do this, except when |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
622 * the no-test-in-network flag is giving and we're |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
623 * in a network game (e.g. restoring orders would |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
624 * fail this test because the first order does not |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
625 * exist yet when inserting the second, giving that |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
626 * a wrong insert location and ignoring the command |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
627 * and thus breaking restoring). However, when we |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
628 * just want to do cost estimation we don't care |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
629 * because it's only done once anyway. */ |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
630 CommandCost res; |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
631 if (estimate_only || !skip_test) { |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
632 /* Test the command. */ |
16036
86c457462b35
(svn r20729) -Fix [FS#4107]: assert when overbuilding object
yexo <yexo@openttd.org>
parents:
15944
diff
changeset
|
633 _cleared_object_areas.Clear(); |
8442
1a90922472a6
(svn r12012) -Fix (r11795): Enable TownRatingTestMode during cost estimation with 'shift'-key.
frosch <frosch@openttd.org>
parents:
8306
diff
changeset
|
634 SetTownRatingTestMode(true); |
10499
45ca88a8de7d
(svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents:
10237
diff
changeset
|
635 res = proc(tile, flags, p1, p2, text); |
8442
1a90922472a6
(svn r12012) -Fix (r11795): Enable TownRatingTestMode during cost estimation with 'shift'-key.
frosch <frosch@openttd.org>
parents:
8306
diff
changeset
|
636 SetTownRatingTestMode(false); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
637 |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
638 /* Make sure we're not messing things up here. */ |
15294
c3d64c33d3d4
(svn r19933) -Fix [FS#3804]: Keep _current_company and _local_company in sync during GUI operation.
frosch <frosch@openttd.org>
parents:
15172
diff
changeset
|
639 assert(exec_as_spectator ? _current_company == COMPANY_SPECTATOR : cur_company.Verify()); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
640 |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
641 /* If the command fails, we're doing an estimate |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
642 * or the player does not have enough money |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
643 * (unless it's a command where the test and |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
644 * execution phase might return different costs) |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
645 * we bail out here. */ |
14314
60d313b887b8
(svn r18866) -Codechange: remove the CmdFailed(ret)/CmdSucceeded(ret) wrapper functions
rubidium <rubidium@openttd.org>
parents:
14237
diff
changeset
|
646 if (res.Failed() || estimate_only || |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
647 (!test_and_exec_can_differ && !CheckCompanyHasMoney(res))) { |
15294
c3d64c33d3d4
(svn r19933) -Fix [FS#3804]: Keep _current_company and _local_company in sync during GUI operation.
frosch <frosch@openttd.org>
parents:
15172
diff
changeset
|
648 cur_company.Restore(); |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
649 return_dcpi(res, false); |
14232
860ea22258ba
(svn r18783) -Codechange: make CheckCompanyHasMoney set an error on the CommandCost it tests when you don't have enough money instead of setting a global variable.
rubidium <rubidium@openttd.org>
parents:
14230
diff
changeset
|
650 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
651 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
652 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
653 #ifdef ENABLE_NETWORK |
12028
1a9da6452071
(svn r16435) -Codechange: don't require the 'user company 0' hack for commands.
rubidium <rubidium@openttd.org>
parents:
12022
diff
changeset
|
654 /* |
1a9da6452071
(svn r16435) -Codechange: don't require the 'user company 0' hack for commands.
rubidium <rubidium@openttd.org>
parents:
12022
diff
changeset
|
655 * If we are in network, and the command is not from the network |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
656 * send it to the command-queue and abort execution |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
657 */ |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
658 if (_networking && !(cmd & CMD_NETWORK_COMMAND)) { |
16628
20d6e821aaad
(svn r21358) -Codechange: make some network function names conform to coding style
rubidium <rubidium@openttd.org>
parents:
16547
diff
changeset
|
659 NetworkSendCommand(tile, p1, p2, cmd & ~CMD_FLAGS_MASK, callback, text, _current_company); |
15294
c3d64c33d3d4
(svn r19933) -Fix [FS#3804]: Keep _current_company and _local_company in sync during GUI operation.
frosch <frosch@openttd.org>
parents:
15172
diff
changeset
|
660 cur_company.Restore(); |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
661 |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
662 /* Don't return anything special here; no error, no costs. |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
663 * This way it's not handled by DoCommand and only the |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
664 * actual execution of the command causes messages. Also |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
665 * reset the storages as we've not executed the command. */ |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
666 return_dcpi(CommandCost(), false); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
667 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
668 #endif /* ENABLE_NETWORK */ |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
669 DEBUG(desync, 1, "cmd: %08x; %02x; %02x; %06x; %08x; %08x; %08x; \"%s\" (%s)", _date, _date_fract, (int)_current_company, tile, p1, p2, cmd & ~CMD_NETWORK_COMMAND, text, GetCommandName(cmd)); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
670 |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
671 /* Actually try and execute the command. If no cost-type is given |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
672 * use the construction one */ |
16036
86c457462b35
(svn r20729) -Fix [FS#4107]: assert when overbuilding object
yexo <yexo@openttd.org>
parents:
15944
diff
changeset
|
673 _cleared_object_areas.Clear(); |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
674 CommandCost res2 = proc(tile, flags | DC_EXEC, p1, p2, text); |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
675 |
15294
c3d64c33d3d4
(svn r19933) -Fix [FS#3804]: Keep _current_company and _local_company in sync during GUI operation.
frosch <frosch@openttd.org>
parents:
15172
diff
changeset
|
676 if (cmd_id == CMD_COMPANY_CTRL) { |
c3d64c33d3d4
(svn r19933) -Fix [FS#3804]: Keep _current_company and _local_company in sync during GUI operation.
frosch <frosch@openttd.org>
parents:
15172
diff
changeset
|
677 cur_company.Trash(); |
c3d64c33d3d4
(svn r19933) -Fix [FS#3804]: Keep _current_company and _local_company in sync during GUI operation.
frosch <frosch@openttd.org>
parents:
15172
diff
changeset
|
678 /* We are a new company -> Switch to new local company. |
c3d64c33d3d4
(svn r19933) -Fix [FS#3804]: Keep _current_company and _local_company in sync during GUI operation.
frosch <frosch@openttd.org>
parents:
15172
diff
changeset
|
679 * We were closed down -> Switch to spectator |
c3d64c33d3d4
(svn r19933) -Fix [FS#3804]: Keep _current_company and _local_company in sync during GUI operation.
frosch <frosch@openttd.org>
parents:
15172
diff
changeset
|
680 * Some other company opened/closed down -> The outside function will switch back */ |
c3d64c33d3d4
(svn r19933) -Fix [FS#3804]: Keep _current_company and _local_company in sync during GUI operation.
frosch <frosch@openttd.org>
parents:
15172
diff
changeset
|
681 _current_company = _local_company; |
c3d64c33d3d4
(svn r19933) -Fix [FS#3804]: Keep _current_company and _local_company in sync during GUI operation.
frosch <frosch@openttd.org>
parents:
15172
diff
changeset
|
682 } else { |
c3d64c33d3d4
(svn r19933) -Fix [FS#3804]: Keep _current_company and _local_company in sync during GUI operation.
frosch <frosch@openttd.org>
parents:
15172
diff
changeset
|
683 /* Make sure nothing bad happened, like changing the current company. */ |
c3d64c33d3d4
(svn r19933) -Fix [FS#3804]: Keep _current_company and _local_company in sync during GUI operation.
frosch <frosch@openttd.org>
parents:
15172
diff
changeset
|
684 assert(exec_as_spectator ? _current_company == COMPANY_SPECTATOR : cur_company.Verify()); |
c3d64c33d3d4
(svn r19933) -Fix [FS#3804]: Keep _current_company and _local_company in sync during GUI operation.
frosch <frosch@openttd.org>
parents:
15172
diff
changeset
|
685 cur_company.Restore(); |
c3d64c33d3d4
(svn r19933) -Fix [FS#3804]: Keep _current_company and _local_company in sync during GUI operation.
frosch <frosch@openttd.org>
parents:
15172
diff
changeset
|
686 } |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
687 |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
688 /* If the test and execution can differ, or we skipped the test |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
689 * we have to check the return of the command. Otherwise we can |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
690 * check whether the test and execution have yielded the same |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
691 * result, i.e. cost and error state are the same. */ |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
692 if (!test_and_exec_can_differ && !skip_test) { |
14314
60d313b887b8
(svn r18866) -Codechange: remove the CmdFailed(ret)/CmdSucceeded(ret) wrapper functions
rubidium <rubidium@openttd.org>
parents:
14237
diff
changeset
|
693 assert(res.GetCost() == res2.GetCost() && res.Failed() == res2.Failed()); // sanity check |
60d313b887b8
(svn r18866) -Codechange: remove the CmdFailed(ret)/CmdSucceeded(ret) wrapper functions
rubidium <rubidium@openttd.org>
parents:
14237
diff
changeset
|
694 } else if (res2.Failed()) { |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
695 return_dcpi(res2, false); |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
696 } |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
697 |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
698 /* If we're needing more money and we haven't done |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
699 * anything yet, ask for the money! */ |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
700 if (_additional_cash_required != 0 && res2.GetCost() == 0) { |
15046
01f8db5ece32
(svn r19663) -Fix: in rare cases, update of signals could be missed
smatz <smatz@openttd.org>
parents:
14991
diff
changeset
|
701 /* It could happen we removed rail, thus gained money, and deleted something else. |
01f8db5ece32
(svn r19663) -Fix: in rare cases, update of signals could be missed
smatz <smatz@openttd.org>
parents:
14991
diff
changeset
|
702 * So make sure the signal buffer is empty even in this case */ |
01f8db5ece32
(svn r19663) -Fix: in rare cases, update of signals could be missed
smatz <smatz@openttd.org>
parents:
14991
diff
changeset
|
703 UpdateSignalsInBuffer(); |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
704 SetDParam(0, _additional_cash_required); |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
705 return_dcpi(CommandCost(STR_ERROR_NOT_ENOUGH_CASH_REQUIRES_CURRENCY), false); |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
706 } |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
707 |
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
|
708 /* update last build coordinate of company. */ |
11949
c89301974eb8
(svn r16352) -Codechange: use PoolItem::GetIfValid() instead of PoolItem::IsValidID() and PoolItem::Get()
smatz <smatz@openttd.org>
parents:
11924
diff
changeset
|
709 if (tile != 0) { |
c89301974eb8
(svn r16352) -Codechange: use PoolItem::GetIfValid() instead of PoolItem::IsValidID() and PoolItem::Get()
smatz <smatz@openttd.org>
parents:
11924
diff
changeset
|
710 Company *c = Company::GetIfValid(_current_company); |
c89301974eb8
(svn r16352) -Codechange: use PoolItem::GetIfValid() instead of PoolItem::IsValidID() and PoolItem::Get()
smatz <smatz@openttd.org>
parents:
11924
diff
changeset
|
711 if (c != NULL) c->last_build_coordinate = tile; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
712 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
713 |
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
|
714 SubtractMoneyFromCompany(res2); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
715 |
8306
ea2c123b3655
(svn r11871) -Fix [FS#1074]: do not update signals after each tile when building/removing a large block of track/signals/station
smatz <smatz@openttd.org>
parents:
8275
diff
changeset
|
716 /* update signals if needed */ |
ea2c123b3655
(svn r11871) -Fix [FS#1074]: do not update signals after each tile when building/removing a large block of track/signals/station
smatz <smatz@openttd.org>
parents:
8275
diff
changeset
|
717 UpdateSignalsInBuffer(); |
ea2c123b3655
(svn r11871) -Fix [FS#1074]: do not update signals after each tile when building/removing a large block of track/signals/station
smatz <smatz@openttd.org>
parents:
8275
diff
changeset
|
718 |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
719 return_dcpi(res2, true); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
720 } |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
721 #undef return_dcpi |
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
|
722 |
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
|
723 |
14557
b1b3804dd055
(svn r19128) -Codechange: CommandCost cost methods return void instead of a copy of *this.
alberth <alberth@openttd.org>
parents:
14418
diff
changeset
|
724 /** |
b1b3804dd055
(svn r19128) -Codechange: CommandCost cost methods return void instead of a copy of *this.
alberth <alberth@openttd.org>
parents:
14418
diff
changeset
|
725 * Adds the cost of the given command return value to this cost. |
b1b3804dd055
(svn r19128) -Codechange: CommandCost cost methods return void instead of a copy of *this.
alberth <alberth@openttd.org>
parents:
14418
diff
changeset
|
726 * Also takes a possible error message when it is set. |
b1b3804dd055
(svn r19128) -Codechange: CommandCost cost methods return void instead of a copy of *this.
alberth <alberth@openttd.org>
parents:
14418
diff
changeset
|
727 * @param ret The command to add the cost of. |
b1b3804dd055
(svn r19128) -Codechange: CommandCost cost methods return void instead of a copy of *this.
alberth <alberth@openttd.org>
parents:
14418
diff
changeset
|
728 */ |
14559
14735f06c670
(svn r19130) -Codechange: Use references and inlining in CommandCost.
alberth <alberth@openttd.org>
parents:
14557
diff
changeset
|
729 void CommandCost::AddCost(const CommandCost &ret) |
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
|
730 { |
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
|
731 this->AddCost(ret.cost); |
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
|
732 if (this->success && !ret.success) { |
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
|
733 this->message = ret.message; |
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
|
734 this->success = false; |
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
|
735 } |
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
|
736 } |