Files
@ r4855:00332ec5d245
Branch filter:
Location: cpp/openttd-patchpack/source/command.h - annotation
r4855:00332ec5d245
6.5 KiB
text/x-c
(svn r6781) - Fix (r5926): Some house introduction dates were incorrectly adjusted in the move to 32bit dates.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | r2186:5ee653b1b5e1 r2186:5ee653b1b5e1 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r0:d63b455452f6 r4495:4147c9c858d4 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4712:ace1fd623579 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r193:6aa65dc5a4b4 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r1227:78cc646079bf r4661:f04708c9a3e8 r2244:0a45bb36cb48 r4344:bff007ae1fd1 r4640:3c3015b68f36 r4659:eac0d373b66a r4662:d52885a4183b r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r543:efdb197f91ad r4344:bff007ae1fd1 r0:d63b455452f6 r0:d63b455452f6 r1804:36be1e10ff8e r1804:36be1e10ff8e r1804:36be1e10ff8e r1804:36be1e10ff8e r1804:36be1e10ff8e r1804:36be1e10ff8e r1804:36be1e10ff8e r1804:36be1e10ff8e r3491:10ed78e15d31 r3491:10ed78e15d31 r1804:36be1e10ff8e r1804:36be1e10ff8e r1804:36be1e10ff8e r1804:36be1e10ff8e r1804:36be1e10ff8e r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1713:410310936d0e r1713:410310936d0e r1713:410310936d0e r1713:410310936d0e r1713:410310936d0e r1691:1594a4bdcc21 r1691:1594a4bdcc21 r1691:1594a4bdcc21 r1691:1594a4bdcc21 r1691:1594a4bdcc21 r1691:1594a4bdcc21 r0:d63b455452f6 r4828:36b2551e4f6c r3491:10ed78e15d31 r4828:36b2551e4f6c r4828:36b2551e4f6c r4828:36b2551e4f6c r4828:36b2551e4f6c r4828:36b2551e4f6c r4828:36b2551e4f6c r0:d63b455452f6 r1820:335b057adac7 r1820:335b057adac7 r959:bb0ac3e56084 r1804:36be1e10ff8e r1093:18f56ef2d029 r0:d63b455452f6 r0:d63b455452f6 | /* $Id$ */
#ifndef COMMAND_H
#define COMMAND_H
enum {
CMD_BUILD_RAILROAD_TRACK = 0,
CMD_REMOVE_RAILROAD_TRACK = 1,
CMD_BUILD_SINGLE_RAIL = 2,
CMD_REMOVE_SINGLE_RAIL = 3,
CMD_LANDSCAPE_CLEAR = 4,
CMD_BUILD_BRIDGE = 5,
CMD_BUILD_RAILROAD_STATION = 6,
CMD_BUILD_TRAIN_DEPOT = 7,
CMD_BUILD_SIGNALS = 8,
CMD_REMOVE_SIGNALS = 9,
CMD_TERRAFORM_LAND = 10,
CMD_PURCHASE_LAND_AREA = 11,
CMD_SELL_LAND_AREA = 12,
CMD_BUILD_TUNNEL = 13,
CMD_REMOVE_FROM_RAILROAD_STATION = 14,
CMD_CONVERT_RAIL = 15,
CMD_BUILD_TRAIN_WAYPOINT = 16,
CMD_RENAME_WAYPOINT = 17,
CMD_REMOVE_TRAIN_WAYPOINT = 18,
CMD_BUILD_ROAD_STOP = 21,
CMD_BUILD_LONG_ROAD = 23,
CMD_REMOVE_LONG_ROAD = 24,
CMD_BUILD_ROAD = 25,
CMD_REMOVE_ROAD = 26,
CMD_BUILD_ROAD_DEPOT = 27,
CMD_BUILD_AIRPORT = 29,
CMD_BUILD_DOCK = 30,
CMD_BUILD_SHIP_DEPOT = 31,
CMD_BUILD_BUOY = 32,
CMD_PLANT_TREE = 33,
CMD_BUILD_RAIL_VEHICLE = 34,
CMD_MOVE_RAIL_VEHICLE = 35,
CMD_START_STOP_TRAIN = 36,
CMD_SELL_RAIL_WAGON = 38,
CMD_SEND_TRAIN_TO_DEPOT = 39,
CMD_FORCE_TRAIN_PROCEED = 40,
CMD_REVERSE_TRAIN_DIRECTION = 41,
CMD_MODIFY_ORDER = 42,
CMD_SKIP_ORDER = 43,
CMD_DELETE_ORDER = 44,
CMD_INSERT_ORDER = 45,
CMD_CHANGE_SERVICE_INT = 46,
CMD_BUILD_INDUSTRY = 47,
CMD_BUILD_COMPANY_HQ = 48,
CMD_SET_PLAYER_FACE = 49,
CMD_SET_PLAYER_COLOR = 50,
CMD_INCREASE_LOAN = 51,
CMD_DECREASE_LOAN = 52,
CMD_WANT_ENGINE_PREVIEW = 53,
CMD_NAME_VEHICLE = 54,
CMD_RENAME_ENGINE = 55,
CMD_CHANGE_COMPANY_NAME = 56,
CMD_CHANGE_PRESIDENT_NAME = 57,
CMD_RENAME_STATION = 58,
CMD_SELL_AIRCRAFT = 59,
CMD_START_STOP_AIRCRAFT = 60,
CMD_BUILD_AIRCRAFT = 61,
CMD_SEND_AIRCRAFT_TO_HANGAR = 62,
CMD_REFIT_AIRCRAFT = 64,
CMD_PLACE_SIGN = 65,
CMD_RENAME_SIGN = 66,
CMD_BUILD_ROAD_VEH = 67,
CMD_START_STOP_ROADVEH = 68,
CMD_SELL_ROAD_VEH = 69,
CMD_SEND_ROADVEH_TO_DEPOT = 70,
CMD_TURN_ROADVEH = 71,
CMD_REFIT_ROAD_VEH = 72,
CMD_PAUSE = 73,
CMD_BUY_SHARE_IN_COMPANY = 74,
CMD_SELL_SHARE_IN_COMPANY = 75,
CMD_BUY_COMPANY = 76,
CMD_BUILD_TOWN = 77,
CMD_RENAME_TOWN = 80,
CMD_DO_TOWN_ACTION = 81,
CMD_SET_ROAD_DRIVE_SIDE = 82,
CMD_CHANGE_DIFFICULTY_LEVEL = 85,
CMD_START_STOP_SHIP = 86,
CMD_SELL_SHIP = 87,
CMD_BUILD_SHIP = 88,
CMD_SEND_SHIP_TO_DEPOT = 89,
CMD_REFIT_SHIP = 91,
CMD_ORDER_REFIT = 98,
CMD_CLONE_ORDER = 99,
CMD_CLEAR_AREA = 100,
CMD_MONEY_CHEAT = 102,
CMD_BUILD_CANAL = 103,
CMD_PLAYER_CTRL = 104, // used in multiplayer to create a new player etc.
CMD_LEVEL_LAND = 105, // level land
CMD_REFIT_RAIL_VEHICLE = 106,
CMD_RESTORE_ORDER_INDEX = 107,
CMD_BUILD_LOCK = 108,
CMD_BUILD_SIGNAL_TRACK = 110,
CMD_REMOVE_SIGNAL_TRACK = 111,
CMD_GIVE_MONEY = 113,
CMD_CHANGE_PATCH_SETTING = 114,
CMD_SET_AUTOREPLACE = 115,
CMD_CLONE_VEHICLE = 116,
CMD_MASS_START_STOP = 117,
CMD_DEPOT_SELL_ALL_VEHICLES = 118,
CMD_DEPOT_MASS_AUTOREPLACE = 119,
};
enum {
DC_EXEC = 0x01,
DC_AUTO = 0x02, // don't allow building on structures
DC_QUERY_COST = 0x04, // query cost only, don't build.
DC_NO_WATER = 0x08, // don't allow building on water
DC_NO_RAIL_OVERLAP = 0x10, // don't allow overlap of rails (used in buildrail)
DC_AI_BUILDING = 0x20, // special building rules for AI
DC_NO_TOWN_RATING = 0x40, // town rating does not disallow you from building
DC_FORCETEST = 0x80, // force test too.
CMD_ERROR = ((int32)0x80000000),
};
#define CMD_MSG(x) ((x)<<16)
enum {
CMD_AUTO = 0x0200,
CMD_NO_WATER = 0x0400,
CMD_NETWORK_COMMAND = 0x0800, // execute the command without sending it on the network
CMD_NO_TEST_IF_IN_NETWORK = 0x1000, // When enabled, the command will bypass the no-DC_EXEC round if in network
CMD_SHOW_NO_ERROR = 0x2000,
};
/** Command flags for the command table
* @see _command_proc_table
*/
enum {
CMD_SERVER = 0x1, /// the command can only be initiated by the server
CMD_OFFLINE = 0x2, /// the command cannot be executed in a multiplayer game; single-player only
};
typedef int32 CommandProc(TileIndex tile, uint32 flags, uint32 p1, uint32 p2);
typedef struct Command {
CommandProc *proc;
byte flags;
} Command;
//#define return_cmd_error(errcode) do { _error_message=(errcode); return CMD_ERROR; } while(0)
#define return_cmd_error(errcode) do { return CMD_ERROR | (errcode); } while (0)
/**
* Check the return value of a DoCommand*() function
* @param res the resulting value from the command to be checked
* @return Return true if the command failed, false otherwise
*/
static inline bool CmdFailed(int32 res)
{
// lower 16bits are the StringID of the possible error
return res <= (CMD_ERROR | INVALID_STRING_ID);
}
/* command.c */
typedef void CommandCallback(bool success, TileIndex tile, uint32 p1, uint32 p2);
int32 DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc);
bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, uint32 cmd);
#ifdef ENABLE_NETWORK
void NetworkSend_Command(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback);
#endif /* ENABLE_NETWORK */
extern const char* _cmd_text; // Text, which gets sent with a command
bool IsValidCommand(uint cmd);
byte GetCommandFlags(uint cmd);
int32 GetAvailableMoneyForCommand(void);
#endif /* COMMAND_H */
|