… | |
… | |
101 | }; |
101 | }; |
102 | |
102 | |
103 | /* how many times we are allowed to give the wrong password before being kicked. */ |
103 | /* how many times we are allowed to give the wrong password before being kicked. */ |
104 | # define MAX_PASSWORD_FAILURES 5 |
104 | # define MAX_PASSWORD_FAILURES 5 |
105 | |
105 | |
|
|
106 | ACC_CLASS (player_TODO) // should become player when newsocket is a baseclass of player |
106 | struct NewSocket |
107 | struct NewSocket |
107 | { |
108 | { |
108 | enum Sock_Status status; |
109 | enum Sock_Status status; |
109 | int fd; |
110 | int ACC (RW, fd); |
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 | /* If we get an incomplete packet, this is used to hold the data. */ |
116 | SockList inbuf; |
117 | SockList inbuf; |
117 | char *host; /* Which host it is connected from (ip address) */ |
118 | char *ACC (RW, host); /* Which host it is connected from (ip address) */ |
118 | uint8 password_fails; /* how many times the player has failed to give the right password */ |
119 | uint8 ACC (RW, password_fails); /* how many times the player has failed to give the right password */ |
119 | Buffer outputbuffer; /* For undeliverable data */ |
120 | Buffer outputbuffer; /* For undeliverable data */ |
120 | uint32 facecache:1; /* If true, client is caching images */ |
121 | uint32 ACC (RO, facecache):1; /* If true, client is caching images */ |
121 | uint32 sent_scroll:1; |
122 | uint32 ACC (RO, sent_scroll):1; |
122 | uint32 sound:1; /* does the client want sound */ |
123 | uint32 ACC (RO, sound):1; /* does the client want sound */ |
123 | uint32 exp64:1; /* Client wants 64 bit exp data, as well as skill data */ |
124 | uint32 ACC (RO, exp64):1; /* Client wants 64 bit exp data, as well as skill data */ |
124 | uint32 newmapcmd:1; /* Send newmap command when entering new map SMACFIGGEN */ |
125 | uint32 ACC (RO, newmapcmd):1; /* Send newmap command when entering new map SMACFIGGEN */ |
125 | uint32 plugincmd:1; /* CF+ extend the protocol through a plug-in */ |
126 | uint32 ACC (RO, plugincmd):1; /* CF+ extend the protocol through a plug-in */ |
126 | uint32 mapinfocmd:1; /* CF+ return map info and send map change info */ |
127 | uint32 ACC (RO, mapinfocmd):1; /* CF+ return map info and send map change info */ |
127 | uint32 extcmd:1; /* CF+ call into extensions/plugins */ |
128 | uint32 ACC (RO, extcmd):1; /* CF+ call into extensions/plugins */ |
128 | uint32 extmap:1; /* CF+ extend map comamnd with extra data */ |
129 | uint32 ACC (RO, extmap):1; /* CF+ extend map comamnd with extra data */ |
129 | uint32 buggy_mapscroll:1; /* CF+ client crashes on large mapscrolls */ |
130 | uint32 ACC (RO, buggy_mapscroll):1; /* CF+ client crashes on large mapscrolls */ |
130 | uint32 darkness:1; /* True if client wants darkness information */ |
131 | uint32 ACC (RO, darkness):1; /* True if client wants darkness information */ |
131 | uint32 image2:1; /* Client wants image2/face2 commands */ |
132 | uint32 ACC (RO, image2):1; /* Client wants image2/face2 commands */ |
132 | uint32 update_look:1; /* If true, we need to send the look window */ |
133 | uint32 ACC (RO, update_look):1; /* If true, we need to send the look window */ |
133 | uint32 can_write:1; /* Can we write to this socket? */ |
134 | uint32 ACC (RO, can_write):1; /* Can we write to this socket? */ |
134 | uint32 has_readable_type:1; /* If true client accept additional text information |
135 | uint32 ACC (RO, has_readable_type):1; /* If true client accept additional text information |
135 | used to arrange text in books, scrolls, or scripted dialogs */ |
136 | used to arrange text in books, scrolls, or scripted dialogs */ |
136 | uint32 monitor_spells:1; /* Client wishes to be informed when their spell list changes */ |
137 | uint32 ACC (RO, monitor_spells):1; /* Client wishes to be informed when their spell list changes */ |
137 | uint32 supported_readables; /* each bit is a readable supported by client */ |
|
|
138 | uint32 cs_version, sc_version; /* versions of the client */ |
|
|
139 | enum MapMode mapmode; /* Type of map commands the client wants. */ |
|
|
140 | uint16 look_position; /* start of drawing of look window */ |
|
|
141 | uint8 mapx, mapy; /* How large a map the client wants */ |
|
|
142 | uint8 itemcmd; /* What version of the 'item' protocol command to use */ |
|
|
143 | uint8 faceset; /* Set the client is using, default 0 */ |
|
|
144 | uint32 ext_mapinfos:1; /* If true client accept additionnal info on maps */ |
138 | uint32 ACC (RO, ext_mapinfos):1; /* If true client accept additionnal info on maps */ |
145 | /* Below are flags for extedend infos to pass to client |
139 | /* Below are flags for extedend infos to pass to client |
146 | * with S->C mapextended command */ |
140 | * with S->C mapextended command */ |
147 | uint32 EMI_smooth:1; /* Send smooth in extendmapinfos */ |
141 | uint32 ACC (RO, EMI_smooth):1; /* Send smooth in extendmapinfos */ |
|
|
142 | uint32 ACC (RW, supported_readables); /* each bit is a readable supported by client */ |
|
|
143 | uint32 ACC (RW, cs_version), ACC (RW, sc_version); /* versions of the client */ |
|
|
144 | enum MapMode mapmode; /* Type of map commands the client wants. */ |
|
|
145 | uint16 ACC (RW, look_position); /* start of drawing of look window */ |
|
|
146 | uint8 ACC (RW, mapx), ACC (RW, mapy); /* How large a map the client wants */ |
|
|
147 | uint8 ACC (RW, itemcmd); /* What version of the 'item' protocol command to use */ |
|
|
148 | uint8 ACC (RW, faceset); /* Set the client is using, default 0 */ |
148 | |
149 | |
149 | maptile *current_map; // CF+ last/current player map |
150 | maptile *ACC (RW, current_map); // CF+ last/current player map |
150 | int current_x, current_y; // CF+ last/current map position |
151 | int ACC (RW, current_x), ACC (RW, current_y); // CF+ last/current map position |
151 | char client[64]; // CF+ client name/version |
152 | char ACC (RW, client)[64]; // CF+ client name/version |
152 | |
|
|
153 | /* Below here is information only relevant for old sockets */ |
|
|
154 | char *comment; /* name or listen comment */ |
|
|
155 | enum Old_Mode old_mode; |
|
|
156 | }; |
153 | }; |
157 | |
154 | |
158 | #define CLIENT_SUPPORT_READABLES(__sockPtr,__type)\ |
155 | #define CLIENT_SUPPORT_READABLES(__sockPtr,__type)\ |
159 | ( ((__type)>0) &&\ |
156 | ( ((__type)>0) &&\ |
160 | ((__sockPtr)->has_readable_type) && \ |
157 | ((__sockPtr)->has_readable_type) && \ |