--- deliantra/server/include/client.h 2006/12/21 06:12:36 1.14 +++ deliantra/server/include/client.h 2006/12/23 00:14:29 1.17 @@ -79,7 +79,6 @@ /* 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]; @@ -87,6 +86,18 @@ int len; }; +// states the socket can be in +enum { + ST_DEAD, // socket is dead + ST_SETUP, // initial handshake / setup / login + ST_PLAYING, // logged in an playing + ST_CUSTOM, // waiting for custom reply + + ST_CONFIRM_QUIT, + ST_CHANGE_CLASS, + ST_GET_PARTY_PASSWORD, +}; + // a handler for a specific type of packet enum { PF_PLAYER = 0x01, // must have valid player / will by synchronised @@ -162,11 +173,11 @@ statsinfo stats; client_container cc_inv, cc_other; + Buffer 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 */ 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 */ bool ACC (RW, sent_scroll); @@ -208,6 +219,7 @@ client (int fd, const char *from_ip); ~client (); void destroy (); + bool destroyed () const { return state == ST_DEAD; } iw cmd_ev; void cmd_cb (iw &w); iow socket_ev; void socket_cb (iow &w, int got);