… | |
… | |
191 | if (mask) |
191 | if (mask) |
192 | ns->facecache = 1; |
192 | ns->facecache = 1; |
193 | } |
193 | } |
194 | |
194 | |
195 | /** |
195 | /** |
196 | * Client has requested pixmap that it somehow missed getting. |
196 | * client requested an image. send it rate-limited |
197 | * This will be called often if the client is |
197 | * before flushing. |
198 | * caching images. |
|
|
199 | */ |
198 | */ |
200 | void |
199 | void |
201 | SendFaceCmd (char *buf, int len, client *ns) |
200 | AskFaceCmd (char *buf, int len, client *ns) |
202 | { |
201 | { |
|
|
202 | int idx = 0, pri = 0; |
|
|
203 | |
|
|
204 | sscanf (buf, "%d %d", &idx, &pri); |
|
|
205 | |
|
|
206 | const facedata *d = face_data (idx, ns->faceset); |
|
|
207 | |
|
|
208 | if (!d) |
|
|
209 | return; // doh |
|
|
210 | |
|
|
211 | client::ixsend ix; |
|
|
212 | |
|
|
213 | ix.pri = pri; |
|
|
214 | ix.idx = idx; |
|
|
215 | ix.ofs = d->data.size (); |
|
|
216 | |
|
|
217 | // the by far most common case will be to insert |
|
|
218 | // right at the end, so no looping. |
|
|
219 | auto (i, ns->ixface.end ()); |
|
|
220 | for (; i != ns->ixface.begin (); ) |
|
|
221 | if (pri >= (--i)->pri) |
|
|
222 | break; |
|
|
223 | |
|
|
224 | ns->ixface.insert (i, ix); |
|
|
225 | } |
|
|
226 | |
|
|
227 | /** |
|
|
228 | * Tells client the picture it has to use |
|
|
229 | * to smooth a picture number given as argument. |
|
|
230 | */ |
|
|
231 | void |
|
|
232 | AskSmooth (char *buf, int len, client *ns) |
|
|
233 | { |
203 | ns->send_image (atoi (buf)); |
234 | ns->send_face (atoi (buf)); |
|
|
235 | ns->flush_fx (); |
204 | } |
236 | } |
205 | |
237 | |
206 | // how lame |
238 | // how lame |
207 | static void print_facename (packet &sl, const facedata &d) |
239 | static void print_facename (packet &sl, const facedata &d) |
208 | { |
240 | { |
… | |
… | |
347 | if (!facenum) |
379 | if (!facenum) |
348 | return; |
380 | return; |
349 | |
381 | |
350 | const facedata *d = face_data (facenum, faceset); |
382 | const facedata *d = face_data (facenum, faceset); |
351 | |
383 | |
|
|
384 | faces_sent[facenum] = true; |
|
|
385 | |
352 | if (!d) |
386 | if (!d) |
353 | { |
387 | { |
354 | LOG (llevError, "client::send_image (%d) out of bounds??\n", facenum); |
388 | LOG (llevError, "client::send_image (%d) out of bounds??\n", facenum); |
355 | return; |
389 | return; |
356 | } |
390 | } |
357 | |
391 | |
358 | faces_sent[facenum] = true; |
392 | //TODO: check type here? |
359 | |
393 | |
360 | if (force_image_newmap) |
394 | if (force_image_newmap) |
361 | force_newmap = true; |
395 | force_newmap = true; |
362 | |
396 | |
363 | packet sl; |
397 | packet sl; |