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.125 by root, Tue Apr 22 04:33:20 2008 UTC vs.
Revision 1.130 by root, Tue May 20 03:14:19 2008 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2001,2007 Mark Wedel 5 * Copyright (©) 2001,2007 Mark Wedel
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
148check_map_change (player *pl) 148check_map_change (player *pl)
149{ 149{
150 client &socket = *pl->ns; 150 client &socket = *pl->ns;
151 object *ob = pl->observe; 151 object *ob = pl->observe;
152 152
153 // first try to aovid a full newmap on tiled map scrolls
154 if (socket.current_map != ob->map)
155 {
156 rv_vector rv;
157
158 get_rangevector_from_mapcoord (socket.current_map, socket.current_x, socket.current_y, ob, &rv, 0);
159
160 // manhattan distance is very handy here
161 if (rv.distance < 8) // 8 works nicely for speed << 70 and buggy gcfclient
162 {
163 socket.current_map = ob->map;
164 socket.current_x = ob->x;
165 socket.current_y = ob->y;
166
167 socket_map_scroll (&socket, rv.distance_x, rv.distance_y);
168 socket.floorbox_reset ();
169 }
170 }
171
153 if (socket.current_map != ob->map || socket.force_newmap) 172 if (socket.current_map != ob->map || socket.force_newmap)
154 { 173 {
155 clear_map (pl); 174 clear_map (pl);
156 socket.current_map = ob->map; 175 socket.current_map = ob->map;
157 176
686 * syntax is: move (to) (tag) (nrof) 705 * syntax is: move (to) (tag) (nrof)
687 */ 706 */
688void 707void
689MoveCmd (char *buf, int len, player *pl) 708MoveCmd (char *buf, int len, player *pl)
690{ 709{
691 int vals[3], i; 710 int to, tag, nrof;
692 711
693 /* A little funky here. We only cycle for 2 records, because 712 if (3 != sscanf (buf, "%d %d %d", &to, &tag, &nrof))
694 * we obviously are not going to find a space after the third
695 * record. Perhaps we should just replace this with a
696 * sscanf?
697 */
698 for (i = 0; i < 2; i++)
699 { 713 {
700 vals[i] = atoi (buf);
701
702 if (!(buf = strchr (buf, ' ')))
703 {
704 LOG (llevError, "Incomplete move command: %s\n", buf); 714 LOG (llevError, "Incomplete move command: %s\n", buf);
705 return; 715 return;
706 }
707
708 buf++;
709 } 716 }
710 717
711 vals[2] = atoi (buf); 718 esrv_move_object (pl->ob, to, tag, nrof);
712
713/* LOG(llevDebug,"Move item %d (nrof=%d) to %d.\n", vals[1], vals[2], vals[0]);*/
714 esrv_move_object (pl->ob, vals[0], vals[1], vals[2]);
715} 719}
716 720
717/****************************************************************************** 721/******************************************************************************
718 * 722 *
719 * Start of commands the server sends to the client. 723 * Start of commands the server sends to the client.
886 890
887/** 891/**
888 * Tells the client that here is a player it should start using. 892 * Tells the client that here is a player it should start using.
889 */ 893 */
890void 894void
891esrv_new_player (player *pl, uint32 weight) 895esrv_new_player (player *pl)
892{ 896{
897 sint32 weight = pl->ob->client_weight ();
898
893 packet sl ("player"); 899 packet sl ("player");
894 900
895 sl << uint32 (pl->ob->count) 901 sl << uint32 (pl->ob->count)
896 << uint32 (weight) 902 << uint32 (weight)
897 << uint32 (pl->ob->face) 903 << uint32 (pl->ob->face)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines