ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/c_new.C
(Generate patch)

Comparing deliantra/server/server/c_new.C (file contents):
Revision 1.1 by elmex, Sun Aug 13 17:16:03 2006 UTC vs.
Revision 1.2 by root, Tue Aug 29 08:01:37 2006 UTC

1/* 1/*
2 * static char *rcsid_c_new_c = 2 * static char *rcsid_c_new_c =
3 * "$Id: c_new.C,v 1.1 2006/08/13 17:16:03 elmex Exp $"; 3 * "$Id: c_new.C,v 1.2 2006/08/29 08:01:37 root Exp $";
4 */ 4 */
5 5
6/* 6/*
7 CrossFire, A Multiplayer game for X-windows 7 CrossFire, A Multiplayer game for X-windows
8 8
49 CommArray_s *asp, dummy; 49 CommArray_s *asp, dummy;
50 char *cp; 50 char *cp;
51 51
52 dummy.name =cmd; 52 dummy.name =cmd;
53 asp =(CommArray_s *)bsearch((void *)&dummy, 53 asp =(CommArray_s *)bsearch((void *)&dummy,
54 (void *)commarray, commsize, 54 (void *)commarray, commsize,
55 sizeof(CommArray_s), compare_A); 55 sizeof(CommArray_s), compare_A);
56 return asp; 56 return asp;
57} 57}
58 58
59/* This function is called from the new client/server code. 59/* This function is called from the new client/server code.
60 * pl is the player who is issuing the command, command is the 60 * pl is the player who is issuing the command, command is the
75 *cp='\0'; 75 *cp='\0';
76 cp--; 76 cp--;
77 } 77 }
78 cp=strchr(command, ' '); 78 cp=strchr(command, ' ');
79 if (cp) { 79 if (cp) {
80 *(cp++) ='\0'; 80 *(cp++) ='\0';
81 while (*cp==' ') cp++; 81 while (*cp==' ') cp++;
82 } 82 }
83 83
84 csp = find_plugin_command(command,pl); 84 csp = find_plugin_command(command,pl);
85 85
86 if (!csp) 86 if (!csp)
87 csp = find_command_element(command, NewServerCommands, NewServerCommandSize); 87 csp = find_command_element(command, NewServerCommands, NewServerCommandSize);
88 if (!csp) 88 if (!csp)
89 csp = find_command_element(command, Commands, CommandsSize); 89 csp = find_command_element(command, Commands, CommandsSize);
90 if (!csp) 90 if (!csp)
91 csp = find_command_element(command, CommunicationCommands, CommunicationCommandSize); 91 csp = find_command_element(command, CommunicationCommands, CommunicationCommandSize);
92 if (!csp && QUERY_FLAG(pl, FLAG_WIZ)) 92 if (!csp && QUERY_FLAG(pl, FLAG_WIZ))
93 csp = find_command_element(command, WizCommands, WizCommandsSize); 93 csp = find_command_element(command, WizCommands, WizCommandsSize);
94 94
95 if (csp==NULL) { 95 if (csp==NULL) {
96 new_draw_info_format(NDI_UNIQUE, 0,pl, 96 new_draw_info_format(NDI_UNIQUE, 0,pl,
97 "'%s' is not a valid command.", command); 97 "'%s' is not a valid command.", command);
98 return 0; 98 return 0;
99 } 99 }
100 100
101 pl->speed_left -= csp->time; 101 pl->speed_left -= csp->time;
102 102
103 /* A character time can never exceed his speed (which in many cases, 103 /* A character time can never exceed his speed (which in many cases,
109 * but greater than -1. This is to improve the performance of the 109 * but greater than -1. This is to improve the performance of the
110 * new client/server. In theory, it shouldn't make much difference. 110 * new client/server. In theory, it shouldn't make much difference.
111 */ 111 */
112 112
113 if (csp->time && pl->speed_left<-2.0) { 113 if (csp->time && pl->speed_left<-2.0) {
114 LOG(llevDebug,"execute_newclient_command: Player issued command that takes more time than he has left.\n"); 114 LOG(llevDebug,"execute_newclient_command: Player issued command that takes more time than he has left.\n");
115 } 115 }
116 return csp->func(pl, cp); 116 return csp->func(pl, cp);
117} 117}
118 118
119int command_run(object *op, char *params) 119int command_run(object *op, char *params)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines