… | |
… | |
152 | |
152 | |
153 | // initialisation done, kick it! |
153 | // initialisation done, kick it! |
154 | send_packet_printf ("version %d %d %s\n", VERSION_CS, VERSION_SC, VERSION_INFO); |
154 | send_packet_printf ("version %d %d %s\n", VERSION_CS, VERSION_SC, VERSION_INFO); |
155 | flush (); |
155 | flush (); |
156 | |
156 | |
|
|
157 | reset_stats (); |
|
|
158 | |
157 | clients.insert (this); |
159 | clients.insert (this); |
158 | } |
160 | } |
159 | |
161 | |
160 | client::~client () |
162 | client::~client () |
161 | { |
163 | { |
… | |
… | |
187 | |
189 | |
188 | socket_ev.suspend (); |
190 | socket_ev.suspend (); |
189 | cmd_ev.suspend (); |
191 | cmd_ev.suspend (); |
190 | |
192 | |
191 | refcnt_dec (); // socket no longer open |
193 | refcnt_dec (); // socket no longer open |
|
|
194 | } |
|
|
195 | |
|
|
196 | void |
|
|
197 | client::reset_stats () |
|
|
198 | { |
|
|
199 | /* we need to clear these to -1 and not zero - otherwise, |
|
|
200 | * if a player quits and starts a new character, we wont |
|
|
201 | * send new values to the client, as things like exp start |
|
|
202 | * at zero. |
|
|
203 | */ |
|
|
204 | for (int i = 0; i < NUM_SKILLS; i++) |
|
|
205 | last_skill_exp[i] = -1; |
|
|
206 | |
|
|
207 | for (int i = 0; i < NROFATTACKS; i++) |
|
|
208 | last_resist[i] = -1; |
|
|
209 | |
|
|
210 | last_weapon_sp = -1; |
|
|
211 | last_level = -1; |
|
|
212 | last_stats.exp = -1; |
|
|
213 | last_weight = (uint32) - 1; |
|
|
214 | last_flags = 0; |
|
|
215 | last_weight = 0; |
|
|
216 | last_weight_limit = 0; |
|
|
217 | last_path_attuned = 0; |
|
|
218 | last_path_repelled = 0; |
|
|
219 | last_path_denied = 0; |
|
|
220 | last_speed = 0; |
|
|
221 | flags = 0; |
|
|
222 | |
|
|
223 | static living zero_living; |
|
|
224 | last_stats = zero_living; |
192 | } |
225 | } |
193 | |
226 | |
194 | /** This sets up the socket and reads all the image information into memory. */ |
227 | /** This sets up the socket and reads all the image information into memory. */ |
195 | void |
228 | void |
196 | init_ericserver (void) |
229 | init_ericserver (void) |