Mercurial > hg > openttd
annotate src/command.cpp @ 15944:d1aa55b7ebcf draft
(svn r20632) -Cleanup: remove "a few" unneeded includes, and add them to some headers
author | rubidium <rubidium@openttd.org> |
---|---|
date | Thu, 26 Aug 2010 22:01:16 +0000 |
parents | 270f9b0689cc |
children | 86c457462b35 |
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" |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
13 #include "openttd.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
|
14 #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
|
15 #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
|
16 #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
|
17 #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
|
18 #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
|
19 #include "genworld.h" |
7609
9e4c3b886ccb
(svn r11138) -Codechange: prepare some subsystems for persistent storage for NewGRFs.
rubidium <rubidium@openttd.org>
parents:
7559
diff
changeset
|
20 #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
|
21 #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
|
22 #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
|
23 #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
|
24 #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
|
25 #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
|
26 #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
|
27 #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
|
28 #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
|
29 #include "core/backup_type.hpp" |
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; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
85 |
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
|
86 CommandProc CmdSendTrainToDepot; |
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 CmdSendAircraftToHangar; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
117 |
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
|
118 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
|
119 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
|
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 CmdSendRoadVehToDepot; |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
122 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
|
123 |
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
|
124 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
|
125 |
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
|
126 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
|
127 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
|
128 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
|
129 |
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
|
130 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
|
131 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
|
132 CommandProc CmdDoTownAction; |
15657
ddfeab1a0a88
(svn r20322) -Codechange: Move Expand town code to a command.
terkhen <terkhen@openttd.org>
parents:
15370
diff
changeset
|
133 CommandProc CmdExpandTown; |
15658
52010e085f5e
(svn r20323) -Codechange: Move Delete town code to a command.
terkhen <terkhen@openttd.org>
parents:
15657
diff
changeset
|
134 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
|
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 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
|
137 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
|
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 CmdSendShipToDepot; |
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 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
|
142 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
|
143 |
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
|
144 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
|
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 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
|
147 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
|
148 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
|
149 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
|
150 |
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
|
151 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
|
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 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
|
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 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
|
156 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
|
157 |
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
|
158 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
|
159 |
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
|
160 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
|
161 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
|
162 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
|
163 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
|
164 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
|
165 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
|
166 |
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
|
167 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
|
168 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
|
169 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
|
170 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
|
171 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
|
172 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
|
173 CommandProc CmdSetGroupReplaceProtection; |
6667
12d521513434
(svn r9898) -Fix (r9874): Many...
peter1138 <peter1138@openttd.org>
parents:
6643
diff
changeset
|
174 |
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
|
175 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
|
176 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
|
177 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
|
178 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
|
179 CommandProc CmdSetTimetableStart; |
6832
17319fb8c1c3
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium <rubidium@openttd.org>
parents:
6794
diff
changeset
|
180 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
181 #define DEF_CMD(proc, flags) {proc, #proc, flags} |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
182 |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
183 /** |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
184 * The master command table |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
185 * |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
186 * 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
|
187 * 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
|
188 * 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
|
189 */ |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
190 static const Command _command_proc_table[] = { |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
191 DEF_CMD(CmdBuildRailroadTrack, CMD_NO_WATER | CMD_AUTO), // CMD_BUILD_RAILROAD_TRACK |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
192 DEF_CMD(CmdRemoveRailroadTrack, CMD_AUTO), // CMD_REMOVE_RAILROAD_TRACK |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
193 DEF_CMD(CmdBuildSingleRail, CMD_NO_WATER | CMD_AUTO), // CMD_BUILD_SINGLE_RAIL |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
194 DEF_CMD(CmdRemoveSingleRail, CMD_AUTO), // CMD_REMOVE_SINGLE_RAIL |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
195 DEF_CMD(CmdLandscapeClear, 0), // CMD_LANDSCAPE_CLEAR |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
196 DEF_CMD(CmdBuildBridge, CMD_AUTO), // CMD_BUILD_BRIDGE |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
197 DEF_CMD(CmdBuildRailStation, CMD_NO_WATER | CMD_AUTO), // CMD_BUILD_RAIL_STATION |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
198 DEF_CMD(CmdBuildTrainDepot, CMD_NO_WATER | CMD_AUTO), // CMD_BUILD_TRAIN_DEPOT |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
199 DEF_CMD(CmdBuildSingleSignal, CMD_AUTO), // CMD_BUILD_SIGNALS |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
200 DEF_CMD(CmdRemoveSingleSignal, CMD_AUTO), // CMD_REMOVE_SIGNALS |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
201 DEF_CMD(CmdTerraformLand, CMD_ALL_TILES | CMD_AUTO), // CMD_TERRAFORM_LAND |
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
|
202 DEF_CMD(CmdBuildObject, CMD_NO_WATER | CMD_AUTO), // CMD_BUILD_OBJECT |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
203 DEF_CMD(CmdBuildTunnel, CMD_AUTO), // CMD_BUILD_TUNNEL |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
204 DEF_CMD(CmdRemoveFromRailStation, 0), // CMD_REMOVE_FROM_RAIL_STATION |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
205 DEF_CMD(CmdConvertRail, 0), // CMD_CONVERT_RAILD |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
206 DEF_CMD(CmdBuildRailWaypoint, 0), // CMD_BUILD_RAIL_WAYPOINT |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
207 DEF_CMD(CmdRenameWaypoint, 0), // CMD_RENAME_WAYPOINT |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
208 DEF_CMD(CmdRemoveFromRailWaypoint, 0), // 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
|
209 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
210 DEF_CMD(CmdBuildRoadStop, CMD_NO_WATER | CMD_AUTO), // CMD_BUILD_ROAD_STOP |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
211 DEF_CMD(CmdRemoveRoadStop, 0), // CMD_REMOVE_ROAD_STOP |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
212 DEF_CMD(CmdBuildLongRoad, CMD_NO_WATER | CMD_AUTO), // CMD_BUILD_LONG_ROAD |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
213 DEF_CMD(CmdRemoveLongRoad, CMD_NO_TEST | CMD_AUTO), // 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. |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
214 DEF_CMD(CmdBuildRoad, CMD_NO_WATER | CMD_AUTO), // CMD_BUILD_ROAD |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
215 DEF_CMD(CmdBuildRoadDepot, CMD_NO_WATER | CMD_AUTO), // 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
|
216 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
217 DEF_CMD(CmdBuildAirport, CMD_NO_WATER | CMD_AUTO), // CMD_BUILD_AIRPORT |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
218 DEF_CMD(CmdBuildDock, CMD_AUTO), // CMD_BUILD_DOCK |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
219 DEF_CMD(CmdBuildShipDepot, CMD_AUTO), // CMD_BUILD_SHIP_DEPOT |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
220 DEF_CMD(CmdBuildBuoy, CMD_AUTO), // CMD_BUILD_BUOY |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
221 DEF_CMD(CmdPlantTree, CMD_AUTO), // CMD_PLANT_TREE |
15854
43d172eac154
(svn r20536) -Codechange: unify the refitting of vehicles
rubidium <rubidium@openttd.org>
parents:
15850
diff
changeset
|
222 |
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
|
223 DEF_CMD(CmdBuildVehicle, CMD_CLIENT_ID), // CMD_BUILD_VEHICLE |
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
|
224 DEF_CMD(CmdSellVehicle, CMD_CLIENT_ID), // CMD_SELL_VEHICLE |
15854
43d172eac154
(svn r20536) -Codechange: unify the refitting of vehicles
rubidium <rubidium@openttd.org>
parents:
15850
diff
changeset
|
225 DEF_CMD(CmdRefitVehicle, 0), // CMD_REFIT_VEHICLE |
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 |
15850
efc03d77eb93
(svn r20532) -Codechange: unify selling of vehicles a bit
rubidium <rubidium@openttd.org>
parents:
15849
diff
changeset
|
227 DEF_CMD(CmdMoveRailVehicle, 0), // CMD_MOVE_RAIL_VEHICLE |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
228 DEF_CMD(CmdSendTrainToDepot, 0), // CMD_SEND_TRAIN_TO_DEPOT |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
229 DEF_CMD(CmdForceTrainProceed, 0), // CMD_FORCE_TRAIN_PROCEED |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
230 DEF_CMD(CmdReverseTrainDirection, 0), // 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
|
231 |
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
|
232 DEF_CMD(CmdClearOrderBackup, CMD_CLIENT_ID), // CMD_CLEAR_ORDER_BACKUP |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
233 DEF_CMD(CmdModifyOrder, 0), // CMD_MODIFY_ORDER |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
234 DEF_CMD(CmdSkipToOrder, 0), // CMD_SKIP_TO_ORDER |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
235 DEF_CMD(CmdDeleteOrder, 0), // CMD_DELETE_ORDER |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
236 DEF_CMD(CmdInsertOrder, 0), // 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
|
237 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
238 DEF_CMD(CmdChangeServiceInt, 0), // 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
|
239 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
240 DEF_CMD(CmdBuildIndustry, 0), // CMD_BUILD_INDUSTRY |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
241 DEF_CMD(CmdSetCompanyManagerFace, 0), // CMD_SET_COMPANY_MANAGER_FACE |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
242 DEF_CMD(CmdSetCompanyColour, 0), // 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
|
243 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
244 DEF_CMD(CmdIncreaseLoan, 0), // CMD_INCREASE_LOAN |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
245 DEF_CMD(CmdDecreaseLoan, 0), // 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
|
246 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
247 DEF_CMD(CmdWantEnginePreview, 0), // 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
|
248 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
249 DEF_CMD(CmdRenameVehicle, 0), // CMD_RENAME_VEHICLE |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
250 DEF_CMD(CmdRenameEngine, 0), // 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
|
251 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
252 DEF_CMD(CmdRenameCompany, 0), // CMD_RENAME_COMPANY |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
253 DEF_CMD(CmdRenamePresident, 0), // 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
|
254 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
255 DEF_CMD(CmdRenameStation, 0), // CMD_RENAME_STATION |
15172
e9741bd69a65
(svn r19801) -Add [FS#3691]: custom naming of depots. Based on work by sbr
rubidium <rubidium@openttd.org>
parents:
15046
diff
changeset
|
256 DEF_CMD(CmdRenameDepot, 0), // 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
|
257 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
258 DEF_CMD(CmdSendAircraftToHangar, 0), // CMD_SEND_AIRCRAFT_TO_HANGAR |
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
|
259 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
260 DEF_CMD(CmdPlaceSign, 0), // CMD_PLACE_SIGN |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
261 DEF_CMD(CmdRenameSign, 0), // 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
|
262 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
263 DEF_CMD(CmdSendRoadVehToDepot, 0), // CMD_SEND_ROADVEH_TO_DEPOT |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
264 DEF_CMD(CmdTurnRoadVeh, 0), // 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
|
265 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
266 DEF_CMD(CmdPause, CMD_SERVER), // CMD_PAUSE |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
267 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
268 DEF_CMD(CmdBuyShareInCompany, 0), // CMD_BUY_SHARE_IN_COMPANY |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
269 DEF_CMD(CmdSellShareInCompany, 0), // CMD_SELL_SHARE_IN_COMPANY |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
270 DEF_CMD(CmdBuyCompany, 0), // 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
|
271 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
272 DEF_CMD(CmdFoundTown, CMD_NO_TEST), // CMD_FOUND_TOWN; founding random town can fail only in exec run |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
273 DEF_CMD(CmdRenameTown, CMD_SERVER), // CMD_RENAME_TOWN |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
274 DEF_CMD(CmdDoTownAction, 0), // CMD_DO_TOWN_ACTION |
15657
ddfeab1a0a88
(svn r20322) -Codechange: Move Expand town code to a command.
terkhen <terkhen@openttd.org>
parents:
15370
diff
changeset
|
275 DEF_CMD(CmdExpandTown, CMD_OFFLINE), // CMD_EXPAND_TOWN |
15658
52010e085f5e
(svn r20323) -Codechange: Move Delete town code to a command.
terkhen <terkhen@openttd.org>
parents:
15657
diff
changeset
|
276 DEF_CMD(CmdDeleteTown, CMD_OFFLINE), // 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
|
277 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
278 DEF_CMD(CmdSendShipToDepot, 0), // CMD_SEND_SHIP_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
|
279 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
280 DEF_CMD(CmdOrderRefit, 0), // CMD_ORDER_REFIT |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
281 DEF_CMD(CmdCloneOrder, 0), // 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
|
282 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
283 DEF_CMD(CmdClearArea, CMD_NO_TEST), // 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
|
284 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
285 DEF_CMD(CmdMoneyCheat, CMD_OFFLINE), // CMD_MONEY_CHEAT |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
286 DEF_CMD(CmdBuildCanal, CMD_AUTO), // CMD_BUILD_CANAL |
15860
bb167d01deb9
(svn r20542) -Codechange: generalise the setting of "p2" to the ClientID.
rubidium <rubidium@openttd.org>
parents:
15854
diff
changeset
|
287 DEF_CMD(CmdCompanyCtrl, CMD_SPECTATOR | CMD_CLIENT_ID), // 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
|
288 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
289 DEF_CMD(CmdLevelLand, CMD_ALL_TILES | CMD_NO_TEST | CMD_AUTO), // 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
|
290 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
291 DEF_CMD(CmdBuildLock, CMD_AUTO), // 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
|
292 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
293 DEF_CMD(CmdBuildSignalTrack, CMD_AUTO), // CMD_BUILD_SIGNAL_TRACK |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
294 DEF_CMD(CmdRemoveSignalTrack, CMD_AUTO), // 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
|
295 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
296 DEF_CMD(CmdGiveMoney, 0), // CMD_GIVE_MONEY |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
297 DEF_CMD(CmdChangeSetting, CMD_SERVER), // CMD_CHANGE_SETTING |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
298 DEF_CMD(CmdChangeCompanySetting, 0), // CMD_CHANGE_COMPANY_SETTING |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
299 DEF_CMD(CmdSetAutoReplace, 0), // CMD_SET_AUTOREPLACE |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
300 DEF_CMD(CmdCloneVehicle, CMD_NO_TEST), // CMD_CLONE_VEHICLE; NewGRF callbacks influence building and refitting making it impossible to correctly estimate the cost |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
301 DEF_CMD(CmdStartStopVehicle, 0), // CMD_START_STOP_VEHICLE |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
302 DEF_CMD(CmdMassStartStopVehicle, 0), // CMD_MASS_START_STOP |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
303 DEF_CMD(CmdAutoreplaceVehicle, 0), // CMD_AUTOREPLACE_VEHICLE |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
304 DEF_CMD(CmdDepotSellAllVehicles, 0), // CMD_DEPOT_SELL_ALL_VEHICLES |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
305 DEF_CMD(CmdDepotMassAutoReplace, 0), // CMD_DEPOT_MASS_AUTOREPLACE |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
306 DEF_CMD(CmdCreateGroup, 0), // CMD_CREATE_GROUP |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
307 DEF_CMD(CmdDeleteGroup, 0), // CMD_DELETE_GROUP |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
308 DEF_CMD(CmdRenameGroup, 0), // CMD_RENAME_GROUP |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
309 DEF_CMD(CmdAddVehicleGroup, 0), // CMD_ADD_VEHICLE_GROUP |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
310 DEF_CMD(CmdAddSharedVehicleGroup, 0), // CMD_ADD_SHARE_VEHICLE_GROUP |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
311 DEF_CMD(CmdRemoveAllVehiclesGroup, 0), // CMD_REMOVE_ALL_VEHICLES_GROUP |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
312 DEF_CMD(CmdSetGroupReplaceProtection, 0), // CMD_SET_GROUP_REPLACE_PROTECTION |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
313 DEF_CMD(CmdMoveOrder, 0), // CMD_MOVE_ORDER |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
314 DEF_CMD(CmdChangeTimetable, 0), // CMD_CHANGE_TIMETABLE |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
315 DEF_CMD(CmdSetVehicleOnTime, 0), // CMD_SET_VEHICLE_ON_TIME |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
316 DEF_CMD(CmdAutofillTimetable, 0), // CMD_AUTOFILL_TIMETABLE |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
317 DEF_CMD(CmdSetTimetableStart, 0), // 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
|
318 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
319 |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
320 /*! |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
321 * 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
|
322 * |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
323 * @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
|
324 * @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
|
325 */ |
10237
d39d46dc7057
(svn r14465) -Codechange: minor code style of command.cpp.
rubidium <rubidium@openttd.org>
parents:
10225
diff
changeset
|
326 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
|
327 { |
10604
ec12a7f3eef8
(svn r14889) -Codechange: replace some magic numbers with constants.
rubidium <rubidium@openttd.org>
parents:
10515
diff
changeset
|
328 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
|
329 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
330 return |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
331 cmd < lengthof(_command_proc_table) && |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
332 _command_proc_table[cmd].proc != NULL; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
333 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
334 |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
335 /*! |
10604
ec12a7f3eef8
(svn r14889) -Codechange: replace some magic numbers with constants.
rubidium <rubidium@openttd.org>
parents:
10515
diff
changeset
|
336 * 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
|
337 * 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
|
338 * |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
339 * @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
|
340 * @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
|
341 */ |
10237
d39d46dc7057
(svn r14465) -Codechange: minor code style of command.cpp.
rubidium <rubidium@openttd.org>
parents:
10225
diff
changeset
|
342 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
|
343 { |
10237
d39d46dc7057
(svn r14465) -Codechange: minor code style of command.cpp.
rubidium <rubidium@openttd.org>
parents:
10225
diff
changeset
|
344 assert(IsValidCommand(cmd)); |
d39d46dc7057
(svn r14465) -Codechange: minor code style of command.cpp.
rubidium <rubidium@openttd.org>
parents:
10225
diff
changeset
|
345 |
10604
ec12a7f3eef8
(svn r14889) -Codechange: replace some magic numbers with constants.
rubidium <rubidium@openttd.org>
parents:
10515
diff
changeset
|
346 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
|
347 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
348 |
14991
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 * 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
|
351 * 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
|
352 * |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
353 * @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
|
354 * @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
|
355 */ |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
356 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
|
357 { |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
358 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
|
359 |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
360 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
|
361 } |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
362 |
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
|
363 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
|
364 |
10624
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
365 /** |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
366 * 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
|
367 * |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
368 * @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
|
369 * @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
|
370 * @see CommandProc |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
371 * @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
|
372 */ |
11090
df23c4e04638
(svn r15434) -Codechange: bit of type safety for the DC_xxx flags.
rubidium <rubidium@openttd.org>
parents:
11085
diff
changeset
|
373 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
|
374 { |
10626
3189a053f43a
(svn r14919) -Feature: distant joining of stations (Frostregen and PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10624
diff
changeset
|
375 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
|
376 } |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
377 |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
378 /*! |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
379 * 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
|
380 * 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
|
381 * |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
382 * @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
|
383 * @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
|
384 * @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
|
385 * @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
|
386 * @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
|
387 * @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
|
388 * @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
|
389 * @return the cost |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
390 */ |
11090
df23c4e04638
(svn r15434) -Codechange: bit of type safety for the DC_xxx flags.
rubidium <rubidium@openttd.org>
parents:
11085
diff
changeset
|
391 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
|
392 { |
6943
fd42cb9816c6
(svn r10197) -Codechange: replace int32 with CommandCost where appropriate.
rubidium <rubidium@openttd.org>
parents:
6832
diff
changeset
|
393 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
|
394 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
395 /* 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
|
396 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
|
397 |
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
|
398 /* 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
|
399 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
|
400 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
401 _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
|
402 |
6123
595dc16a6fd8
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas <belugas@openttd.org>
parents:
6012
diff
changeset
|
403 /* 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
|
404 if (_docommand_recursive == 1 || !(flags & DC_EXEC) ) { |
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
|
405 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
|
406 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
|
407 SetTownRatingTestMode(false); |
14314
60d313b887b8
(svn r18866) -Codechange: remove the CmdFailed(ret)/CmdSucceeded(ret) wrapper functions
rubidium <rubidium@openttd.org>
parents:
14237
diff
changeset
|
408 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
|
409 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
|
410 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
411 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
412 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
|
413 !(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
|
414 !(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
|
415 !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
|
416 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
|
417 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
418 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
419 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
|
420 _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
|
421 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
|
422 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
423 } |
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 /* 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
|
426 * themselves to the cost object at some point */ |
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
|
427 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
|
428 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
|
429 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
|
430 _docommand_recursive--; |
14824
fa89f804ec0f
(svn r19415) -Codechange: Forward CommandCost with an error back to the caller.
alberth <alberth@openttd.org>
parents:
14823
diff
changeset
|
431 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
|
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 |
6123
595dc16a6fd8
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas <belugas@openttd.org>
parents:
6012
diff
changeset
|
434 /* 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
|
435 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
|
436 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
|
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 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
|
440 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
441 |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
442 /*! |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
443 * 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
|
444 * 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
|
445 * 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
|
446 * |
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
|
447 * @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
|
448 */ |
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
|
449 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
|
450 { |
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 CompanyID company = _current_company; |
11924
fccc9cea27a7
(svn r16327) -Codechange: replace IsValidPoolItemID(index) by PoolItem::IsValidID(index)
smatz <smatz@openttd.org>
parents:
11922
diff
changeset
|
452 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
|
453 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
|
454 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
455 |
10624
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
456 /** |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
457 * 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
|
458 * @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
|
459 * @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
|
460 * @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
|
461 */ |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
462 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
|
463 { |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
464 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
|
465 } |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
466 |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
467 /*! |
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
|
468 * 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
|
469 * 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
|
470 * \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
|
471 * 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
|
472 * |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
473 * @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
|
474 * @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
|
475 * @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
|
476 * @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
|
477 * @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
|
478 * @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
|
479 * @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
|
480 * @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
|
481 */ |
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
|
482 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
|
483 { |
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
|
484 /* 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
|
485 * 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
|
486 * 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
|
487 * 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
|
488 * 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
|
489 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
|
490 !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
|
491 !(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
|
492 (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
|
493 |
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
|
494 /* 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
|
495 * 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
|
496 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
|
497 |
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
|
498 /* 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
|
499 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
|
500 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
|
501 |
15860
bb167d01deb9
(svn r20542) -Codechange: generalise the setting of "p2" to the ClientID.
rubidium <rubidium@openttd.org>
parents:
15854
diff
changeset
|
502 #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
|
503 /* 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
|
504 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
|
505 #endif |
bb167d01deb9
(svn r20542) -Codechange: generalise the setting of "p2" to the ClientID.
rubidium <rubidium@openttd.org>
parents:
15854
diff
changeset
|
506 |
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
|
507 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
|
508 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
|
509 /* 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
|
510 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
|
511 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
|
512 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
|
513 } |
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
|
514 } 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
|
515 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
|
516 } 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
|
517 /* 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
|
518 * 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
|
519 * 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
|
520 * 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
|
521 * 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
|
522 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
|
523 } |
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
|
524 |
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
|
525 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
|
526 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
|
527 } |
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
|
528 |
14314
60d313b887b8
(svn r18866) -Codechange: remove the CmdFailed(ret)/CmdSucceeded(ret) wrapper functions
rubidium <rubidium@openttd.org>
parents:
14237
diff
changeset
|
529 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
|
530 } |
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 |
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
|
532 |
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 * 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
|
535 * @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
|
536 * @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
|
537 */ |
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 #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
|
539 |
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 /*! |
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 * 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
|
542 * |
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 * @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
|
544 * @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
|
545 * @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
|
546 * @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
|
547 * @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
|
548 * @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
|
549 * @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
|
550 * @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
|
551 * @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
|
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 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
|
554 { |
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 /* 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
|
556 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
|
557 _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
|
558 |
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 /* 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
|
560 _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
|
561 |
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
|
562 /* Get pointer to command handler */ |
10604
ec12a7f3eef8
(svn r14889) -Codechange: replace some magic numbers with constants.
rubidium <rubidium@openttd.org>
parents:
10515
diff
changeset
|
563 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
|
564 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
|
565 |
32ba3eb6d7c9
(svn r14890) -Codechange: move the notest information into the command table.
rubidium <rubidium@openttd.org>
parents:
10604
diff
changeset
|
566 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
|
567 /* 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
|
568 * 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
|
569 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
|
570 |
10605
32ba3eb6d7c9
(svn r14890) -Codechange: move the notest information into the command table.
rubidium <rubidium@openttd.org>
parents:
10604
diff
changeset
|
571 /* 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
|
572 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
|
573 /* 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
|
574 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
|
575 |
15860
bb167d01deb9
(svn r20542) -Codechange: generalise the setting of "p2" to the ClientID.
rubidium <rubidium@openttd.org>
parents:
15854
diff
changeset
|
576 #ifdef ENABLE_NETWORK |
bb167d01deb9
(svn r20542) -Codechange: generalise the setting of "p2" to the ClientID.
rubidium <rubidium@openttd.org>
parents:
15854
diff
changeset
|
577 /* 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
|
578 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
|
579 #endif |
bb167d01deb9
(svn r20542) -Codechange: generalise the setting of "p2" to the ClientID.
rubidium <rubidium@openttd.org>
parents:
15854
diff
changeset
|
580 |
10855
7881d9cd55ab
(svn r15190) -Feature: Allow terraforming of the tiles at the edges of the map.
Yexo <Yexo@openttd.org>
parents:
10707
diff
changeset
|
581 /* 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
|
582 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
|
583 |
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
|
584 /* 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
|
585 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
|
586 |
12028
1a9da6452071
(svn r16435) -Codechange: don't require the 'user company 0' hack for commands.
rubidium <rubidium@openttd.org>
parents:
12022
diff
changeset
|
587 /* 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
|
588 * 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
|
589 * 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
|
590 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
|
591 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
|
592 } |
10997
0692d0966f52
(svn r15337) -Fix: don't allow a spectating server to build stuff.
rubidium <rubidium@openttd.org>
parents:
10995
diff
changeset
|
593 |
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
|
594 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
|
595 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
|
596 |
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
|
597 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
|
598 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
|
599 |
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
|
600 /* 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
|
601 * 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
|
602 * 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
|
603 * 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
|
604 * 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
|
605 * 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
|
606 * 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
|
607 * 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
|
608 * 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
|
609 * 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
|
610 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
|
611 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
|
612 /* Test the command. */ |
8442
1a90922472a6
(svn r12012) -Fix (r11795): Enable TownRatingTestMode during cost estimation with 'shift'-key.
frosch <frosch@openttd.org>
parents:
8306
diff
changeset
|
613 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
|
614 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
|
615 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
|
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 /* 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
|
618 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
|
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 /* 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
|
621 * 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
|
622 * (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
|
623 * 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
|
624 * 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
|
625 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
|
626 (!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
|
627 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
|
628 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
|
629 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
630 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
631 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
632 #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
|
633 /* |
1a9da6452071
(svn r16435) -Codechange: don't require the 'user company 0' hack for commands.
rubidium <rubidium@openttd.org>
parents:
12022
diff
changeset
|
634 * 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
|
635 * 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
|
636 */ |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
637 if (_networking && !(cmd & CMD_NETWORK_COMMAND)) { |
14233
613d8459ebe1
(svn r18784) -Codechange: make NetworkSend_Command accept a company instead of using _local_company to pass that information, with the whole mess when you don't want the company to be _local_company.
rubidium <rubidium@openttd.org>
parents:
14232
diff
changeset
|
638 NetworkSend_Command(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
|
639 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
|
640 |
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 /* 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
|
642 * 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
|
643 * 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
|
644 * 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
|
645 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
|
646 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
647 #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
|
648 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
|
649 |
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
|
650 /* 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
|
651 * use the construction one */ |
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
|
652 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
|
653 |
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
|
654 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
|
655 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
|
656 /* 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
|
657 * 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
|
658 * 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
|
659 _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
|
660 } 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
|
661 /* 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
|
662 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
|
663 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
|
664 } |
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
|
665 |
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 /* 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
|
667 * 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
|
668 * 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
|
669 * 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
|
670 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
|
671 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
|
672 } 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
|
673 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
|
674 } |
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 |
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
|
676 /* 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
|
677 * 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
|
678 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
|
679 /* 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
|
680 * 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
|
681 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
|
682 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
|
683 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
|
684 } |
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
|
685 |
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
|
686 /* 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
|
687 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
|
688 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
|
689 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
|
690 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
691 |
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
|
692 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
|
693 |
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
|
694 /* 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
|
695 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
|
696 |
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
|
697 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
|
698 } |
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
|
699 #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
|
700 |
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
|
701 |
14557
b1b3804dd055
(svn r19128) -Codechange: CommandCost cost methods return void instead of a copy of *this.
alberth <alberth@openttd.org>
parents:
14418
diff
changeset
|
702 /** |
b1b3804dd055
(svn r19128) -Codechange: CommandCost cost methods return void instead of a copy of *this.
alberth <alberth@openttd.org>
parents:
14418
diff
changeset
|
703 * 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
|
704 * 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
|
705 * @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
|
706 */ |
14559
14735f06c670
(svn r19130) -Codechange: Use references and inlining in CommandCost.
alberth <alberth@openttd.org>
parents:
14557
diff
changeset
|
707 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
|
708 { |
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
|
709 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
|
710 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
|
711 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
|
712 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
|
713 } |
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
|
714 } |