… | |
… | |
194 | { |
194 | { |
195 | INVOKE_PLAYER (REGION_CHANGE, pl, ARG_REGION (reg), ARG_REGION (socket.current_region)); |
195 | INVOKE_PLAYER (REGION_CHANGE, pl, ARG_REGION (reg), ARG_REGION (socket.current_region)); |
196 | socket.current_region = reg; |
196 | socket.current_region = reg; |
197 | } |
197 | } |
198 | |
198 | |
199 | // first try to aovid a full newmap on tiled map scrolls |
199 | // first try to avoid a full newmap on tiled map scrolls |
200 | if (socket.current_map != ob->map && !socket.force_newmap) |
200 | if (socket.current_map != ob->map && !socket.force_newmap) |
201 | { |
201 | { |
202 | rv_vector rv; |
202 | rv_vector rv; |
203 | |
203 | |
204 | get_rangevector_from_mapcoord (socket.current_map, socket.current_x, socket.current_y, ob, &rv, 0); |
204 | get_rangevector_from_mapcoord (socket.current_map, socket.current_x, socket.current_y, ob, &rv, 0); |
… | |
… | |
276 | |
276 | |
277 | /** |
277 | /** |
278 | * RequestInfo is sort of a meta command. There is some specific |
278 | * RequestInfo is sort of a meta command. There is some specific |
279 | * request of information, but we call other functions to provide |
279 | * request of information, but we call other functions to provide |
280 | * that information. |
280 | * that information. |
|
|
281 | * requestinfo is completely deprecated, use resource exti request |
|
|
282 | * and the fxix or http protocols. |
281 | */ |
283 | */ |
282 | void |
284 | void |
283 | RequestInfo (char *buf, int len, client *ns) |
285 | RequestInfo (char *buf, int len, client *ns) |
284 | { |
286 | { |
285 | char *params; |
287 | char *params; |
… | |
… | |
494 | * Cleaning up the input should probably be done first - all actions |
496 | * Cleaning up the input should probably be done first - all actions |
495 | * for the command that issued the count should be done before any other |
497 | * for the command that issued the count should be done before any other |
496 | * commands. |
498 | * commands. |
497 | */ |
499 | */ |
498 | pl->count = 0; |
500 | pl->count = 0; |
499 | } |
|
|
500 | |
|
|
501 | /** |
|
|
502 | * This handles the general commands from the client (ie, north, fire, cast, |
|
|
503 | * etc.). It is a lot like PlayerCmd above, but is called with the |
|
|
504 | * 'ncom' method which gives more information back to the client so it |
|
|
505 | * can throttle. |
|
|
506 | */ |
|
|
507 | void |
|
|
508 | NewPlayerCmd (char *buf, int len, player *pl) |
|
|
509 | { |
|
|
510 | if (len <= 6) |
|
|
511 | { |
|
|
512 | LOG (llevDebug, "%s: corrupt ncom command <%s>: not long enough (%d) - discarding\n", pl->ns->host, buf, len); |
|
|
513 | return; |
|
|
514 | } |
|
|
515 | |
|
|
516 | uint16 cmdid = net_uint16 ((uint8 *)buf); |
|
|
517 | sint32 repeat = net_sint32 ((uint8 *)buf + 2); |
|
|
518 | |
|
|
519 | /* -1 is special - no repeat, but don't update */ |
|
|
520 | if (repeat != -1) |
|
|
521 | pl->count = repeat; |
|
|
522 | |
|
|
523 | buf += 6; //len -= 6; |
|
|
524 | |
|
|
525 | execute_newserver_command (pl->ob, buf); |
|
|
526 | |
|
|
527 | /* Perhaps something better should be done with a left over count. |
|
|
528 | * Cleaning up the input should probably be done first - all actions |
|
|
529 | * for the command that issued the count should be done before any other |
|
|
530 | * commands. |
|
|
531 | */ |
|
|
532 | pl->count = 0; |
|
|
533 | |
|
|
534 | //TODO: schmorp thinks whatever this calculates, it makes no sense at all |
|
|
535 | int time = pl->ob->has_active_speed () |
|
|
536 | ? (int) (MAX_TIME / pl->ob->speed) |
|
|
537 | : MAX_TIME * 100; |
|
|
538 | |
|
|
539 | /* Send confirmation of command execution now */ |
|
|
540 | packet sl ("comc"); |
|
|
541 | sl << uint16 (cmdid) << uint32 (time); |
|
|
542 | pl->ns->send_packet (sl); |
|
|
543 | } |
501 | } |
544 | |
502 | |
545 | /** This is a reply to a previous query. */ |
503 | /** This is a reply to a previous query. */ |
546 | void |
504 | void |
547 | ReplyCmd (char *buf, int len, client *ns) |
505 | ReplyCmd (char *buf, int len, client *ns) |