--- deliantra/server/include/client.h 2006/12/20 09:14:22 1.13 +++ deliantra/server/include/client.h 2006/12/21 06:12:36 1.14 @@ -70,8 +70,6 @@ * are using. */ -enum Sock_Status { Ns_Add, Ns_Dead }; - /* Only one map mode can actually be used, so lets make it a switch * instead of having a bunch of different fields that needed to * get toggled. @@ -156,9 +154,8 @@ #define MAX_PASSWORD_FAILURES 5 ACC_CLASS (client) // should become player when newsocket is a baseclass of player -struct client : zero_initialised, attachable_base +struct client : zero_initialised, attachable { - enum Sock_Status status; int ACC (RW, fd); unsigned int inbuf_len; // number of bytes valid in inbuf uint8 *faces_sent; // This is a bitmap on sent face status @@ -168,6 +165,7 @@ char *ACC (RW, host); /* Which host it is connected from (ip address) */ uint8 ACC (RW, password_fails); /* how many times the player has failed to give the right password */ + bool destroyed; // set when this socket is to be destroyed Buffer outputbuffer; bool ACC (RW, facecache); /* If true, client is caching images */ @@ -216,12 +214,19 @@ std::deque< command, slice_allocator > cmd_queue; - // resets movement state + // large structures at the end please + struct Map lastmap; + std::bitset anims_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]; + bool may_execute (const packet_type *pkt) const; void execute (const packet_type *pkt, char *data, int datalen); void queue_command (packet_type *handler, char *data, int datalen); bool handle_command (); + // resets movement state void reset_state (); bool handle_packet (); @@ -242,12 +247,7 @@ // called when the player has been moved void floorbox_reset () { look_position = 0; floorbox_update (); } - // large structures at the end please - struct Map lastmap; - std::bitset anims_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]; + static client *create (int fd, const char *peername); }; #define CLIENT_SUPPORT_READABLES(__sockPtr,__type)\