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.24 by root, Sun Mar 11 02:12:45 2007 UTC vs.
Revision 1.27 by root, Mon Mar 12 23:45:37 2007 UTC

207} 207}
208 208
209// how lame 209// how lame
210static void print_facename (packet &sl, const facedata &d) 210static void print_facename (packet &sl, const facedata &d)
211{ 211{
212 sl.printf ("%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x" 212 for (int i = 0; i < CHKSUM_SIZE; ++i)
213 "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", 213 sl.printf ("%02x", d.chksum [i]);
214 d.chksum [ 0], d.chksum [ 1], d.chksum [ 2], d.chksum [ 3], 214}
215 d.chksum [ 4], d.chksum [ 5], d.chksum [ 6], d.chksum [ 7], 215
216 d.chksum [ 8], d.chksum [ 9], d.chksum [10], d.chksum [11], 216// gcfclient uses the server-provided checksum for comparison,
217 d.chksum [12], d.chksum [13], d.chksum [14], d.chksum [15]); 217// but always wrotes a broken checksum to its cache file, so we
218// have to provide gcfclient with a useless checksum just to
219// have to cache the image despite its bugs.
220static uint32 gcfclient_checksum (const facedata *d)
221{
222 uint32 csum = 0;
223
224 for (std::string::const_iterator i = d->data.begin ();
225 i != d->data.end ();
226 ++i)
227 {
228 csum = rotate_right (csum);
229 csum += *(uint8 *)&*i;
230 }
231
232 return csum;
218} 233}
219 234
220/** 235/**
221 * Sends a face to a client if they are in pixmap mode 236 * Sends a face to a client if they are in pixmap mode
222 * nothing gets sent in bitmap mode. 237 * nothing gets sent in bitmap mode.
238 253
239 packet sl; 254 packet sl;
240 255
241 if (ns->facecache && !nocache) 256 if (ns->facecache && !nocache)
242 { 257 {
243 sl << (ns->image2 ? "face2 " : "face1 ") 258 if (ns->force_face0)
244 << uint16 (face_num); 259 sl << "face " << uint16 (face_num);
245
246 if (ns->image2) 260 else if (ns->image2)
247 sl << uint8 (0); 261 sl << "face2 " << uint16 (face_num) << uint8 (0) << uint32 (ns->force_bad_checksum ? gcfclient_checksum (d) : 0);
248 262 else
249 sl << uint32 (0); 263 sl << "face1 " << uint16 (face_num) << uint32 (ns->force_bad_checksum ? gcfclient_checksum (d) : 0);
250 264
251 // how lame 265 // how lame
252 print_facename (sl, *d); 266 print_facename (sl, *d);
253 267
254 ns->send_packet (sl); 268 ns->send_packet (sl);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines