Crossfire Client, Trunk
p_cmd.h File Reference
+ 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)
 

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)
 
void extended_command (const char *ocommand)
 
const ConsoleCommandfind_command (const char *cmd)
 
ConsoleCommand ** get_cat_sorted_commands (void)
 
const char * get_category_name (CommCat cat)
 
int handle_local_command (const char *cp, const char *cpnext)
 
void init_commands (void)
 

Variables

const typedef char *(* CommHelpFunc )(void)
 

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

◆ CommFunc

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

Definition at line 36 of file p_cmd.h.

Enumeration Type Documentation

◆ CommCat

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

◆ complete_command()

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 614 of file p_cmd.c.

References commands, CommonCommands, draw_ext_info(), MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, 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:

◆ extended_command()

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 515 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:

◆ find_command()

const ConsoleCommand* find_command ( const char *  cmd)

Definition at line 428 of file p_cmd.c.

References name_sorted_commands, 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:

◆ get_cat_sorted_commands()

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 468 of file p_cmd.c.

References cat_sorted_commands.

Referenced by do_clienthelp_list().

+ Here is the caller graph for this function:

◆ get_category_name()

const char* get_category_name ( CommCat  cat)

Definition at line 166 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:

◆ handle_local_command()

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 481 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:

◆ init_commands()

void init_commands ( void  )

Fills some internal arrays. Run this on startup, but not before filling in ToolkitCommands and ToolkitCommandsSize.

Definition at line 407 of file p_cmd.c.

References cat_sorted_commands, CommonCommands, name_sorted_commands, 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:

Variable Documentation

◆ CommHelpFunc

const typedef char*(* CommHelpFunc) (void)

Definition at line 41 of file p_cmd.h.