… | |
… | |
67 | { |
67 | { |
68 | int idx = 0, pri = 0; |
68 | int idx = 0, pri = 0; |
69 | |
69 | |
70 | sscanf (buf, "%d %d", &idx, &pri); |
70 | sscanf (buf, "%d %d", &idx, &pri); |
71 | |
71 | |
|
|
72 | //TODO: somehow fetch default priority from send_fx here |
|
|
73 | |
72 | const facedata *d = face_data (idx, ns->faceset); |
74 | const facedata *d = face_data (idx, ns->faceset); |
73 | |
75 | |
74 | if (!d) |
76 | if (!d) |
75 | return; // doh |
77 | return; // doh |
76 | |
78 | |
… | |
… | |
169 | |
171 | |
170 | faceinfo *f = face_info (facenum); |
172 | faceinfo *f = face_info (facenum); |
171 | |
173 | |
172 | if (!f) |
174 | if (!f) |
173 | { |
175 | { |
174 | LOG (llevError, "client::send_face (%d) out of bounds??\n", facenum); |
176 | LOG (llevError | logBacktrace, "client::send_face (%d) out of bounds??\n", facenum); |
175 | return; |
177 | return; |
176 | } |
178 | } |
177 | |
179 | |
178 | // refuse to send non-image faces |
180 | // refuse to send non-image faces |
179 | if (!fx_want [f->type]) |
181 | if (!fx_want [f->type]) |
… | |
… | |
292 | { |
294 | { |
293 | LOG (llevError, "client::send_image (%d) out of bounds??\n", facenum); |
295 | LOG (llevError, "client::send_image (%d) out of bounds??\n", facenum); |
294 | return; |
296 | return; |
295 | } |
297 | } |
296 | |
298 | |
297 | //TODO: check type here? |
|
|
298 | |
|
|
299 | if (force_image_newmap) |
299 | if (force_image_newmap) |
300 | force_newmap = true; |
300 | force_newmap = true; |
301 | |
301 | |
302 | packet sl; |
302 | packet sl; |
303 | |
303 | |
… | |
… | |
420 | } |
420 | } |
421 | |
421 | |
422 | sl.printf ("replyinfo image_sums %d %d ", start, stop); |
422 | sl.printf ("replyinfo image_sums %d %d ", start, stop); |
423 | |
423 | |
424 | for (int i = start; i <= stop && i < faces.size (); i++) |
424 | for (int i = start; i <= stop && i < faces.size (); i++) |
425 | { |
425 | if (const faceinfo *f = face_info (i)) |
|
|
426 | if (ns->fx_want [f->type]) |
|
|
427 | { |
426 | ns->faces_sent[i] = true; |
428 | ns->faces_sent[i] = true; |
427 | |
429 | |
428 | const facedata *d = face_data (i, ns->faceset); |
430 | const facedata *d = f->data (ns->faceset); |
429 | |
431 | |
430 | if (sl.room () < 2 + 4 + 1 + d->data.size () + 1) |
432 | if (sl.room () < 2 + 4 + 1 + d->data.size () + 1) |
431 | break; |
433 | break; |
432 | |
434 | |
433 | sl << uint16 (i) |
435 | sl << uint16 (i) |
434 | << uint32 (0) // checksum |
436 | << uint32 (0) // checksum |
435 | << uint8 (ns->faceset); |
437 | << uint8 (ns->faceset); |
436 | |
438 | |
437 | print_facename (sl, *d); sl << uint8 (0); |
439 | print_facename (sl, *d); sl << uint8 (0); |
438 | } |
440 | } |
439 | |
441 | |
440 | /* It would make more sense to catch this pre-emptively in the code above. |
442 | /* It would make more sense to catch this pre-emptively in the code above. |
441 | * however, if this really happens, we probably just want to cut down the |
443 | * however, if this really happens, we probably just want to cut down the |
442 | * size to less than 1000, since that is what we claim the protocol would |
444 | * size to less than 1000, since that is what we claim the protocol would |
443 | * support. |
445 | * support. |
444 | */ |
446 | */ |
445 | //TODO: taken care of above, should simply abort or make sure the above code is correct |
447 | //TODO: taken care of above, should simply abort or make sure the above code is correct |
446 | if (sl.length () >= MAXSOCKBUF) |
448 | if (sl.length () > MAXSOCKBUF) |
447 | { |
449 | { |
448 | LOG (llevError, "send_image_send: buffer overrun, %d > %d\n", sl.length (), MAXSOCKBUF); |
450 | LOG (llevError, "send_image_send: buffer overrun, %d > %d\n", sl.length (), MAXSOCKBUF); |
449 | abort (); |
451 | abort (); |
450 | } |
452 | } |
451 | |
453 | |