author | tron |
Fri, 29 Jul 2005 18:22:04 +0000 | |
changeset 2230 | e461b07aead7 |
parent 2204 | c7ce008b5775 |
child 2244 | 417a472e7cb5 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#include "stdafx.h" |
1891
862800791170
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1877
diff
changeset
|
4 |
#include "openttd.h" |
507
04b5403aaf6b
(svn r815) Include strings.h only in the files which need it.
tron
parents:
467
diff
changeset
|
5 |
#include "table/strings.h" |
2163
b17b313113a0
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2159
diff
changeset
|
6 |
#include "functions.h" |
679
04ca2cd69420
(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
652
diff
changeset
|
7 |
#include "map.h" |
0 | 8 |
#include "gui.h" |
9 |
#include "command.h" |
|
10 |
#include "player.h" |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
11 |
#include "network.h" |
2159
f6284cf5fab0
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
1980
diff
changeset
|
12 |
#include "variables.h" |
0 | 13 |
|
1820
d03c56850dc2
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1804
diff
changeset
|
14 |
const char* _cmd_text = NULL; |
d03c56850dc2
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1804
diff
changeset
|
15 |
|
0 | 16 |
#define DEF_COMMAND(yyyy) int32 yyyy(int x, int y, uint32 flags, uint32 p1, uint32 p2) |
17 |
||
18 |
DEF_COMMAND(CmdBuildRailroadTrack); |
|
19 |
DEF_COMMAND(CmdRemoveRailroadTrack); |
|
20 |
DEF_COMMAND(CmdBuildSingleRail); |
|
21 |
DEF_COMMAND(CmdRemoveSingleRail); |
|
22 |
||
23 |
DEF_COMMAND(CmdLandscapeClear); |
|
24 |
||
25 |
DEF_COMMAND(CmdBuildBridge); |
|
26 |
||
27 |
DEF_COMMAND(CmdBuildRailroadStation); |
|
28 |
DEF_COMMAND(CmdRemoveFromRailroadStation); |
|
29 |
DEF_COMMAND(CmdConvertRail); |
|
30 |
||
1227
1d940a5e02d2
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1217
diff
changeset
|
31 |
DEF_COMMAND(CmdBuildSingleSignal); |
1d940a5e02d2
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1217
diff
changeset
|
32 |
DEF_COMMAND(CmdRemoveSingleSignal); |
0 | 33 |
|
34 |
DEF_COMMAND(CmdTerraformLand); |
|
35 |
||
36 |
DEF_COMMAND(CmdPurchaseLandArea); |
|
37 |
DEF_COMMAND(CmdSellLandArea); |
|
38 |
||
39 |
DEF_COMMAND(CmdBuildTunnel); |
|
40 |
||
41 |
DEF_COMMAND(CmdBuildTrainDepot); |
|
395
788a9bba0889
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
215
diff
changeset
|
42 |
DEF_COMMAND(CmdBuildTrainWaypoint); |
788a9bba0889
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
215
diff
changeset
|
43 |
DEF_COMMAND(CmdRenameWaypoint); |
788a9bba0889
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
215
diff
changeset
|
44 |
DEF_COMMAND(CmdRemoveTrainWaypoint); |
0 | 45 |
|
1217
59c024cfaf54
(svn r1721) -Feature: It is now possible to build multiple road stations (up to 8) on
celestar
parents:
1093
diff
changeset
|
46 |
DEF_COMMAND(CmdBuildRoadStop); |
0 | 47 |
|
48 |
DEF_COMMAND(CmdBuildLongRoad); |
|
49 |
DEF_COMMAND(CmdRemoveLongRoad); |
|
50 |
DEF_COMMAND(CmdBuildRoad); |
|
51 |
DEF_COMMAND(CmdRemoveRoad); |
|
52 |
||
53 |
DEF_COMMAND(CmdBuildRoadDepot); |
|
54 |
||
55 |
DEF_COMMAND(CmdBuildAirport); |
|
56 |
||
57 |
DEF_COMMAND(CmdBuildDock); |
|
58 |
||
59 |
DEF_COMMAND(CmdBuildShipDepot); |
|
60 |
||
61 |
DEF_COMMAND(CmdBuildBuoy); |
|
62 |
||
63 |
DEF_COMMAND(CmdPlantTree); |
|
64 |
||
65 |
DEF_COMMAND(CmdBuildRailVehicle); |
|
66 |
DEF_COMMAND(CmdMoveRailVehicle); |
|
67 |
||
68 |
DEF_COMMAND(CmdStartStopTrain); |
|
69 |
||
70 |
DEF_COMMAND(CmdSellRailWagon); |
|
71 |
||
1794
24b4239f2090
(svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents:
1786
diff
changeset
|
72 |
DEF_COMMAND(CmdSendTrainToDepot); |
0 | 73 |
DEF_COMMAND(CmdForceTrainProceed); |
74 |
DEF_COMMAND(CmdReverseTrainDirection); |
|
75 |
||
76 |
DEF_COMMAND(CmdModifyOrder); |
|
77 |
DEF_COMMAND(CmdSkipOrder); |
|
78 |
DEF_COMMAND(CmdDeleteOrder); |
|
79 |
DEF_COMMAND(CmdInsertOrder); |
|
80 |
DEF_COMMAND(CmdChangeTrainServiceInt); |
|
81 |
DEF_COMMAND(CmdRestoreOrderIndex); |
|
82 |
||
83 |
DEF_COMMAND(CmdBuildIndustry); |
|
84 |
||
85 |
DEF_COMMAND(CmdBuildCompanyHQ); |
|
86 |
DEF_COMMAND(CmdSetPlayerFace); |
|
87 |
DEF_COMMAND(CmdSetPlayerColor); |
|
88 |
||
89 |
DEF_COMMAND(CmdIncreaseLoan); |
|
90 |
DEF_COMMAND(CmdDecreaseLoan); |
|
91 |
||
92 |
DEF_COMMAND(CmdWantEnginePreview); |
|
93 |
||
94 |
DEF_COMMAND(CmdNameVehicle); |
|
95 |
DEF_COMMAND(CmdRenameEngine); |
|
96 |
||
97 |
DEF_COMMAND(CmdChangeCompanyName); |
|
98 |
DEF_COMMAND(CmdChangePresidentName); |
|
99 |
||
100 |
DEF_COMMAND(CmdRenameStation); |
|
101 |
||
102 |
DEF_COMMAND(CmdSellAircraft); |
|
103 |
DEF_COMMAND(CmdStartStopAircraft); |
|
104 |
DEF_COMMAND(CmdBuildAircraft); |
|
105 |
DEF_COMMAND(CmdSendAircraftToHangar); |
|
106 |
DEF_COMMAND(CmdChangeAircraftServiceInt); |
|
107 |
DEF_COMMAND(CmdRefitAircraft); |
|
108 |
||
109 |
DEF_COMMAND(CmdPlaceSign); |
|
110 |
DEF_COMMAND(CmdRenameSign); |
|
111 |
||
112 |
DEF_COMMAND(CmdBuildRoadVeh); |
|
113 |
DEF_COMMAND(CmdStartStopRoadVeh); |
|
114 |
DEF_COMMAND(CmdSellRoadVeh); |
|
115 |
DEF_COMMAND(CmdSendRoadVehToDepot); |
|
116 |
DEF_COMMAND(CmdTurnRoadVeh); |
|
117 |
DEF_COMMAND(CmdChangeRoadVehServiceInt); |
|
118 |
||
119 |
DEF_COMMAND(CmdPause); |
|
120 |
||
121 |
DEF_COMMAND(CmdBuyShareInCompany); |
|
122 |
DEF_COMMAND(CmdSellShareInCompany); |
|
123 |
DEF_COMMAND(CmdBuyCompany); |
|
124 |
||
125 |
DEF_COMMAND(CmdBuildTown); |
|
126 |
||
127 |
DEF_COMMAND(CmdRenameTown); |
|
128 |
DEF_COMMAND(CmdDoTownAction); |
|
129 |
||
130 |
DEF_COMMAND(CmdSetRoadDriveSide); |
|
131 |
||
132 |
DEF_COMMAND(CmdChangeDifficultyLevel); |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
133 |
DEF_COMMAND(CmdChangePatchSetting); |
0 | 134 |
|
135 |
DEF_COMMAND(CmdStartStopShip); |
|
136 |
DEF_COMMAND(CmdSellShip); |
|
137 |
DEF_COMMAND(CmdBuildShip); |
|
138 |
DEF_COMMAND(CmdSendShipToDepot); |
|
139 |
DEF_COMMAND(CmdChangeShipServiceInt); |
|
140 |
DEF_COMMAND(CmdRefitShip); |
|
141 |
||
142 |
DEF_COMMAND(CmdCloneOrder); |
|
143 |
||
144 |
DEF_COMMAND(CmdClearArea); |
|
145 |
||
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
146 |
DEF_COMMAND(CmdGiveMoney); |
0 | 147 |
DEF_COMMAND(CmdMoneyCheat); |
148 |
DEF_COMMAND(CmdBuildCanal); |
|
147
d0c8100d18cf
(svn r148) -Feature: Company HQ can now be moved somewhere else (cost 1% of company value). Water floods HQ.
darkvater
parents:
58
diff
changeset
|
149 |
DEF_COMMAND(CmdBuildLock); |
0 | 150 |
|
151 |
DEF_COMMAND(CmdPlayerCtrl); |
|
152 |
||
153 |
DEF_COMMAND(CmdLevelLand); |
|
154 |
||
155 |
DEF_COMMAND(CmdRefitRailVehicle); |
|
156 |
||
1227
1d940a5e02d2
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1217
diff
changeset
|
157 |
DEF_COMMAND(CmdBuildSignalTrack); |
1d940a5e02d2
(svn r1731) - Fix: [ 1106930 ] BugFix: placing signals with 2x1 drags workaround is completely rewritten. Also features checks for hacked/modified clients. Thanks a lot Hackykid!
darkvater
parents:
1217
diff
changeset
|
158 |
DEF_COMMAND(CmdRemoveSignalTrack); |
58
b9fdcc9b5c90
(svn r59) -Feature: Added Autosignals, just like Autorail. Can copy signal style, convert signal<->semaphore, etc. Big thanks to betatesters Dribbel and Testman57 (Darkvater)
darkvater
parents:
0
diff
changeset
|
159 |
|
842 | 160 |
DEF_COMMAND(CmdReplaceVehicle); |
812
65ecc321b3db
(svn r1283) -Add: AutoRenew is now a client-side patch instead of a game-side patch
truelight
parents:
679
diff
changeset
|
161 |
|
0 | 162 |
/* The master command table */ |
1804
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
163 |
static const Command _command_proc_table[] = { |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
164 |
{CmdBuildRailroadTrack, 0}, /* 0 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
165 |
{CmdRemoveRailroadTrack, 0}, /* 1 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
166 |
{CmdBuildSingleRail, 0}, /* 2 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
167 |
{CmdRemoveSingleRail, 0}, /* 3 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
168 |
{CmdLandscapeClear, 0}, /* 4 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
169 |
{CmdBuildBridge, 0}, /* 5 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
170 |
{CmdBuildRailroadStation, 0}, /* 6 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
171 |
{CmdBuildTrainDepot, 0}, /* 7 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
172 |
{CmdBuildSingleSignal, 0}, /* 8 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
173 |
{CmdRemoveSingleSignal, 0}, /* 9 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
174 |
{CmdTerraformLand, 0}, /* 10 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
175 |
{CmdPurchaseLandArea, 0}, /* 11 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
176 |
{CmdSellLandArea, 0}, /* 12 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
177 |
{CmdBuildTunnel, 0}, /* 13 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
178 |
{CmdRemoveFromRailroadStation, 0}, /* 14 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
179 |
{CmdConvertRail, 0}, /* 15 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
180 |
{CmdBuildTrainWaypoint, 0}, /* 16 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
181 |
{CmdRenameWaypoint, 0}, /* 17 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
182 |
{CmdRemoveTrainWaypoint, 0}, /* 18 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
183 |
{NULL, 0}, /* 19 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
184 |
{NULL, 0}, /* 20 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
185 |
{CmdBuildRoadStop, 0}, /* 21 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
186 |
{NULL, 0}, /* 22 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
187 |
{CmdBuildLongRoad, 0}, /* 23 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
188 |
{CmdRemoveLongRoad, 0}, /* 24 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
189 |
{CmdBuildRoad, 0}, /* 25 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
190 |
{CmdRemoveRoad, 0}, /* 26 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
191 |
{CmdBuildRoadDepot, 0}, /* 27 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
192 |
{NULL, 0}, /* 28 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
193 |
{CmdBuildAirport, 0}, /* 29 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
194 |
{CmdBuildDock, 0}, /* 30 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
195 |
{CmdBuildShipDepot, 0}, /* 31 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
196 |
{CmdBuildBuoy, 0}, /* 32 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
197 |
{CmdPlantTree, 0}, /* 33 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
198 |
{CmdBuildRailVehicle, 0}, /* 34 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
199 |
{CmdMoveRailVehicle, 0}, /* 35 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
200 |
{CmdStartStopTrain, 0}, /* 36 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
201 |
{NULL, 0}, /* 37 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
202 |
{CmdSellRailWagon, 0}, /* 38 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
203 |
{CmdSendTrainToDepot, 0}, /* 39 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
204 |
{CmdForceTrainProceed, 0}, /* 40 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
205 |
{CmdReverseTrainDirection, 0}, /* 41 */ |
147
d0c8100d18cf
(svn r148) -Feature: Company HQ can now be moved somewhere else (cost 1% of company value). Water floods HQ.
darkvater
parents:
58
diff
changeset
|
206 |
|
1804
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
207 |
{CmdModifyOrder, 0}, /* 42 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
208 |
{CmdSkipOrder, 0}, /* 43 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
209 |
{CmdDeleteOrder, 0}, /* 44 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
210 |
{CmdInsertOrder, 0}, /* 45 */ |
0 | 211 |
|
1804
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
212 |
{CmdChangeTrainServiceInt, 0}, /* 46 */ |
147
d0c8100d18cf
(svn r148) -Feature: Company HQ can now be moved somewhere else (cost 1% of company value). Water floods HQ.
darkvater
parents:
58
diff
changeset
|
213 |
|
1804
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
214 |
{CmdBuildIndustry, 0}, /* 47 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
215 |
{CmdBuildCompanyHQ, 0}, /* 48 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
216 |
{CmdSetPlayerFace, 0}, /* 49 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
217 |
{CmdSetPlayerColor, 0}, /* 50 */ |
1796
614d996f6be7
(svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents:
1794
diff
changeset
|
218 |
|
1804
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
219 |
{CmdIncreaseLoan, 0}, /* 51 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
220 |
{CmdDecreaseLoan, 0}, /* 52 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
221 |
|
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
222 |
{CmdWantEnginePreview, 0}, /* 53 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
223 |
|
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
224 |
{CmdNameVehicle, 0}, /* 54 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
225 |
{CmdRenameEngine, 0}, /* 55 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
226 |
|
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
227 |
{CmdChangeCompanyName, 0}, /* 56 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
228 |
{CmdChangePresidentName, 0}, /* 57 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
229 |
|
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
230 |
{CmdRenameStation, 0}, /* 58 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
231 |
|
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
232 |
{CmdSellAircraft, 0}, /* 59 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
233 |
{CmdStartStopAircraft, 0}, /* 60 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
234 |
|
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
235 |
{CmdBuildAircraft, 0}, /* 61 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
236 |
{CmdSendAircraftToHangar, 0}, /* 62 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
237 |
{CmdChangeAircraftServiceInt, 0}, /* 63 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
238 |
{CmdRefitAircraft, 0}, /* 64 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
239 |
|
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
240 |
{CmdPlaceSign, 0}, /* 65 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
241 |
{CmdRenameSign, 0}, /* 66 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
242 |
|
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
243 |
{CmdBuildRoadVeh, 0}, /* 67 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
244 |
{CmdStartStopRoadVeh, 0}, /* 68 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
245 |
{CmdSellRoadVeh, 0}, /* 69 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
246 |
{CmdSendRoadVehToDepot, 0}, /* 70 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
247 |
{CmdTurnRoadVeh, 0}, /* 71 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
248 |
{CmdChangeRoadVehServiceInt, 0}, /* 72 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
249 |
|
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
250 |
{CmdPause, CMD_SERVER}, /* 73 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
251 |
|
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
252 |
{CmdBuyShareInCompany, 0}, /* 74 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
253 |
{CmdSellShareInCompany, 0}, /* 75 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
254 |
{CmdBuyCompany, 0}, /* 76 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
255 |
|
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
256 |
{CmdBuildTown, CMD_OFFLINE}, /* 77 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
257 |
{NULL, 0}, /* 78 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
258 |
{NULL, 0}, /* 79 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
259 |
{CmdRenameTown, CMD_SERVER}, /* 80 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
260 |
{CmdDoTownAction, 0}, /* 81 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
261 |
|
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
262 |
{CmdSetRoadDriveSide, CMD_SERVER}, /* 82 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
263 |
{NULL, 0}, /* 83 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
264 |
{NULL, 0}, /* 84 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
265 |
{CmdChangeDifficultyLevel, CMD_SERVER}, /* 85 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
266 |
|
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
267 |
{CmdStartStopShip, 0}, /* 86 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
268 |
{CmdSellShip, 0}, /* 87 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
269 |
{CmdBuildShip, 0}, /* 88 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
270 |
{CmdSendShipToDepot, 0}, /* 89 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
271 |
{CmdChangeShipServiceInt, 0}, /* 90 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
272 |
{CmdRefitShip, 0}, /* 91 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
273 |
|
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
274 |
{NULL, 0}, /* 92 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
275 |
{NULL, 0}, /* 93 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
276 |
{NULL, 0}, /* 94 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
277 |
{NULL, 0}, /* 95 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
278 |
{NULL, 0}, /* 96 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
279 |
{NULL, 0}, /* 97 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
280 |
{NULL, 0}, /* 98 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
281 |
|
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
282 |
{CmdCloneOrder, 0}, /* 99 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
283 |
|
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
284 |
{CmdClearArea, 0}, /* 100 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
285 |
{NULL, 0}, /* 101 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
286 |
|
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
287 |
{CmdMoneyCheat, CMD_OFFLINE}, /* 102 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
288 |
{CmdBuildCanal, 0}, /* 103 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
289 |
{CmdPlayerCtrl, 0}, /* 104 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
290 |
|
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
291 |
{CmdLevelLand, 0}, /* 105 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
292 |
|
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
293 |
{CmdRefitRailVehicle, 0}, /* 106 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
294 |
{CmdRestoreOrderIndex, 0}, /* 107 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
295 |
{CmdBuildLock, 0}, /* 108 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
296 |
{NULL, 0}, /* 109 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
297 |
{CmdBuildSignalTrack, 0}, /* 110 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
298 |
{CmdRemoveSignalTrack, 0}, /* 111 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
299 |
{NULL, 0}, /* 112 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
300 |
{CmdGiveMoney, 0}, /* 113 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
301 |
{CmdChangePatchSetting, CMD_SERVER}, /* 114 */ |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
302 |
{CmdReplaceVehicle, 0}, /* 115 */ |
0 | 303 |
}; |
304 |
||
903
a301a264e0fc
(svn r1389) -Add: [Network] Added packet protection. No longer a client or server
truelight
parents:
889
diff
changeset
|
305 |
/* This function range-checks a cmd, and checks if the cmd is not NULL */ |
959
e6a3bbda610f
(svn r1451) Fix some of the signed/unsigned comparison warnings
tron
parents:
926
diff
changeset
|
306 |
bool IsValidCommand(uint cmd) |
903
a301a264e0fc
(svn r1389) -Add: [Network] Added packet protection. No longer a client or server
truelight
parents:
889
diff
changeset
|
307 |
{ |
a301a264e0fc
(svn r1389) -Add: [Network] Added packet protection. No longer a client or server
truelight
parents:
889
diff
changeset
|
308 |
cmd = cmd & 0xFF; |
a301a264e0fc
(svn r1389) -Add: [Network] Added packet protection. No longer a client or server
truelight
parents:
889
diff
changeset
|
309 |
|
1804
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
310 |
if (cmd >= lengthof(_command_proc_table) || _command_proc_table[cmd].proc == NULL) |
903
a301a264e0fc
(svn r1389) -Add: [Network] Added packet protection. No longer a client or server
truelight
parents:
889
diff
changeset
|
311 |
return false; |
a301a264e0fc
(svn r1389) -Add: [Network] Added packet protection. No longer a client or server
truelight
parents:
889
diff
changeset
|
312 |
|
a301a264e0fc
(svn r1389) -Add: [Network] Added packet protection. No longer a client or server
truelight
parents:
889
diff
changeset
|
313 |
return true; |
a301a264e0fc
(svn r1389) -Add: [Network] Added packet protection. No longer a client or server
truelight
parents:
889
diff
changeset
|
314 |
} |
a301a264e0fc
(svn r1389) -Add: [Network] Added packet protection. No longer a client or server
truelight
parents:
889
diff
changeset
|
315 |
|
1804
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
316 |
byte GetCommandFlags(uint cmd) {return _command_proc_table[cmd & 0xFF].flags;} |
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
317 |
|
0 | 318 |
int32 DoCommandByTile(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc) |
319 |
{ |
|
926
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
903
diff
changeset
|
320 |
return DoCommand(TileX(tile) * 16, TileY(tile) * 16, p1, p2, flags, procc); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
147
diff
changeset
|
321 |
} |
0 | 322 |
|
323 |
||
324 |
int32 DoCommand(int x, int y, uint32 p1, uint32 p2, uint32 flags, uint procc) |
|
325 |
{ |
|
326 |
int32 res; |
|
327 |
CommandProc *proc; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
147
diff
changeset
|
328 |
|
1776
956f8589024d
(svn r2280) - Fix: Check if the passed tile to DoCommand is within the current mapsize
Darkvater
parents:
1728
diff
changeset
|
329 |
/* Do not even think about executing out-of-bounds tile-commands */ |
1980
6c5917cfcb78
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1962
diff
changeset
|
330 |
if (TileVirtXY(x, y) > MapSize()) { |
1820
d03c56850dc2
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1804
diff
changeset
|
331 |
_cmd_text = NULL; |
d03c56850dc2
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1804
diff
changeset
|
332 |
return CMD_ERROR; |
d03c56850dc2
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1804
diff
changeset
|
333 |
} |
1776
956f8589024d
(svn r2280) - Fix: Check if the passed tile to DoCommand is within the current mapsize
Darkvater
parents:
1728
diff
changeset
|
334 |
|
1804
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
335 |
proc = _command_proc_table[procc].proc; |
0 | 336 |
|
337 |
if (_docommand_recursive == 0) { |
|
338 |
_error_message = INVALID_STRING_ID; |
|
339 |
// update last build coord of player |
|
340 |
if ( (x|y) != 0 && _current_player < MAX_PLAYERS) { |
|
1980
6c5917cfcb78
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1962
diff
changeset
|
341 |
GetPlayer(_current_player)->last_build_coordinate = TileVirtXY(x, y); |
0 | 342 |
} |
343 |
} |
|
344 |
||
345 |
_docommand_recursive++; |
|
346 |
||
347 |
// only execute the test call if it's toplevel, or we're not execing. |
|
348 |
if (_docommand_recursive == 1 || !(flags & DC_EXEC) || (flags & DC_FORCETEST) ) { |
|
349 |
res = proc(x, y, flags&~DC_EXEC, p1, p2); |
|
1691
852ca27d6eef
(svn r2195) Add CmdFailed() as the One True Way(tm) to check if a command failed.
tron
parents:
1623
diff
changeset
|
350 |
if (CmdFailed(res)) { |
0 | 351 |
if (res & 0xFFFF) _error_message = res & 0xFFFF; |
352 |
goto error; |
|
353 |
} |
|
354 |
||
355 |
if (_docommand_recursive == 1) { |
|
356 |
if (!(flags&DC_QUERY_COST) && res != 0 && !CheckPlayerHasMoney(res)) |
|
357 |
goto error; |
|
358 |
} |
|
359 |
||
360 |
if (!(flags & DC_EXEC)) { |
|
361 |
_docommand_recursive--; |
|
1820
d03c56850dc2
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1804
diff
changeset
|
362 |
_cmd_text = NULL; |
0 | 363 |
return res; |
364 |
} |
|
365 |
} |
|
366 |
||
889
64d2f7d5f02b
(svn r1375) -Fix: [1050990] Buying trains sometimes accounted for incorrectly. Was the result of the cost getting reset in a recursive call of docommand. That is fixed. In addition all cost-commands are typed explicitely. Please do not forget to do so or your costs will be credited to construction if you are unlucky.
darkvater
parents:
842
diff
changeset
|
367 |
/* Execute the command here. All cost-relevant functions set the expenses type |
64d2f7d5f02b
(svn r1375) -Fix: [1050990] Buying trains sometimes accounted for incorrectly. Was the result of the cost getting reset in a recursive call of docommand. That is fixed. In addition all cost-commands are typed explicitely. Please do not forget to do so or your costs will be credited to construction if you are unlucky.
darkvater
parents:
842
diff
changeset
|
368 |
* themselves with "SET_EXPENSES_TYPE(...);" at the beginning of the function */ |
0 | 369 |
res = proc(x, y, flags, p1, p2); |
1691
852ca27d6eef
(svn r2195) Add CmdFailed() as the One True Way(tm) to check if a command failed.
tron
parents:
1623
diff
changeset
|
370 |
if (CmdFailed(res)) { |
0 | 371 |
if (res & 0xFFFF) _error_message = res & 0xFFFF; |
372 |
error: |
|
373 |
_docommand_recursive--; |
|
1820
d03c56850dc2
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1804
diff
changeset
|
374 |
_cmd_text = NULL; |
0 | 375 |
return CMD_ERROR; |
376 |
} |
|
377 |
||
378 |
// if toplevel, subtract the money. |
|
379 |
if (--_docommand_recursive == 0) { |
|
380 |
SubtractMoneyFromPlayer(res); |
|
381 |
} |
|
382 |
||
1820
d03c56850dc2
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1804
diff
changeset
|
383 |
_cmd_text = NULL; |
0 | 384 |
return res; |
385 |
} |
|
386 |
||
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
959
diff
changeset
|
387 |
int32 GetAvailableMoneyForCommand(void) |
0 | 388 |
{ |
1794
24b4239f2090
(svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents:
1786
diff
changeset
|
389 |
PlayerID pid = _current_player; |
147
d0c8100d18cf
(svn r148) -Feature: Company HQ can now be moved somewhere else (cost 1% of company value). Water floods HQ.
darkvater
parents:
58
diff
changeset
|
390 |
if (pid >= MAX_PLAYERS) return 0x7FFFFFFF; // max int |
1962
8254df1b359b
(svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer
celestar
parents:
1891
diff
changeset
|
391 |
return GetPlayer(pid)->player_money; |
0 | 392 |
} |
393 |
||
394 |
// toplevel network safe docommand function for the current player. must not be called recursively. |
|
395 |
// the callback is called when the command succeeded or failed. |
|
396 |
bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, uint32 cmd) |
|
397 |
{ |
|
398 |
int32 res = 0,res2; |
|
399 |
CommandProc *proc; |
|
400 |
uint32 flags; |
|
401 |
bool notest; |
|
402 |
||
926
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
903
diff
changeset
|
403 |
int x = TileX(tile) * 16; |
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
903
diff
changeset
|
404 |
int y = TileY(tile) * 16; |
0 | 405 |
|
1776
956f8589024d
(svn r2280) - Fix: Check if the passed tile to DoCommand is within the current mapsize
Darkvater
parents:
1728
diff
changeset
|
406 |
/* Do not even think about executing out-of-bounds tile-commands */ |
1820
d03c56850dc2
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1804
diff
changeset
|
407 |
if (tile > MapSize()) { |
d03c56850dc2
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1804
diff
changeset
|
408 |
_cmd_text = NULL; |
d03c56850dc2
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1804
diff
changeset
|
409 |
return false; |
d03c56850dc2
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1804
diff
changeset
|
410 |
} |
1776
956f8589024d
(svn r2280) - Fix: Check if the passed tile to DoCommand is within the current mapsize
Darkvater
parents:
1728
diff
changeset
|
411 |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
147
diff
changeset
|
412 |
assert(_docommand_recursive == 0); |
0 | 413 |
|
414 |
_error_message = INVALID_STRING_ID; |
|
415 |
_error_message_2 = cmd >> 16; |
|
416 |
_additional_cash_required = 0; |
|
417 |
||
1834
52de5b434670
(svn r2339) - Fix: on a dedicated server, after the joining of a player, the player was set to player 0 instead of remaining OWNER_SPECTATOR. Fix this, and allow the dedicated server to execute commands (so 'patch <value>') now works and not only when a client is connected.
Darkvater
parents:
1820
diff
changeset
|
418 |
/** Spectator has no rights except for the dedicated server which |
52de5b434670
(svn r2339) - Fix: on a dedicated server, after the joining of a player, the player was set to player 0 instead of remaining OWNER_SPECTATOR. Fix this, and allow the dedicated server to execute commands (so 'patch <value>') now works and not only when a client is connected.
Darkvater
parents:
1820
diff
changeset
|
419 |
* is a spectator but is the server, so can do anything */ |
52de5b434670
(svn r2339) - Fix: on a dedicated server, after the joining of a player, the player was set to player 0 instead of remaining OWNER_SPECTATOR. Fix this, and allow the dedicated server to execute commands (so 'patch <value>') now works and not only when a client is connected.
Darkvater
parents:
1820
diff
changeset
|
420 |
if (_current_player == OWNER_SPECTATOR && !_network_dedicated) { |
0 | 421 |
ShowErrorMessage(_error_message, _error_message_2, x, y); |
1820
d03c56850dc2
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1804
diff
changeset
|
422 |
_cmd_text = NULL; |
0 | 423 |
return false; |
424 |
} |
|
425 |
||
426 |
flags = 0; |
|
427 |
if (cmd & CMD_AUTO) flags |= DC_AUTO; |
|
428 |
if (cmd & CMD_NO_WATER) flags |= DC_NO_WATER; |
|
429 |
||
430 |
// get pointer to command handler |
|
431 |
assert((cmd & 0xFF) < lengthof(_command_proc_table)); |
|
1804
fbe724472bb4
(svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents:
1802
diff
changeset
|
432 |
proc = _command_proc_table[cmd & 0xFF].proc; |
1877
ab6a315fa930
(svn r2383) - Fix: Monkey-testing turned up some command crashes.
Darkvater
parents:
1838
diff
changeset
|
433 |
if (proc == NULL) { |
ab6a315fa930
(svn r2383) - Fix: Monkey-testing turned up some command crashes.
Darkvater
parents:
1838
diff
changeset
|
434 |
_cmd_text = NULL; |
ab6a315fa930
(svn r2383) - Fix: Monkey-testing turned up some command crashes.
Darkvater
parents:
1838
diff
changeset
|
435 |
return false; |
ab6a315fa930
(svn r2383) - Fix: Monkey-testing turned up some command crashes.
Darkvater
parents:
1838
diff
changeset
|
436 |
} |
0 | 437 |
|
826 | 438 |
// Some commands have a different output in dryrun than the realrun |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
439 |
// e.g.: if you demolish a whole town, the dryrun would say okay. |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
440 |
// but by really destroying, your rating drops and at a certain point |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
441 |
// it will fail. so res and res2 are different |
467
dd312bc9ca36
(svn r697) Fix the town road removal crash _still_ present there.
pasky
parents:
395
diff
changeset
|
442 |
// CMD_REMOVE_ROAD: This command has special local authority |
dd312bc9ca36
(svn r697) Fix the town road removal crash _still_ present there.
pasky
parents:
395
diff
changeset
|
443 |
// restrictions which may cause the test run to fail (the previous |
dd312bc9ca36
(svn r697) Fix the town road removal crash _still_ present there.
pasky
parents:
395
diff
changeset
|
444 |
// road fragments still stay there and the town won't let you |
dd312bc9ca36
(svn r697) Fix the town road removal crash _still_ present there.
pasky
parents:
395
diff
changeset
|
445 |
// disconnect the road system), but the exec will succeed and this |
dd312bc9ca36
(svn r697) Fix the town road removal crash _still_ present there.
pasky
parents:
395
diff
changeset
|
446 |
// fact will trigger an assertion failure. --pasky |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
147
diff
changeset
|
447 |
notest = |
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
147
diff
changeset
|
448 |
(cmd & 0xFF) == CMD_CLEAR_AREA || |
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
147
diff
changeset
|
449 |
(cmd & 0xFF) == CMD_CONVERT_RAIL || |
0 | 450 |
(cmd & 0xFF) == CMD_LEVEL_LAND || |
1701
4a2c9ee2034d
(svn r2205) - Fixup of revision 2200, not twice CMD_REMOVE_LONG_ROAD :p. Thanks TrueLight.
Darkvater
parents:
1696
diff
changeset
|
451 |
(cmd & 0xFF) == CMD_REMOVE_ROAD || |
1696
08e933d60bef
(svn r2200) - Fix [ 1179892 ] click & drag removal of road assertion fail. Add CMD_REMOVE_LONG_ROAD to the 'notest' section as it might have difficulties with town ratings, etc. Read the comment for more info (mgasterix)
Darkvater
parents:
1691
diff
changeset
|
452 |
(cmd & 0xFF) == CMD_REMOVE_LONG_ROAD; |
0 | 453 |
|
454 |
_docommand_recursive = 1; |
|
455 |
||
456 |
// cost estimation only? |
|
842 | 457 |
if (_shift_pressed && _current_player == _local_player && !(cmd & (CMD_NETWORK_COMMAND | CMD_SHOW_NO_ERROR))) { |
0 | 458 |
// estimate the cost. |
459 |
res = proc(x, y, flags, p1, p2); |
|
1691
852ca27d6eef
(svn r2195) Add CmdFailed() as the One True Way(tm) to check if a command failed.
tron
parents:
1623
diff
changeset
|
460 |
if (CmdFailed(res)) { |
0 | 461 |
if (res & 0xFFFF) _error_message = res & 0xFFFF; |
462 |
ShowErrorMessage(_error_message, _error_message_2, x, y); |
|
463 |
} else { |
|
464 |
ShowEstimatedCostOrIncome(res, x, y); |
|
465 |
} |
|
466 |
||
467 |
_docommand_recursive = 0; |
|
1820
d03c56850dc2
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1804
diff
changeset
|
468 |
_cmd_text = NULL; |
0 | 469 |
return false; |
470 |
} |
|
471 |
||
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
147
diff
changeset
|
472 |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
473 |
if (!((cmd & CMD_NO_TEST_IF_IN_NETWORK) && _networking)) { |
0 | 474 |
// first test if the command can be executed. |
475 |
res = proc(x,y, flags, p1, p2); |
|
1691
852ca27d6eef
(svn r2195) Add CmdFailed() as the One True Way(tm) to check if a command failed.
tron
parents:
1623
diff
changeset
|
476 |
if (CmdFailed(res)) { |
0 | 477 |
if (res & 0xFFFF) _error_message = res & 0xFFFF; |
478 |
goto show_error; |
|
479 |
} |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
480 |
// no money? Only check if notest is off |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
481 |
if (!notest && res != 0 && !CheckPlayerHasMoney(res)) goto show_error; |
0 | 482 |
} |
483 |
||
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
484 |
#ifdef ENABLE_NETWORK |
1838
4aed9afd0744
(svn r2343) - Fix (regression): dedicated server caused desyncs with its commands, because the player sent over the network is OWNER_SPECTATOR as well, which on clients cannot execute anything. So *hack*hack* it into temporarily player 0.
Darkvater
parents:
1834
diff
changeset
|
485 |
/** If we are in network, and the command is not from the network |
4aed9afd0744
(svn r2343) - Fix (regression): dedicated server caused desyncs with its commands, because the player sent over the network is OWNER_SPECTATOR as well, which on clients cannot execute anything. So *hack*hack* it into temporarily player 0.
Darkvater
parents:
1834
diff
changeset
|
486 |
* send it to the command-queue and abort execution |
4aed9afd0744
(svn r2343) - Fix (regression): dedicated server caused desyncs with its commands, because the player sent over the network is OWNER_SPECTATOR as well, which on clients cannot execute anything. So *hack*hack* it into temporarily player 0.
Darkvater
parents:
1834
diff
changeset
|
487 |
* If we are a dedicated server temporarily switch local player, otherwise |
4aed9afd0744
(svn r2343) - Fix (regression): dedicated server caused desyncs with its commands, because the player sent over the network is OWNER_SPECTATOR as well, which on clients cannot execute anything. So *hack*hack* it into temporarily player 0.
Darkvater
parents:
1834
diff
changeset
|
488 |
* the other parties won't be able to execute our command and will desync. |
4aed9afd0744
(svn r2343) - Fix (regression): dedicated server caused desyncs with its commands, because the player sent over the network is OWNER_SPECTATOR as well, which on clients cannot execute anything. So *hack*hack* it into temporarily player 0.
Darkvater
parents:
1834
diff
changeset
|
489 |
* @todo Rewrite dedicated server to something more than a dirty hack! |
4aed9afd0744
(svn r2343) - Fix (regression): dedicated server caused desyncs with its commands, because the player sent over the network is OWNER_SPECTATOR as well, which on clients cannot execute anything. So *hack*hack* it into temporarily player 0.
Darkvater
parents:
1834
diff
changeset
|
490 |
*/ |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
491 |
if (_networking && !(cmd & CMD_NETWORK_COMMAND)) { |
1838
4aed9afd0744
(svn r2343) - Fix (regression): dedicated server caused desyncs with its commands, because the player sent over the network is OWNER_SPECTATOR as well, which on clients cannot execute anything. So *hack*hack* it into temporarily player 0.
Darkvater
parents:
1834
diff
changeset
|
492 |
if (_network_dedicated) _local_player = 0; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
493 |
NetworkSend_Command(tile, p1, p2, cmd, callback); |
1838
4aed9afd0744
(svn r2343) - Fix (regression): dedicated server caused desyncs with its commands, because the player sent over the network is OWNER_SPECTATOR as well, which on clients cannot execute anything. So *hack*hack* it into temporarily player 0.
Darkvater
parents:
1834
diff
changeset
|
494 |
if (_network_dedicated) _local_player = OWNER_SPECTATOR; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
495 |
_docommand_recursive = 0; |
1820
d03c56850dc2
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1804
diff
changeset
|
496 |
_cmd_text = NULL; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
497 |
return true; |
0 | 498 |
} |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
499 |
#endif /* ENABLE_NETWORK */ |
0 | 500 |
|
501 |
// update last build coordinate of player. |
|
1962
8254df1b359b
(svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer
celestar
parents:
1891
diff
changeset
|
502 |
if ( tile != 0 && _current_player < MAX_PLAYERS) GetPlayer(_current_player)->last_build_coordinate = tile; |
0 | 503 |
|
889
64d2f7d5f02b
(svn r1375) -Fix: [1050990] Buying trains sometimes accounted for incorrectly. Was the result of the cost getting reset in a recursive call of docommand. That is fixed. In addition all cost-commands are typed explicitely. Please do not forget to do so or your costs will be credited to construction if you are unlucky.
darkvater
parents:
842
diff
changeset
|
504 |
/* Actually try and execute the command. If no cost-type is given |
64d2f7d5f02b
(svn r1375) -Fix: [1050990] Buying trains sometimes accounted for incorrectly. Was the result of the cost getting reset in a recursive call of docommand. That is fixed. In addition all cost-commands are typed explicitely. Please do not forget to do so or your costs will be credited to construction if you are unlucky.
darkvater
parents:
842
diff
changeset
|
505 |
* use the construction one */ |
64d2f7d5f02b
(svn r1375) -Fix: [1050990] Buying trains sometimes accounted for incorrectly. Was the result of the cost getting reset in a recursive call of docommand. That is fixed. In addition all cost-commands are typed explicitely. Please do not forget to do so or your costs will be credited to construction if you are unlucky.
darkvater
parents:
842
diff
changeset
|
506 |
_yearly_expenses_type = EXPENSES_CONSTRUCTION; |
0 | 507 |
res2 = proc(x,y, flags|DC_EXEC, p1, p2); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
147
diff
changeset
|
508 |
|
826 | 509 |
// If notest is on, it means the result of the test can be different than |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
534
diff
changeset
|
510 |
// the real command.. so ignore the test |
652
206a7c2016ba
(svn r1085) -Fix: [Network] [ 1084834 ] If IF_IN_NETWORK flag was on, an error
truelight
parents:
601
diff
changeset
|
511 |
if (!notest && !((cmd & CMD_NO_TEST_IF_IN_NETWORK) && _networking)) { |
0 | 512 |
assert(res == res2); // sanity check |
513 |
} else { |
|
1702
be148d0fbf9d
(svn r2206) - Regression Fix: slight typo of res2 into res, this also fixes recent bug "[ 1183396 ] Train can't find depot, it gives money in Multiplayer"
Darkvater
parents:
1701
diff
changeset
|
514 |
if (CmdFailed(res2)) { |
0 | 515 |
if (res2 & 0xFFFF) _error_message = res2 & 0xFFFF; |
516 |
goto show_error; |
|
517 |
} |
|
518 |
} |
|
519 |
||
520 |
SubtractMoneyFromPlayer(res2); |
|
521 |
||
522 |
if (_current_player == _local_player && _game_mode != GM_EDITOR) { |
|
523 |
if (res2 != 0) |
|
524 |
ShowCostOrIncomeAnimation(x, y, GetSlopeZ(x, y), res2); |
|
525 |
if (_additional_cash_required) { |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
526 |
SetDParam(0, _additional_cash_required); |
0 | 527 |
ShowErrorMessage(STR_0003_NOT_ENOUGH_CASH_REQUIRES, _error_message_2, x,y); |
528 |
if (res2 == 0) goto callb_err; |
|
529 |
} |
|
530 |
} |
|
531 |
||
532 |
_docommand_recursive = 0; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
147
diff
changeset
|
533 |
|
0 | 534 |
if (callback) callback(true, tile, p1, p2); |
1820
d03c56850dc2
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1804
diff
changeset
|
535 |
_cmd_text = NULL; |
0 | 536 |
return true; |
537 |
||
538 |
show_error: |
|
539 |
// show error message if the command fails? |
|
540 |
if (_current_player == _local_player && _error_message_2 != 0) |
|
541 |
ShowErrorMessage(_error_message, _error_message_2, x,y); |
|
542 |
||
543 |
callb_err: |
|
544 |
_docommand_recursive = 0; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
147
diff
changeset
|
545 |
|
0 | 546 |
if (callback) callback(false, tile, p1, p2); |
1820
d03c56850dc2
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1804
diff
changeset
|
547 |
_cmd_text = NULL; |
0 | 548 |
return false; |
549 |
} |