--- deliantra/server/socket/loop.C 2008/04/22 07:28:05 1.74 +++ deliantra/server/socket/loop.C 2008/12/27 01:25:00 1.78 @@ -1,7 +1,7 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. * - * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team * Copyright (©) 2002-2003,2007 Mark Wedel & The Crossfire Development Team * Copyright (©) 1992,2007 Frank Tore Johansen * @@ -117,6 +117,8 @@ if (!pl || destroyed ()) return; + pl->dirty = true; + /* Update the players stats once per tick. More efficient than * sending them whenever they change, and probably just as useful */ @@ -125,7 +127,10 @@ sint32 weight = pl->ob->client_weight (); if (last_weight != weight) - esrv_update_item (UPD_WEIGHT, pl->ob, pl->ob); + { + pl->ob->update_stats (); + esrv_update_item (UPD_WEIGHT, pl->ob, pl->ob); + } draw_client_map (pl); @@ -179,13 +184,13 @@ max_send = min (max_send, (tcpi.tcpi_snd_cwnd - tcpi.tcpi_unacked + tcpi.tcpi_sacked) * mss); #endif - // if we can split images, round to next-lowest mss - if (fxix) max_send -= max_send % mss; + // round to next-lowest mss + max_send -= max_send % mss; if (ixface.empty ()) { // regularly send a new face when queue is empty - if (bg_scrub && !--bg_scrub && enable_bg_scrub) + if (bg_scrub && !--bg_scrub) while (scrub_idx < faces.size () - 1) { ++scrub_idx; @@ -217,36 +222,28 @@ if (facedata *d = face_data (ix.idx, faceset)) { - if (fxix) - { - // estimate the packet header overhead "ix " + idx + (new)ofs - int pktlen = 3 + ber32::encoded_size (ix.idx) + ber32::encoded_size (ix.ofs); - int chunk = min (avail - packet::hdrlen, MAXSOCKBUF) - pktlen; - - // only transfer something if the amount of data transferred - // has a healthy relation to the header overhead - if (chunk < 64) - break; + // estimate the packet header overhead "ix " + idx + (new)ofs + int pktlen = 3 + ber32::encoded_size (ix.idx) + ber32::encoded_size (ix.ofs); + int chunk = min (avail - packet::hdrlen, MAXSOCKBUF) - pktlen; + + // only transfer something if the amount of data transferred + // has a healthy relation to the header overhead + if (chunk < 64) + break; - chunk = min (chunk, (int)ix.ofs); + chunk = min (chunk, (int)ix.ofs); - ix.ofs -= chunk; + ix.ofs -= chunk; - //fprintf (stderr, "i%dx %6d: %5d+%4d (%4d)\n", fxix, ix.idx,ix.ofs,chunk, ixface.size());//D + //fprintf (stderr, "i%dx %6d: %5d+%4d (%4d)\n", fxix, ix.idx,ix.ofs,chunk, ixface.size());//D - packet sl ("ix"); + packet sl ("ix"); - sl << ber32 (ix.idx) - << ber32 (ix.ofs) - << data (d->data.data () + ix.ofs, chunk); + sl << ber32 (ix.idx) + << ber32 (ix.ofs) + << data (d->data.data () + ix.ofs, chunk); - send_packet (sl); - } - else - { - send_image (ix.idx); - ix.ofs = 0; - } + send_packet (sl); } else ix.ofs = 0;