annotate command.c @ 3491:6aef91e18846 draft

(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex Remove DoCommandByTile(), because now it does the same as DoCommand()
author tron <tron@openttd.org>
date Mon, 10 Apr 2006 07:15:58 +0000
parents cb95eb3cf3d3
children f4cec86aeb9b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2186
042e6d005cb0 (svn r2701) Insert Id tags into all source files
tron <tron@openttd.org>
parents: 2163
diff changeset
1 /* $Id$ */
042e6d005cb0 (svn r2701) Insert Id tags into all source files
tron <tron@openttd.org>
parents: 2163
diff changeset
2
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
3 #include "stdafx.h"
1891
81b2cb2fc036 (svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater <Darkvater@openttd.org>
parents: 1877
diff changeset
4 #include "openttd.h"
507
9dcc34b8887e (svn r815) Include strings.h only in the files which need it.
tron <tron@openttd.org>
parents: 467
diff changeset
5 #include "table/strings.h"
2163
acad95b3c4a2 (svn r2673) Include functions.h directly, not globally via openttd.h
tron <tron@openttd.org>
parents: 2159
diff changeset
6 #include "functions.h"
679
21e658645b32 (svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron <tron@openttd.org>
parents: 652
diff changeset
7 #include "map.h"
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
8 #include "gui.h"
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
9 #include "command.h"
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
10 #include "player.h"
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 534
diff changeset
11 #include "network.h"
2159
a832c39b4afe (svn r2669) Shuffle some more stuff around to reduce dependencies
tron <tron@openttd.org>
parents: 1980
diff changeset
12 #include "variables.h"
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
13
1820
bda7198fe6ba (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 <tron@openttd.org>
parents: 1804
diff changeset
14 const char* _cmd_text = NULL;
bda7198fe6ba (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 <tron@openttd.org>
parents: 1804
diff changeset
15
3491
6aef91e18846 (svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron <tron@openttd.org>
parents: 3421
diff changeset
16 #define DEF_COMMAND(yyyy) int32 yyyy(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
17
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
18 DEF_COMMAND(CmdBuildRailroadTrack);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
19 DEF_COMMAND(CmdRemoveRailroadTrack);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
20 DEF_COMMAND(CmdBuildSingleRail);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
21 DEF_COMMAND(CmdRemoveSingleRail);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
22
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
23 DEF_COMMAND(CmdLandscapeClear);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
24
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
25 DEF_COMMAND(CmdBuildBridge);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
26
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
27 DEF_COMMAND(CmdBuildRailroadStation);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
28 DEF_COMMAND(CmdRemoveFromRailroadStation);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
29 DEF_COMMAND(CmdConvertRail);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
30
1227
259e7dab9c80 (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 <darkvater@openttd.org>
parents: 1217
diff changeset
31 DEF_COMMAND(CmdBuildSingleSignal);
259e7dab9c80 (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 <darkvater@openttd.org>
parents: 1217
diff changeset
32 DEF_COMMAND(CmdRemoveSingleSignal);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
33
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
34 DEF_COMMAND(CmdTerraformLand);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
35
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
36 DEF_COMMAND(CmdPurchaseLandArea);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
37 DEF_COMMAND(CmdSellLandArea);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
38
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
39 DEF_COMMAND(CmdBuildTunnel);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
40
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
41 DEF_COMMAND(CmdBuildTrainDepot);
395
9566850ffa0d (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 <darkvater@openttd.org>
parents: 215
diff changeset
42 DEF_COMMAND(CmdBuildTrainWaypoint);
9566850ffa0d (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 <darkvater@openttd.org>
parents: 215
diff changeset
43 DEF_COMMAND(CmdRenameWaypoint);
9566850ffa0d (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 <darkvater@openttd.org>
parents: 215
diff changeset
44 DEF_COMMAND(CmdRemoveTrainWaypoint);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
45
1217
9bc5fcb40a5d (svn r1721) -Feature: It is now possible to build multiple road stations (up to 8) on
celestar <celestar@openttd.org>
parents: 1093
diff changeset
46 DEF_COMMAND(CmdBuildRoadStop);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
47
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
48 DEF_COMMAND(CmdBuildLongRoad);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
49 DEF_COMMAND(CmdRemoveLongRoad);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
50 DEF_COMMAND(CmdBuildRoad);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
51 DEF_COMMAND(CmdRemoveRoad);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
52
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
53 DEF_COMMAND(CmdBuildRoadDepot);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
54
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
55 DEF_COMMAND(CmdBuildAirport);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
56
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
57 DEF_COMMAND(CmdBuildDock);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
58
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
59 DEF_COMMAND(CmdBuildShipDepot);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
60
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
61 DEF_COMMAND(CmdBuildBuoy);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
62
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
63 DEF_COMMAND(CmdPlantTree);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
64
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
65 DEF_COMMAND(CmdBuildRailVehicle);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
66 DEF_COMMAND(CmdMoveRailVehicle);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
67
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
68 DEF_COMMAND(CmdStartStopTrain);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
69
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
70 DEF_COMMAND(CmdSellRailWagon);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
71
1794
5f679efc4b84 (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater <Darkvater@openttd.org>
parents: 1786
diff changeset
72 DEF_COMMAND(CmdSendTrainToDepot);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
73 DEF_COMMAND(CmdForceTrainProceed);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
74 DEF_COMMAND(CmdReverseTrainDirection);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
75
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
76 DEF_COMMAND(CmdModifyOrder);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
77 DEF_COMMAND(CmdSkipOrder);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
78 DEF_COMMAND(CmdDeleteOrder);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
79 DEF_COMMAND(CmdInsertOrder);
2819
717b7b06dcdb (svn r3367) Unify the 4 distinct CMD_CHANGE_{AIRCRAFT,ROADVEH,SHIP,TRAIN}_SERVICE_INT commands into one CMD_CHANGE_SERVICE_INT command.
tron <tron@openttd.org>
parents: 2809
diff changeset
80 DEF_COMMAND(CmdChangeServiceInt);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
81 DEF_COMMAND(CmdRestoreOrderIndex);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
82
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
83 DEF_COMMAND(CmdBuildIndustry);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
84
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
85 DEF_COMMAND(CmdBuildCompanyHQ);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
86 DEF_COMMAND(CmdSetPlayerFace);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
87 DEF_COMMAND(CmdSetPlayerColor);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
88
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
89 DEF_COMMAND(CmdIncreaseLoan);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
90 DEF_COMMAND(CmdDecreaseLoan);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
91
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
92 DEF_COMMAND(CmdWantEnginePreview);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
93
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
94 DEF_COMMAND(CmdNameVehicle);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
95 DEF_COMMAND(CmdRenameEngine);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
96
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
97 DEF_COMMAND(CmdChangeCompanyName);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
98 DEF_COMMAND(CmdChangePresidentName);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
99
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
100 DEF_COMMAND(CmdRenameStation);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
101
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
102 DEF_COMMAND(CmdSellAircraft);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
103 DEF_COMMAND(CmdStartStopAircraft);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
104 DEF_COMMAND(CmdBuildAircraft);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
105 DEF_COMMAND(CmdSendAircraftToHangar);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
106 DEF_COMMAND(CmdRefitAircraft);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
107
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
108 DEF_COMMAND(CmdPlaceSign);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
109 DEF_COMMAND(CmdRenameSign);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
110
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
111 DEF_COMMAND(CmdBuildRoadVeh);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
112 DEF_COMMAND(CmdStartStopRoadVeh);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
113 DEF_COMMAND(CmdSellRoadVeh);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
114 DEF_COMMAND(CmdSendRoadVehToDepot);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
115 DEF_COMMAND(CmdTurnRoadVeh);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
116
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
117 DEF_COMMAND(CmdPause);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
118
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
119 DEF_COMMAND(CmdBuyShareInCompany);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
120 DEF_COMMAND(CmdSellShareInCompany);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
121 DEF_COMMAND(CmdBuyCompany);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
122
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
123 DEF_COMMAND(CmdBuildTown);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
124
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
125 DEF_COMMAND(CmdRenameTown);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
126 DEF_COMMAND(CmdDoTownAction);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
127
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
128 DEF_COMMAND(CmdSetRoadDriveSide);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
129
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
130 DEF_COMMAND(CmdChangeDifficultyLevel);
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 534
diff changeset
131 DEF_COMMAND(CmdChangePatchSetting);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
132
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
133 DEF_COMMAND(CmdStartStopShip);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
134 DEF_COMMAND(CmdSellShip);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
135 DEF_COMMAND(CmdBuildShip);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
136 DEF_COMMAND(CmdSendShipToDepot);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
137 DEF_COMMAND(CmdRefitShip);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
138
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
139 DEF_COMMAND(CmdCloneOrder);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
140
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
141 DEF_COMMAND(CmdClearArea);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
142
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 534
diff changeset
143 DEF_COMMAND(CmdGiveMoney);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
144 DEF_COMMAND(CmdMoneyCheat);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
145 DEF_COMMAND(CmdBuildCanal);
147
4a8a161e8d54 (svn r148) -Feature: Company HQ can now be moved somewhere else (cost 1% of company value). Water floods HQ.
darkvater <darkvater@openttd.org>
parents: 58
diff changeset
146 DEF_COMMAND(CmdBuildLock);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
147
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
148 DEF_COMMAND(CmdPlayerCtrl);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
149
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
150 DEF_COMMAND(CmdLevelLand);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
151
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
152 DEF_COMMAND(CmdRefitRailVehicle);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
153
1227
259e7dab9c80 (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 <darkvater@openttd.org>
parents: 1217
diff changeset
154 DEF_COMMAND(CmdBuildSignalTrack);
259e7dab9c80 (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 <darkvater@openttd.org>
parents: 1217
diff changeset
155 DEF_COMMAND(CmdRemoveSignalTrack);
58
9c9aa1db223f (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 <darkvater@openttd.org>
parents: 0
diff changeset
156
842
a71aeb1cfa97 (svn r1323) Adding autoreplace feature
bjarni <bjarni@openttd.org>
parents: 826
diff changeset
157 DEF_COMMAND(CmdReplaceVehicle);
812
ddbbbf294f73 (svn r1283) -Add: AutoRenew is now a client-side patch instead of a game-side patch
truelight <truelight@openttd.org>
parents: 679
diff changeset
158
2244
eba7ec7edf28 (svn r2764) -Feature: Clone vehicles
bjarni <bjarni@openttd.org>
parents: 2204
diff changeset
159 DEF_COMMAND(CmdCloneVehicle);
eba7ec7edf28 (svn r2764) -Feature: Clone vehicles
bjarni <bjarni@openttd.org>
parents: 2204
diff changeset
160
eba7ec7edf28 (svn r2764) -Feature: Clone vehicles
bjarni <bjarni@openttd.org>
parents: 2204
diff changeset
161
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
162 /* The master command table */
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
163 static const Command _command_proc_table[] = {
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
164 {CmdBuildRailroadTrack, 0}, /* 0 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
165 {CmdRemoveRailroadTrack, 0}, /* 1 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
166 {CmdBuildSingleRail, 0}, /* 2 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
167 {CmdRemoveSingleRail, 0}, /* 3 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
168 {CmdLandscapeClear, 0}, /* 4 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
169 {CmdBuildBridge, 0}, /* 5 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
170 {CmdBuildRailroadStation, 0}, /* 6 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
171 {CmdBuildTrainDepot, 0}, /* 7 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
172 {CmdBuildSingleSignal, 0}, /* 8 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
173 {CmdRemoveSingleSignal, 0}, /* 9 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
174 {CmdTerraformLand, 0}, /* 10 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
175 {CmdPurchaseLandArea, 0}, /* 11 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
176 {CmdSellLandArea, 0}, /* 12 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
177 {CmdBuildTunnel, 0}, /* 13 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
178 {CmdRemoveFromRailroadStation, 0}, /* 14 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
179 {CmdConvertRail, 0}, /* 15 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
180 {CmdBuildTrainWaypoint, 0}, /* 16 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
181 {CmdRenameWaypoint, 0}, /* 17 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
182 {CmdRemoveTrainWaypoint, 0}, /* 18 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
183 {NULL, 0}, /* 19 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
184 {NULL, 0}, /* 20 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
185 {CmdBuildRoadStop, 0}, /* 21 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
186 {NULL, 0}, /* 22 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
187 {CmdBuildLongRoad, 0}, /* 23 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
188 {CmdRemoveLongRoad, 0}, /* 24 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
189 {CmdBuildRoad, 0}, /* 25 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
190 {CmdRemoveRoad, 0}, /* 26 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
191 {CmdBuildRoadDepot, 0}, /* 27 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
192 {NULL, 0}, /* 28 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
193 {CmdBuildAirport, 0}, /* 29 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
194 {CmdBuildDock, 0}, /* 30 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
195 {CmdBuildShipDepot, 0}, /* 31 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
196 {CmdBuildBuoy, 0}, /* 32 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
197 {CmdPlantTree, 0}, /* 33 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
198 {CmdBuildRailVehicle, 0}, /* 34 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
199 {CmdMoveRailVehicle, 0}, /* 35 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
200 {CmdStartStopTrain, 0}, /* 36 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
201 {NULL, 0}, /* 37 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
202 {CmdSellRailWagon, 0}, /* 38 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
203 {CmdSendTrainToDepot, 0}, /* 39 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
204 {CmdForceTrainProceed, 0}, /* 40 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
205 {CmdReverseTrainDirection, 0}, /* 41 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
206
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
207 {CmdModifyOrder, 0}, /* 42 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
208 {CmdSkipOrder, 0}, /* 43 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
209 {CmdDeleteOrder, 0}, /* 44 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
210 {CmdInsertOrder, 0}, /* 45 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
211
2819
717b7b06dcdb (svn r3367) Unify the 4 distinct CMD_CHANGE_{AIRCRAFT,ROADVEH,SHIP,TRAIN}_SERVICE_INT commands into one CMD_CHANGE_SERVICE_INT command.
tron <tron@openttd.org>
parents: 2809
diff changeset
212 {CmdChangeServiceInt, 0}, /* 46 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
213
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
214 {CmdBuildIndustry, 0}, /* 47 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
215 {CmdBuildCompanyHQ, 0}, /* 48 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
216 {CmdSetPlayerFace, 0}, /* 49 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
217 {CmdSetPlayerColor, 0}, /* 50 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
218
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
219 {CmdIncreaseLoan, 0}, /* 51 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
220 {CmdDecreaseLoan, 0}, /* 52 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
221
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
222 {CmdWantEnginePreview, 0}, /* 53 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
223
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
224 {CmdNameVehicle, 0}, /* 54 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
225 {CmdRenameEngine, 0}, /* 55 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
226
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
227 {CmdChangeCompanyName, 0}, /* 56 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
228 {CmdChangePresidentName, 0}, /* 57 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
229
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
230 {CmdRenameStation, 0}, /* 58 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
231
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
232 {CmdSellAircraft, 0}, /* 59 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
233 {CmdStartStopAircraft, 0}, /* 60 */
1794
5f679efc4b84 (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater <Darkvater@openttd.org>
parents: 1786
diff changeset
234
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
235 {CmdBuildAircraft, 0}, /* 61 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
236 {CmdSendAircraftToHangar, 0}, /* 62 */
2819
717b7b06dcdb (svn r3367) Unify the 4 distinct CMD_CHANGE_{AIRCRAFT,ROADVEH,SHIP,TRAIN}_SERVICE_INT commands into one CMD_CHANGE_SERVICE_INT command.
tron <tron@openttd.org>
parents: 2809
diff changeset
237 {NULL, 0}, /* 63 */
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
238 {CmdRefitAircraft, 0}, /* 64 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
239
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
240 {CmdPlaceSign, 0}, /* 65 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
241 {CmdRenameSign, 0}, /* 66 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
242
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
243 {CmdBuildRoadVeh, 0}, /* 67 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
244 {CmdStartStopRoadVeh, 0}, /* 68 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
245 {CmdSellRoadVeh, 0}, /* 69 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
246 {CmdSendRoadVehToDepot, 0}, /* 70 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
247 {CmdTurnRoadVeh, 0}, /* 71 */
2819
717b7b06dcdb (svn r3367) Unify the 4 distinct CMD_CHANGE_{AIRCRAFT,ROADVEH,SHIP,TRAIN}_SERVICE_INT commands into one CMD_CHANGE_SERVICE_INT command.
tron <tron@openttd.org>
parents: 2809
diff changeset
248 {NULL, 0}, /* 72 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
249
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
250 {CmdPause, CMD_SERVER}, /* 73 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
251
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
252 {CmdBuyShareInCompany, 0}, /* 74 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
253 {CmdSellShareInCompany, 0}, /* 75 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
254 {CmdBuyCompany, 0}, /* 76 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
255
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
256 {CmdBuildTown, CMD_OFFLINE}, /* 77 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
257 {NULL, 0}, /* 78 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
258 {NULL, 0}, /* 79 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
259 {CmdRenameTown, CMD_SERVER}, /* 80 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
260 {CmdDoTownAction, 0}, /* 81 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
261
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
262 {CmdSetRoadDriveSide, CMD_SERVER}, /* 82 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
263 {NULL, 0}, /* 83 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
264 {NULL, 0}, /* 84 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
265 {CmdChangeDifficultyLevel, CMD_SERVER}, /* 85 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
266
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
267 {CmdStartStopShip, 0}, /* 86 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
268 {CmdSellShip, 0}, /* 87 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
269 {CmdBuildShip, 0}, /* 88 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
270 {CmdSendShipToDepot, 0}, /* 89 */
2819
717b7b06dcdb (svn r3367) Unify the 4 distinct CMD_CHANGE_{AIRCRAFT,ROADVEH,SHIP,TRAIN}_SERVICE_INT commands into one CMD_CHANGE_SERVICE_INT command.
tron <tron@openttd.org>
parents: 2809
diff changeset
271 {NULL, 0}, /* 90 */
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
272 {CmdRefitShip, 0}, /* 91 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
273
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
274 {NULL, 0}, /* 92 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
275 {NULL, 0}, /* 93 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
276 {NULL, 0}, /* 94 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
277 {NULL, 0}, /* 95 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
278 {NULL, 0}, /* 96 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
279 {NULL, 0}, /* 97 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
280 {NULL, 0}, /* 98 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
281
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
282 {CmdCloneOrder, 0}, /* 99 */
147
4a8a161e8d54 (svn r148) -Feature: Company HQ can now be moved somewhere else (cost 1% of company value). Water floods HQ.
darkvater <darkvater@openttd.org>
parents: 58
diff changeset
283
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
284 {CmdClearArea, 0}, /* 100 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
285 {NULL, 0}, /* 101 */
1796
80af8ed2ebd8 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater <Darkvater@openttd.org>
parents: 1794
diff changeset
286
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
287 {CmdMoneyCheat, CMD_OFFLINE}, /* 102 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
288 {CmdBuildCanal, 0}, /* 103 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
289 {CmdPlayerCtrl, 0}, /* 104 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
290
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
291 {CmdLevelLand, 0}, /* 105 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
292
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
293 {CmdRefitRailVehicle, 0}, /* 106 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
294 {CmdRestoreOrderIndex, 0}, /* 107 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
295 {CmdBuildLock, 0}, /* 108 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
296 {NULL, 0}, /* 109 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
297 {CmdBuildSignalTrack, 0}, /* 110 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
298 {CmdRemoveSignalTrack, 0}, /* 111 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
299 {NULL, 0}, /* 112 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
300 {CmdGiveMoney, 0}, /* 113 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
301 {CmdChangePatchSetting, CMD_SERVER}, /* 114 */
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
302 {CmdReplaceVehicle, 0}, /* 115 */
2244
eba7ec7edf28 (svn r2764) -Feature: Clone vehicles
bjarni <bjarni@openttd.org>
parents: 2204
diff changeset
303 {CmdCloneVehicle, 0}, /* 116 */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
304 };
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
305
903
81a2e3172b5a (svn r1389) -Add: [Network] Added packet protection. No longer a client or server
truelight <truelight@openttd.org>
parents: 889
diff changeset
306 /* This function range-checks a cmd, and checks if the cmd is not NULL */
959
ca7c19a004cc (svn r1451) Fix some of the signed/unsigned comparison warnings
tron <tron@openttd.org>
parents: 926
diff changeset
307 bool IsValidCommand(uint cmd)
903
81a2e3172b5a (svn r1389) -Add: [Network] Added packet protection. No longer a client or server
truelight <truelight@openttd.org>
parents: 889
diff changeset
308 {
2645
b086d6d1b76d (svn r3187) Simplify overly complicated ifs, especially if (foo) return false; else return true; is confusing
tron <tron@openttd.org>
parents: 2425
diff changeset
309 cmd &= 0xFF;
903
81a2e3172b5a (svn r1389) -Add: [Network] Added packet protection. No longer a client or server
truelight <truelight@openttd.org>
parents: 889
diff changeset
310
2645
b086d6d1b76d (svn r3187) Simplify overly complicated ifs, especially if (foo) return false; else return true; is confusing
tron <tron@openttd.org>
parents: 2425
diff changeset
311 return
b086d6d1b76d (svn r3187) Simplify overly complicated ifs, especially if (foo) return false; else return true; is confusing
tron <tron@openttd.org>
parents: 2425
diff changeset
312 cmd < lengthof(_command_proc_table) &&
b086d6d1b76d (svn r3187) Simplify overly complicated ifs, especially if (foo) return false; else return true; is confusing
tron <tron@openttd.org>
parents: 2425
diff changeset
313 _command_proc_table[cmd].proc != NULL;
903
81a2e3172b5a (svn r1389) -Add: [Network] Added packet protection. No longer a client or server
truelight <truelight@openttd.org>
parents: 889
diff changeset
314 }
81a2e3172b5a (svn r1389) -Add: [Network] Added packet protection. No longer a client or server
truelight <truelight@openttd.org>
parents: 889
diff changeset
315
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
316 byte GetCommandFlags(uint cmd) {return _command_proc_table[cmd & 0xFF].flags;}
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
317
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
318
2304
e70e09b8bb73 (svn r2828) Only command.c needs to know about _docommand_recursive, so make it static. Tell me if there's a problem, because i removed it from network_server.c, but afaict it should be ok
tron <tron@openttd.org>
parents: 2244
diff changeset
319 static int _docommand_recursive;
e70e09b8bb73 (svn r2828) Only command.c needs to know about _docommand_recursive, so make it static. Tell me if there's a problem, because i removed it from network_server.c, but afaict it should be ok
tron <tron@openttd.org>
parents: 2244
diff changeset
320
3491
6aef91e18846 (svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron <tron@openttd.org>
parents: 3421
diff changeset
321 int32 DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
322 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
323 int32 res;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
324 CommandProc *proc;
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 147
diff changeset
325
1776
891db10c7fdc (svn r2280) - Fix: Check if the passed tile to DoCommand is within the current mapsize
Darkvater <Darkvater@openttd.org>
parents: 1728
diff changeset
326 /* Do not even think about executing out-of-bounds tile-commands */
3491
6aef91e18846 (svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron <tron@openttd.org>
parents: 3421
diff changeset
327 if (tile >= MapSize()) {
1820
bda7198fe6ba (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 <tron@openttd.org>
parents: 1804
diff changeset
328 _cmd_text = NULL;
bda7198fe6ba (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 <tron@openttd.org>
parents: 1804
diff changeset
329 return CMD_ERROR;
bda7198fe6ba (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 <tron@openttd.org>
parents: 1804
diff changeset
330 }
1776
891db10c7fdc (svn r2280) - Fix: Check if the passed tile to DoCommand is within the current mapsize
Darkvater <Darkvater@openttd.org>
parents: 1728
diff changeset
331
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
332 proc = _command_proc_table[procc].proc;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
333
2749
1f62bf2f2eb3 (svn r3294) - Fix: use INVALID_STRING_ID instead of -1.
Darkvater <Darkvater@openttd.org>
parents: 2715
diff changeset
334 if (_docommand_recursive == 0) _error_message = INVALID_STRING_ID;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
335
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
336 _docommand_recursive++;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
337
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
338 // only execute the test call if it's toplevel, or we're not execing.
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
339 if (_docommand_recursive == 1 || !(flags & DC_EXEC) || (flags & DC_FORCETEST) ) {
3491
6aef91e18846 (svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron <tron@openttd.org>
parents: 3421
diff changeset
340 res = proc(tile, flags & ~DC_EXEC, p1, p2);
1691
681b5e560269 (svn r2195) Add CmdFailed() as the One True Way(tm) to check if a command failed.
tron <tron@openttd.org>
parents: 1623
diff changeset
341 if (CmdFailed(res)) {
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
342 if (res & 0xFFFF) _error_message = res & 0xFFFF;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
343 goto error;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
344 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
345
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
346 if (_docommand_recursive == 1) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
347 if (!(flags&DC_QUERY_COST) && res != 0 && !CheckPlayerHasMoney(res))
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
348 goto error;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
349 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
350
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
351 if (!(flags & DC_EXEC)) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
352 _docommand_recursive--;
1820
bda7198fe6ba (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 <tron@openttd.org>
parents: 1804
diff changeset
353 _cmd_text = NULL;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
354 return res;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
355 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
356 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
357
889
8a7301b5aa5b (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 <darkvater@openttd.org>
parents: 842
diff changeset
358 /* Execute the command here. All cost-relevant functions set the expenses type
8a7301b5aa5b (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 <darkvater@openttd.org>
parents: 842
diff changeset
359 * themselves with "SET_EXPENSES_TYPE(...);" at the beginning of the function */
3491
6aef91e18846 (svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron <tron@openttd.org>
parents: 3421
diff changeset
360 res = proc(tile, flags, p1, p2);
1691
681b5e560269 (svn r2195) Add CmdFailed() as the One True Way(tm) to check if a command failed.
tron <tron@openttd.org>
parents: 1623
diff changeset
361 if (CmdFailed(res)) {
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
362 if (res & 0xFFFF) _error_message = res & 0xFFFF;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
363 error:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
364 _docommand_recursive--;
1820
bda7198fe6ba (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 <tron@openttd.org>
parents: 1804
diff changeset
365 _cmd_text = NULL;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
366 return CMD_ERROR;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
367 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
368
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
369 // if toplevel, subtract the money.
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
370 if (--_docommand_recursive == 0) {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
371 SubtractMoneyFromPlayer(res);
2772
197339083d52 (svn r3319) - Fix (regression): "Unnamed Competitors". A result of revision r3224 which allowed AI's for multiplayer. Old AI's didn't function correctly anymore. The update of last-built tile is moved back, but to a slightly different place so it is only executed when the command is actually successfully executed. This code shouldn't be neccessary, but alas, the old AI doesn't use DoCommandDP() functions.
Darkvater <Darkvater@openttd.org>
parents: 2767
diff changeset
372 // XXX - Old AI hack which doesn't use DoCommandDP; update last build coord of player
3491
6aef91e18846 (svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron <tron@openttd.org>
parents: 3421
diff changeset
373 if (tile != 0 && _current_player < MAX_PLAYERS) {
6aef91e18846 (svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron <tron@openttd.org>
parents: 3421
diff changeset
374 GetPlayer(_current_player)->last_build_coordinate = tile;
2772
197339083d52 (svn r3319) - Fix (regression): "Unnamed Competitors". A result of revision r3224 which allowed AI's for multiplayer. Old AI's didn't function correctly anymore. The update of last-built tile is moved back, but to a slightly different place so it is only executed when the command is actually successfully executed. This code shouldn't be neccessary, but alas, the old AI doesn't use DoCommandDP() functions.
Darkvater <Darkvater@openttd.org>
parents: 2767
diff changeset
375 }
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
376 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
377
1820
bda7198fe6ba (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 <tron@openttd.org>
parents: 1804
diff changeset
378 _cmd_text = NULL;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
379 return res;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
380 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
381
1093
5029c37a31c0 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron <tron@openttd.org>
parents: 959
diff changeset
382 int32 GetAvailableMoneyForCommand(void)
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
383 {
1794
5f679efc4b84 (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater <Darkvater@openttd.org>
parents: 1786
diff changeset
384 PlayerID pid = _current_player;
147
4a8a161e8d54 (svn r148) -Feature: Company HQ can now be moved somewhere else (cost 1% of company value). Water floods HQ.
darkvater <darkvater@openttd.org>
parents: 58
diff changeset
385 if (pid >= MAX_PLAYERS) return 0x7FFFFFFF; // max int
1962
24ee3f699d48 (svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer
celestar <celestar@openttd.org>
parents: 1891
diff changeset
386 return GetPlayer(pid)->player_money;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
387 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
388
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
389 // toplevel network safe docommand function for the current player. must not be called recursively.
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
390 // the callback is called when the command succeeded or failed.
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
391 bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, uint32 cmd)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
392 {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
393 int32 res = 0,res2;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
394 CommandProc *proc;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
395 uint32 flags;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
396 bool notest;
3182
34fbc723248a (svn r3827) Remove the global variable _error_message_2, it's only used as local variable
tron <tron@openttd.org>
parents: 2820
diff changeset
397 StringID error_part1;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
398
3421
cb95eb3cf3d3 (svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar <celestar@openttd.org>
parents: 3182
diff changeset
399 int x = TileX(tile) * TILE_SIZE;
cb95eb3cf3d3 (svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
celestar <celestar@openttd.org>
parents: 3182
diff changeset
400 int y = TileY(tile) * TILE_SIZE;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
401
1776
891db10c7fdc (svn r2280) - Fix: Check if the passed tile to DoCommand is within the current mapsize
Darkvater <Darkvater@openttd.org>
parents: 1728
diff changeset
402 /* Do not even think about executing out-of-bounds tile-commands */
2820
9d8e0b41ef8a (svn r3368) Fix the same type of off-by-one error when checking, if the passed coordinate is on the map, like in r3357, but this time in DoCommandP - *cough* code duplication *cough*
tron <tron@openttd.org>
parents: 2819
diff changeset
403 if (tile >= MapSize()) {
1820
bda7198fe6ba (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 <tron@openttd.org>
parents: 1804
diff changeset
404 _cmd_text = NULL;
bda7198fe6ba (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 <tron@openttd.org>
parents: 1804
diff changeset
405 return false;
bda7198fe6ba (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 <tron@openttd.org>
parents: 1804
diff changeset
406 }
1776
891db10c7fdc (svn r2280) - Fix: Check if the passed tile to DoCommand is within the current mapsize
Darkvater <Darkvater@openttd.org>
parents: 1728
diff changeset
407
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 147
diff changeset
408 assert(_docommand_recursive == 0);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
409
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
410 _error_message = INVALID_STRING_ID;
3182
34fbc723248a (svn r3827) Remove the global variable _error_message_2, it's only used as local variable
tron <tron@openttd.org>
parents: 2820
diff changeset
411 error_part1 = GB(cmd, 16, 16);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
412 _additional_cash_required = 0;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
413
1834
cf4c15e04a89 (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 <Darkvater@openttd.org>
parents: 1820
diff changeset
414 /** Spectator has no rights except for the dedicated server which
cf4c15e04a89 (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 <Darkvater@openttd.org>
parents: 1820
diff changeset
415 * is a spectator but is the server, so can do anything */
cf4c15e04a89 (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 <Darkvater@openttd.org>
parents: 1820
diff changeset
416 if (_current_player == OWNER_SPECTATOR && !_network_dedicated) {
3182
34fbc723248a (svn r3827) Remove the global variable _error_message_2, it's only used as local variable
tron <tron@openttd.org>
parents: 2820
diff changeset
417 ShowErrorMessage(_error_message, error_part1, x, y);
1820
bda7198fe6ba (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 <tron@openttd.org>
parents: 1804
diff changeset
418 _cmd_text = NULL;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
419 return false;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
420 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
421
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
422 flags = 0;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
423 if (cmd & CMD_AUTO) flags |= DC_AUTO;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
424 if (cmd & CMD_NO_WATER) flags |= DC_NO_WATER;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
425
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
426 // get pointer to command handler
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
427 assert((cmd & 0xFF) < lengthof(_command_proc_table));
1804
5bce46125859 (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 <Darkvater@openttd.org>
parents: 1802
diff changeset
428 proc = _command_proc_table[cmd & 0xFF].proc;
1877
5cc49449518b (svn r2383) - Fix: Monkey-testing turned up some command crashes.
Darkvater <Darkvater@openttd.org>
parents: 1838
diff changeset
429 if (proc == NULL) {
5cc49449518b (svn r2383) - Fix: Monkey-testing turned up some command crashes.
Darkvater <Darkvater@openttd.org>
parents: 1838
diff changeset
430 _cmd_text = NULL;
5cc49449518b (svn r2383) - Fix: Monkey-testing turned up some command crashes.
Darkvater <Darkvater@openttd.org>
parents: 1838
diff changeset
431 return false;
5cc49449518b (svn r2383) - Fix: Monkey-testing turned up some command crashes.
Darkvater <Darkvater@openttd.org>
parents: 1838
diff changeset
432 }
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
433
826
f0bdeb9778ab (svn r1297) Language fixes in the source.. (ln-)
miham <miham@openttd.org>
parents: 812
diff changeset
434 // Some commands have a different output in dryrun than the realrun
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 534
diff changeset
435 // e.g.: if you demolish a whole town, the dryrun would say okay.
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 534
diff changeset
436 // but by really destroying, your rating drops and at a certain point
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 534
diff changeset
437 // it will fail. so res and res2 are different
467
9741de53e1b5 (svn r697) Fix the town road removal crash _still_ present there.
pasky <pasky@openttd.org>
parents: 395
diff changeset
438 // CMD_REMOVE_ROAD: This command has special local authority
9741de53e1b5 (svn r697) Fix the town road removal crash _still_ present there.
pasky <pasky@openttd.org>
parents: 395
diff changeset
439 // restrictions which may cause the test run to fail (the previous
9741de53e1b5 (svn r697) Fix the town road removal crash _still_ present there.
pasky <pasky@openttd.org>
parents: 395
diff changeset
440 // road fragments still stay there and the town won't let you
9741de53e1b5 (svn r697) Fix the town road removal crash _still_ present there.
pasky <pasky@openttd.org>
parents: 395
diff changeset
441 // disconnect the road system), but the exec will succeed and this
9741de53e1b5 (svn r697) Fix the town road removal crash _still_ present there.
pasky <pasky@openttd.org>
parents: 395
diff changeset
442 // fact will trigger an assertion failure. --pasky
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 147
diff changeset
443 notest =
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 147
diff changeset
444 (cmd & 0xFF) == CMD_CLEAR_AREA ||
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 147
diff changeset
445 (cmd & 0xFF) == CMD_CONVERT_RAIL ||
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
446 (cmd & 0xFF) == CMD_LEVEL_LAND ||
1701
6ead7449b9ce (svn r2205) - Fixup of revision 2200, not twice CMD_REMOVE_LONG_ROAD :p. Thanks TrueLight.
Darkvater <Darkvater@openttd.org>
parents: 1696
diff changeset
447 (cmd & 0xFF) == CMD_REMOVE_ROAD ||
1696
e74c7e40880e (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 <Darkvater@openttd.org>
parents: 1691
diff changeset
448 (cmd & 0xFF) == CMD_REMOVE_LONG_ROAD;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
449
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
450 _docommand_recursive = 1;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
451
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
452 // cost estimation only?
2425
b79a84f8df2c (svn r2951) - Fix: [ 1259345 ] Changing engine in netgame opens train window for everyone
Darkvater <Darkvater@openttd.org>
parents: 2304
diff changeset
453 if (_shift_pressed && IsLocalPlayer() && !(cmd & (CMD_NETWORK_COMMAND | CMD_SHOW_NO_ERROR))) {
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
454 // estimate the cost.
3491
6aef91e18846 (svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron <tron@openttd.org>
parents: 3421
diff changeset
455 res = proc(tile, flags, p1, p2);
1691
681b5e560269 (svn r2195) Add CmdFailed() as the One True Way(tm) to check if a command failed.
tron <tron@openttd.org>
parents: 1623
diff changeset
456 if (CmdFailed(res)) {
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
457 if (res & 0xFFFF) _error_message = res & 0xFFFF;
3182
34fbc723248a (svn r3827) Remove the global variable _error_message_2, it's only used as local variable
tron <tron@openttd.org>
parents: 2820
diff changeset
458 ShowErrorMessage(_error_message, error_part1, x, y);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
459 } else {
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
460 ShowEstimatedCostOrIncome(res, x, y);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
461 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
462
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
463 _docommand_recursive = 0;
1820
bda7198fe6ba (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 <tron@openttd.org>
parents: 1804
diff changeset
464 _cmd_text = NULL;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
465 return false;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
466 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
467
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 147
diff changeset
468
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 534
diff changeset
469 if (!((cmd & CMD_NO_TEST_IF_IN_NETWORK) && _networking)) {
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
470 // first test if the command can be executed.
3491
6aef91e18846 (svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron <tron@openttd.org>
parents: 3421
diff changeset
471 res = proc(tile, flags, p1, p2);
1691
681b5e560269 (svn r2195) Add CmdFailed() as the One True Way(tm) to check if a command failed.
tron <tron@openttd.org>
parents: 1623
diff changeset
472 if (CmdFailed(res)) {
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
473 if (res & 0xFFFF) _error_message = res & 0xFFFF;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
474 goto show_error;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
475 }
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 534
diff changeset
476 // no money? Only check if notest is off
2767
b065d9f50aef (svn r3313) Remove GPMI related changes from trunk
tron <tron@openttd.org>
parents: 2759
diff changeset
477 if (!notest && res != 0 && !CheckPlayerHasMoney(res)) goto show_error;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
478 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
479
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 534
diff changeset
480 #ifdef ENABLE_NETWORK
1838
925fb6fd2fb5 (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 <Darkvater@openttd.org>
parents: 1834
diff changeset
481 /** If we are in network, and the command is not from the network
925fb6fd2fb5 (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 <Darkvater@openttd.org>
parents: 1834
diff changeset
482 * send it to the command-queue and abort execution
925fb6fd2fb5 (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 <Darkvater@openttd.org>
parents: 1834
diff changeset
483 * If we are a dedicated server temporarily switch local player, otherwise
925fb6fd2fb5 (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 <Darkvater@openttd.org>
parents: 1834
diff changeset
484 * the other parties won't be able to execute our command and will desync.
925fb6fd2fb5 (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 <Darkvater@openttd.org>
parents: 1834
diff changeset
485 * @todo Rewrite dedicated server to something more than a dirty hack!
925fb6fd2fb5 (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 <Darkvater@openttd.org>
parents: 1834
diff changeset
486 */
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 534
diff changeset
487 if (_networking && !(cmd & CMD_NETWORK_COMMAND)) {
1838
925fb6fd2fb5 (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 <Darkvater@openttd.org>
parents: 1834
diff changeset
488 if (_network_dedicated) _local_player = 0;
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 534
diff changeset
489 NetworkSend_Command(tile, p1, p2, cmd, callback);
1838
925fb6fd2fb5 (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 <Darkvater@openttd.org>
parents: 1834
diff changeset
490 if (_network_dedicated) _local_player = OWNER_SPECTATOR;
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 534
diff changeset
491 _docommand_recursive = 0;
1820
bda7198fe6ba (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 <tron@openttd.org>
parents: 1804
diff changeset
492 _cmd_text = NULL;
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 534
diff changeset
493 return true;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
494 }
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 534
diff changeset
495 #endif /* ENABLE_NETWORK */
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
496
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
497 // update last build coordinate of player.
1962
24ee3f699d48 (svn r2468) -Codechange: Got rid of DEREF_PLAYER and replaced it by GetPlayer
celestar <celestar@openttd.org>
parents: 1891
diff changeset
498 if ( tile != 0 && _current_player < MAX_PLAYERS) GetPlayer(_current_player)->last_build_coordinate = tile;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
499
889
8a7301b5aa5b (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 <darkvater@openttd.org>
parents: 842
diff changeset
500 /* Actually try and execute the command. If no cost-type is given
8a7301b5aa5b (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 <darkvater@openttd.org>
parents: 842
diff changeset
501 * use the construction one */
8a7301b5aa5b (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 <darkvater@openttd.org>
parents: 842
diff changeset
502 _yearly_expenses_type = EXPENSES_CONSTRUCTION;
3491
6aef91e18846 (svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron <tron@openttd.org>
parents: 3421
diff changeset
503 res2 = proc(tile, flags|DC_EXEC, p1, p2);
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 147
diff changeset
504
826
f0bdeb9778ab (svn r1297) Language fixes in the source.. (ln-)
miham <miham@openttd.org>
parents: 812
diff changeset
505 // If notest is on, it means the result of the test can be different than
543
0bade3c3b8ba (svn r942) -Merged branch/network back into the trunk
truelight <truelight@openttd.org>
parents: 534
diff changeset
506 // the real command.. so ignore the test
652
45c107be2fca (svn r1085) -Fix: [Network] [ 1084834 ] If IF_IN_NETWORK flag was on, an error
truelight <truelight@openttd.org>
parents: 601
diff changeset
507 if (!notest && !((cmd & CMD_NO_TEST_IF_IN_NETWORK) && _networking)) {
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
508 assert(res == res2); // sanity check
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
509 } else {
1702
83aefdb31cff (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 <Darkvater@openttd.org>
parents: 1701
diff changeset
510 if (CmdFailed(res2)) {
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
511 if (res2 & 0xFFFF) _error_message = res2 & 0xFFFF;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
512 goto show_error;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
513 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
514 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
515
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
516 SubtractMoneyFromPlayer(res2);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
517
2425
b79a84f8df2c (svn r2951) - Fix: [ 1259345 ] Changing engine in netgame opens train window for everyone
Darkvater <Darkvater@openttd.org>
parents: 2304
diff changeset
518 if (IsLocalPlayer() && _game_mode != GM_EDITOR) {
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
519 if (res2 != 0)
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
520 ShowCostOrIncomeAnimation(x, y, GetSlopeZ(x, y), res2);
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
521 if (_additional_cash_required) {
534
6de858608a45 (svn r901) Small step in the process to clean up the DPARAM mess:
tron <tron@openttd.org>
parents: 507
diff changeset
522 SetDParam(0, _additional_cash_required);
3182
34fbc723248a (svn r3827) Remove the global variable _error_message_2, it's only used as local variable
tron <tron@openttd.org>
parents: 2820
diff changeset
523 ShowErrorMessage(STR_0003_NOT_ENOUGH_CASH_REQUIRES, error_part1, x,y);
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
524 if (res2 == 0) goto callb_err;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
525 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
526 }
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
527
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
528 _docommand_recursive = 0;
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 147
diff changeset
529
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
530 if (callback) callback(true, tile, p1, p2);
1820
bda7198fe6ba (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 <tron@openttd.org>
parents: 1804
diff changeset
531 _cmd_text = NULL;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
532 return true;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
533
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
534 show_error:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
535 // show error message if the command fails?
3182
34fbc723248a (svn r3827) Remove the global variable _error_message_2, it's only used as local variable
tron <tron@openttd.org>
parents: 2820
diff changeset
536 if (IsLocalPlayer() && error_part1 != 0) {
34fbc723248a (svn r3827) Remove the global variable _error_message_2, it's only used as local variable
tron <tron@openttd.org>
parents: 2820
diff changeset
537 ShowErrorMessage(_error_message, error_part1, x,y);
34fbc723248a (svn r3827) Remove the global variable _error_message_2, it's only used as local variable
tron <tron@openttd.org>
parents: 2820
diff changeset
538 }
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
539
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
540 callb_err:
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
541 _docommand_recursive = 0;
193
d9c55f0bc5ec (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight <truelight@openttd.org>
parents: 147
diff changeset
542
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
543 if (callback) callback(false, tile, p1, p2);
1820
bda7198fe6ba (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 <tron@openttd.org>
parents: 1804
diff changeset
544 _cmd_text = NULL;
0
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
545 return false;
fa6ee4d75c8a (svn r1) Import of revision 975 of old (crashed) SVN
truelight <truelight@openttd.org>
parents:
diff changeset
546 }