commands/commands.c File Reference

#include <global.h>
#include <ctype.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:
pl Player being checked.
command Command that 'pl' wants to perform.
Returns:
1 if the player can do the command, 0 otherwise.

Definition at line 254 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:
a The first command
b The second command
Returns:
Return value of strcmp on the two command names.

Definition at line 211 of file commands.c.

int execute_newserver_command ( object pl,
char *  command 
)

Execute a command by player.

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

Definition at line 288 of file commands.c.

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

Find a command element.

Parameters:
cmd The command name.
commarray The commands array to search in.
commsize The commands array size.
Returns:
The command entry in the array if found.

Definition at line 233 of file commands.c.

void init_commands (  ) 

Initialize all the commands and emotes.

Sorts the commands and emotes using qsort().

Definition at line 220 of file commands.c.


Variable Documentation

Normal game commands

Definition at line 34 of file commands.c.

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

Size of normal commands

Definition at line 81 of file commands.c.

Emotion commands

Definition at line 84 of file commands.c.

Size of emotion commands

Definition at line 144 of file commands.c.

Wizard commands

Definition at line 147 of file commands.c.

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

Size of Wizard commands

Definition at line 203 of file commands.c.


Generated by  doxygen 1.6.2