Mercurial > hg > openttd
annotate src/command.cpp @ 16547:a11cd939c335 draft
(svn r21273) -Codechange: Return values should start at the same line.
author | alberth <alberth@openttd.org> |
---|---|
date | Sat, 20 Nov 2010 15:44:24 +0000 |
parents | ab8c26c4d456 |
children | 20d6e821aaad |
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" |
16036
86c457462b35
(svn r20729) -Fix [FS#4107]: assert when overbuilding object
yexo <yexo@openttd.org>
parents:
15944
diff
changeset
|
30 #include "object_base.h" |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
31 |
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
|
32 #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
|
33 |
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
|
34 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
|
35 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
|
36 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
|
37 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
|
38 |
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 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
|
40 |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
41 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
|
42 |
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
|
43 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
|
44 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
|
45 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
|
46 |
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
|
47 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
|
48 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
|
49 |
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
|
50 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
|
51 |
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
|
52 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
|
53 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
|
54 |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
55 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
|
56 |
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
|
57 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
|
58 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
|
59 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
|
60 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
|
61 |
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
|
62 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
|
63 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
|
64 |
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
|
65 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
|
66 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
|
67 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
|
68 |
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
|
69 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
|
70 |
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
|
71 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
|
72 |
eb3340ea843f
(svn r18788) -Codechange: replace macro as without macro it's shorter than with the macro.
rubidium <rubidium@openttd.org>
parents:
14234
diff
changeset
|
73 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
|
74 |
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
|
75 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
|
76 |
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
|
77 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
|
78 |
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
|
79 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
|
80 |
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
|
81 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
|
82 |
15849
f4ed8e905fee
(svn r20531) -Codechange: unify quite a bit of the vehicle building commands
rubidium <rubidium@openttd.org>
parents:
15744
diff
changeset
|
83 CommandProc CmdBuildVehicle; |
15850
efc03d77eb93
(svn r20532) -Codechange: unify selling of vehicles a bit
rubidium <rubidium@openttd.org>
parents:
15849
diff
changeset
|
84 CommandProc CmdSellVehicle; |
15854
43d172eac154
(svn r20536) -Codechange: unify the refitting of vehicles
rubidium <rubidium@openttd.org>
parents:
15850
diff
changeset
|
85 CommandProc CmdRefitVehicle; |
16075
ab8c26c4d456
(svn r20768) -Codechange: unify send-to-depot commands
rubidium <rubidium@openttd.org>
parents:
16053
diff
changeset
|
86 CommandProc CmdSendVehicleToDepot; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
87 |
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
|
88 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
|
89 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
|
90 |
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
|
91 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
|
92 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
|
93 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
|
94 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
|
95 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
|
96 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
|
97 |
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
|
98 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
|
99 |
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
|
100 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
|
101 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
|
102 |
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
|
103 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
|
104 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
|
105 |
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
|
106 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
|
107 |
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
|
108 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
|
109 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
|
110 |
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
|
111 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
|
112 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
|
113 |
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
|
114 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
|
115 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
|
116 |
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
|
117 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
|
118 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
|
119 |
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
|
120 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
|
121 |
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
|
122 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
|
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 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
|
125 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
|
126 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
|
127 |
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
|
128 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
|
129 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
|
130 CommandProc CmdDoTownAction; |
15657
ddfeab1a0a88
(svn r20322) -Codechange: Move Expand town code to a command.
terkhen <terkhen@openttd.org>
parents:
15370
diff
changeset
|
131 CommandProc CmdExpandTown; |
15658
52010e085f5e
(svn r20323) -Codechange: Move Delete town code to a command.
terkhen <terkhen@openttd.org>
parents:
15657
diff
changeset
|
132 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
|
133 |
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
|
134 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
|
135 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
|
136 |
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
|
137 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
|
138 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
|
139 |
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
|
140 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
|
141 |
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
|
142 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
|
143 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
|
144 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
|
145 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
|
146 |
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
|
147 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
|
148 |
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
|
149 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
|
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 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
|
152 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
|
153 |
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
|
154 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
|
155 |
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
|
156 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
|
157 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
|
158 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
|
159 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
|
160 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
|
161 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
|
162 |
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
|
163 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
|
164 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
|
165 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
|
166 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
|
167 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
|
168 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
|
169 CommandProc CmdSetGroupReplaceProtection; |
6667
12d521513434
(svn r9898) -Fix (r9874): Many...
peter1138 <peter1138@openttd.org>
parents:
6643
diff
changeset
|
170 |
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
|
171 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
|
172 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
|
173 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
|
174 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
|
175 CommandProc CmdSetTimetableStart; |
6832
17319fb8c1c3
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium <rubidium@openttd.org>
parents:
6794
diff
changeset
|
176 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
177 #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
|
178 |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
179 /** |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
180 * The master command table |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
181 * |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
182 * 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
|
183 * 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
|
184 * 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
|
185 */ |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
186 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
|
187 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
|
188 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
|
189 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
|
190 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
|
191 DEF_CMD(CmdLandscapeClear, 0), // CMD_LANDSCAPE_CLEAR |
16053
0cdc65a036de
(svn r20746) -Fix: set CMD_NO_WATER flag for CmdBuildBridge
yexo <yexo@openttd.org>
parents:
16036
diff
changeset
|
192 DEF_CMD(CmdBuildBridge, CMD_NO_WATER | CMD_AUTO), // CMD_BUILD_BRIDGE |
14991
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(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
|
194 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
|
195 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
|
196 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
|
197 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
|
198 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
|
199 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
|
200 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
|
201 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
|
202 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
|
203 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
|
204 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
|
205 |
14991
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(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
|
207 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
|
208 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
|
209 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
|
210 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
|
211 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
|
212 |
14991
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(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
|
214 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
|
215 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
|
216 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
|
217 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
|
218 |
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
|
219 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
|
220 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
|
221 DEF_CMD(CmdRefitVehicle, 0), // CMD_REFIT_VEHICLE |
16075
ab8c26c4d456
(svn r20768) -Codechange: unify send-to-depot commands
rubidium <rubidium@openttd.org>
parents:
16053
diff
changeset
|
222 DEF_CMD(CmdSendVehicleToDepot, 0), // CMD_SEND_VEHICLE_TO_DEPOT |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
223 |
15850
efc03d77eb93
(svn r20532) -Codechange: unify selling of vehicles a bit
rubidium <rubidium@openttd.org>
parents:
15849
diff
changeset
|
224 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
|
225 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
|
226 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
|
227 |
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
|
228 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
|
229 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
|
230 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
|
231 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
|
232 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
|
233 |
14991
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(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
|
235 |
14991
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(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
|
237 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
|
238 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
|
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(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
|
241 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
|
242 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
243 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
|
244 |
14991
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(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
|
246 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
|
247 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
248 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
|
249 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
|
250 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
251 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
|
252 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
|
253 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
254 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
|
255 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
|
256 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
257 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
|
258 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
259 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
|
260 |
14991
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(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
|
262 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
|
263 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
|
264 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
265 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
|
266 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
|
267 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
|
268 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
|
269 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
|
270 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
271 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
|
272 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
|
273 |
14991
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(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
|
275 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
276 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
|
277 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
|
278 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
|
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(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
|
281 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
282 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
|
283 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
284 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
|
285 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
|
286 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
287 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
|
288 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
|
289 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
|
290 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
|
291 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
|
292 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
|
293 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
|
294 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
|
295 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
|
296 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
|
297 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
|
298 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
|
299 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
|
300 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
|
301 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
|
302 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
|
303 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
|
304 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
|
305 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
|
306 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
|
307 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
|
308 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
|
309 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
310 |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
311 /*! |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
312 * 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
|
313 * |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
314 * @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
|
315 * @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
|
316 */ |
10237
d39d46dc7057
(svn r14465) -Codechange: minor code style of command.cpp.
rubidium <rubidium@openttd.org>
parents:
10225
diff
changeset
|
317 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
|
318 { |
10604
ec12a7f3eef8
(svn r14889) -Codechange: replace some magic numbers with constants.
rubidium <rubidium@openttd.org>
parents:
10515
diff
changeset
|
319 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
|
320 |
16547
a11cd939c335
(svn r21273) -Codechange: Return values should start at the same line.
alberth <alberth@openttd.org>
parents:
16075
diff
changeset
|
321 return cmd < lengthof(_command_proc_table) && _command_proc_table[cmd].proc != NULL; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
322 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
323 |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
324 /*! |
10604
ec12a7f3eef8
(svn r14889) -Codechange: replace some magic numbers with constants.
rubidium <rubidium@openttd.org>
parents:
10515
diff
changeset
|
325 * 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
|
326 * 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
|
327 * |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
328 * @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
|
329 * @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
|
330 */ |
10237
d39d46dc7057
(svn r14465) -Codechange: minor code style of command.cpp.
rubidium <rubidium@openttd.org>
parents:
10225
diff
changeset
|
331 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
|
332 { |
10237
d39d46dc7057
(svn r14465) -Codechange: minor code style of command.cpp.
rubidium <rubidium@openttd.org>
parents:
10225
diff
changeset
|
333 assert(IsValidCommand(cmd)); |
d39d46dc7057
(svn r14465) -Codechange: minor code style of command.cpp.
rubidium <rubidium@openttd.org>
parents:
10225
diff
changeset
|
334 |
10604
ec12a7f3eef8
(svn r14889) -Codechange: replace some magic numbers with constants.
rubidium <rubidium@openttd.org>
parents:
10515
diff
changeset
|
335 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
|
336 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
337 |
14991
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
338 /*! |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
339 * 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
|
340 * 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
|
341 * |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
342 * @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
|
343 * @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
|
344 */ |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
345 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
|
346 { |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
347 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
|
348 |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
349 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
|
350 } |
6790e0d0f93d
(svn r19602) -Codechange: add the name of the command to the desync logs
rubidium <rubidium@openttd.org>
parents:
14990
diff
changeset
|
351 |
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
|
352 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
|
353 |
10624
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
354 /** |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
355 * 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
|
356 * |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
357 * @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
|
358 * @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
|
359 * @see CommandProc |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
360 * @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
|
361 */ |
11090
df23c4e04638
(svn r15434) -Codechange: bit of type safety for the DC_xxx flags.
rubidium <rubidium@openttd.org>
parents:
11085
diff
changeset
|
362 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
|
363 { |
10626
3189a053f43a
(svn r14919) -Feature: distant joining of stations (Frostregen and PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10624
diff
changeset
|
364 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
|
365 } |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
366 |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
367 /*! |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
368 * 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
|
369 * 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
|
370 * |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
371 * @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
|
372 * @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
|
373 * @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
|
374 * @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
|
375 * @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
|
376 * @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
|
377 * @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
|
378 * @return the cost |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
379 */ |
11090
df23c4e04638
(svn r15434) -Codechange: bit of type safety for the DC_xxx flags.
rubidium <rubidium@openttd.org>
parents:
11085
diff
changeset
|
380 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
|
381 { |
6943
fd42cb9816c6
(svn r10197) -Codechange: replace int32 with CommandCost where appropriate.
rubidium <rubidium@openttd.org>
parents:
6832
diff
changeset
|
382 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
|
383 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
384 /* 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
|
385 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
|
386 |
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
|
387 /* 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
|
388 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
|
389 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
390 _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
|
391 |
6123
595dc16a6fd8
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas <belugas@openttd.org>
parents:
6012
diff
changeset
|
392 /* 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
|
393 if (_docommand_recursive == 1 || !(flags & DC_EXEC) ) { |
16036
86c457462b35
(svn r20729) -Fix [FS#4107]: assert when overbuilding object
yexo <yexo@openttd.org>
parents:
15944
diff
changeset
|
394 if (_docommand_recursive == 1) _cleared_object_areas.Clear(); |
8232
cca79a4335e0
(svn r11795) -Fix [FS#1616]: take town rating into account when testing if a command can be executed.
glx <glx@openttd.org>
parents:
8230
diff
changeset
|
395 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
|
396 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
|
397 SetTownRatingTestMode(false); |
14314
60d313b887b8
(svn r18866) -Codechange: remove the CmdFailed(ret)/CmdSucceeded(ret) wrapper functions
rubidium <rubidium@openttd.org>
parents:
14237
diff
changeset
|
398 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
|
399 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
|
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 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
402 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
|
403 !(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
|
404 !(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
|
405 !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
|
406 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
|
407 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
408 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
409 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
|
410 _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
|
411 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
|
412 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
413 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
414 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
415 /* 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
|
416 * themselves to the cost object at some point */ |
16036
86c457462b35
(svn r20729) -Fix [FS#4107]: assert when overbuilding object
yexo <yexo@openttd.org>
parents:
15944
diff
changeset
|
417 if (_docommand_recursive == 1) _cleared_object_areas.Clear(); |
10499
45ca88a8de7d
(svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents:
10237
diff
changeset
|
418 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
|
419 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
|
420 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
|
421 _docommand_recursive--; |
14824
fa89f804ec0f
(svn r19415) -Codechange: Forward CommandCost with an error back to the caller.
alberth <alberth@openttd.org>
parents:
14823
diff
changeset
|
422 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
|
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 |
6123
595dc16a6fd8
(svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas <belugas@openttd.org>
parents:
6012
diff
changeset
|
425 /* 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
|
426 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
|
427 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
|
428 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
429 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
430 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
|
431 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
432 |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
433 /*! |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
434 * 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
|
435 * 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
|
436 * 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
|
437 * |
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
|
438 * @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
|
439 */ |
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
|
440 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
|
441 { |
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
|
442 CompanyID company = _current_company; |
11924
fccc9cea27a7
(svn r16327) -Codechange: replace IsValidPoolItemID(index) by PoolItem::IsValidID(index)
smatz <smatz@openttd.org>
parents:
11922
diff
changeset
|
443 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
|
444 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
|
445 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
446 |
10624
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
447 /** |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
448 * 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
|
449 * @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
|
450 * @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
|
451 * @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
|
452 */ |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
453 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
|
454 { |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
455 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
|
456 } |
2f1e024c151f
(svn r14916) -Codechange: make it possible to send CommandContainers directly to DoCommand(P).
rubidium <rubidium@openttd.org>
parents:
10608
diff
changeset
|
457 |
7559
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
458 /*! |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10151
diff
changeset
|
459 * 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
|
460 * 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
|
461 * \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
|
462 * 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
|
463 * |
ad850ff2c61a
(svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium <rubidium@openttd.org>
parents:
7521
diff
changeset
|
464 * @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
|
465 * @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
|
466 * @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
|
467 * @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
|
468 * @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
|
469 * @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
|
470 * @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
|
471 * @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
|
472 */ |
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
|
473 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
|
474 { |
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
|
475 /* 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
|
476 * 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
|
477 * 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
|
478 * 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
|
479 * 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
|
480 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
|
481 !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
|
482 !(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
|
483 (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
|
484 |
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
|
485 /* 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
|
486 * 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
|
487 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
|
488 |
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
|
489 /* 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
|
490 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
|
491 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
|
492 |
15860
bb167d01deb9
(svn r20542) -Codechange: generalise the setting of "p2" to the ClientID.
rubidium <rubidium@openttd.org>
parents:
15854
diff
changeset
|
493 #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
|
494 /* 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
|
495 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
|
496 #endif |
bb167d01deb9
(svn r20542) -Codechange: generalise the setting of "p2" to the ClientID.
rubidium <rubidium@openttd.org>
parents:
15854
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 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
|
499 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
|
500 /* 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
|
501 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
|
502 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
|
503 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
|
504 } |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
505 } 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
|
506 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
|
507 } 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
|
508 /* 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
|
509 * 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
|
510 * 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
|
511 * 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
|
512 * 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
|
513 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
|
514 } |
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 |
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 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
|
517 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
|
518 } |
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 |
14314
60d313b887b8
(svn r18866) -Codechange: remove the CmdFailed(ret)/CmdSucceeded(ret) wrapper functions
rubidium <rubidium@openttd.org>
parents:
14237
diff
changeset
|
520 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
|
521 } |
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 |
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 * 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
|
526 * @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
|
527 * @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
|
528 */ |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
529 #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
|
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 * 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
|
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 * @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
|
535 * @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
|
536 * @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
|
537 * @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
|
538 * @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
|
539 * @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
|
540 * @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
|
541 * @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
|
542 * @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
|
543 */ |
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
544 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
|
545 { |
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 /* 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
|
547 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
|
548 _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
|
549 |
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 /* 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
|
551 _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
|
552 |
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
|
553 /* Get pointer to command handler */ |
10604
ec12a7f3eef8
(svn r14889) -Codechange: replace some magic numbers with constants.
rubidium <rubidium@openttd.org>
parents:
10515
diff
changeset
|
554 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
|
555 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
|
556 |
32ba3eb6d7c9
(svn r14890) -Codechange: move the notest information into the command table.
rubidium <rubidium@openttd.org>
parents:
10604
diff
changeset
|
557 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
|
558 /* 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
|
559 * 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
|
560 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
|
561 |
10605
32ba3eb6d7c9
(svn r14890) -Codechange: move the notest information into the command table.
rubidium <rubidium@openttd.org>
parents:
10604
diff
changeset
|
562 /* 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
|
563 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
|
564 /* 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
|
565 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
|
566 |
15860
bb167d01deb9
(svn r20542) -Codechange: generalise the setting of "p2" to the ClientID.
rubidium <rubidium@openttd.org>
parents:
15854
diff
changeset
|
567 #ifdef ENABLE_NETWORK |
bb167d01deb9
(svn r20542) -Codechange: generalise the setting of "p2" to the ClientID.
rubidium <rubidium@openttd.org>
parents:
15854
diff
changeset
|
568 /* 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
|
569 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
|
570 #endif |
bb167d01deb9
(svn r20542) -Codechange: generalise the setting of "p2" to the ClientID.
rubidium <rubidium@openttd.org>
parents:
15854
diff
changeset
|
571 |
10855
7881d9cd55ab
(svn r15190) -Feature: Allow terraforming of the tiles at the edges of the map.
Yexo <Yexo@openttd.org>
parents:
10707
diff
changeset
|
572 /* 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
|
573 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
|
574 |
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
|
575 /* 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
|
576 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
|
577 |
12028
1a9da6452071
(svn r16435) -Codechange: don't require the 'user company 0' hack for commands.
rubidium <rubidium@openttd.org>
parents:
12022
diff
changeset
|
578 /* 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
|
579 * 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
|
580 * 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
|
581 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
|
582 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
|
583 } |
10997
0692d0966f52
(svn r15337) -Fix: don't allow a spectating server to build stuff.
rubidium <rubidium@openttd.org>
parents:
10995
diff
changeset
|
584 |
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
|
585 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
|
586 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
|
587 |
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
|
588 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
|
589 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
|
590 |
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 /* 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
|
592 * 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
|
593 * 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
|
594 * 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
|
595 * 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
|
596 * 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
|
597 * 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
|
598 * 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
|
599 * 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
|
600 * 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
|
601 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
|
602 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
|
603 /* Test the command. */ |
16036
86c457462b35
(svn r20729) -Fix [FS#4107]: assert when overbuilding object
yexo <yexo@openttd.org>
parents:
15944
diff
changeset
|
604 _cleared_object_areas.Clear(); |
8442
1a90922472a6
(svn r12012) -Fix (r11795): Enable TownRatingTestMode during cost estimation with 'shift'-key.
frosch <frosch@openttd.org>
parents:
8306
diff
changeset
|
605 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
|
606 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
|
607 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
|
608 |
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
|
609 /* 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
|
610 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
|
611 |
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
|
612 /* 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
|
613 * 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
|
614 * (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
|
615 * 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
|
616 * 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
|
617 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
|
618 (!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
|
619 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
|
620 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
|
621 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
622 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
623 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
624 #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
|
625 /* |
1a9da6452071
(svn r16435) -Codechange: don't require the 'user company 0' hack for commands.
rubidium <rubidium@openttd.org>
parents:
12022
diff
changeset
|
626 * 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
|
627 * 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
|
628 */ |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
629 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
|
630 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
|
631 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
|
632 |
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
|
633 /* 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
|
634 * 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
|
635 * 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
|
636 * 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
|
637 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
|
638 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
639 #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
|
640 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
|
641 |
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
|
642 /* 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
|
643 * use the construction one */ |
16036
86c457462b35
(svn r20729) -Fix [FS#4107]: assert when overbuilding object
yexo <yexo@openttd.org>
parents:
15944
diff
changeset
|
644 _cleared_object_areas.Clear(); |
14234
81d35fec0dca
(svn r18785) -Codechange: rewrite/rework DoCommandP in order to simplify it, reduce duplication and remove gotos.
rubidium <rubidium@openttd.org>
parents:
14233
diff
changeset
|
645 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
|
646 |
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
|
647 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
|
648 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
|
649 /* 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
|
650 * 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
|
651 * 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
|
652 _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
|
653 } 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
|
654 /* 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
|
655 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
|
656 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
|
657 } |
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
|
658 |
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
|
659 /* 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
|
660 * 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
|
661 * 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
|
662 * 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
|
663 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
|
664 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
|
665 } 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
|
666 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
|
667 } |
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 |
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 /* 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
|
670 * 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
|
671 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
|
672 /* 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
|
673 * 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
|
674 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
|
675 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
|
676 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
|
677 } |
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 |
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
|
679 /* 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
|
680 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
|
681 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
|
682 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
|
683 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
684 |
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
|
685 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
|
686 |
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
|
687 /* 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
|
688 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
|
689 |
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
|
690 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
|
691 } |
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
|
692 #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
|
693 |
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
|
694 |
14557
b1b3804dd055
(svn r19128) -Codechange: CommandCost cost methods return void instead of a copy of *this.
alberth <alberth@openttd.org>
parents:
14418
diff
changeset
|
695 /** |
b1b3804dd055
(svn r19128) -Codechange: CommandCost cost methods return void instead of a copy of *this.
alberth <alberth@openttd.org>
parents:
14418
diff
changeset
|
696 * 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
|
697 * 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
|
698 * @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
|
699 */ |
14559
14735f06c670
(svn r19130) -Codechange: Use references and inlining in CommandCost.
alberth <alberth@openttd.org>
parents:
14557
diff
changeset
|
700 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
|
701 { |
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
|
702 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
|
703 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
|
704 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
|
705 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
|
706 } |
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
|
707 } |