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.36 by root, Thu Dec 14 04:30:33 2006 UTC vs.
Revision 1.37 by root, Thu Dec 14 20:39:54 2006 UTC

699 699
700 sl << "smooth " 700 sl << "smooth "
701 << uint16 (face) 701 << uint16 (face)
702 << uint16 (smoothface); 702 << uint16 (smoothface);
703 703
704 Send_With_Handling (ns, &sl); 704 ns->send_packet (sl);
705} 705}
706 706
707 /** 707 /**
708 * Tells client the picture it has to use 708 * Tells client the picture it has to use
709 * to smooth a picture number given as argument. 709 * to smooth a picture number given as argument.
832 832
833 /* Send confirmation of command execution now */ 833 /* Send confirmation of command execution now */
834 834
835 packet sl; 835 packet sl;
836 sl << "comc " << uint16 (pktlen) << uint32 (time); 836 sl << "comc " << uint16 (pktlen) << uint32 (time);
837 Send_With_Handling (pl->socket, &sl); 837 pl->socket->send_packet (sl);
838} 838}
839 839
840 840
841/** This is a reply to a previous query. */ 841/** This is a reply to a previous query. */
842void 842void
1173 set_title (pl->ob, buf); 1173 set_title (pl->ob, buf);
1174 AddIfString (pl->socket->stats.title, buf, CS_STAT_TITLE); 1174 AddIfString (pl->socket->stats.title, buf, CS_STAT_TITLE);
1175 1175
1176 /* Only send it away if we have some actual data */ 1176 /* Only send it away if we have some actual data */
1177 if (sl.length () > 6) 1177 if (sl.length () > 6)
1178 Send_With_Handling (pl->socket, &sl); 1178 pl->socket->send_packet (sl);
1179} 1179}
1180 1180
1181/** 1181/**
1182 * Tells the client that here is a player it should start using. 1182 * Tells the client that here is a player it should start using.
1183 */ 1183 */
1192 sl << uint32 (pl->ob->count) 1192 sl << uint32 (pl->ob->count)
1193 << uint32 (weight) 1193 << uint32 (weight)
1194 << uint32 (pl->ob->face->number) 1194 << uint32 (pl->ob->face->number)
1195 << data8 (pl->ob->name); 1195 << data8 (pl->ob->name);
1196 1196
1197 Send_With_Handling (pl->socket, &sl); 1197 pl->socket->send_packet (sl);
1198 SET_FLAG (pl->ob, FLAG_CLIENT_SENT); 1198 SET_FLAG (pl->ob, FLAG_CLIENT_SENT);
1199} 1199}
1200 1200
1201/** 1201/**
1202 * Need to send an animation sequence to the client. 1202 * Need to send an animation sequence to the client.
1234 if (!(ns->faces_sent[animations[anim_num].faces[i]] & NS_FACESENT_FACE)) 1234 if (!(ns->faces_sent[animations[anim_num].faces[i]] & NS_FACESENT_FACE))
1235 esrv_send_face (ns, animations[anim_num].faces[i], 0); 1235 esrv_send_face (ns, animations[anim_num].faces[i], 0);
1236 sl << uint16 (animations[anim_num].faces[i]); /* flags - not used right now */ 1236 sl << uint16 (animations[anim_num].faces[i]); /* flags - not used right now */
1237 } 1237 }
1238 1238
1239 Send_With_Handling (ns, &sl); 1239 ns->send_packet (sl);
1240 1240
1241 ns->anims_sent[anim_num] = 1; 1241 ns->anims_sent[anim_num] = 1;
1242} 1242}
1243 1243
1244 1244
1868 * with no faces tells the client to blank out the 1868 * with no faces tells the client to blank out the
1869 * space. 1869 * space.
1870 */ 1870 */
1871 got_one = 0; 1871 got_one = 0;
1872 for (i = oldlen + 2; i < sl.length (); i++) 1872 for (i = oldlen + 2; i < sl.length (); i++)
1873 if (sl.buf[i]) 1873 if (sl[i])
1874 got_one = 1; 1874 got_one = 1;
1875 1875
1876 if (got_one && (mask & 0xf)) 1876 if (got_one && (mask & 0xf))
1877 sl.buf[oldlen + 1] = mask & 0xff; 1877 sl[oldlen + 1] = mask & 0xff;
1878 else 1878 else
1879 { /*either all faces blank, either no face at all */ 1879 { /*either all faces blank, either no face at all */
1880 if (mask & 0xf) /*at least 1 face, we know it's blank, only send coordinates */ 1880 if (mask & 0xf) /*at least 1 face, we know it's blank, only send coordinates */
1881 sl.reset (oldlen + 2); 1881 sl.reset (oldlen + 2);
1882 else 1882 else
1948 1948
1949 map_clearcell (&lastcell, 0, 0, 0, count); 1949 map_clearcell (&lastcell, 0, 0, 0, count);
1950 } 1950 }
1951 1951
1952 if ((mask & 0xf) || need_send) 1952 if ((mask & 0xf) || need_send)
1953 sl.buf[oldlen + 1] = mask & 0xff; 1953 sl[oldlen + 1] = mask & 0xff;
1954 else 1954 else
1955 sl.reset (oldlen); 1955 sl.reset (oldlen);
1956 } 1956 }
1957 else 1957 else
1958 { 1958 {
1988 mask |= 0x8; 1988 mask |= 0x8;
1989 1989
1990 if (socket.extmap) 1990 if (socket.extmap)
1991 { 1991 {
1992 *last_ext |= 0x80; 1992 *last_ext |= 0x80;
1993 last_ext = sl.buf + sl.length (); 1993 last_ext = &sl[sl.length ()];
1994 sl << uint8 (d); 1994 sl << uint8 (d);
1995 } 1995 }
1996 else 1996 else
1997 sl << uint8 (255 - 64 * d); 1997 sl << uint8 (255 - 64 * d);
1998 } 1998 }
2032 { 2032 {
2033 lastcell.stat_hp = stat_hp; 2033 lastcell.stat_hp = stat_hp;
2034 2034
2035 mask |= 0x8; 2035 mask |= 0x8;
2036 *last_ext |= 0x80; 2036 *last_ext |= 0x80;
2037 last_ext = sl.buf + sl.length (); 2037 last_ext = &sl[sl.length ()];
2038 2038
2039 sl << uint8 (5) << uint8 (stat_hp); 2039 sl << uint8 (5) << uint8 (stat_hp);
2040 2040
2041 if (stat_width > 1) 2041 if (stat_width > 1)
2042 { 2042 {
2043 *last_ext |= 0x80; 2043 *last_ext |= 0x80;
2044 last_ext = sl.buf + sl.length (); 2044 last_ext = &sl[sl.length ()];
2045 2045
2046 sl << uint8 (6) << uint8 (stat_width); 2046 sl << uint8 (6) << uint8 (stat_width);
2047 } 2047 }
2048 } 2048 }
2049 2049
2051 { 2051 {
2052 lastcell.player = player; 2052 lastcell.player = player;
2053 2053
2054 mask |= 0x8; 2054 mask |= 0x8;
2055 *last_ext |= 0x80; 2055 *last_ext |= 0x80;
2056 last_ext = sl.buf + sl.length (); 2056 last_ext = &sl[sl.length ()];
2057 2057
2058 sl << uint8 (0x47) << uint8 (8) << (uint64)player; 2058 sl << uint8 (0x47) << uint8 (8) << (uint64)player;
2059 } 2059 }
2060 2060
2061 if (lastcell.flags != flags) 2061 if (lastcell.flags != flags)
2062 { 2062 {
2063 lastcell.flags = flags; 2063 lastcell.flags = flags;
2064 2064
2065 mask |= 0x8; 2065 mask |= 0x8;
2066 *last_ext |= 0x80; 2066 *last_ext |= 0x80;
2067 last_ext = sl.buf + sl.length (); 2067 last_ext = &sl[sl.length ()];
2068 2068
2069 sl << uint8 (8) << uint8 (flags); 2069 sl << uint8 (8) << uint8 (flags);
2070 } 2070 }
2071 } 2071 }
2072 2072
2114 * space by checking the mask. If so, update the mask. 2114 * space by checking the mask. If so, update the mask.
2115 * if not, reset the len to that from before adding the mask 2115 * if not, reset the len to that from before adding the mask
2116 * value, so we don't send those bits. 2116 * value, so we don't send those bits.
2117 */ 2117 */
2118 if (mask & 0xf) 2118 if (mask & 0xf)
2119 sl.buf[oldlen + 1] = mask & 0xff; 2119 sl[oldlen + 1] = mask & 0xff;
2120 else 2120 else
2121 sl.reset (oldlen); 2121 sl.reset (oldlen);
2122 2122
2123 if (emask & 0xf) 2123 if (emask & 0xf)
2124 esl.buf[eoldlen + 1] = emask & 0xff; 2124 esl[eoldlen + 1] = emask & 0xff;
2125 else 2125 else
2126 esl.reset (eoldlen); 2126 esl.reset (eoldlen);
2127 } /* else this is a viewable space */ 2127 } /* else this is a viewable space */
2128 } /* for x loop */ 2128 } /* for x loop */
2129 } /* for y loop */ 2129 } /* for y loop */
2135 { 2135 {
2136 /* No map data will follow, so don't say the client 2136 /* No map data will follow, so don't say the client
2137 * it doesn't need draw! 2137 * it doesn't need draw!
2138 */ 2138 */
2139 ewhatflag &= (~EMI_NOREDRAW); 2139 ewhatflag &= (~EMI_NOREDRAW);
2140 esl.buf[ewhatstart + 1] = ewhatflag & 0xff; 2140 esl[ewhatstart + 1] = ewhatflag & 0xff;
2141 } 2141 }
2142 2142
2143 if (esl.length () > estartlen) 2143 if (esl.length () > estartlen)
2144 Send_With_Handling (&socket, &esl); 2144 socket.send_packet (esl);
2145 } 2145 }
2146 2146
2147 if (sl.length () > startlen || socket.sent_scroll) 2147 if (sl.length () > startlen || socket.sent_scroll)
2148 { 2148 {
2149 Send_With_Handling (&socket, &sl); 2149 socket.send_packet (sl);
2150 socket.sent_scroll = 0; 2150 socket.sent_scroll = 0;
2151 } 2151 }
2152} 2152}
2153 2153
2154/** 2154/**
2246 { 2246 {
2247 LOG (llevError, "Buffer overflow in send_skill_info!\n"); 2247 LOG (llevError, "Buffer overflow in send_skill_info!\n");
2248 fatal (0); 2248 fatal (0);
2249 } 2249 }
2250 2250
2251 Send_With_Handling (ns, &sl); 2251 ns->send_packet (sl);
2252} 2252}
2253 2253
2254/** 2254/**
2255 * This sends the spell path to name mapping. We ignore 2255 * This sends the spell path to name mapping. We ignore
2256 * the params - we always send the same info no matter what. 2256 * the params - we always send the same info no matter what.
2269 { 2269 {
2270 LOG (llevError, "Buffer overflow in send_spell_paths!\n"); 2270 LOG (llevError, "Buffer overflow in send_spell_paths!\n");
2271 fatal (0); 2271 fatal (0);
2272 } 2272 }
2273 2273
2274 Send_With_Handling (ns, &sl); 2274 ns->send_packet (sl);
2275} 2275}
2276 2276
2277/** 2277/**
2278 * This looks for any spells the player may have that have changed their stats. 2278 * This looks for any spells the player may have that have changed their stats.
2279 * it then sends an updspell packet for each spell that has changed in this way 2279 * it then sends an updspell packet for each spell that has changed in this way
2319 2319
2320 if (flags & UPD_SP_MANA ) sl << uint16 (spell->last_sp); 2320 if (flags & UPD_SP_MANA ) sl << uint16 (spell->last_sp);
2321 if (flags & UPD_SP_GRACE ) sl << uint16 (spell->last_grace); 2321 if (flags & UPD_SP_GRACE ) sl << uint16 (spell->last_grace);
2322 if (flags & UPD_SP_DAMAGE) sl << uint16 (spell->last_eat); 2322 if (flags & UPD_SP_DAMAGE) sl << uint16 (spell->last_eat);
2323 2323
2324 Send_With_Handling (pl->socket, &sl); 2324 pl->socket->send_packet (sl);
2325 } 2325 }
2326 } 2326 }
2327 } 2327 }
2328} 2328}
2329 2329
2342 packet sl; 2342 packet sl;
2343 2343
2344 sl << "delspell " 2344 sl << "delspell "
2345 << uint32 (spell->count); 2345 << uint32 (spell->count);
2346 2346
2347 Send_With_Handling (pl->socket, &sl); 2347 pl->socket->send_packet (sl);
2348} 2348}
2349 2349
2350/* appends the spell *spell to the Socklist we will send the data to. */ 2350/* appends the spell *spell to the Socklist we will send the data to. */
2351static void 2351static void
2352append_spell (player *pl, packet &sl, object *spell) 2352append_spell (player *pl, packet &sl, object *spell)
2429 if (spell->type != SPELL) 2429 if (spell->type != SPELL)
2430 continue; 2430 continue;
2431 2431
2432 if (sl.length () >= (MAXSOCKBUF - (26 + strlen (spell->name) + (spell->msg ? strlen (spell->msg) : 0)))) 2432 if (sl.length () >= (MAXSOCKBUF - (26 + strlen (spell->name) + (spell->msg ? strlen (spell->msg) : 0))))
2433 { 2433 {
2434 Send_With_Handling (pl->socket, &sl); 2434 pl->socket->send_packet (sl);
2435 2435
2436 sl.reset (); 2436 sl.reset ();
2437 sl << "addspell "; 2437 sl << "addspell ";
2438 } 2438 }
2439 2439
2453 LOG (llevError, "Buffer overflow in esrv_add_spells!\n"); 2453 LOG (llevError, "Buffer overflow in esrv_add_spells!\n");
2454 fatal (0); 2454 fatal (0);
2455 } 2455 }
2456 2456
2457 /* finally, we can send the packet */ 2457 /* finally, we can send the packet */
2458 Send_With_Handling (pl->socket, &sl); 2458 pl->socket->send_packet (sl);
2459} 2459}
2460 2460

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines