--- deliantra/server/include/client.h 2007/04/10 09:35:23 1.46 +++ deliantra/server/include/client.h 2007/04/25 18:47:50 1.49 @@ -34,7 +34,7 @@ struct MapCell { - UUID player; // this is, unfortunately, very wasteful of memory space, but pretty bandwidth-efficient + tag_t player; // this is, unfortunately, very wasteful of memory space, but pretty bandwidth-efficient int count; /* This is really darkness in the map1 command */ faceidx faces[MAP_LAYERS]; unsigned char stat_hp; // health of something in this space, or 0 @@ -70,16 +70,6 @@ */ enum { Map0Cmd = 0, Map1Cmd = 1, Map1aCmd = 2 }; -/* The following is the setup for a ring buffer for storing output - * data that the OS can't handle right away. - */ -struct Buffer -{ - char data[SOCKETBUFSIZE]; - int start; - int len; -}; - // states the socket can be in enum { ST_DEAD, // socket is dead @@ -87,7 +77,6 @@ ST_PLAYING, // logged in an playing ST_CUSTOM, // waiting for custom reply - ST_CHANGE_CLASS, ST_GET_PARTY_PASSWORD, }; @@ -167,7 +156,15 @@ statsinfo stats; int ACC (RO, active); - Buffer outputbuffer; + /* The following is the setup for a ring buffer for storing output + * data that the OS can't handle right away. + */ + struct + { + char data[SOCKETBUFSIZE]; + int start; + int len; + } outputbuffer; char *ACC (RW, host); /* Which host it is connected from (ip address) */ uint8 ACC (RW, state); /* Input state of the player (name, password, etc */ @@ -211,7 +208,8 @@ /* Below are flags for extedend infos to pass to client * with S->C mapextended command */ bool ACC (RW, EMI_smooth); /* Send smooth in extendmapinfos */ - bool ACC (RW, smoothing); // cfplus-style smoothing + bool ACC (RW, smoothing); // trt-style smoothing + bool ACC (RW, can_msg); // trt-style text messages bool ACC (RW, force_newmap); // force a newmap before next map update uint32 ACC (RW, supported_readables); /* each bit is a readable supported by client */ @@ -225,7 +223,7 @@ maptile *ACC (RW, current_map); // CF+ last/current player map region *ACC (RW, current_region); // CF+ last/current player region int ACC (RW, current_x), ACC (RW, current_y); // CF+ last/current map position - char ACC (RW, version)[64]; // CF+ client name/version + shstr ACC (RW, version); // CF+ client name/version uint8 ACC (RW, faceset); // CF+ selected faceset player_ptr ACC (RO, pl); @@ -262,6 +260,17 @@ // we add 2 byte for the header, one for the trailing 0 byte uint8 inbuf[MAXSOCKBUF + 2 + 1]; + enum { MSG_BUF_SIZE = 80, MSG_BUF_COUNT = 10 }; + struct msg_buf + { + tick_t expire; + int len; + int count; + char msg[MSG_BUF_SIZE]; + } msgbuf[MSG_BUF_COUNT]; + + MTH bool msg_suppressed (const char *msg); + bool may_execute (const packet_type *pkt) const; void execute (const packet_type *pkt, char *data, int datalen); @@ -291,6 +300,7 @@ MTH void send_image (faceidx facenum); MTH void send_faces (object *ob); MTH void send_animation (short anim_num); + MTH void send_msg (int color, const char *type, const char *msg); // called when something under the player changes MTH void floorbox_update () { update_look = 1; }