Crossfire Client, Trunk
|
#include <ctype.h>
#include "client.h"
#include "external.h"
#include "p_cmd.h"
#include "script.h"
#include "chelp.h"
Go to the source code of this file.
Macros | |
#define | H1(a) draw_ext_info(NDI_BLACK, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, a) |
#define | H2(a) draw_ext_info(NDI_BLACK, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, a) |
#define | LINE(a) draw_ext_info(NDI_BLACK, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, a) |
Functions | |
static void | cmd_raw (const char *cmd) |
static void | command_foodbeep () |
static void | command_help (const char *cpnext) |
const char * | complete_command (const char *command) |
void | config_check (void) |
static void | do_clearinfo () |
static void | do_clienthelp_list () |
static void | do_disconnect () |
static void | do_inv () |
static void | do_magicmap () |
static void | do_mapedit () |
static void | do_savedefaults () |
static void | do_savewinpos () |
static void | do_script_list () |
static void | do_set_mapscale (const char *used) |
static void | do_take (const char *used) |
void | extended_command (const char *ocommand) |
const ConsoleCommand * | find_command (const char *cmd) |
ConsoleCommand ** | get_cat_sorted_commands (void) |
const char * | get_category_name (CommCat cat) |
static 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_cwindow (void) |
static const char * | help_help (void) |
static const char * | help_inv (void) |
static const char * | help_magicmap (void) |
static const char * | help_savewinpos (void) |
static const char * | help_script (void) |
static const char * | help_scriptkill (void) |
static const char * | help_scriptkillall (void) |
static const char * | help_scripttell (void) |
static const char * | help_unbind (void) |
void | init_commands () |
void | map_check_resize (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 | |
bool | arm_mapedit = false |
static ConsoleCommand ** | cat_sorted_commands |
static const char *const | commands [] |
static ConsoleCommand | CommonCommands [] |
static ConsoleCommand ** | name_sorted_commands |
const size_t | num_commands = sizeof(CommonCommands) / sizeof(ConsoleCommand) |
const size_t | num_server_commands = sizeof(commands) / sizeof(char *) |
Contains a lot about the commands typed into the client.
Definition in file p_cmd.c.
|
static |
Definition at line 316 of file p_cmd.c.
References cs_print_string(), csocket, and ClientSocket::fd.
|
static |
Definition at line 153 of file p_cmd.c.
References CONFIG_FOODBEEP, draw_ext_info(), MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, NDI_BLACK, use_config, and want_config.
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.
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().
|
static |
Definition at line 202 of file p_cmd.c.
References menu_clear().
|
static |
Definition at line 204 of file p_cmd.c.
References client_disconnect().
|
static |
Definition at line 207 of file p_cmd.c.
References cpl, Player_Struct::ob, and print_inventory().
|
static |
Definition at line 209 of file p_cmd.c.
References draw_magic_map().
|
static |
Definition at line 217 of file p_cmd.c.
References arm_mapedit, and send_command().
|
static |
Definition at line 213 of file p_cmd.c.
References save_defaults().
|
static |
Definition at line 215 of file p_cmd.c.
References save_winpos().
|
static |
Definition at line 200 of file p_cmd.c.
References script_list().
|
static |
Definition at line 222 of file p_cmd.c.
References config_check(), CONFIG_MAPSCALE, draw_ext_info(), MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_CONFIG, NDI_RED, and want_config.
|
static |
Definition at line 233 of file p_cmd.c.
References command_take().
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.
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().
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().
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().
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().
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.
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().
|
static |
Definition at line 240 of file p_cmd.c.
References HELP_BIND_LONG.
|
static |
Definition at line 252 of file p_cmd.c.
References HELP_INV_LONG.
|
static |
Definition at line 248 of file p_cmd.c.
References HELP_MAGICMAP_LONG.
|
static |
Definition at line 244 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 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().
|
static |
Definition at line 139 of file p_cmd.c.
References COMMAND_WINDOW, CONFIG_CWINDOW, draw_ext_info(), MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, NDI_BLACK, use_config, and want_config.
|
static |
Definition at line 395 of file p_cmd.c.
References ConsoleCommand::cat, and ConsoleCommand::name.
Referenced by init_commands().
|
static |
Definition at line 385 of file p_cmd.c.
References ConsoleCommand::name.
Referenced by find_command(), and init_commands().
|
static |
Definition at line 391 of file p_cmd.c.
Referenced by get_cat_sorted_commands(), and init_commands().
|
static |
Definition at line 584 of file p_cmd.c.
Referenced by complete_command().
|
static |
Definition at line 320 of file p_cmd.c.
Referenced by complete_command(), and init_commands().
|
static |
Definition at line 383 of file p_cmd.c.
Referenced by find_command(), and init_commands().
const size_t num_commands = sizeof(CommonCommands) / sizeof(ConsoleCommand) |
Definition at line 378 of file p_cmd.c.
Referenced by complete_command(), find_command(), get_num_commands(), and init_commands().
const size_t num_server_commands = sizeof(commands) / sizeof(char *) |
Definition at line 605 of file p_cmd.c.
Referenced by complete_command().