--- deliantra/server/server/commands.C 2006/09/29 19:28:43 1.12 +++ deliantra/server/server/commands.C 2006/12/14 22:45:41 1.19 @@ -25,12 +25,11 @@ * Command parser */ +#include + #include #include -#ifndef __CEXTRACT__ -# include -#endif -#include +#include /* Added times to all the commands. However, this was quickly done, * and probably needs more refinements. All socket and DM commands @@ -114,7 +113,6 @@ {"southwest", command_southwest, 1.0}, {"northwest", command_northwest, 1.0}, }; - const int CommandsSize = sizeof (Commands) / sizeof (CommArray_s); CommArray_s CommunicationCommands[] = { @@ -178,7 +176,6 @@ {"orcknuckle", command_orcknuckle, 0.0}, {"printlos", command_printlos, 0.0}, }; - const int CommunicationCommandSize = sizeof (CommunicationCommands) / sizeof (CommArray_s); CommArray_s NewServerCommands[] = { @@ -187,7 +184,6 @@ {"fire", command_fire, 1.0}, {"fire_stop", command_fire_stop, 0.0}, }; - const int NewServerCommandSize = sizeof (NewServerCommands) / sizeof (CommArray_s); /* @@ -203,14 +199,11 @@ {"dump", command_dump, 0.0}, {"dumpbelow", command_dumpbelow, 0.0}, {"dumpfriendlyobjects", command_dumpfriendlyobjects, 0.0}, - {"dumpallarchetypes", command_dumpallarchetypes, 0.0}, {"dumpallmaps", command_dumpallmaps, 0.0}, - {"dumpallobjects", command_dumpallobjects, 0.0}, {"dumpmap", command_dumpmap, 0.0}, {"forget_spell", command_forget_spell, 0.0}, {"free", command_free, 0.0}, {"freeze", command_freeze, 0.0}, - {"goto", command_goto, 0.0}, {"hide", command_hide, 0.0}, {"insert_into", command_insert_into, 0.0}, {"invisible", command_invisible, 0.0}, @@ -239,13 +232,10 @@ {"style_info", command_style_map_info, 0.0}, /* Costly command, so make it wiz only */ {"summon", command_summon, 0.0}, {"teleport", command_teleport, 0.0}, - {"wizpass", command_wizpass, 0.0}, - {"wizcast", command_wizcast, 0.0}, {"overlay_save", command_save_overlay, 0.0}, /* {"possess", command_possess, 0.0}, */ {"mon_aggr", command_mon_aggr, 0.0}, - {"loadtest", command_loadtest, 0.0}, }; const int WizCommandsSize = sizeof (WizCommands) / sizeof (CommArray_s); @@ -260,24 +250,19 @@ {"players", command_players, 0.0}, {"version", command_version, 0.0}, }; - const int Socket_CommandsSize = sizeof (Socket_Commands) / sizeof (CommArray_s); - /* Socket commands - these should really do nothing more than output things * to the various players/sockets. */ CommArray_s Socket2_Commands[] = { }; - const int Socket2_CommandsSize = sizeof (Socket2_Commands) / sizeof (CommArray_s); - - static int compare_A (const void *a, const void *b) { - return strcmp (((CommArray_s *) a)->name, ((CommArray_s *) b)->name); + return strcmp (((CommArray_s *)a)->name, ((CommArray_s *)b)->name); } void @@ -291,43 +276,3 @@ qsort (Socket2_Commands, Socket2_CommandsSize, sizeof (CommArray_s), compare_A); } -#ifndef tolower -# define tolower(C) (((C) >= 'A' && (C) <= 'Z')? (C) - 'A' + 'a': (C)) -#endif - - -CommFunc -find_oldsocket_command (char *cmd) -{ - CommArray_s *asp, dummy; - char *cp; - - for (cp = cmd; *cp; cp++) - { - *cp = tolower (*cp); - } - - dummy.name = cmd; - asp = (CommArray_s *) bsearch ((void *) &dummy, (void *) Socket_Commands, Socket_CommandsSize, sizeof (CommArray_s), compare_A); - if (asp) - return asp->func; - return NULL; -} - -CommFunc -find_oldsocket_command2 (char *cmd) -{ - CommArray_s *asp, dummy; - char *cp; - - for (cp = cmd; *cp; cp++) - { - *cp = tolower (*cp); - } - - dummy.name = cmd; - asp = (CommArray_s *) bsearch ((void *) &dummy, (void *) Socket2_Commands, Socket2_CommandsSize, sizeof (CommArray_s), compare_A); - if (asp) - return asp->func; - return NULL; -}