ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/image.C
(Generate patch)

Comparing deliantra/server/socket/image.C (file contents):
Revision 1.8 by root, Thu Dec 14 01:21:58 2006 UTC vs.
Revision 1.12 by root, Thu Dec 14 22:45:41 2006 UTC

229 if (len >= MAX_FACE_SETS) 229 if (len >= MAX_FACE_SETS)
230 { 230 {
231 LOG (llevError, "To high a setnum in image_info file: %d > %d\n", len, MAX_FACE_SETS); 231 LOG (llevError, "To high a setnum in image_info file: %d > %d\n", len, MAX_FACE_SETS);
232 abort (); 232 abort ();
233 } 233 }
234 facesets[len].prefix = strdup_local (cps[1]); 234 facesets[len].prefix = strdup (cps[1]);
235 facesets[len].fullname = strdup_local (cps[2]); 235 facesets[len].fullname = strdup (cps[2]);
236 facesets[len].fallback = atoi (cps[3]); 236 facesets[len].fallback = atoi (cps[3]);
237 facesets[len].size = strdup_local (cps[4]); 237 facesets[len].size = strdup (cps[4]);
238 facesets[len].extension = strdup_local (cps[5]); 238 facesets[len].extension = strdup (cps[5]);
239 facesets[len].comment = strdup_local (cps[6]); 239 facesets[len].comment = strdup (cps[6]);
240 } 240 }
241 } 241 }
242 close_and_delete (infile, compressed); 242 close_and_delete (infile, compressed);
243 for (i = 0; i < MAX_FACE_SETS; i++) 243 for (i = 0; i < MAX_FACE_SETS; i++)
244 { 244 {
312 * the caching attribute. 312 * the caching attribute.
313 * 313 *
314 */ 314 */
315 315
316void 316void
317SetFaceMode (char *buf, int len, NewSocket *ns) 317SetFaceMode (char *buf, int len, client_socket *ns)
318{ 318{
319 int mask = (atoi (buf) & CF_FACE_CACHE), mode = (atoi (buf) & ~CF_FACE_CACHE); 319 int mask = (atoi (buf) & CF_FACE_CACHE), mode = (atoi (buf) & ~CF_FACE_CACHE);
320 320
321 if (mode == CF_FACE_NONE) 321 if (mode == CF_FACE_NONE)
322 ns->facecache = 1; 322 ns->facecache = 1;
336 * This will be called often if the client is 336 * This will be called often if the client is
337 * caching images. 337 * caching images.
338 */ 338 */
339 339
340void 340void
341SendFaceCmd (char *buff, int len, NewSocket * ns) 341SendFaceCmd (char *buff, int len, client_socket * ns)
342{ 342{
343 long tmpnum = atoi (buff); 343 long tmpnum = atoi (buff);
344 short facenum = tmpnum & 0xffff; 344 short facenum = tmpnum & 0xffff;
345 345
346 if (facenum != 0) 346 if (facenum != 0)
355 * face (and askface is the only place that should be setting it). Otherwise, 355 * face (and askface is the only place that should be setting it). Otherwise,
356 * we look at the facecache, and if set, send the image name. 356 * we look at the facecache, and if set, send the image name.
357 */ 357 */
358 358
359void 359void
360esrv_send_face (NewSocket *ns, short face_num, int nocache) 360esrv_send_face (client_socket *ns, short face_num, int nocache)
361{ 361{
362 char fallback; 362 char fallback;
363 363
364 if (face_num <= 0 || face_num >= nrofpixmaps) 364 if (face_num <= 0 || face_num >= nrofpixmaps)
365 { 365 {
385 sl << uint8 (fallback); 385 sl << uint8 (fallback);
386 386
387 sl << uint32 (facesets[fallback].faces[face_num].checksum) 387 sl << uint32 (facesets[fallback].faces[face_num].checksum)
388 << new_faces[face_num].name; 388 << new_faces[face_num].name;
389 389
390 Send_With_Handling (ns, &sl); 390 ns->send_packet (sl);
391 } 391 }
392 else 392 else
393 { 393 {
394 sl << (ns->image2 ? "image2 " : "image ") 394 sl << (ns->image2 ? "image2 " : "image ")
395 << uint32 (face_num); 395 << uint32 (face_num);
398 sl << uint8 (fallback); 398 sl << uint8 (fallback);
399 399
400 sl << uint32 (facesets[fallback].faces[face_num].datalen) 400 sl << uint32 (facesets[fallback].faces[face_num].datalen)
401 << data (facesets[fallback].faces[face_num].data, facesets[fallback].faces[face_num].datalen); 401 << data (facesets[fallback].faces[face_num].data, facesets[fallback].faces[face_num].datalen);
402 402
403 Send_With_Handling (ns, &sl); 403 ns->send_packet (sl);
404 } 404 }
405 405
406 ns->faces_sent[face_num] |= NS_FACESENT_FACE; 406 ns->faces_sent[face_num] |= NS_FACESENT_FACE;
407} 407}
408 408
411 * and the image_info file information. See the doc/Developers/protocol 411 * and the image_info file information. See the doc/Developers/protocol
412 * if you want further detail. 412 * if you want further detail.
413 */ 413 */
414 414
415void 415void
416send_image_info (NewSocket * ns, char *params) 416send_image_info (client_socket * ns, char *params)
417{ 417{
418 packet sl; 418 packet sl;
419 419
420 sl.printf ("replyinfo image_info\n%d\n%d\n", nrofpixmaps - 1, bmaps_checksum); 420 sl.printf ("replyinfo image_info\n%d\n%d\n", nrofpixmaps - 1, bmaps_checksum);
421 421
423 if (facesets[i].prefix) 423 if (facesets[i].prefix)
424 sl.printf ("%d:%s:%s:%d:%s:%s:%s", 424 sl.printf ("%d:%s:%s:%d:%s:%s:%s",
425 i, facesets[i].prefix, facesets[i].fullname, facesets[i].fallback, 425 i, facesets[i].prefix, facesets[i].fullname, facesets[i].fallback,
426 facesets[i].size, facesets[i].extension, facesets[i].comment); 426 facesets[i].size, facesets[i].extension, facesets[i].comment);
427 427
428 Send_With_Handling (ns, &sl); 428 ns->send_packet (sl);
429} 429}
430 430
431/** 431/**
432 * Sends requested face information. 432 * Sends requested face information.
433 * \param ns socket to send to 433 * \param ns socket to send to
436 * For each image in [start..stop] sends 436 * For each image in [start..stop] sends
437 * - checksum 437 * - checksum
438 * - name 438 * - name
439 */ 439 */
440void 440void
441send_image_sums (NewSocket * ns, char *params) 441send_image_sums (client_socket * ns, char *params)
442{ 442{
443 int start, stop; 443 int start, stop;
444 char *cp, buf[MAX_BUF]; 444 char *cp, buf[MAX_BUF];
445 445
446 packet sl; 446 packet sl;
476 /* It would make more sense to catch this pre-emptively in the code above. 476 /* It would make more sense to catch this pre-emptively in the code above.
477 * however, if this really happens, we probably just want to cut down the 477 * however, if this really happens, we probably just want to cut down the
478 * size to less than 1000, since that is what we claim the protocol would 478 * size to less than 1000, since that is what we claim the protocol would
479 * support. 479 * support.
480 */ 480 */
481 if (sl.len >= MAXSOCKBUF) 481 if (sl.length () >= MAXSOCKBUF)
482 { 482 {
483 LOG (llevError, "send_image_send: buffer overrun, %d > %d\n", sl.len, MAXSOCKBUF); 483 LOG (llevError, "send_image_send: buffer overrun, %d > %d\n", sl.length (), MAXSOCKBUF);
484 abort (); 484 abort ();
485 } 485 }
486 486
487 Send_With_Handling (ns, &sl); 487 ns->send_packet (sl);
488} 488}
489 489

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines