Crossfire Client, Branches  R11627
p_cmd.c File Reference
#include <client.h>
#include <external.h>
#include <script.h>
#include <p_cmd.h>
#include "../help/chelp.h"
+ Include dependency graph for p_cmd.c:

Go to the source code of this file.

Macros

#define assumed_wrap   get_info_width()
 
#define H1(a)   draw_info(a, NDI_BLACK)
 
#define H2(a)   draw_info(a, NDI_BLACK)
 
#define LINE(a)   draw_info(a, NDI_BLACK)
 
#define NUM_COMMANDS   ((int)(sizeof(commands) / sizeof(char*)))
 
#define tolower(C)   (((C) >= 'A' && (C) <= 'Z')? (C) - 'A' + 'a': (C))
 

Functions

static void command_foodbep (const char *cpnext)
 
static void command_help (const char *cpnext)
 
const char * complete_command (const char *command)
 
static void do_clearinfo (const char *ignored)
 
static void do_clienthelp (const char *arg)
 
static void do_clienthelp_list (void)
 
static void do_disconnect (const char *ignored)
 
static void do_inv (const char *ignored)
 
static void do_magicmap (const char *ignored)
 
static void do_metaserver (const char *ignored)
 
static void do_num_free_items (const char *ignored)
 
static void do_savedefaults (const char *ignored)
 
static void do_savewinpos (const char *ignored)
 
static void do_script_list (const char *ignored)
 
static void do_serverhelp (const char *arg)
 
static void do_take (const char *used)
 
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 get_num_commands (void)
 
int handle_local_command (const char *cp, const char *cpnext)
 
static const char * help_bind (void)
 
static const char * help_clienthelp (void)
 
static const char * help_cwindow (void)
 
static const char * help_help (void)
 
static const char * help_inv (void)
 
static const char * help_magicmap (void)
 
static const char * help_metaserver (void)
 
static const char * help_savewinpos (void)
 
static const char * help_script (void)
 
static const char * help_scriptkill (void)
 
static const char * help_scripttell (void)
 
static const char * help_serverhelp (void)
 
static const char * help_showweight (void)
 
static const char * help_unbind (void)
 
void init_commands (void)
 
static void set_command_window (const char *cpnext)
 
static void show_help (const ConsoleCommand *cc)
 
static int sort_by_category (const void *a_, const void *b_)
 
static int sort_by_name (const void *a_, const void *b_)
 

Variables

static ConsoleCommand ** cat_sorted_commands
 
static const char *const commands []
 
static ConsoleCommand CommonCommands []
 
const int CommonCommandsSize = sizeof(CommonCommands) / sizeof(ConsoleCommand)
 
static ConsoleCommand ** name_sorted_commands
 
int num_commands
 

Macro Definition Documentation

#define assumed_wrap   get_info_width()

Definition at line 67 of file p_cmd.c.

Referenced by do_clienthelp_list().

#define H1 (   a)    draw_info(a, NDI_BLACK)

Definition at line 62 of file p_cmd.c.

Referenced by do_clienthelp_list(), and show_help().

#define H2 (   a)    draw_info(a, NDI_BLACK)

Definition at line 63 of file p_cmd.c.

Referenced by do_clienthelp_list(), and show_help().

#define LINE (   a)    draw_info(a, NDI_BLACK)

Definition at line 64 of file p_cmd.c.

Referenced by do_clienthelp_list(), and show_help().

#define NUM_COMMANDS   ((int)(sizeof(commands) / sizeof(char*)))

Definition at line 965 of file p_cmd.c.

Referenced by complete_command().

#define tolower (   C)    (((C) >= 'A' && (C) <= 'Z')? (C) - 'A' + 'a': (C))

Definition at line 799 of file p_cmd.c.

Referenced by find_command().

Function Documentation

static void command_foodbep ( const char *  cpnext)
static

Definition at line 319 of file p_cmd.c.

References CONFIG_FOODBEEP, draw_info(), NDI_BLACK, use_config, and want_config.

+ Here is the call graph for this function:

static void command_help ( const char *  cpnext)
static

Definition at line 257 of file p_cmd.c.

References do_clienthelp_list(), find_command(), MAX_BUF, send_command(), and show_help().

+ Here is the call graph for this function:

const char* complete_command ( const char *  command)

Definition at line 972 of file p_cmd.c.

References CommonCommandsSize, display, draw_info(), list, name, ConsoleCommand::name, NDI_BLACK, and NUM_COMMANDS.

Referenced by gtk_complete_command(), and write_ch().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void do_clearinfo ( const char *  ignored)
static

Definition at line 361 of file p_cmd.c.

References menu_clear().

+ Here is the call graph for this function:

static void do_clienthelp ( const char *  arg)
static

Definition at line 192 of file p_cmd.c.

References do_clienthelp_list(), draw_info(), find_command(), MAX_BUF, NDI_BLACK, and show_help().

+ Here is the call graph for this function:

static void do_clienthelp_list ( void  )
static

Definition at line 71 of file p_cmd.c.

References assumed_wrap, ConsoleCommand::cat, COMM_CAT_MISC, ConsoleCommand::desc, get_cat_sorted_commands(), get_category_name(), get_num_commands(), H1, H2, LINE, MAX_BUF, and ConsoleCommand::name.

Referenced by command_help(), and do_clienthelp().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void do_disconnect ( const char *  ignored)
static

Definition at line 363 of file p_cmd.c.

References cleanup_connection(), csocket, and ClientSocket::fd.

+ Here is the call graph for this function:

static void do_inv ( const char *  ignored)
static

Definition at line 390 of file p_cmd.c.

References cpl, Player_Struct::ob, and print_inventory().

+ Here is the call graph for this function:

static void do_magicmap ( const char *  ignored)
static

Definition at line 392 of file p_cmd.c.

References cpl, draw_magic_map(), and Player_Struct::showmagic.

+ Here is the call graph for this function:

static void do_metaserver ( const char *  ignored)
static

Definition at line 397 of file p_cmd.c.

References draw_info(), FALSE, meta_port, meta_server, metaserver_get_info(), metaserver_show(), and NDI_BLACK.

+ Here is the call graph for this function:

static void do_num_free_items ( const char *  ignored)
static

Definition at line 410 of file p_cmd.c.

References LOG(), LOG_INFO, and num_free_items().

+ Here is the call graph for this function:

static void do_savedefaults ( const char *  ignored)
static

Definition at line 404 of file p_cmd.c.

References save_defaults().

+ Here is the call graph for this function:

static void do_savewinpos ( const char *  ignored)
static

Definition at line 406 of file p_cmd.c.

References save_winpos().

+ Here is the call graph for this function:

static void do_script_list ( const char *  ignored)
static

Definition at line 360 of file p_cmd.c.

References script_list().

+ Here is the call graph for this function:

static void do_serverhelp ( const char *  arg)
static

Definition at line 229 of file p_cmd.c.

References MAX_BUF, and send_command().

+ Here is the call graph for this function:

static void do_take ( const char *  used)
static

Definition at line 408 of file p_cmd.c.

References command_take().

+ Here is the call graph for this function:

void extended_command ( const char *  ocommand)

Definition at line 890 of file p_cmd.c.

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

Referenced by do_key_press(), enter_callback(), menu_apply(), menu_disarm(), menu_quit_character(), menu_search(), menu_who(), on_entry_commands_activate(), parse_key(), and sexit().

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

References sort_by_name(), and tolower.

Referenced by chelp_entry_callback(), command_help(), do_clienthelp(), 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 846 of file p_cmd.c.

References cat_sorted_commands.

Referenced by do_clienthelp_list(), and set_default_text().

+ Here is the caller graph for this function:

const char* get_category_name ( CommCat  cat)

Definition at line 335 of file p_cmd.c.

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

Referenced by chelp_entry_callback(), do_clienthelp_list(), set_default_text(), and show_help().

+ Here is the caller graph for this function:

int get_num_commands ( void  )

Definition at line 727 of file p_cmd.c.

References num_commands.

Referenced by do_clienthelp_list(), and set_default_text().

+ Here is the caller graph for this function:

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

Definition at line 858 of file p_cmd.c.

References ConsoleCommand::dofunc, draw_info(), FALSE, find_command(), MAX_BUF, ConsoleCommand::name, NDI_RED, and TRUE.

Referenced by extended_command(), and script_process_cmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static const char* help_bind ( void  )
static

Definition at line 419 of file p_cmd.c.

References HELP_BIND_LONG.

static const char* help_clienthelp ( void  )
static

Definition at line 213 of file p_cmd.c.

static const char* help_cwindow ( void  )
static

Definition at line 427 of file p_cmd.c.

static const char* help_help ( void  )
static

Definition at line 281 of file p_cmd.c.

static const char* help_inv ( void  )
static

Definition at line 425 of file p_cmd.c.

References HELP_INV_LONG.

static const char* help_magicmap ( void  )
static

Definition at line 423 of file p_cmd.c.

References HELP_MAGICMAP_LONG.

static const char* help_metaserver ( void  )
static

Definition at line 470 of file p_cmd.c.

static const char* help_savewinpos ( void  )
static

Definition at line 461 of file p_cmd.c.

static const char* help_script ( void  )
static

Definition at line 440 of file p_cmd.c.

static const char* help_scriptkill ( void  )
static

Definition at line 487 of file p_cmd.c.

static const char* help_scripttell ( void  )
static

Definition at line 451 of file p_cmd.c.

static const char* help_serverhelp ( void  )
static

Definition at line 241 of file p_cmd.c.

static const char* help_showweight ( void  )
static

Definition at line 497 of file p_cmd.c.

static const char* help_unbind ( void  )
static

Definition at line 421 of file p_cmd.c.

References HELP_UNBIND_LONG.

void init_commands ( void  )

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

Definition at line 755 of file p_cmd.c.

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

Referenced by init_client_vars().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void set_command_window ( const char *  cpnext)
static

Definition at line 306 of file p_cmd.c.

References COMMAND_WINDOW, CONFIG_CWINDOW, draw_info(), NDI_BLACK, use_config, and want_config.

+ Here is the call graph for this function:

static void show_help ( const ConsoleCommand cc)
static

Definition at line 160 of file p_cmd.c.

References ConsoleCommand::cat, ConsoleCommand::desc, get_category_name(), H1, H2, ConsoleCommand::helpfunc, LINE, MAX_BUF, and ConsoleCommand::name.

Referenced by command_help(), and do_clienthelp().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int sort_by_category ( const void *  a_,
const void *  b_ 
)
static

Definition at line 742 of file p_cmd.c.

References ConsoleCommand::cat, and ConsoleCommand::name.

Referenced by init_commands().

+ Here is the caller graph for this function:

static int sort_by_name ( const void *  a_,
const void *  b_ 
)
static

Definition at line 731 of file p_cmd.c.

References ConsoleCommand::name.

Referenced by find_command(), and init_commands().

+ Here is the caller graph for this function:

Variable Documentation

ConsoleCommand** cat_sorted_commands
static

Definition at line 739 of file p_cmd.c.

Referenced by get_cat_sorted_commands().

const char* const commands[]
static
Initial value:
= {
"accuse", "afk", "apply", "applymode", "archs", "beg", "bleed", "blush",
"body", "bounce", "bow", "bowmode", "brace", "build", "burp", "cackle", "cast",
"chat", "chuckle", "clap", "cointoss", "cough", "cringe", "cry", "dance",
"disarm", "dm", "dmhide", "drop", "dropall", "east", "examine", "explore",
"fire", "fire_stop", "fix_me", "flip", "frown", "gasp", "get", "giggle",
"glare", "grin", "groan", "growl", "gsay", "help", "hiccup", "hiscore", "hug",
"inventory", "invoke", "killpets", "kiss", "laugh", "lick", "listen", "logs",
"mapinfo", "maps", "mark", "me", "motd", "nod", "north", "northeast",
"northwest", "orcknuckle", "output-count", "output-sync", "party", "peaceful",
"petmode", "pickup", "players", "poke", "pout", "prepare", "printlos", "puke",
"quests", "quit", "ready_skill", "rename", "reply", "resistances",
"rotateshoottype", "run", "run_stop", "save", "say", "scream", "search",
"search-items", "shake", "shiver", "shout", "showpets", "shrug", "shutdown",
"sigh", "skills", "slap", "smile", "smirk", "snap", "sneeze", "snicker",
"sniff", "snore", "sound", "south", "southeast", "southwest", "spit",
"statistics", "stay", "strings", "strut", "sulk", "take", "tell", "thank",
"think", "throw", "time", "title", "twiddle", "use_skill", "usekeys",
"version", "wave", "weather", "west", "whereabouts", "whereami", "whistle",
"who", "wimpy", "wink", "yawn",
}

Definition at line 944 of file p_cmd.c.

ConsoleCommand CommonCommands[]
static

Definition at line 535 of file p_cmd.c.

const int CommonCommandsSize = sizeof(CommonCommands) / sizeof(ConsoleCommand)

Definition at line 715 of file p_cmd.c.

Referenced by complete_command(), and init_commands().

ConsoleCommand** name_sorted_commands
static

Definition at line 729 of file p_cmd.c.

int num_commands

Definition at line 725 of file p_cmd.c.

Referenced by get_num_commands().