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.66 by root, Thu Feb 15 04:04:23 2007 UTC vs.
Revision 1.68 by root, Sun Mar 4 19:36:12 2007 UTC

35 * Note: All functions that are used to process data from the client 35 * Note: All functions that are used to process data from the client
36 * have the prototype of (char *data, int datalen, int client_num). This 36 * have the prototype of (char *data, int datalen, int client_num). This
37 * way, we can use one dispatch table. 37 * way, we can use one dispatch table.
38 * 38 *
39 * esrv_map_new starts updating the map 39 * esrv_map_new starts updating the map
40 *
41 * esrv_map_setbelow allows filling in all of the faces for the map.
42 * if a face has not already been sent to the client, it is sent now.
43 * 40 *
44 */ 41 */
45 42
46#include <global.h> 43#include <global.h>
47#include <sproto.h> 44#include <sproto.h>
708 uint16 smoothface; 705 uint16 smoothface;
709 706
710 /* If we can't find a face, return and set it so we won't try to send this 707 /* If we can't find a face, return and set it so we won't try to send this
711 * again. 708 * again.
712 */ 709 */
713 if ((!FindSmooth (face, &smoothface)) && (!FindSmooth (smooth_face->number, &smoothface))) 710 if (!FindSmooth (face, &smoothface))
714 { 711 {
715 712
716 LOG (llevError, "could not findsmooth for %d. Neither default (%s)\n", face, &smooth_face->name); 713 LOG (llevError, "could not findsmooth for %d.\n", face);
717 ns->faces_sent[face] |= NS_FACESENT_SMOOTH; 714 ns->faces_sent[face] |= NS_FACESENT_SMOOTH;
718 return; 715 return;
719 } 716 }
720 717
721 if (!(ns->faces_sent[smoothface] & NS_FACESENT_FACE)) 718 if (!(ns->faces_sent[smoothface] & NS_FACESENT_FACE))
729 << uint16 (smoothface); 726 << uint16 (smoothface);
730 727
731 ns->send_packet (sl); 728 ns->send_packet (sl);
732} 729}
733 730
734 /** 731/**
735 * Tells client the picture it has to use 732 * Tells client the picture it has to use
736 * to smooth a picture number given as argument. 733 * to smooth a picture number given as argument.
737 */ 734 */
738void 735void
739AskSmooth (char *buf, int len, client *ns) 736AskSmooth (char *buf, int len, client *ns)
740{ 737{
741 SendSmooth (ns, atoi (buf)); 738 SendSmooth (ns, atoi (buf));
742} 739}
1166/****************************************************************************** 1163/******************************************************************************
1167 * 1164 *
1168 * Start of map related commands. 1165 * Start of map related commands.
1169 * 1166 *
1170 ******************************************************************************/ 1167 ******************************************************************************/
1171
1172/**
1173 * This adds face_num to a map cell at x,y. If the client doesn't have
1174 * the face yet, we will also send it.
1175 */
1176static void
1177esrv_map_setbelow (client * ns, int x, int y, short face_num, struct Map *newmap)
1178{
1179 if (newmap->cells[x][y].count >= MAP_LAYERS)
1180 {
1181 //TODO: one or the other, can't both have abort and return, verify and act
1182 LOG (llevError, "Too many faces in map cell %d %d\n", x, y);
1183 return;
1184 abort ();
1185 }
1186
1187 newmap->cells[x][y].faces[newmap->cells[x][y].count] = face_num;
1188 newmap->cells[x][y].count++;
1189
1190 if (!(ns->faces_sent[face_num] & NS_FACESENT_FACE))
1191 esrv_send_face (ns, face_num, 0);
1192}
1193 1168
1194/** Clears a map cell */ 1169/** Clears a map cell */
1195static void 1170static void
1196map_clearcell (struct MapCell *cell, int face0, int face1, int face2, int count) 1171map_clearcell (struct MapCell *cell, int face0, int face1, int face2, int count)
1197{ 1172{
1998 */ 1973 */
1999void 1974void
2000draw_client_map (object *pl) 1975draw_client_map (object *pl)
2001{ 1976{
2002 int i, j; 1977 int i, j;
2003 sint16 ax, ay, nx, ny; /* ax and ay goes from 0 to max-size of arrays */ 1978 sint16 ax, ay; /* ax and ay goes from 0 to max-size of arrays */
2004 facetile *face, *floor;
2005 facetile *floor2;
2006 int d, mflags; 1979 int mflags;
2007 struct Map newmap; 1980 struct Map newmap;
2008 maptile *m, *pm; 1981 maptile *m, *pm;
2009 1982
2010 if (pl->type != PLAYER) 1983 if (pl->type != PLAYER)
2011 { 1984 {
2192 2165
2193/* appends the spell *spell to the Socklist we will send the data to. */ 2166/* appends the spell *spell to the Socklist we will send the data to. */
2194static void 2167static void
2195append_spell (player *pl, packet &sl, object *spell) 2168append_spell (player *pl, packet &sl, object *spell)
2196{ 2169{
2197 int len, i, skill = 0; 2170 int i, skill = 0;
2198 2171
2199 if (!(spell->name)) 2172 if (!(spell->name))
2200 { 2173 {
2201 LOG (llevError, "item number %d is a spell with no name.\n", spell->count); 2174 LOG (llevError, "item number %d is a spell with no name.\n", spell->count);
2202 return; 2175 return;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines