Crossfire Client, Trunk  R20507
Data Structures | Typedefs | Enumerations | Functions
p_cmd.h File Reference

Includes and prototypes for p_cmd.c for player-commands like '/magicmap'. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ConsoleCommand
 

Typedefs

typedef void(* CommFunc) (const char *params)
 
typedef const char *(* CommHelpFunc) (void)
 

Enumerations

enum  CommCat {
  COMM_CAT_MISC = 0, COMM_CAT_INFO = 2, COMM_CAT_SETUP = 3, COMM_CAT_SCRIPT = 4,
  COMM_CAT_DEBUG = 5
}
 

Functions

const char * complete_command (const char *ocommand)
 Player has entered 'command' and hit tab to complete it. More...
 
void extended_command (const char *ocommand)
 This is an extended command (ie, 'who, 'whatever, etc). More...
 
const ConsoleCommandfind_command (const char *cmd)
 
ConsoleCommand ** get_cat_sorted_commands (void)
 Returns a pointer to the head of an array of ConsoleCommands sorted by category, then by name. More...
 
const char * get_category_name (CommCat cat)
 
int handle_local_command (const char *cp, const char *cpnext)
 Tries to handle command cp (with optional params in cpnext, which may be null) as a local command. More...
 
void init_commands (void)
 Fills some internal arrays. More...
 

Detailed Description

Includes and prototypes for p_cmd.c for player-commands like '/magicmap'.

Basically stolen piecemeal from the server branch.

Definition in file p_cmd.h.

Typedef Documentation

typedef void(* CommFunc) (const char *params)

Definition at line 36 of file p_cmd.h.

typedef const char*(* CommHelpFunc) (void)

Definition at line 41 of file p_cmd.h.

Enumeration Type Documentation

enum CommCat
Enumerator
COMM_CAT_MISC 
COMM_CAT_INFO 
COMM_CAT_SETUP 
COMM_CAT_SCRIPT 
COMM_CAT_DEBUG 

Definition at line 44 of file p_cmd.h.

Function Documentation

const char* complete_command ( const char *  command)

Player has entered 'command' and hit tab to complete it.

See if we can find a completion. Returns matching command. Returns NULL if no command matches.

Parameters
command

Definition at line 583 of file p_cmd.c.

References draw_ext_info(), MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, name, ConsoleCommand::name, NDI_BLACK, num_commands, and num_server_commands.

Referenced by gtk_complete_command().

Here is the call graph for this function:

Here is the caller graph for this function:

void extended_command ( const char *  ocommand)

This is an extended command (ie, 'who, 'whatever, etc).

In general, we just send the command to the server, but there are a few that we care about (bind, unbind)

The command passed to us can not be modified - if it is a keybinding, we get passed the string that is that binding - modifying it effectively changes the binding.

Parameters
ocommand

Definition at line 484 of file p_cmd.c.

References Player_Struct::count, cpl, handle_local_command(), MAX_BUF, script_lua_command(), send_command(), and Player_Struct::title.

Referenced by menu_quit_character(), on_entry_commands_activate(), and parse_key().

Here is the call graph for this function:

Here is the caller graph for this function:

const ConsoleCommand* find_command ( const char *  cmd)

Definition at line 397 of file p_cmd.c.

References num_commands, and sort_by_name().

Referenced by command_help(), and handle_local_command().

Here is the call graph for this function:

Here is the caller graph for this function:

ConsoleCommand** get_cat_sorted_commands ( void  )

Returns a pointer to the head of an array of ConsoleCommands sorted by category, then by name.

It's num_commands long.

Definition at line 437 of file p_cmd.c.

References cat_sorted_commands.

Referenced by do_clienthelp_list().

Here is the caller graph for this function:

const char* get_category_name ( CommCat  cat)

Definition at line 160 of file p_cmd.c.

References COMM_CAT_DEBUG, COMM_CAT_INFO, COMM_CAT_MISC, COMM_CAT_SCRIPT, and COMM_CAT_SETUP.

Referenced by do_clienthelp_list().

Here is the caller graph for this function:

int handle_local_command ( const char *  cp,
const char *  cpnext 
)

Tries to handle command cp (with optional params in cpnext, which may be null) as a local command.

If this was a local command, returns true to indicate command was handled. This code was moved from extended_command so scripts ca issue local commands to handle keybindings or anything else.

Parameters
cp
cpnext

Definition at line 450 of file p_cmd.c.

References ConsoleCommand::dofunc, draw_ext_info(), find_command(), MAX_BUF, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, ConsoleCommand::name, and NDI_RED.

Referenced by extended_command(), and script_process_cmd().

Here is the call graph for this function:

Here is the caller graph for this function:

void init_commands ( void  )

Fills some internal arrays.

Run this on startup, but not before filling in ToolkitCommands and ToolkitCommandsSize.

Definition at line 376 of file p_cmd.c.

References num_commands, sort_by_category(), and sort_by_name().

Referenced by client_init().

Here is the call graph for this function:

Here is the caller graph for this function: