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

Comparing deliantra/server/socket/request.C (file contents):
Revision 1.190 by root, Sun Nov 4 01:01:13 2012 UTC vs.
Revision 1.191 by root, Thu Nov 15 04:50:50 2012 UTC

498 * commands. 498 * commands.
499 */ 499 */
500 pl->count = 0; 500 pl->count = 0;
501} 501}
502 502
503/**
504 * This handles the general commands from the client (ie, north, fire, cast,
505 * etc.). It is a lot like PlayerCmd above, but is called with the
506 * 'ncom' method which gives more information back to the client so it
507 * can throttle.
508 */
509void
510NewPlayerCmd (char *buf, int len, player *pl)
511{
512 if (len <= 6)
513 {
514 LOG (llevDebug, "%s: corrupt ncom command <%s>: not long enough (%d) - discarding\n", pl->ns->host, buf, len);
515 return;
516 }
517
518 uint16 cmdid = net_uint16 ((uint8 *)buf);
519 sint32 repeat = net_sint32 ((uint8 *)buf + 2);
520
521 /* -1 is special - no repeat, but don't update */
522 if (repeat != -1)
523 pl->count = repeat;
524
525 buf += 6; //len -= 6;
526
527 execute_newserver_command (pl->ob, buf);
528
529 /* Perhaps something better should be done with a left over count.
530 * Cleaning up the input should probably be done first - all actions
531 * for the command that issued the count should be done before any other
532 * commands.
533 */
534 pl->count = 0;
535
536 //TODO: schmorp thinks whatever this calculates, it makes no sense at all
537 int time = pl->ob->has_active_speed ()
538 ? (int) (MAX_TIME / pl->ob->speed)
539 : MAX_TIME * 100;
540
541 /* Send confirmation of command execution now */
542 packet sl ("comc");
543 sl << uint16 (cmdid) << uint32 (time);
544 pl->ns->send_packet (sl);
545}
546
547/** This is a reply to a previous query. */ 503/** This is a reply to a previous query. */
548void 504void
549ReplyCmd (char *buf, int len, client *ns) 505ReplyCmd (char *buf, int len, client *ns)
550{ 506{
551 if (ns->state == ST_CUSTOM) 507 if (ns->state == ST_CUSTOM)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines