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.6 by root, Sat Aug 19 03:54:23 2006 UTC vs.
Revision 1.7 by root, Mon Aug 21 07:13:32 2006 UTC

1/* 1/*
2 * static char *rcsid_init_c = 2 * static char *rcsid_init_c =
3 * "$Id: request.C,v 1.6 2006/08/19 03:54:23 root Exp $"; 3 * "$Id: request.C,v 1.7 2006/08/21 07:13:32 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
163 * empty). 163 * empty).
164 */ 164 */
165 ns->sent_scroll = 1; 165 ns->sent_scroll = 1;
166} 166}
167 167
168static void
169clear_map (player *pl)
170{
171 NewSocket &socket = pl->socket;
172
173 memset (&socket.lastmap, 0, sizeof (socket.lastmap));
174
175 if (socket.newmapcmd == 1)
176 Write_String_To_Socket (&socket, "newmap", 6);
177
178 socket.update_look = 1;
179 socket.look_position = 0;
180}
181
168/** check for map change and send new map data */ 182/** check for map change and send new map data */
169static void 183static void
170check_map_change (player *pl) 184check_map_change (player *pl)
171{ 185{
172 NewSocket &socket = pl->socket; 186 NewSocket &socket = pl->socket;
174 char buf[MAX_BUF]; /* eauugggh */ 188 char buf[MAX_BUF]; /* eauugggh */
175 189
176 if (socket.current_map != ob->map) 190 if (socket.current_map != ob->map)
177 { 191 {
178 socket.current_map = ob->map; 192 socket.current_map = ob->map;
179 memset (&socket.lastmap, 0, sizeof(socket.lastmap));
180 193
181 if (socket.newmapcmd == 1) 194 clear_map (pl);
182 Write_String_To_Socket (&socket, "newmap", 6);
183
184 socket.update_look = 1;
185 socket.look_position =0;
186 195
187 if (socket.mapinfocmd) 196 if (socket.mapinfocmd)
188 { 197 {
189 if (ob->map && ob->map->path [0]) 198 if (ob->map && ob->map->path [0])
190 { 199 {
205 Write_String_To_Socket (&socket, buf, strlen (buf)); 214 Write_String_To_Socket (&socket, buf, strlen (buf));
206 } 215 }
207 } 216 }
208 else if (socket.current_x != ob->x || socket.current_y != ob->y) 217 else if (socket.current_x != ob->x || socket.current_y != ob->y)
209 { 218 {
219 int dx = ob->x - socket.current_x;
220 int dy = ob->y - socket.current_y;
221
222 if (socket.buggy_mapscroll && (abs (dx) > 8 || abs (dy) > 8))
223 clear_map (pl); // current (<= 1.9.1) clients have unchecked buffer overflows
224 else
225 {
210 socket_map_scroll (&socket, ob->x - socket.current_x, ob->y - socket.current_y); 226 socket_map_scroll (&socket, ob->x - socket.current_x, ob->y - socket.current_y);
211 socket.update_look = 1; 227 socket.update_look = 1;
212 socket.look_position = 0; 228 socket.look_position = 0;
229 }
213 } 230 }
214 231
215 socket.current_x = ob->x; 232 socket.current_x = ob->x;
216 socket.current_y = ob->y; 233 socket.current_y = ob->y;
217} 234}
823 } 840 }
824 cp = strchr(cp+1, ' '); 841 cp = strchr(cp+1, ' ');
825 if (cp) { 842 if (cp) {
826 LOG(llevDebug,"CS: connection from client of type <%s>, ip %s\n", cp, ns->host); 843 LOG(llevDebug,"CS: connection from client of type <%s>, ip %s\n", cp, ns->host);
827 844
845 snprintf (ns->client, sizeof (ns->client), "%s", cp + 1);
846
828 /* This is first implementation - i skip all beta DX clients with it 847 /* This is first implementation - i skip all beta DX clients with it
829 * Add later stuff here for other clients 848 * Add later stuff here for other clients
830 */ 849 */
831 850
832 /* these are old dxclients */ 851 /* these are old dxclients */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines