src/command_type.h
author rubidium
Fri, 21 Dec 2007 21:50:46 +0000
changeset 8116 8da76dcb3287
child 8123 ce31d2843a95
permissions -rw-r--r--
(svn r11677) -Codechange: move price and command related types/functions to their respective places.
8116
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
     1
/* $Id$ */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
     2
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
     3
/** @file command_type.h Types related to commands. */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
     4
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
     5
#ifndef COMMAND_TYPE_H
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
     6
#define COMMAND_TYPE_H
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
     7
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
     8
#include "economy_type.h"
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
     9
#include "strings_type.h"
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    10
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    11
/**
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    12
 * Common return value for all commands. Wraps the cost and
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    13
 * a possible error message/state together.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    14
 */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    15
class CommandCost {
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    16
	Money cost;       ///< The cost of this action
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    17
	StringID message; ///< Warning message for when success is unset
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    18
	bool success;     ///< Whether the comment went fine up to this moment
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    19
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    20
public:
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    21
	/**
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    22
	 * Creates a command cost return with no cost and no error
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    23
	 */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    24
	CommandCost() : cost(0), message(INVALID_STRING_ID), success(true) {}
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    25
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    26
	/**
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    27
	 * Creates a command return value the is failed with the given message
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    28
	 */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    29
	CommandCost(StringID msg) : cost(0), message(msg), success(false) {}
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    30
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    31
	/**
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    32
	 * Creates a command return value with the given start cost
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    33
	 * @param cst the initial cost of this command
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    34
	 */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    35
	CommandCost(Money cst) : cost(cst), message(INVALID_STRING_ID), success(true) {}
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    36
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    37
	/**
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    38
	 * Adds the cost of the given command return value to this cost.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    39
	 * Also takes a possible error message when it is set.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    40
	 * @param ret the command to add the cost of.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    41
	 * @return this class.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    42
	 */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    43
	CommandCost AddCost(CommandCost ret);
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    44
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    45
	/**
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    46
	 * Adds the given cost to the cost of the command.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    47
	 * @param cost the cost to add
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    48
	 * @return this class.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    49
	 */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    50
	CommandCost AddCost(Money cost);
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    51
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    52
	/**
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    53
	 * Multiplies the cost of the command by the given factor.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    54
	 * @param cost factor to multiply the costs with
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    55
	 * @return this class
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    56
	 */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    57
	CommandCost MultiplyCost(int factor);
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    58
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    59
	/**
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    60
	 * The costs as made up to this moment
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    61
	 * @return the costs
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    62
	 */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    63
	Money GetCost() const;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    64
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    65
	/**
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    66
	 * Sets the global error message *if* this class has one.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    67
	 */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    68
	void SetGlobalErrorMessage() const;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    69
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    70
	/**
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    71
	 * Did this command succeed?
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    72
	 * @return true if and only if it succeeded
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    73
	 */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    74
	bool Succeeded() const;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    75
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    76
	/**
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    77
	 * Did this command fail?
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    78
	 * @return true if and only if it failed
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    79
	 */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    80
	bool Failed() const;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    81
};
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    82
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    83
/**
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    84
 * List of commands.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    85
 *
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    86
 * This enum defines all possible commands which can be executed to the game
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    87
 * engine. Observing the game like the query-tool or checking the profit of a
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    88
 * vehicle don't result in a command which should be executed in the engine
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    89
 * nor send to the server in a network game.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    90
 *
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    91
 * @see _command_proc_table
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    92
 */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    93
enum {
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    94
	CMD_BUILD_RAILROAD_TRACK         =   0, ///< build a rail track
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    95
	CMD_REMOVE_RAILROAD_TRACK        =   1, ///< remove a rail track
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    96
	CMD_BUILD_SINGLE_RAIL            =   2, ///< build a single rail track
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    97
	CMD_REMOVE_SINGLE_RAIL           =   3, ///< remove a single rail track
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    98
	CMD_LANDSCAPE_CLEAR              =   4, ///< demolish a tile
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    99
	CMD_BUILD_BRIDGE                 =   5, ///< build a bridge
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   100
	CMD_BUILD_RAILROAD_STATION       =   6, ///< build a railroad station
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   101
	CMD_BUILD_TRAIN_DEPOT            =   7, ///< build a train depot
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   102
	CMD_BUILD_SIGNALS                =   8, ///< build a signal
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   103
	CMD_REMOVE_SIGNALS               =   9, ///< remove a signal
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   104
	CMD_TERRAFORM_LAND               =  10, ///< terraform a tile
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   105
	CMD_PURCHASE_LAND_AREA           =  11, ///< purchase a tile
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   106
	CMD_SELL_LAND_AREA               =  12, ///< sell a bought tile before
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   107
	CMD_BUILD_TUNNEL                 =  13, ///< build a tunnel
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   108
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   109
	CMD_REMOVE_FROM_RAILROAD_STATION =  14, ///< remove a tile station
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   110
	CMD_CONVERT_RAIL                 =  15, ///< convert a rail type
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   111
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   112
	CMD_BUILD_TRAIN_WAYPOINT         =  16, ///< build a waypoint
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   113
	CMD_RENAME_WAYPOINT              =  17, ///< rename a waypoint
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   114
	CMD_REMOVE_TRAIN_WAYPOINT        =  18, ///< remove a waypoint
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   115
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   116
	CMD_BUILD_ROAD_STOP              =  21, ///< build a road stop
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   117
	CMD_REMOVE_ROAD_STOP             =  22, ///< remove a road stop
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   118
	CMD_BUILD_LONG_ROAD              =  23, ///< build a complete road (not a "half" one)
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   119
	CMD_REMOVE_LONG_ROAD             =  24, ///< remove a complete road (not a "half" one)
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   120
	CMD_BUILD_ROAD                   =  25, ///< build a "half" road
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   121
	CMD_REMOVE_ROAD                  =  26, ///< remove a "half" road
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   122
	CMD_BUILD_ROAD_DEPOT             =  27, ///< build a road depot
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   123
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   124
	CMD_BUILD_AIRPORT                =  29, ///< build an airport
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   125
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   126
	CMD_BUILD_DOCK                   =  30, ///< build a dock
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   127
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   128
	CMD_BUILD_SHIP_DEPOT             =  31, ///< build a ship depot
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   129
	CMD_BUILD_BUOY                   =  32, ///< build a buoy
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   130
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   131
	CMD_PLANT_TREE                   =  33, ///< plant a tree
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   132
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   133
	CMD_BUILD_RAIL_VEHICLE           =  34, ///< build a rail vehicle
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   134
	CMD_MOVE_RAIL_VEHICLE            =  35, ///< move a rail vehicle (in the depot)
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   135
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   136
	CMD_START_STOP_TRAIN             =  36, ///< start or stop a train
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   137
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   138
	CMD_SELL_RAIL_WAGON              =  38, ///< sell a rail wagon
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   139
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   140
	CMD_SEND_TRAIN_TO_DEPOT          =  39, ///< send a train to a depot
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   141
	CMD_FORCE_TRAIN_PROCEED          =  40, ///< proceed a train to pass a red signal
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   142
	CMD_REVERSE_TRAIN_DIRECTION      =  41, ///< turn a train around
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   143
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   144
	CMD_MODIFY_ORDER                 =  42, ///< modify an order (like set full-load)
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   145
	CMD_SKIP_TO_ORDER                =  43, ///< skip an order to the next of specific one
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   146
	CMD_DELETE_ORDER                 =  44, ///< delete an order
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   147
	CMD_INSERT_ORDER                 =  45, ///< insert a new order
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   148
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   149
	CMD_CHANGE_SERVICE_INT           =  46, ///< change the server interval of a vehicle
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   150
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   151
	CMD_BUILD_INDUSTRY               =  47, ///< build a new industry
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   152
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   153
	CMD_BUILD_COMPANY_HQ             =  48, ///< build the company headquarter
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   154
	CMD_SET_PLAYER_FACE              =  49, ///< set the face of the player/company
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   155
	CMD_SET_PLAYER_COLOR             =  50, ///< set the color of the player/company
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   156
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   157
	CMD_INCREASE_LOAN                =  51, ///< increase the loan from the bank
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   158
	CMD_DECREASE_LOAN                =  52, ///< decrease the loan from the bank
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   159
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   160
	CMD_WANT_ENGINE_PREVIEW          =  53, ///< confirm the preview of an engine
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   161
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   162
	CMD_NAME_VEHICLE                 =  54, ///< rename a whole vehicle
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   163
	CMD_RENAME_ENGINE                =  55, ///< rename a engine (in the engine list)
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   164
	CMD_CHANGE_COMPANY_NAME          =  56, ///< change the company name
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   165
	CMD_CHANGE_PRESIDENT_NAME        =  57, ///< change the president name
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   166
	CMD_RENAME_STATION               =  58, ///< rename a station
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   167
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   168
	CMD_SELL_AIRCRAFT                =  59, ///< sell an aircraft
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   169
	CMD_START_STOP_AIRCRAFT          =  60, ///< start/stop an aircraft
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   170
	CMD_BUILD_AIRCRAFT               =  61, ///< build an aircraft
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   171
	CMD_SEND_AIRCRAFT_TO_HANGAR      =  62, ///< send an aircraft to a hanger
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   172
	CMD_REFIT_AIRCRAFT               =  64, ///< refit the cargo space of an aircraft
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   173
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   174
	CMD_PLACE_SIGN                   =  65, ///< place a sign
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   175
	CMD_RENAME_SIGN                  =  66, ///< rename a sign
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   176
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   177
	CMD_BUILD_ROAD_VEH               =  67, ///< build a road vehicle
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   178
	CMD_START_STOP_ROADVEH           =  68, ///< start/stop a road vehicle
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   179
	CMD_SELL_ROAD_VEH                =  69, ///< sell a road vehicle
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   180
	CMD_SEND_ROADVEH_TO_DEPOT        =  70, ///< send a road vehicle to the depot
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   181
	CMD_TURN_ROADVEH                 =  71, ///< turn a road vehicle around
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   182
	CMD_REFIT_ROAD_VEH               =  72, ///< refit the cargo space of a road vehicle
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   183
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   184
	CMD_PAUSE                        =  73, ///< pause the game
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   185
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   186
	CMD_BUY_SHARE_IN_COMPANY         =  74, ///< buy a share from a company
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   187
	CMD_SELL_SHARE_IN_COMPANY        =  75, ///< sell a share from a company
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   188
	CMD_BUY_COMPANY                  =  76, ///< buy a company which is bankrupt
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   189
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   190
	CMD_BUILD_TOWN                   =  77, ///< build a town
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   191
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   192
	CMD_RENAME_TOWN                  =  80, ///< rename a town
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   193
	CMD_DO_TOWN_ACTION               =  81, ///< do a action from the town detail window (like advertises or bribe)
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   194
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   195
	CMD_SET_ROAD_DRIVE_SIDE          =  82, ///< set the side where the road vehicles drive
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   196
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   197
	CMD_CHANGE_DIFFICULTY_LEVEL      =  85, ///< change the difficult of a game (each setting for it own)
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   198
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   199
	CMD_START_STOP_SHIP              =  86, ///< start/stop a ship
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   200
	CMD_SELL_SHIP                    =  87, ///< sell a ship
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   201
	CMD_BUILD_SHIP                   =  88, ///< build a new ship
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   202
	CMD_SEND_SHIP_TO_DEPOT           =  89, ///< send a ship to a depot
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   203
	CMD_REFIT_SHIP                   =  91, ///< refit the cargo space of a ship
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   204
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   205
	CMD_ORDER_REFIT                  =  98, ///< change the refit informaction of an order (for "goto depot" )
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   206
	CMD_CLONE_ORDER                  =  99, ///< clone (and share) an order
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   207
	CMD_CLEAR_AREA                   = 100, ///< clear an area
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   208
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   209
	CMD_MONEY_CHEAT                  = 102, ///< do the money cheat
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   210
	CMD_BUILD_CANAL                  = 103, ///< build a canal
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   211
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   212
	CMD_PLAYER_CTRL                  = 104, ///< used in multiplayer to create a new player etc.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   213
	CMD_LEVEL_LAND                   = 105, ///< level land
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   214
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   215
	CMD_REFIT_RAIL_VEHICLE           = 106, ///< refit the cargo space of a train
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   216
	CMD_RESTORE_ORDER_INDEX          = 107, ///< restore vehicle order-index and service interval
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   217
	CMD_BUILD_LOCK                   = 108, ///< build a lock
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   218
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   219
	CMD_BUILD_SIGNAL_TRACK           = 110, ///< add signals along a track (by dragging)
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   220
	CMD_REMOVE_SIGNAL_TRACK          = 111, ///< remove signals along a track (by dragging)
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   221
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   222
	CMD_GIVE_MONEY                   = 113, ///< give money to an other player
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   223
	CMD_CHANGE_PATCH_SETTING         = 114, ///< change a patch setting
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   224
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   225
	CMD_SET_AUTOREPLACE              = 115, ///< set an autoreplace entry
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   226
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   227
	CMD_CLONE_VEHICLE                = 116, ///< clone a vehicle
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   228
	CMD_MASS_START_STOP              = 117, ///< start/stop all vehicles (in a depot)
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   229
	CMD_DEPOT_SELL_ALL_VEHICLES      = 118, ///< sell all vehicles which are in a given depot
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   230
	CMD_DEPOT_MASS_AUTOREPLACE       = 119, ///< force the autoreplace to take action in a given depot
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   231
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   232
	CMD_CREATE_GROUP                 = 120, ///< create a new group
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   233
	CMD_DELETE_GROUP                 = 121, ///< delete a group
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   234
	CMD_RENAME_GROUP                 = 122, ///< rename a group
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   235
	CMD_ADD_VEHICLE_GROUP            = 123, ///< add a vehicle to a group
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   236
	CMD_ADD_SHARED_VEHICLE_GROUP     = 124, ///< add all other shared vehicles to a group which are missing
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   237
	CMD_REMOVE_ALL_VEHICLES_GROUP    = 125, ///< remove all vehicles from a group
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   238
	CMD_SET_GROUP_REPLACE_PROTECTION = 126, ///< set the autoreplace-protection for a group
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   239
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   240
	CMD_MOVE_ORDER                   = 127, ///< move an order
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   241
	CMD_CHANGE_TIMETABLE             = 128, ///< change the timetable for a vehicle
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   242
	CMD_SET_VEHICLE_ON_TIME          = 129, ///< set the vehicle on time feature (timetable)
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   243
	CMD_AUTOFILL_TIMETABLE           = 130, ///< autofill the timetable
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   244
};
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   245
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   246
/**
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   247
 * List of flags for a command.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   248
 *
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   249
 * This enums defines some flags which can be used for the commands.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   250
 */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   251
enum {
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   252
	DC_EXEC            = 0x01, ///< execute the given command
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   253
	DC_AUTO            = 0x02, ///< don't allow building on structures
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   254
	DC_QUERY_COST      = 0x04, ///< query cost only,  don't build.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   255
	DC_NO_WATER        = 0x08, ///< don't allow building on water
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   256
	DC_NO_RAIL_OVERLAP = 0x10, ///< don't allow overlap of rails (used in buildrail)
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   257
	DC_AI_BUILDING     = 0x20, ///< special building rules for AI
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   258
	DC_NO_TOWN_RATING  = 0x40, ///< town rating does not disallow you from building
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   259
	DC_FORCETEST       = 0x80, ///< force test too.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   260
};
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   261
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   262
/**
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   263
 * Used to combine a StringID with the command.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   264
 *
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   265
 * This macro can be used to add a StringID (the error message to show) on a command-id
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   266
 * (CMD_xxx). Use the binary or-operator "|" to combine the command with the result from
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   267
 * this macro.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   268
 *
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   269
 * @param x The StringID to combine with a command-id
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   270
 */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   271
#define CMD_MSG(x) ((x) << 16)
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   272
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   273
/**
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   274
 * Defines some flags.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   275
 *
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   276
 * This enumeration defines some flags which are binary-or'ed on a command.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   277
 */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   278
enum {
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   279
	CMD_NO_WATER              = 0x0400, ///< dont build on water
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   280
	CMD_NETWORK_COMMAND       = 0x0800, ///< execute the command without sending it on the network
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   281
	CMD_NO_TEST_IF_IN_NETWORK = 0x1000, ///< When enabled, the command will bypass the no-DC_EXEC round if in network
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   282
	CMD_SHOW_NO_ERROR         = 0x2000, ///< do not show the error message
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   283
};
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   284
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   285
/**
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   286
 * Command flags for the command table _command_proc_table.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   287
 *
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   288
 * This enumeration defines flags for the _command_proc_table.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   289
 */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   290
enum {
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   291
	CMD_SERVER  = 0x1, ///< the command can only be initiated by the server
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   292
	CMD_OFFLINE = 0x2, ///< the command cannot be executed in a multiplayer game; single-player only
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   293
	CMD_AUTO    = 0x4, ///< set the DC_AUTO flag on this command
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   294
};
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   295
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   296
/**
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   297
 * Defines the callback type for all command handler functions.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   298
 *
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   299
 * This type defines the function header for all functions which handles a CMD_* command.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   300
 * A command handler use the parameters to act according to the meaning of the command.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   301
 * The tile parameter defines the tile to perform an action on.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   302
 * The flag parameter is filled with flags from the DC_* enumeration. The parameters
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   303
 * p1 and p2 are filled with parameters for the command like "which road type", "which
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   304
 * order" or "direction". Each function should mentioned in there doxygen comments
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   305
 * the usage of these parameters.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   306
 *
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   307
 * @param tile The tile to apply a command on
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   308
 * @param flags Flags for the command, from the DC_* enumeration
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   309
 * @param p1 Additional data for the command
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   310
 * @param p2 Additional data for the command
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   311
 * @return The CommandCost of the command, which can be succeeded or failed.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   312
 */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   313
typedef CommandCost CommandProc(TileIndex tile, uint32 flags, uint32 p1, uint32 p2);
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   314
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   315
/**
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   316
 * Define a command with the flags which belongs to it.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   317
 *
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   318
 * This struct connect a command handler function with the flags created with
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   319
 * the #CMD_AUTO, #CMD_OFFLINE and #CMD_SERVER values.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   320
 */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   321
struct Command {
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   322
	CommandProc *proc;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   323
	byte flags;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   324
};
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   325
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   326
/**
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   327
 * Define a callback function for the client, after the command is finished.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   328
 *
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   329
 * Functions of this type are called after the command is finished. The parameters
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   330
 * are from the #CommandProc callback type. The boolean parameter indicates if the
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   331
 * command succeeded or failed.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   332
 *
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   333
 * @param success If the command succeeded or not.
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   334
 * @param tile The tile of the command action
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   335
 * @param p1 Additional data of the command
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   336
 * @param p1 Additional data of the command
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   337
 * @see CommandProc
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   338
 */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   339
typedef void CommandCallback(bool success, TileIndex tile, uint32 p1, uint32 p2);
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   340
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   341
#endif /* COMMAND_TYPE_H */