--- deliantra/server/server/commands.C 2006/11/07 16:30:55 1.16 +++ 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); /* @@ -254,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 @@ -285,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; -}