… | |
… | |
100 | }; |
100 | }; |
101 | |
101 | |
102 | /* how many times we are allowed to give the wrong password before being kicked. */ |
102 | /* how many times we are allowed to give the wrong password before being kicked. */ |
103 | # define MAX_PASSWORD_FAILURES 5 |
103 | # define MAX_PASSWORD_FAILURES 5 |
104 | |
104 | |
105 | ACC_CLASS (player_TODO) // should become player when newsocket is a baseclass of player |
105 | ACC_CLASS (client_socket) // should become player when newsocket is a baseclass of player |
106 | struct NewSocket |
106 | struct NewSocket : zero_initialised |
107 | { |
107 | { |
108 | enum Sock_Status status; |
108 | enum Sock_Status status; |
109 | int ACC (RW, fd); |
109 | int ACC (RW, fd); |
|
|
110 | unsigned int inbuf_len; // number of bytes valid in inbuf |
110 | struct Map lastmap; |
111 | struct Map lastmap; |
111 | size_t faces_sent_len; /* This is the number of elements allocated in faces_sent[] */ |
112 | size_t faces_sent_len; /* This is the number of elements allocated in faces_sent[] */ |
112 | uint8 *faces_sent; /* This is a bitmap on sent face status */ |
113 | uint8 *faces_sent; /* This is a bitmap on sent face status */ |
113 | uint8 anims_sent[MAXANIMNUM]; |
114 | uint8 anims_sent[MAXANIMNUM]; |
114 | struct statsinfo stats; |
115 | struct statsinfo stats; |
115 | /* If we get an incomplete packet, this is used to hold the data. */ |
116 | |
116 | SockList inbuf; |
|
|
117 | char *ACC (RW, host); /* Which host it is connected from (ip address) */ |
117 | char *ACC (RW, host); /* Which host it is connected from (ip address) */ |
118 | uint8 ACC (RW, password_fails); /* how many times the player has failed to give the right password */ |
118 | uint8 ACC (RW, password_fails); /* how many times the player has failed to give the right password */ |
119 | Buffer outputbuffer; /* For undeliverable data */ |
119 | Buffer outputbuffer; /* For undeliverable data */ |
120 | uint32 ACC (RO, facecache):1; /* If true, client is caching images */ |
120 | uint32 ACC (RO, facecache):1; /* If true, client is caching images */ |
121 | uint32 ACC (RO, sent_scroll):1; |
121 | uint32 ACC (RO, sent_scroll):1; |
… | |
… | |
147 | uint8 ACC (RW, faceset); /* Set the client is using, default 0 */ |
147 | uint8 ACC (RW, faceset); /* Set the client is using, default 0 */ |
148 | |
148 | |
149 | maptile *ACC (RW, current_map); // CF+ last/current player map |
149 | maptile *ACC (RW, current_map); // CF+ last/current player map |
150 | int ACC (RW, current_x), ACC (RW, current_y); // CF+ last/current map position |
150 | int ACC (RW, current_x), ACC (RW, current_y); // CF+ last/current map position |
151 | char ACC (RW, client)[64]; // CF+ client name/version |
151 | char ACC (RW, client)[64]; // CF+ client name/version |
|
|
152 | |
|
|
153 | /* If we get an incomplete packet, this is used to hold the data. */ |
|
|
154 | uint8 inbuf[MAXSOCKBUF]; |
|
|
155 | |
|
|
156 | int read_packet (); // returns length of packet or 0 |
|
|
157 | void skip_packet (int len); // we have processed the packet, skip it |
152 | }; |
158 | }; |
153 | |
159 | |
154 | #define CLIENT_SUPPORT_READABLES(__sockPtr,__type)\ |
160 | #define CLIENT_SUPPORT_READABLES(__sockPtr,__type)\ |
155 | ( ((__type)>0) &&\ |
161 | ( ((__type)>0) &&\ |
156 | ((__sockPtr)->has_readable_type) && \ |
162 | ((__sockPtr)->has_readable_type) && \ |