| 1 | /** |
| 2 | * @file |
| 3 | * Defines and structures related to commands the player can send. |
| 4 | */ |
| 5 | |
| 6 | #ifndef COMMANDS_H |
| 7 | #define COMMANDS_H |
| 8 | |
| 9 | /* |
| 10 | * Crossfire commands |
| 11 | * ++Jam |
| 12 | * |
| 13 | * ''', run and fire-keys are parsed separately (cannot be overrided). |
| 14 | */ |
| 15 | |
| 16 | |
| 17 | /* The initialized arrays were removed from this file and are now |
| 18 | * in commands.c. Initializing the arrays in any header file |
| 19 | * is stupid, as it means that header file can only be included |
| 20 | * in one source file (so what is the point of putting them in a header |
| 21 | * file then?). Header files should be used like this one - to declare |
| 22 | * the structures externally - they actual structures should resided/ |
| 23 | * be initialized in one of the source files. |
| 24 | */ |
| 25 | |
| 26 | /** |
| 27 | * One command function. |
| 28 | * @param op |
| 29 | * the player executing the command |
| 30 | * @param params |
| 31 | * the command parameters; empty string if no commands are given; leading and |
| 32 | * trailing spaces have been removed |
| 33 | */ |
| 34 | typedef void (*command_function)(object *op, const char *params); |
| 35 | |
| 36 | /** Represents one command. */ |
| 37 | typedef struct { |
| 38 | const char *name; /**< Command name. */ |
| 39 | command_function func; /**< Pointer to command function. */ |
| 40 | float time; /**< How long it takes to execute this command. */ |
| 41 | } command_array_struct; |
| 42 | |
| 43 | extern command_array_struct Commands[], WizCommands[], CommunicationCommands[]; |
| 44 | |
| 45 | extern const int CommandsSize, WizCommandsSize, CommunicationCommandSize; |
| 46 | |
| 47 | /** Time, in seconds from epoch, of server shutdown. */ |
| 48 | extern int cmd_shutdown_time; |
| 49 | |
| 50 | #endif /* COMMANDS_H */ |