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.43 by root, Sun Jul 1 04:08:14 2007 UTC vs.
Revision 1.49 by root, Thu Jul 12 18:48:54 2007 UTC

1/* 1/*
2 * This file is part of Crossfire TRT, the Multiplayer Online Role Playing Game. 2 * This file is part of Crossfire TRT, the Roguelike Realtime MORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team 4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team
5 * Copyright (©) 2001,2007 Mark Wedel 5 * Copyright (©) 2001,2007 Mark Wedel
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Crossfire TRT is free software; you can redistribute it and/or modify it 8 * Crossfire TRT is free software: you can redistribute it and/or modify
9 * under the terms of the GNU General Public License as published by the Free 9 * it under the terms of the GNU General Public License as published by
10 * Software Foundation; either version 2 of the License, or (at your option) 10 * the Free Software Foundation, either version 3 of the License, or
11 * any later version. 11 * (at your option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, but 13 * This program is distributed in the hope that it will be useful,
14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License along 18 * You should have received a copy of the GNU General Public License
19 * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 * 20 *
22 * The authors can be reached via e-mail to <crossfire@schmorp.de> 21 * The authors can be reached via e-mail to <crossfire@schmorp.de>
23 */ 22 */
24 23
25/** \file 24/** \file
212 211
213 ix.pri = pri; 212 ix.pri = pri;
214 ix.idx = idx; 213 ix.idx = idx;
215 ix.ofs = d->data.size (); 214 ix.ofs = d->data.size ();
216 215
216 auto (pos, ns->ixface.end ());
217
218 if (ns->fxix < 2)
219 {
220 // gcfclient does not support prioritising, older cfplus versions
221 // do not support interleaved transfers.
222 if (!ns->ixface.empty ())
223 pos = ns->ixface.end () - 1;
224 }
225 else
226 {
217 // the by far most common case will be to insert 227 // the by far most common case will be to insert
218 // right at the end, so no looping. 228 // near the end, so little looping.
219 auto (i, ns->ixface.end ()); 229 while (pos != ns->ixface.begin ())
220 for (; i != ns->ixface.begin (); ) 230 {
221 if (pri >= (--i)->pri) 231 --pos;
232
233 // sort within 2k bins, to slightly prefer smaller images
234 if (pri > pos->pri || (pri == pos->pri && (ix.ofs >> 11) <= (pos->ofs >> 11)))
235 {
236 ++pos;
222 break; 237 break;
238 }
239 }
240 }
223 241
224 ns->ixface.insert (i, ix); 242 ns->ixface.insert (pos, ix);
243
244#if 0
245 for (auto (i, ns->ixface.begin ()); i != ns->ixface.end (); ++i)
246 fprintf (stderr, "<%d,%d> ", i->pri, i->ofs);
247 fprintf (stderr, "\n");
248#endif
225} 249}
226 250
227/** 251/**
228 * Tells client the picture it has to use 252 * Tells client the picture it has to use
229 * to smooth a picture number given as argument. 253 * to smooth a picture number given as argument.
282 { 306 {
283 LOG (llevError, "client::send_face (%d) out of bounds??\n", facenum); 307 LOG (llevError, "client::send_face (%d) out of bounds??\n", facenum);
284 return; 308 return;
285 } 309 }
286 310
287 if (faces_sent[facenum]) 311 faceinfo *f = face_info (facenum);
312
313 // refuse tos end non-image faces
314 if (f->type)
288 return; 315 return;
289 316
290 faces_sent[facenum] = true; 317 if (!must_send_face (facenum))
318 return;
291 319
292 // if for some reason we let a client without face caching connect, 320 // if for some reason we let a client without face caching connect,
293 // we better support that decision here and implement it. 321 // we better support that decision here and implement it.
294 if (!facecache) 322 if (!facecache)
295 return send_image (facenum); 323 return send_image (facenum);
313 print_facename (sl, *d); 341 print_facename (sl, *d);
314 send_packet (sl); 342 send_packet (sl);
315 343
316 if (EMI_smooth) 344 if (EMI_smooth)
317 { 345 {
318 faceinfo *f = face_info (facenum);
319
320 if (f->smooth) 346 if (f->smooth)
321 { 347 {
322 send_face (f->smooth); 348 send_face (f->smooth);
323 349
324 packet sl ("smooth"); 350 packet sl ("smooth");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines