… | |
… | |
245 | |
245 | |
246 | send_rules (ob); |
246 | send_rules (ob); |
247 | send_news (ob); |
247 | send_news (ob); |
248 | display_motd (ob); |
248 | display_motd (ob); |
249 | INVOKE_PLAYER (LOGIN, this); |
249 | INVOKE_PLAYER (LOGIN, this); |
|
|
250 | } |
|
|
251 | |
|
|
252 | void |
|
|
253 | player::disconnect () |
|
|
254 | { |
|
|
255 | if (!ns) |
|
|
256 | return; |
|
|
257 | |
|
|
258 | //TODO: don't be so harsh and destroy :) |
|
|
259 | destroy (); |
|
|
260 | |
|
|
261 | ns->pl = 0; |
|
|
262 | ns = 0; |
250 | } |
263 | } |
251 | |
264 | |
252 | // the need for this function can be explained |
265 | // the need for this function can be explained |
253 | // by load_object not returning the object |
266 | // by load_object not returning the object |
254 | void |
267 | void |
… | |
… | |
303 | |
316 | |
304 | last_stats.exp = -1; |
317 | last_stats.exp = -1; |
305 | last_weight = (uint32) - 1; |
318 | last_weight = (uint32) - 1; |
306 | } |
319 | } |
307 | |
320 | |
308 | player::~player () |
321 | void |
|
|
322 | player::do_destroy () |
309 | { |
323 | { |
|
|
324 | attachable::do_destroy (); |
|
|
325 | |
|
|
326 | disconnect (); |
|
|
327 | |
310 | terminate_all_pets (ob); |
328 | terminate_all_pets (ob); |
311 | |
329 | |
312 | if (first_player != this) |
330 | if (first_player != this) |
313 | { |
331 | { |
314 | player *prev = first_player; |
332 | player *prev = first_player; |
… | |
… | |
326 | } |
344 | } |
327 | else |
345 | else |
328 | first_player = next; |
346 | first_player = next; |
329 | |
347 | |
330 | if (ob) |
348 | if (ob) |
331 | { |
|
|
332 | ob->contr = 0; |
|
|
333 | ob->destroy (1); |
349 | ob->destroy (true); |
334 | } |
|
|
335 | |
350 | |
336 | if (ns) |
351 | if (ns) |
337 | { |
352 | { |
338 | ns->send_packet ("goodbye"); |
353 | ns->send_packet ("goodbye"); |
339 | ns->flush (); |
354 | ns->flush (); |
340 | ns->pl = 0; |
355 | ns->pl = 0; |
341 | ns->destroy (); |
356 | ns->destroy (); |
342 | } |
357 | } |
343 | |
358 | |
|
|
359 | attachable::do_destroy (); |
|
|
360 | } |
|
|
361 | |
|
|
362 | player::~player () |
|
|
363 | { |
344 | /* Clear item stack */ |
364 | /* Clear item stack */ |
345 | free (stack_items); |
365 | free (stack_items); |
346 | } |
366 | } |
347 | |
367 | |
348 | /* Tries to add player on the connection passed in ns. |
368 | /* Tries to add player on the connection passed in ns. |