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.188 by root, Mon Oct 29 23:55:57 2012 UTC vs.
Revision 1.192 by root, Wed Nov 21 13:22:34 2012 UTC

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 */
282void 284void
283RequestInfo (char *buf, int len, client *ns) 285RequestInfo (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 */
507void
508NewPlayerCmd (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. */
546void 504void
547ReplyCmd (char *buf, int len, client *ns) 505ReplyCmd (char *buf, int len, client *ns)
1272 << uint16 (spell->cached_grace) 1230 << uint16 (spell->cached_grace)
1273 << uint16 (spell->cached_eat) 1231 << uint16 (spell->cached_eat)
1274 << uint8 (skill) 1232 << uint8 (skill)
1275 << uint32 (spell->path_attuned) 1233 << uint32 (spell->path_attuned)
1276 << uint32 (spell->face) 1234 << uint32 (spell->face)
1277 << data8 (spell->name) 1235 << data8 (spell->name);
1236
1237 if (pl->ns->monitor_spells < 2)
1278 << data16 (spell->msg); 1238 sl << data16 (spell->msg);
1279} 1239}
1280 1240
1281/** 1241/**
1282 * This tells the client to add the spell *ob, if *ob is NULL, then add 1242 * This tells the client to add the spell *ob, if *ob is NULL, then add
1283 * all spells in the player's inventory. 1243 * all spells in the player's inventory.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines