… | |
… | |
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> |
… | |
… | |
1167 | * |
1164 | * |
1168 | * Start of map related commands. |
1165 | * Start of map related commands. |
1169 | * |
1166 | * |
1170 | ******************************************************************************/ |
1167 | ******************************************************************************/ |
1171 | |
1168 | |
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 | */ |
|
|
1176 | static void |
|
|
1177 | esrv_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 | |
|
|
1194 | /** Clears a map cell */ |
1169 | /** Clears a map cell */ |
1195 | static void |
1170 | static void |
1196 | map_clearcell (struct MapCell *cell, int face0, int face1, int face2, int count) |
1171 | map_clearcell (struct MapCell *cell, int face0, int face1, int face2, int count) |
1197 | { |
1172 | { |
1198 | cell->faces[0] = face0; |
1173 | cell->faces[0] = face0; |
… | |
… | |
1998 | */ |
1973 | */ |
1999 | void |
1974 | void |
2000 | draw_client_map (object *pl) |
1975 | draw_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. */ |
2194 | static void |
2167 | static void |
2195 | append_spell (player *pl, packet &sl, object *spell) |
2168 | append_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; |