src/command.h
author rubidium
Mon, 24 Sep 2007 20:56:33 +0000
changeset 8123 2f8dfb527d7c
parent 8056 1020455bfd81
permissions -rw-r--r--
(svn r11158) -Codechange: reduce the amount of Random calls needed when we do not have NewGRF industries that actually need the random bits.
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 1820
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 1820
diff changeset
     2
6449
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6338
diff changeset
     3
/** @file command.h */
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6338
diff changeset
     4
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
#ifndef COMMAND_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     6
#define COMMAND_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
     8
/**
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
     9
 * List of commands.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    10
 *
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    11
 * This enum defines all possible commands which can be executed to the game
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    12
 * engine. Observing the game like the query-tool or checking the profit of a
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    13
 * vehicle don't result in a command which should be executed in the engine
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    14
 * nor send to the server in a network game.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    15
 *
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    16
 * @see _command_proc_table
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    17
 */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    18
enum {
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    19
	CMD_BUILD_RAILROAD_TRACK         =   0, ///< build a rail track
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    20
	CMD_REMOVE_RAILROAD_TRACK        =   1, ///< remove a rail track
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    21
	CMD_BUILD_SINGLE_RAIL            =   2, ///< build a single rail track
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    22
	CMD_REMOVE_SINGLE_RAIL           =   3, ///< remove a single rail track
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    23
	CMD_LANDSCAPE_CLEAR              =   4, ///< demolish a tile
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    24
	CMD_BUILD_BRIDGE                 =   5, ///< build a bridge
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    25
	CMD_BUILD_RAILROAD_STATION       =   6, ///< build a railroad station
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    26
	CMD_BUILD_TRAIN_DEPOT            =   7, ///< build a train depot
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    27
	CMD_BUILD_SIGNALS                =   8, ///< build a signal
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    28
	CMD_REMOVE_SIGNALS               =   9, ///< remove a signal
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    29
	CMD_TERRAFORM_LAND               =  10, ///< terraform a tile
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    30
	CMD_PURCHASE_LAND_AREA           =  11, ///< purchase a tile
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    31
	CMD_SELL_LAND_AREA               =  12, ///< sell a bought tile before
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    32
	CMD_BUILD_TUNNEL                 =  13, ///< build a tunnel
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 3990
diff changeset
    33
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    34
	CMD_REMOVE_FROM_RAILROAD_STATION =  14, ///< remove a tile station
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    35
	CMD_CONVERT_RAIL                 =  15, ///< convert a rail type
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 3990
diff changeset
    36
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    37
	CMD_BUILD_TRAIN_WAYPOINT         =  16, ///< build a waypoint
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    38
	CMD_RENAME_WAYPOINT              =  17, ///< rename a waypoint
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    39
	CMD_REMOVE_TRAIN_WAYPOINT        =  18, ///< remove a waypoint
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 3990
diff changeset
    40
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    41
	CMD_BUILD_ROAD_STOP              =  21, ///< build a road stop
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    42
	CMD_REMOVE_ROAD_STOP             =  22, ///< remove a road stop
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    43
	CMD_BUILD_LONG_ROAD              =  23, ///< build a complete road (not a "half" one)
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    44
	CMD_REMOVE_LONG_ROAD             =  24, ///< remove a complete road (not a "half" one)
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    45
	CMD_BUILD_ROAD                   =  25, ///< build a "half" road
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    46
	CMD_REMOVE_ROAD                  =  26, ///< remove a "half" road
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    47
	CMD_BUILD_ROAD_DEPOT             =  27, ///< build a road depot
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 3990
diff changeset
    48
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    49
	CMD_BUILD_AIRPORT                =  29, ///< build an airport
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 3990
diff changeset
    50
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    51
	CMD_BUILD_DOCK                   =  30, ///< build a dock
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 3990
diff changeset
    52
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    53
	CMD_BUILD_SHIP_DEPOT             =  31, ///< build a ship depot
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    54
	CMD_BUILD_BUOY                   =  32, ///< build a buoy
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    55
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    56
	CMD_PLANT_TREE                   =  33, ///< plant a tree
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    57
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    58
	CMD_BUILD_RAIL_VEHICLE           =  34, ///< build a rail vehicle
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    59
	CMD_MOVE_RAIL_VEHICLE            =  35, ///< move a rail vehicle (in the depot)
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    60
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    61
	CMD_START_STOP_TRAIN             =  36, ///< start or stop a train
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    62
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    63
	CMD_SELL_RAIL_WAGON              =  38, ///< sell a rail wagon
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    64
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    65
	CMD_SEND_TRAIN_TO_DEPOT          =  39, ///< send a train to a depot
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    66
	CMD_FORCE_TRAIN_PROCEED          =  40, ///< proceed a train to pass a red signal
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    67
	CMD_REVERSE_TRAIN_DIRECTION      =  41, ///< turn a train around
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    68
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    69
	CMD_MODIFY_ORDER                 =  42, ///< modify an order (like set full-load)
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    70
	CMD_SKIP_TO_ORDER                =  43, ///< skip an order to the next of specific one
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    71
	CMD_DELETE_ORDER                 =  44, ///< delete an order
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    72
	CMD_INSERT_ORDER                 =  45, ///< insert a new order
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    73
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    74
	CMD_CHANGE_SERVICE_INT           =  46, ///< change the server interval of a vehicle
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    75
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    76
	CMD_BUILD_INDUSTRY               =  47, ///< build a new industry
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    77
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    78
	CMD_BUILD_COMPANY_HQ             =  48, ///< build the company headquarter
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    79
	CMD_SET_PLAYER_FACE              =  49, ///< set the face of the player/company
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    80
	CMD_SET_PLAYER_COLOR             =  50, ///< set the color of the player/company
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    81
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    82
	CMD_INCREASE_LOAN                =  51, ///< increase the loan from the bank
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    83
	CMD_DECREASE_LOAN                =  52, ///< decrease the loan from the bank
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    84
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    85
	CMD_WANT_ENGINE_PREVIEW          =  53, ///< confirm the preview of an engine
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    86
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    87
	CMD_NAME_VEHICLE                 =  54, ///< rename a whole vehicle
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    88
	CMD_RENAME_ENGINE                =  55, ///< rename a engine (in the engine list)
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    89
	CMD_CHANGE_COMPANY_NAME          =  56, ///< change the company name
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    90
	CMD_CHANGE_PRESIDENT_NAME        =  57, ///< change the president name
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    91
	CMD_RENAME_STATION               =  58, ///< rename a station
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    92
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    93
	CMD_SELL_AIRCRAFT                =  59, ///< sell an aircraft
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    94
	CMD_START_STOP_AIRCRAFT          =  60, ///< start/stop an aircraft
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    95
	CMD_BUILD_AIRCRAFT               =  61, ///< build an aircraft
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    96
	CMD_SEND_AIRCRAFT_TO_HANGAR      =  62, ///< send an aircraft to a hanger
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
    97
	CMD_REFIT_AIRCRAFT               =  64, ///< refit the cargo space of an aircraft
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    98
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
    99
	CMD_PLACE_SIGN                   =  65, ///< place a sign
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   100
	CMD_RENAME_SIGN                  =  66, ///< rename a sign
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   101
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   102
	CMD_BUILD_ROAD_VEH               =  67, ///< build a road vehicle
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   103
	CMD_START_STOP_ROADVEH           =  68, ///< start/stop a road vehicle
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   104
	CMD_SELL_ROAD_VEH                =  69, ///< sell a road vehicle
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   105
	CMD_SEND_ROADVEH_TO_DEPOT        =  70, ///< send a road vehicle to the depot
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   106
	CMD_TURN_ROADVEH                 =  71, ///< turn a road vehicle around
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   107
	CMD_REFIT_ROAD_VEH               =  72, ///< refit the cargo space of a road vehicle
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   108
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   109
	CMD_PAUSE                        =  73, ///< pause the game
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   110
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   111
	CMD_BUY_SHARE_IN_COMPANY         =  74, ///< buy a share from a company
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   112
	CMD_SELL_SHARE_IN_COMPANY        =  75, ///< sell a share from a company
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   113
	CMD_BUY_COMPANY                  =  76, ///< buy a company which is bankrupt
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   114
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   115
	CMD_BUILD_TOWN                   =  77, ///< build a town
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   116
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   117
	CMD_RENAME_TOWN                  =  80, ///< rename a town
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   118
	CMD_DO_TOWN_ACTION               =  81, ///< do a action from the town detail window (like advertises or bribe)
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   119
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   120
	CMD_SET_ROAD_DRIVE_SIDE          =  82, ///< set the side where the road vehicles drive
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   121
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   122
	CMD_CHANGE_DIFFICULTY_LEVEL      =  85, ///< change the difficult of a game (each setting for it own)
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   123
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   124
	CMD_START_STOP_SHIP              =  86, ///< start/stop a ship
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   125
	CMD_SELL_SHIP                    =  87, ///< sell a ship
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   126
	CMD_BUILD_SHIP                   =  88, ///< build a new ship
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   127
	CMD_SEND_SHIP_TO_DEPOT           =  89, ///< send a ship to a depot
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   128
	CMD_REFIT_SHIP                   =  91, ///< refit the cargo space of a ship
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   129
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   130
	CMD_ORDER_REFIT                  =  98, ///< change the refit informaction of an order (for "goto depot" )
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   131
	CMD_CLONE_ORDER                  =  99, ///< clone (and share) an order
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   132
	CMD_CLEAR_AREA                   = 100, ///< clear an area
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   133
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   134
	CMD_MONEY_CHEAT                  = 102, ///< do the money cheat
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   135
	CMD_BUILD_CANAL                  = 103, ///< build a canal
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 3990
diff changeset
   136
6449
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6338
diff changeset
   137
	CMD_PLAYER_CTRL                  = 104, ///< used in multiplayer to create a new player etc.
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6338
diff changeset
   138
	CMD_LEVEL_LAND                   = 105, ///< level land
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 3990
diff changeset
   139
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   140
	CMD_REFIT_RAIL_VEHICLE           = 106, ///< refit the cargo space of a train
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   141
	CMD_RESTORE_ORDER_INDEX          = 107, ///< restore vehicle order-index and service interval
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   142
	CMD_BUILD_LOCK                   = 108, ///< build a lock
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   143
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   144
	CMD_BUILD_SIGNAL_TRACK           = 110, ///< add signals along a track (by dragging)
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   145
	CMD_REMOVE_SIGNAL_TRACK          = 111, ///< remove signals along a track (by dragging)
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   146
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   147
	CMD_GIVE_MONEY                   = 113, ///< give money to an other player
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   148
	CMD_CHANGE_PATCH_SETTING         = 114, ///< change a patch setting
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   149
8056
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   150
	CMD_SET_AUTOREPLACE              = 115, ///< set an autoreplace entry
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   151
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   152
	CMD_CLONE_VEHICLE                = 116, ///< clone a vehicle
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   153
	CMD_MASS_START_STOP              = 117, ///< start/stop all vehicles (in a depot)
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   154
	CMD_DEPOT_SELL_ALL_VEHICLES      = 118, ///< sell all vehicles which are in a given depot
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   155
	CMD_DEPOT_MASS_AUTOREPLACE       = 119, ///< force the autoreplace to take action in a given depot
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   156
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   157
	CMD_CREATE_GROUP                 = 120, ///< create a new group
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   158
	CMD_DELETE_GROUP                 = 121, ///< delete a group
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   159
	CMD_RENAME_GROUP                 = 122, ///< rename a group
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   160
	CMD_ADD_VEHICLE_GROUP            = 123, ///< add a vehicle to a group
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   161
	CMD_ADD_SHARED_VEHICLE_GROUP     = 124, ///< add all other shared vehicles to a group which are missing
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   162
	CMD_REMOVE_ALL_VEHICLES_GROUP    = 125, ///< remove all vehicles from a group
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   163
	CMD_SET_GROUP_REPLACE_PROTECTION = 126, ///< set the autoreplace-protection for a group
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   164
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   165
	CMD_MOVE_ORDER                   = 127, ///< move an order
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   166
	CMD_CHANGE_TIMETABLE             = 128, ///< change the timetable for a vehicle
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   167
	CMD_SET_VEHICLE_ON_TIME          = 129, ///< set the vehicle on time feature (timetable)
1020455bfd81 (svn r11085) -Fix-ish (r11084): some tabs that did not show up in the diff, which caused a mess of tab and non-tab usage.
rubidium
parents: 8055
diff changeset
   168
	CMD_AUTOFILL_TIMETABLE           = 130, ///< autofill the timetable
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   169
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   170
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   171
/**
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   172
 * List of flags for a command.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   173
 *
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   174
 * This enums defines some flags which can be used for the commands.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   175
 */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   176
enum {
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   177
	DC_EXEC            = 0x01, ///< execute the given command
6449
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6338
diff changeset
   178
	DC_AUTO            = 0x02, ///< don't allow building on structures
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6338
diff changeset
   179
	DC_QUERY_COST      = 0x04, ///< query cost only,  don't build.
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6338
diff changeset
   180
	DC_NO_WATER        = 0x08, ///< don't allow building on water
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6338
diff changeset
   181
	DC_NO_RAIL_OVERLAP = 0x10, ///< don't allow overlap of rails (used in buildrail)
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6338
diff changeset
   182
	DC_AI_BUILDING     = 0x20, ///< special building rules for AI
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6338
diff changeset
   183
	DC_NO_TOWN_RATING  = 0x40, ///< town rating does not disallow you from building
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6338
diff changeset
   184
	DC_FORCETEST       = 0x80, ///< force test too.
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   185
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   186
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   187
/**
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   188
 * Used to combine a StringID with the command.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   189
 *
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   190
 * This macro can be used to add a StringID (the error message to show) on a command-id
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   191
 * (CMD_xxx). Use the binary or-operator "|" to combine the command with the result from
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   192
 * this macro.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   193
 *
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   194
 * @param x The StringID to combine with a command-id
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   195
 */
6987
b0f13039bda2 (svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents: 6574
diff changeset
   196
#define CMD_MSG(x) ((x) << 16)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   197
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   198
/**
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   199
 * Defines some flags.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   200
 *
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   201
 * This enumeration defines some flags which are binary-or'ed on a command.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   202
 */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   203
enum {
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   204
	CMD_NO_WATER              = 0x0400, ///< dont build on water
6449
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6338
diff changeset
   205
	CMD_NETWORK_COMMAND       = 0x0800, ///< execute the command without sending it on the network
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6338
diff changeset
   206
	CMD_NO_TEST_IF_IN_NETWORK = 0x1000, ///< When enabled, the command will bypass the no-DC_EXEC round if in network
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   207
	CMD_SHOW_NO_ERROR         = 0x2000, ///< do not show the error message
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   208
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   209
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   210
/**
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   211
 * Command flags for the command table _command_proc_table.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   212
 *
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   213
 * This enumeration defines flags for the _command_proc_table.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   214
 */
1804
7810fc0aa941 (svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents: 1796
diff changeset
   215
enum {
6449
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6338
diff changeset
   216
	CMD_SERVER  = 0x1, ///< the command can only be initiated by the server
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6338
diff changeset
   217
	CMD_OFFLINE = 0x2, ///< the command cannot be executed in a multiplayer game; single-player only
8017
8c46e61c510f (svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents: 7889
diff changeset
   218
	CMD_AUTO    = 0x4, ///< set the DC_AUTO flag on this command
1804
7810fc0aa941 (svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents: 1796
diff changeset
   219
};
7810fc0aa941 (svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents: 1796
diff changeset
   220
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   221
/**
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   222
 * Defines the callback type for all command handler functions.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   223
 *
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   224
 * This type defines the function header for all functions which handles a CMD_* command.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   225
 * A command handler use the parameters to act according to the meaning of the command.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   226
 * The tile parameter defines the tile to perform an action on.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   227
 * The flag parameter is filled with flags from the DC_* enumeration. The parameters
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   228
 * p1 and p2 are filled with parameters for the command like "which road type", "which
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   229
 * order" or "direction". Each function should mentioned in there doxygen comments
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   230
 * the usage of these parameters.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   231
 *
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   232
 * @param tile The tile to apply a command on
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   233
 * @param flags Flags for the command, from the DC_* enumeration
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   234
 * @param p1 Additional data for the command
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   235
 * @param p2 Additional data for the command
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   236
 * @return The CommandCost of the command, which can be succeeded or failed.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   237
 */
7439
0c0e2945c890 (svn r10197) -Codechange: replace int32 with CommandCost where appropriate.
rubidium
parents: 7328
diff changeset
   238
typedef CommandCost CommandProc(TileIndex tile, uint32 flags, uint32 p1, uint32 p2);
3491
4c8427796c64 (svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
tron
parents: 2819
diff changeset
   239
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   240
/**
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   241
 * Define a command with the flags which belongs to it.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   242
 *
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   243
 * This struct connect a command handler function with the flags created with
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   244
 * the #CMD_AUTO, #CMD_OFFLINE and #CMD_SERVER values.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   245
 */
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   246
struct Command {
1804
7810fc0aa941 (svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents: 1796
diff changeset
   247
	CommandProc *proc;
7810fc0aa941 (svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents: 1796
diff changeset
   248
	byte flags;
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   249
};
1804
7810fc0aa941 (svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents: 1796
diff changeset
   250
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   251
/**
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   252
 * Checks if a command failes.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   253
 *
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   254
 * As you see the parameter is not a command but the return value of a command,
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   255
 * the CommandCost class. This function checks if the command executed by
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   256
 * the CommandProc function failed and returns true if it does.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   257
 *
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   258
 * @param cost The return value of a CommandProc call
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   259
 * @return true if the command failes
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   260
 * @see CmdSucceded
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   261
 */
7446
1c4d469f986e (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 7442
diff changeset
   262
static inline bool CmdFailed(CommandCost cost) { return cost.Failed(); }
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   263
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   264
/**
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   265
 * Checks if a command succeeded.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   266
 *
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   267
 * As #CmdFailed this function checks if a command succeeded
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   268
 *
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   269
 * @param cost The return value of a CommandProc call
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   270
 * @return true if the command succeeded
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   271
 * @see CmdSucceeded
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   272
 */
7446
1c4d469f986e (svn r10205) -Codechange: refactor returning of cost, so it can be more easily modified.
rubidium
parents: 7442
diff changeset
   273
static inline bool CmdSucceeded(CommandCost cost) { return cost.Succeeded(); }
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   274
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   275
/**
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   276
 * Define a default return value for a failed command.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   277
 *
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   278
 * This variable contains a CommandCost object with is declared as "failed".
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   279
 * Other functions just need to return this error if there is an error,
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   280
 * which doesn't need to specific by a StringID.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   281
 */
7889
f167f5959c24 (svn r10762) -Codechange: Change enum StringIDEnum { to static const StringID = for
peter1138
parents: 7718
diff changeset
   282
static const CommandCost CMD_ERROR = CommandCost(INVALID_STRING_ID);
1691
fcd9fefaed02 (svn r2195) Add CmdFailed() as the One True Way(tm) to check if a command failed.
tron
parents: 1623
diff changeset
   283
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   284
/**
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   285
 * Returns from a function with a specific StringID as error.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   286
 *
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   287
 * This macro is used to return from a function. The parameter contains the
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   288
 * StringID which will be returned.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   289
 *
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   290
 * @param errcode The StringID to return
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   291
 */
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   292
#define return_cmd_error(errcode) return CommandCost(errcode);
7442
a4f7989f27d4 (svn r10200) -Codechange: add "shortcut" for !CmdFailed (CmdSucceeded).
rubidium
parents: 7439
diff changeset
   293
6449
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6338
diff changeset
   294
/* command.cpp */
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   295
/**
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   296
 * Define a callback function for the client, after the command is finished.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   297
 *
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   298
 * Functions of this type are called after the command is finished. The parameters
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   299
 * are from the #CommandProc callback type. The boolean parameter indicates if the
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   300
 * command succeeded or failed.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   301
 *
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   302
 * @param success If the command succeeded or not.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   303
 * @param tile The tile of the command action
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   304
 * @param p1 Additional data of the command
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   305
 * @param p1 Additional data of the command
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   306
 * @see CommandProc
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   307
 */
4828
9e32eafd4657 (svn r6752) -Codechange: Move command functions from messy functions.h into command.h
Darkvater
parents: 4712
diff changeset
   308
typedef void CommandCallback(bool success, TileIndex tile, uint32 p1, uint32 p2);
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   309
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   310
/**
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   311
 * Execute a command
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   312
 */
7439
0c0e2945c890 (svn r10197) -Codechange: replace int32 with CommandCost where appropriate.
rubidium
parents: 7328
diff changeset
   313
CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc);
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   314
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   315
/**
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   316
 * Execute a network safe DoCommand function
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   317
 */
7718
220603f0122e (svn r10501) -Fix [FS#1015]: error dialog was sometimes shown on all clients when a command failed instead of only the client that actually did the command.
rubidium
parents: 7562
diff changeset
   318
bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, uint32 cmd, bool my_cmd = true);
4828
9e32eafd4657 (svn r6752) -Codechange: Move command functions from messy functions.h into command.h
Darkvater
parents: 4712
diff changeset
   319
9e32eafd4657 (svn r6752) -Codechange: Move command functions from messy functions.h into command.h
Darkvater
parents: 4712
diff changeset
   320
#ifdef ENABLE_NETWORK
9e32eafd4657 (svn r6752) -Codechange: Move command functions from messy functions.h into command.h
Darkvater
parents: 4712
diff changeset
   321
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   322
/**
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   323
 * Send a command over the network
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   324
 */
4828
9e32eafd4657 (svn r6752) -Codechange: Move command functions from messy functions.h into command.h
Darkvater
parents: 4712
diff changeset
   325
void NetworkSend_Command(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback);
9e32eafd4657 (svn r6752) -Codechange: Move command functions from messy functions.h into command.h
Darkvater
parents: 4712
diff changeset
   326
#endif /* ENABLE_NETWORK */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   327
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   328
/**
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   329
 * Text, which gets sent with a command
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   330
 *
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   331
 * This variable contains a string (be specific a pointer of the first
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   332
 * char of this string) which will be send with a command. This is
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   333
 * used for user input data like names or chat messages.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   334
 */
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   335
extern const char *_cmd_text;
1820
9b6458526480 (svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents: 1804
diff changeset
   336
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   337
/**
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   338
 * Checks if a integer value belongs to a command.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   339
 */
959
b031d88c76f3 (svn r1451) Fix some of the signed/unsigned comparison warnings
tron
parents: 903
diff changeset
   340
bool IsValidCommand(uint cmd);
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   341
/**
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   342
 * Returns the flags from a given command.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   343
 */
1804
7810fc0aa941 (svn r2308) - Fix: enforce server-only and/or offline commands by giving them flags in the process table. This also fixes bug "[ 1190944 ] Many commands not checked for security"
Darkvater
parents: 1796
diff changeset
   344
byte GetCommandFlags(uint cmd);
8055
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   345
/**
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   346
 * Returns the current money available which can be used for a command.
07697c701048 (svn r11084) -Documentation [FS#1219]: of command.*. Patch by Progman.
rubidium
parents: 8017
diff changeset
   347
 */
7486
d130c10f4dab (svn r10246) -Fix (r10297): some forgotten money conversions and truncation issues. Thanks to benc for providing the patch.
rubidium
parents: 7476
diff changeset
   348
Money GetAvailableMoneyForCommand();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   349
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   350
#endif /* COMMAND_H */