Crossfire Client, Trunk
p_cmd.c
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 1999-2013 Mark Wedel and the Crossfire Development Team
5  * Copyright (c) 1992 Frank Tore Johansen
6  *
7  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
8  * welcome to redistribute it under certain conditions. For details, please
9  * see COPYING and LICENSE.
10  *
11  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
12  */
13 
19 #include <ctype.h>
20 
21 #include "client.h"
22 #include "external.h"
23 #include "p_cmd.h"
24 #include "script.h"
25 
31 #define H1(a) draw_ext_info(NDI_BLACK, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, a)
32 #define H2(a) draw_ext_info(NDI_BLACK, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, a)
33 #define LINE(a) draw_ext_info(NDI_BLACK, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, a)
34 
35 extern void config_check(void);
36 extern void map_check_resize(void);
37 
39 bool arm_mapedit = false;
40 
41 /* TODO Help topics other than commands? Refer to other documents? */
42 
43 static int get_num_commands(void);
44 
45 static void do_clienthelp_list() {
46  ConsoleCommand **sorted_cmds = get_cat_sorted_commands();
47  CommCat category = COMM_CAT_MISC;
48  GString *line = g_string_new(NULL);
49 
50  H1("Client commands:");
51  for (int i = 0; i < get_num_commands(); i++) {
52  ConsoleCommand *cmd = sorted_cmds[i];
53  if (cmd->cat != category) {
54  // If moving on to next category, dump line_buf and print header.
55  char buf[MAX_BUF];
56  snprintf(buf, sizeof(buf), "%s commands:",
57  get_category_name(cmd->cat));
58  LINE(line->str);
59  H2(buf);
60 
61  category = cmd->cat;
62  g_string_free(line, true);
63  line = g_string_new(NULL);
64  }
65  g_string_append_printf(line, "%s ", cmd->name);
66  }
67 
68  LINE(line->str);
69  g_string_free(line, true);
70 }
71 
72 static void show_help(const ConsoleCommand *cc) {
73  char buf[MAX_BUF];
74  if (cc->desc != NULL) {
75  snprintf(buf, MAX_BUF - 1, "%s - %s", cc->name, cc->desc);
76  } else {
77  snprintf(buf, MAX_BUF - 1, "Help for '%s':", cc->name);
78  }
79  H2(buf);
80 
81  if (cc->helpfunc != NULL) {
82  const char *long_help = NULL;
83  long_help = cc->helpfunc();
84 
85  if (long_help != NULL) {
86  LINE(long_help);
87  } else {
88  LINE("Extended help for this command is broken.");
89  }
90  } else {
91  LINE("No extended help is available for this command.");
92  }
93 }
94 
95 static void command_help(const char *cpnext) {
96  if (cpnext) {
97  const ConsoleCommand * cc;
98  char buf[MAX_BUF];
99 
100  cc = find_command(cpnext);
101  if (cc != NULL) {
102  show_help(cc);
103  } else {
104  snprintf(buf, sizeof(buf), "help %s", cpnext);
105  /* maybe not a must send, but we probably don't want to drop it */
106  send_command(buf, -1, 1);
107  }
108  } else {
110  /* Now fetch (in theory) command list from the server.
111  TODO Protocol command - feed it to the tab completer.
112 
113  Nope! It effectivey fetches '/help commands for commands'.
114  */
115  send_command("help", -1, 1); /* TODO make install in server branch doesn't install def_help. */
116  }
117 }
118 
119 static const char * help_help(void) {
120  return
121  "Syntax:\n"
122  "\n"
123  " help\n"
124  " help <topic>\n"
125  "\n"
126  "Without any arguments, displays a list of client-side "
127  "commands, and fetches the without-arguments help from "
128  "the server.\n"
129  "\n"
130  "With arguments, first checks if there's a client command "
131  "named <topic>. If there is, display it's help. If there "
132  "isn't, send the topic to the server.";
133 }
134  /* EndOf PCmdHelpCommands
137  */
138 
139 static void set_command_window(const char *cpnext) {
140  if (!cpnext) {
142  "cwindow command requires a number parameter");
143  } else {
144  want_config[CONFIG_CWINDOW] = atoi(cpnext);
147  } else {
149  }
150  }
151 }
152 
153 static void command_foodbeep() {
157  "Warning bell when low on food disabled");
158  } else {
161  "Warning bell when low on food enabled");
162  }
164 }
165 
166 const char * get_category_name(CommCat cat) {
167  const char * cat_name;
168 
169  /* HACK Need to keep this in sync. with player.h */
170  switch(cat) {
171  case COMM_CAT_MISC:
172  cat_name = "Miscellaneous";
173  break;
174  case COMM_CAT_INFO:
175  cat_name = "Informational";
176  break;
177  case COMM_CAT_SETUP:
178  cat_name = "Configuration";
179  break;
180  case COMM_CAT_SCRIPT:
181  cat_name = "Scripting";
182  break;
183  case COMM_CAT_DEBUG:
184  cat_name = "Debugging";
185  break;
186  default:
187  cat_name = "PROGRAMMER ERROR";
188  break;
189  }
190 
191  return cat_name;
192 }
193 
194 /*
195  * Command table.
196  *
197  * Implementation basically stolen verbatim from the server.
198  */
199 
200 static void do_script_list() { script_list(); }
201 
202 static void do_clearinfo() { menu_clear(); }
203 
204 static void do_disconnect() { client_disconnect(); }
205 
206 
207 static void do_inv() { print_inventory(cpl.ob); }
208 
209 static void do_magicmap() {
210  draw_magic_map();
211 }
212 
213 static void do_savedefaults() { save_defaults(); }
214 
215 static void do_savewinpos() { save_winpos(); }
216 
217 static void do_mapedit() {
218  send_command("mapinfo", -1, 1);
219  arm_mapedit = true;
220 }
221 
222 static void do_set_mapscale(const char *used) {
223  if (used != NULL) {
224  long long scale = strtoll(used, NULL, 0);
225  want_config[CONFIG_MAPSCALE] = scale;
226  config_check();
227  } else {
229  "mapscale command requires an argument");
230  }
231 }
232 
233 static void do_take(const char *used) {
234  command_take("take", used); /* I dunno why they want it. */
235 }
236 
237 /* Help "typecasters". */
238 #include "chelp.h"
239 
240 static const char * help_bind(void) {
241  return HELP_BIND_LONG;
242 }
243 
244 static const char * help_unbind(void) {
245  return HELP_UNBIND_LONG;
246 }
247 
248 static const char * help_magicmap(void) {
249  return HELP_MAGICMAP_LONG;
250 }
251 
252 static const char * help_inv(void) {
253  return HELP_INV_LONG;
254 }
255 
256 static const char * help_cwindow(void) {
257  return
258  "Syntax:\n"
259  "\n"
260  " cwindow <val>\n"
261  "\n"
262  "set size of command"
263  "window (if val is exceeded"
264  "client won't send new"
265  "commands to server\n\n"
266  "(What does this mean, 'put a lid on it'?) TODO";
267 }
268 
269 static const char * help_script(void) {
270  return
271  "Syntax: script <path>\n\n"
272  "Start an executable client script located at <path>. For details on "
273  "client-side scripting, please see the Crossfire Wiki.";
274 }
275 
276 static const char * help_scripttell(void) {
277  return
278  "Syntax:\n"
279  "\n"
280  " scripttell <yourname> <data>\n"
281  "\n"
282  "?";
283 }
284 
285 /* Toolkit-dependent. */
286 
287 static const char * help_savewinpos(void) {
288  return
289  "Syntax:\n"
290  "\n"
291  " savewinpos\n"
292  "\n"
293  "save window positions - split windows mode only.";
294 }
295 
296 static const char * help_scriptkill(void) {
297  return
298  "Syntax:\n"
299  "\n"
300  " scriptkill <name>\n"
301  "\n"
302  "Stop scripts named <name>.\n"
303  "(Not guaranteed to work?)";
304 }
305 
306 static const char * help_scriptkillall(void) {
307  return
308  "Syntax:\n"
309  "\n"
310  " scriptkillall\n"
311  "\n"
312  "Stop all active scripts.\n"
313  "(Not guaranteed to work?)";
314 }
315 
316 static void cmd_raw(const char *cmd) {
317  cs_print_string(csocket.fd, "%s", cmd);
318 }
319 
321  {"cmd", COMM_CAT_DEBUG, cmd_raw, NULL, "Send a raw command to the server"},
322 
324 
325  {"script", COMM_CAT_SCRIPT, script_init, help_script, NULL},
326 #ifdef HAVE_LUA
327  {"lua_load", COMM_CAT_SCRIPT, script_lua_load, NULL, NULL},
328 
329  {"lua_list", COMM_CAT_SCRIPT, script_lua_list, NULL, NULL},
330 
331  {"lua_kill", COMM_CAT_SCRIPT, script_lua_kill, NULL, NULL},
332 #endif
333  {"scripts", COMM_CAT_SCRIPT, do_script_list, NULL, "List running scripts"},
334 
335  {"scriptkill", COMM_CAT_SCRIPT, script_kill, help_scriptkill, NULL},
336 
337  {"scriptkillall", COMM_CAT_SCRIPT, script_killall_wrapper, help_scriptkillall, NULL},
338 
339  {"scripttell", COMM_CAT_SCRIPT, script_tell, help_scripttell, NULL},
340 
341  {"clearinfo", COMM_CAT_MISC, do_clearinfo, NULL, "Clear message window"},
342 
343  {"cwindow", COMM_CAT_SETUP, set_command_window, help_cwindow, NULL},
344 
345  {"disconnect", COMM_CAT_MISC, do_disconnect, NULL, NULL},
346 
347 
348  {"foodbeep", COMM_CAT_SETUP, command_foodbeep, NULL,
349  "toggle audible low on food warning"},
350 
351  {"help", COMM_CAT_MISC, command_help, help_help, NULL},
352 
354 
355  {"magicmap", COMM_CAT_MISC, do_magicmap, help_magicmap,
357 
358  {"mapedit", COMM_CAT_MISC, do_mapedit, NULL, NULL},
359 
360  {"mapscale", COMM_CAT_MISC, do_set_mapscale, NULL, NULL},
361 
362  {"savedefaults", COMM_CAT_SETUP, do_savedefaults, NULL,
364 
365  {
367  "Saves the position and sizes of windows." /* Panes? */
368  },
369 
370  {"take", COMM_CAT_MISC, do_take, NULL, NULL},
371 
372  {"unbind", COMM_CAT_SETUP, unbind_key, help_unbind, NULL},
373 
374  {"show", COMM_CAT_SETUP, command_show, NULL,
375  "Change what items to show in inventory"},
376 };
377 
378 const size_t num_commands = sizeof(CommonCommands) / sizeof(ConsoleCommand);
379 static int get_num_commands() {
380  return num_commands;
381 }
382 
384 
385 static int sort_by_name(const void * a_, const void * b_) {
386  ConsoleCommand * a = *((ConsoleCommand **)a_);
387  ConsoleCommand * b = *((ConsoleCommand **)b_);
388  return strcmp(a->name, b->name);
389 }
390 
392 
393 /* Sort by category, then by name. */
394 
395 static int sort_by_category(const void *a_, const void *b_) {
396  /* Typecasts, so it goes. */
397  ConsoleCommand * a = *((ConsoleCommand **)a_);
398  ConsoleCommand * b = *((ConsoleCommand **)b_);
399 
400  if (a->cat == b->cat) {
401  return strcmp(a->name, b->name);
402  }
403 
404  return a->cat - b->cat;
405 }
406 
408  /* XXX Leak! */
409  name_sorted_commands = g_malloc(sizeof(ConsoleCommand *) * num_commands);
410 
411  for (size_t i = 0; i < num_commands; i++) {
413  }
414 
415  /* Sort them. */
417 
418  /* Copy the list, then sort it by category. */
419  cat_sorted_commands = g_malloc(sizeof(ConsoleCommand *) * num_commands);
420 
422 
424 
425  /* TODO Add to the list of tab-completion items. */
426 }
427 
428 const ConsoleCommand * find_command(const char *cmd) {
429  ConsoleCommand ** asp_p = NULL, dummy;
430  ConsoleCommand * dummy_p;
431  ConsoleCommand * asp;
432  char *cp, *cmd_cpy;
433  cmd_cpy = g_strdup(cmd);
434 
435  for (cp=cmd_cpy; *cp; cp++) {
436  *cp =tolower(*cp);
437  }
438 
439  dummy.name = cmd_cpy;
440  dummy_p = &dummy;
441  asp_p = bsearch(
442  (void *)&dummy_p,
443  (void *)name_sorted_commands,
444  num_commands,
445  sizeof(ConsoleCommand *),
446  sort_by_name);
447 
448  if (asp_p == NULL) {
449  free(cmd_cpy);
450  return NULL;
451  }
452 
453  asp = *asp_p;
454 
455  /* TODO The server's find_command() searches first the commands,
456  then the emotes. We might have to do something similar someday, too. */
457  /* if (asp == NULL) search something else? */
458 
459  free(cmd_cpy);
460 
461  return asp;
462 }
463 
469  return cat_sorted_commands;
470 }
471 
481 int handle_local_command(const char* cp, const char *cpnext) {
482  const ConsoleCommand * cc = NULL;
483 
484  cc = find_command(cp);
485 
486  if (cc == NULL) {
487  return FALSE;
488  }
489 
490  if (cc->dofunc == NULL) {
491  char buf[MAX_BUF];
492 
493  snprintf(buf, MAX_BUF - 1, "Client command %s has no implementation!", cc->name);
495 
496  return FALSE;
497  }
498 
499  cc->dofunc(cpnext);
500 
501  return TRUE;
502 }
503 
515 void extended_command(const char *ocommand) {
516  const char *cp = ocommand;
517  char *cpnext, command[MAX_BUF];
518 
519  if ((cpnext = strchr(cp, ' '))!=NULL) {
520  int len = cpnext - ocommand;
521  if (len > (MAX_BUF -1 )) {
522  len = MAX_BUF-1;
523  }
524 
525  strncpy(command, ocommand, len);
526  command[len] = '\0';
527  cp = command;
528  while (*cpnext == ' ') {
529  cpnext++;
530  }
531  if (*cpnext == 0) {
532  cpnext = NULL;
533  }
534  }
535  /*
536  * Try to prevent potential client hang by trying to delete a
537  * character when there is no character to delete.
538  * Thus, only send quit command if there is a player to delete.
539  */
540  if (cpl.title[0] == '\0' && strcmp(cp, "quit") == 0){
541  // Bail here, there isn't anything this should be doing.
542  return;
543  }
544 
545  /* cp now contains the command (everything before first space),
546  * and cpnext contains everything after that first space. cpnext
547  * could be NULL.
548  */
549 #ifdef HAVE_LUA
550  if ( script_lua_command(cp, cpnext) ) {
551  return;
552  }
553 #endif
554 
555  /* If this isn't a client-side command, send it to the server. */
556  if (!handle_local_command(cp, cpnext)) {
557  /* just send the command(s) (if `ocommand' is a compound command */
558  /* then split it and send each part separately */
559  /* TODO Remove this from the server; end of commands.c. */
560  strncpy(command, ocommand, MAX_BUF-1);
561  command[MAX_BUF-1]=0;
562  cp = strtok(command, ";");
563  while ( cp ) {
564  while( *cp == ' ' ) {
565  cp++;
566  } /* throw out leading spaces; server
567  does not like them */
568  send_command(cp, cpl.count, 0);
569  cp = strtok(NULL, ";");
570  }
571  }
572 }
573 
574 /* ------------------------------------------------------------------ */
575 
576 /* This list is used for the 'tab' completion, and nothing else.
577  * Therefore, if it is out of date, it isn't that terrible, but
578  * ideally it should stay somewhat up to date with regards to
579  * the commands the server supports.
580  */
581 
582 /* TODO Dynamically generate. */
583 
584 static const char *const commands[] = {
585  "accuse", "afk", "apply", "applymode", "archs", "beg", "bleed", "blush",
586  "body", "bounce", "bow", "bowmode", "brace", "build", "burp", "cackle", "cast",
587  "chat", "chuckle", "clap", "cointoss", "cough", "cringe", "cry", "dance",
588  "disarm", "dm", "dmhide", "drop", "dropall", "east", "examine", "explore",
589  "fire", "fire_stop", "fix_me", "flip", "frown", "gasp", "get", "giggle",
590  "glare", "grin", "groan", "growl", "gsay", "help", "hiccup", "hiscore", "hug",
591  "inventory", "invoke", "killpets", "kiss", "laugh", "lick", "listen", "logs",
592  "mapinfo", "maps", "mark", "me", "motd", "nod", "north", "northeast",
593  "northwest", "orcknuckle", "output-count", "output-sync", "party", "peaceful",
594  "petmode", "pickup", "players", "poke", "pout", "prepare", "printlos", "puke",
595  "quests", "quit", "ready_skill", "rename", "reply", "resistances",
596  "rotateshoottype", "run", "run_stop", "save", "say", "scream", "search",
597  "search-items", "shake", "shiver", "shout", "showpets", "shrug", "shutdown",
598  "sigh", "skills", "slap", "smile", "smirk", "snap", "sneeze", "snicker",
599  "sniff", "snore", "sound", "south", "southeast", "southwest", "spit",
600  "statistics", "stay", "strings", "strut", "sulk", "take", "tell", "thank",
601  "think", "throw", "time", "title", "twiddle", "use_skill", "usekeys",
602  "version", "wave", "weather", "west", "whereabouts", "whereami", "whistle",
603  "who", "wimpy", "wink", "yawn",
604 };
605 const size_t num_server_commands = sizeof(commands) / sizeof(char *);
606 
614 const char * complete_command(const char *command) {
615  int len, display = 0;
616  const char *match;
617  static char result[64];
618  char list[500];
619 
620  len = strlen(command);
621 
622  if (len == 0) {
623  return NULL;
624  }
625 
626  strcpy(list, "Matching commands:");
627 
628  /* TODO Partial match, e.g.:
629  If the completion list was:
630  wear
631  wet #?
632 
633  If we type 'w' then hit tab, put in the e.
634 
635  Basically part of bash (readline?)'s behaviour.
636  */
637 
638  match = NULL;
639 
640  /* check server side commands */
641  for (size_t i = 0; i < num_server_commands; i++) {
642  if (!strncmp(command, commands[i], len)) {
643  if (display) {
644  snprintf(list + strlen(list), 499 - strlen(list), " %s", commands[i]);
645  } else if (match != NULL) {
646  display = 1;
647  snprintf(list + strlen(list), 499 - strlen(list), " %s %s", match, commands[i]);
648  match = NULL;
649  } else {
650  match = commands[i];
651  }
652  }
653  }
654 
655  /* check client side commands */
656  for (size_t i = 0; i < num_commands; i++) {
657  if (!strncmp(command, CommonCommands[i].name, len)) {
658  if (display) {
659  snprintf(list + strlen(list), 499 - strlen(list), " %s", CommonCommands[i].name);
660  } else if (match != NULL) {
661  display = 1;
662  snprintf(list + strlen(list), 499 - strlen(list), " %s %s", match, CommonCommands[i].name);
663  match = NULL;
664  } else {
665  match = CommonCommands[i].name;
666  }
667  }
668  }
669 
670  if (match == NULL) {
671  if (display) {
672  strncat(list, "\n", 499 - strlen(list));
675  } else
677  "No matching command.\n");
678  /* No match. */
679  return NULL;
680  }
681 
682  /*
683  * Append a space to allow typing arguments. For commands without arguments
684  * the excess space should be stripped off automatically.
685  */
686  snprintf(result, sizeof(result), "%s ", match);
687  return result;
688 }
COMM_CAT_INFO
@ COMM_CAT_INFO
Definition: p_cmd.h:46
help_cwindow
static const char * help_cwindow(void)
Definition: p_cmd.c:256
MSG_TYPE_CLIENT
#define MSG_TYPE_CLIENT
Definition: newclient.h:387
CONFIG_CWINDOW
#define CONFIG_CWINDOW
Definition: client.h:186
CommonCommands
static ConsoleCommand CommonCommands[]
Definition: p_cmd.c:320
HELP_INV_SHORT
#define HELP_INV_SHORT
Definition: chelp.h:66
find_command
const ConsoleCommand * find_command(const char *cmd)
Definition: p_cmd.c:428
Player_Struct::title
char title[MAX_BUF]
Definition: client.h:349
help_savewinpos
static const char * help_savewinpos(void)
Definition: p_cmd.c:287
client_disconnect
void client_disconnect()
Definition: client.c:175
ClientSocket::fd
GSocketConnection * fd
Definition: client.h:124
HELP_BIND_LONG
#define HELP_BIND_LONG
Definition: chelp.h:7
extended_command
void extended_command(const char *ocommand)
Definition: p_cmd.c:515
HELP_INV_LONG
#define HELP_INV_LONG
Definition: chelp.h:67
external.h
init_commands
void init_commands()
Definition: p_cmd.c:407
HELP_MAGICMAP_LONG
#define HELP_MAGICMAP_LONG
Definition: chelp.h:55
script_lua_kill
void script_lua_kill(const char *param)
ConsoleCommand::name
const char * name
Definition: p_cmd.h:57
COMM_CAT_MISC
@ COMM_CAT_MISC
Definition: p_cmd.h:45
CommCat
CommCat
Definition: p_cmd.h:44
CONFIG_MAPSCALE
#define CONFIG_MAPSCALE
Definition: client.h:190
chelp.h
get_category_name
const char * get_category_name(CommCat cat)
Definition: p_cmd.c:166
NDI_RED
#define NDI_RED
Definition: newclient.h:224
save_defaults
void save_defaults(void)
Definition: config.c:513
map_check_resize
void map_check_resize(void)
Definition: map.c:49
menu_clear
void menu_clear(void)
Definition: info.c:1326
help_scriptkill
static const char * help_scriptkill(void)
Definition: p_cmd.c:296
do_savedefaults
static void do_savedefaults()
Definition: p_cmd.c:213
cmd_raw
static void cmd_raw(const char *cmd)
Definition: p_cmd.c:316
HELP_SAVEDEFAULTS_SHORT
#define HELP_SAVEDEFAULTS_SHORT
Definition: chelp.h:59
do_take
static void do_take(const char *used)
Definition: p_cmd.c:233
set_command_window
static void set_command_window(const char *cpnext)
Definition: p_cmd.c:139
draw_magic_map
void draw_magic_map(void)
Definition: magicmap.c:24
command_help
static void command_help(const char *cpnext)
Definition: p_cmd.c:95
ConsoleCommand::cat
CommCat cat
Definition: p_cmd.h:58
CONFIG_FOODBEEP
#define CONFIG_FOODBEEP
Definition: client.h:203
HELP_UNBIND_LONG
#define HELP_UNBIND_LONG
Definition: chelp.h:45
MAX_BUF
#define MAX_BUF
Definition: client.h:40
do_clienthelp_list
static void do_clienthelp_list()
Definition: p_cmd.c:45
command_take
void command_take(const char *command, const char *cpnext)
Definition: player.c:351
help_help
static const char * help_help(void)
Definition: p_cmd.c:119
COMM_CAT_DEBUG
@ COMM_CAT_DEBUG
Definition: p_cmd.h:49
num_commands
const size_t num_commands
Definition: p_cmd.c:378
do_script_list
static void do_script_list()
Definition: p_cmd.c:200
Player_Struct::ob
item * ob
Definition: client.h:334
show_help
static void show_help(const ConsoleCommand *cc)
Definition: p_cmd.c:72
H2
#define H2(a)
Definition: p_cmd.c:32
script_lua_load
void script_lua_load(const char *name)
bind_key
void bind_key(const char *params)
COMM_CAT_SCRIPT
@ COMM_CAT_SCRIPT
Definition: p_cmd.h:48
command_foodbeep
static void command_foodbeep()
Definition: p_cmd.c:153
complete_command
const char * complete_command(const char *command)
Definition: p_cmd.c:614
name_sorted_commands
static ConsoleCommand ** name_sorted_commands
Definition: p_cmd.c:383
cs_print_string
int cs_print_string(GSocketConnection *fd, const char *str,...)
Definition: newsocket.c:252
script_kill
void script_kill(const char *params)
Definition: script.c:515
want_config
gint16 want_config[CONFIG_NUMS]
Definition: init.c:41
csocket
ClientSocket csocket
Definition: client.c:70
draw_ext_info
void draw_ext_info(int orig_color, int type, int subtype, const char *message)
Definition: info.c:915
do_mapedit
static void do_mapedit()
Definition: p_cmd.c:217
NDI_BLACK
#define NDI_BLACK
Definition: newclient.h:221
COMM_CAT_SETUP
@ COMM_CAT_SETUP
Definition: p_cmd.h:47
num_server_commands
const size_t num_server_commands
Definition: p_cmd.c:605
arm_mapedit
bool arm_mapedit
Definition: p_cmd.c:39
LINE
#define LINE(a)
Definition: p_cmd.c:33
sort_by_category
static int sort_by_category(const void *a_, const void *b_)
Definition: p_cmd.c:395
save_winpos
void save_winpos(void)
Definition: config.c:793
script_list
void script_list(void)
Definition: script.c:493
H1
#define H1(a)
Definition: p_cmd.c:31
do_set_mapscale
static void do_set_mapscale(const char *used)
Definition: p_cmd.c:222
script_lua_list
void script_lua_list(const char *param)
do_clearinfo
static void do_clearinfo()
Definition: p_cmd.c:202
p_cmd.h
help_magicmap
static const char * help_magicmap(void)
Definition: p_cmd.c:248
ConsoleCommand::dofunc
CommFunc dofunc
Definition: p_cmd.h:59
send_command
int send_command(const char *command, int repeat, int must_send)
Definition: player.c:235
do_disconnect
static void do_disconnect()
Definition: p_cmd.c:204
cpl
Client_Player cpl
Definition: client.c:69
MSG_TYPE_CLIENT_CONFIG
#define MSG_TYPE_CLIENT_CONFIG
Definition: newclient.h:630
ConsoleCommand::helpfunc
CommHelpFunc helpfunc
Definition: p_cmd.h:61
script_lua_command
int script_lua_command(const char *command, const char *param)
ConsoleCommand
Definition: p_cmd.h:56
COMMAND_WINDOW
#define COMMAND_WINDOW
Definition: client.h:76
unbind_key
void unbind_key(const char *params)
Definition: keys.c:1465
MSG_TYPE_CLIENT_NOTICE
#define MSG_TYPE_CLIENT_NOTICE
Definition: newclient.h:635
handle_local_command
int handle_local_command(const char *cp, const char *cpnext)
Definition: p_cmd.c:481
ConsoleCommand::desc
const char * desc
Definition: p_cmd.h:62
help_scripttell
static const char * help_scripttell(void)
Definition: p_cmd.c:276
Player_Struct::count
guint32 count
Definition: client.h:357
script.h
use_config
gint16 use_config[CONFIG_NUMS]
Definition: client.h:242
get_num_commands
static int get_num_commands(void)
Definition: p_cmd.c:379
do_magicmap
static void do_magicmap()
Definition: p_cmd.c:209
HELP_MAGICMAP_SHORT
#define HELP_MAGICMAP_SHORT
Definition: chelp.h:54
cat_sorted_commands
static ConsoleCommand ** cat_sorted_commands
Definition: p_cmd.c:391
help_bind
static const char * help_bind(void)
Definition: p_cmd.c:240
HELP_BIND_SHORT
#define HELP_BIND_SHORT
Definition: chelp.h:6
get_cat_sorted_commands
ConsoleCommand ** get_cat_sorted_commands(void)
Definition: p_cmd.c:468
script_init
void script_init(const char *cparams)
Definition: script.c:205
script_tell
void script_tell(const char *params)
Definition: script.c:959
script_killall_wrapper
void script_killall_wrapper(const char *params)
Definition: script.c:536
sort_by_name
static int sort_by_name(const void *a_, const void *b_)
Definition: p_cmd.c:385
do_savewinpos
static void do_savewinpos()
Definition: p_cmd.c:215
commands
static const char *const commands[]
Definition: p_cmd.c:584
client.h
help_scriptkillall
static const char * help_scriptkillall(void)
Definition: p_cmd.c:306
help_script
static const char * help_script(void)
Definition: p_cmd.c:269
help_unbind
static const char * help_unbind(void)
Definition: p_cmd.c:244
help_inv
static const char * help_inv(void)
Definition: p_cmd.c:252
print_inventory
void print_inventory(item *op)
Definition: item.c:620
do_inv
static void do_inv()
Definition: p_cmd.c:207
command_show
void command_show(const char *params)
Definition: inventory.c:661
config_check
void config_check(void)
Definition: config.c:331