Atrinik Server 2.5
Functions | Variables
commands/commands.c File Reference
#include <global.h>

Go to the source code of this file.

Functions

static int compare_A (const void *a, const void *b)
void init_commands ()
CommArray_sfind_command_element (char *cmd, CommArray_s *commarray, int commsize)
int can_do_wiz_command (player *pl, const char *command)
int execute_newserver_command (object *pl, char *command)

Variables

CommArray_s Commands []
const int CommandsSize = sizeof(Commands) / sizeof(CommArray_s)
CommArray_s CommunicationCommands []
const int CommunicationCommandSize = sizeof(CommunicationCommands)/ sizeof(CommArray_s)
CommArray_s WizCommands []
const int WizCommandsSize = sizeof(WizCommands) / sizeof(CommArray_s)

Detailed Description

Command parsing related code.

Definition in file commands.c.


Function Documentation

int can_do_wiz_command ( player pl,
const char *  command 
)

Check whether the specified player is able to perform a DM command.

Parameters:
plPlayer being checked.
commandCommand that 'pl' wants to perform.
Returns:
1 if the player can do the command, 0 otherwise.

Definition at line 262 of file commands.c.

static int compare_A ( const void *  a,
const void *  b 
) [static]

Compare two commands, for qsort() in init_command() and bsearch() in find_command_element().

Parameters:
aThe first command
bThe second command
Returns:
Return value of strcmp on the two command names.

Definition at line 219 of file commands.c.

int execute_newserver_command ( object pl,
char *  command 
)

Execute a command by player.

Parameters:
plThe player who is issuing the command.
commandThe command.
Returns:
0 if not a valid command, otherwise return value of the called command function is returned.

Definition at line 296 of file commands.c.

CommArray_s* find_command_element ( char *  cmd,
CommArray_s commarray,
int  commsize 
)

Find a command element.

Parameters:
cmdThe command name.
commarrayThe commands array to search in.
commsizeThe commands array size.
Returns:
The command entry in the array if found.

Definition at line 241 of file commands.c.

void init_commands ( )

Initialize all the commands and emotes.

Sorts the commands and emotes using qsort().

Definition at line 228 of file commands.c.


Variable Documentation

Normal game commands

Definition at line 33 of file commands.c.

const int CommandsSize = sizeof(Commands) / sizeof(CommArray_s)

Size of normal commands

Definition at line 82 of file commands.c.

Emotion commands

Definition at line 85 of file commands.c.

Size of emotion commands

Definition at line 150 of file commands.c.

Wizard commands

Definition at line 153 of file commands.c.

const int WizCommandsSize = sizeof(WizCommands) / sizeof(CommArray_s)

Size of Wizard commands

Definition at line 211 of file commands.c.