--- deliantra/server/include/client.h 2007/03/14 00:04:58 1.35 +++ deliantra/server/include/client.h 2007/03/15 03:30:37 1.39 @@ -35,11 +35,11 @@ struct MapCell { UUID player; // this is, unfortunately, very wasteful of memory space, but pretty bandwidth-efficient - int count; /* This is really darkness in the map1 command */ + int count; /* This is really darkness in the map1 command */ faceidx faces[MAP_LAYERS]; - uint16 smooth[MAP_LAYERS]; - unsigned char stat_hp; // health of something in this space, or 0 + unsigned char stat_hp; // health of something in this space, or 0 unsigned char flags; + uint8_t smooth[MAP_LAYERS]; }; #define MAX_CLIENT_X MAP_CLIENT_X @@ -223,7 +223,12 @@ player_ptr ACC (RO, pl); - int ACC (RW, rtt), ACC (RW, rttvar); /* round-trip time and -variance, if known */ + int ACC (RW, rtt), ACC (RW, rttvar); /* round-trip time and -variance, if known */ + + int ACC (RW, max_rate); // max. # of bytes to send per tick + faceidx ACC (RW, scrub_idx); // which face to send next + int ACC (RW, bg_scrub); // how many ticks till the next background face send + std::vector askface; // which faces have been requested by the client void do_destroy (); void gather_callbacks (AV *&callbacks, event_type event) const; @@ -237,7 +242,8 @@ // large structures at the end please struct Map lastmap; std::bitset anims_sent; - uint8 ACC (RW, faces_sent[MAX_FACES]); // This is a bitmap on sent face status + std::bitset faces_sent; + // if we get an incomplete packet, this is used to hold the data. // we add 2 byte for the header, one for the trailing 0 byte uint8 inbuf[MAXSOCKBUF + 2 + 1]; @@ -258,6 +264,7 @@ MTH void flush (); MTH void write_outputbuffer (); + MTH int outputbuffer_len () const { return outputbuffer.len; } void send (void *buf_, int len); void send_packet (const char *buf); @@ -266,9 +273,9 @@ void send_packet (packet &sl); void send_drawinfo (const char *msg, int flags = NDI_BLACK); - MTH void send_face (faceidx facenum, bool nocache = false); + MTH void send_face (faceidx facenum); + MTH void send_image (faceidx facenum); MTH void send_faces (object *ob); - MTH void send_smooth (faceidx facenum); MTH void send_animation (short anim_num); // called when something under the player changes @@ -276,6 +283,8 @@ // called when the player has been moved MTH void floorbox_reset () { look_position = 0; floorbox_update (); } + MTH void tick (); // called every server tick to do housekeeping etc. + MTH static client *create (int fd, const char *peername); protected: @@ -288,12 +297,6 @@ ((__sockPtr)->has_readable_type) && \ ((__sockPtr)->supported_readables & (1<<(__type))) ) -/* Bitmask for the faces_sent[] array - what - * portion of the face have we sent? - */ -#define NS_FACESENT_FACE 0x1 -#define NS_FACESENT_SMOOTH 0x2 - /* Constants in the form EMI_ is for extended map infos. * Even if the client select the additionnal infos it wants * on the map, there may exist cases where this whole info