… | |
… | |
229 | add_friendly_object (ob); |
229 | add_friendly_object (ob); |
230 | |
230 | |
231 | LOG (llevInfo, "LOGIN: Player named %s from ip %s\n", &ob->name, ns->host); |
231 | LOG (llevInfo, "LOGIN: Player named %s from ip %s\n", &ob->name, ns->host); |
232 | |
232 | |
233 | new_draw_info (NDI_UNIQUE, 0, ob, "Welcome Back!"); |
233 | new_draw_info (NDI_UNIQUE, 0, ob, "Welcome Back!"); |
234 | new_draw_info_format (NDI_UNIQUE | NDI_ALL | NDI_DK_ORANGE, 5, NULL, "%s has entered the game.", &ob->name); |
|
|
235 | |
234 | |
236 | esrv_new_player (this, ob->weight + ob->carrying); |
235 | esrv_new_player (this, ob->weight + ob->carrying); |
237 | |
236 | |
238 | ob->update_stats (); |
237 | ob->update_stats (); |
239 | ns->floorbox_update (); |
238 | ns->floorbox_update (); |
… | |
… | |
252 | void |
251 | void |
253 | player::disconnect () |
252 | player::disconnect () |
254 | { |
253 | { |
255 | //TODO: don't be so harsh and destroy :) |
254 | //TODO: don't be so harsh and destroy :) |
256 | if (ns) |
255 | if (ns) |
|
|
256 | { |
|
|
257 | if (enable_save) |
|
|
258 | INVOKE_PLAYER (LOGOUT, this, ARG_INT (0)); |
|
|
259 | |
|
|
260 | client *ns = this->ns; |
|
|
261 | ns->send_packet ("goodbye"); |
|
|
262 | ns->flush (); |
|
|
263 | ns->pl = 0; |
|
|
264 | this->ns = 0; |
|
|
265 | |
|
|
266 | ns->destroy (); |
257 | destroy (); |
267 | destroy (); |
|
|
268 | } |
258 | } |
269 | } |
259 | |
270 | |
260 | // the need for this function can be explained |
271 | // the need for this function can be explained |
261 | // by load_object not returning the object |
272 | // by load_object not returning the object |
262 | void |
273 | void |
… | |
… | |
314 | } |
325 | } |
315 | |
326 | |
316 | void |
327 | void |
317 | player::do_destroy () |
328 | player::do_destroy () |
318 | { |
329 | { |
319 | attachable::do_destroy (); |
330 | disconnect (); |
320 | |
331 | |
321 | save (false); |
332 | save (false); |
322 | enable_save = false; |
333 | enable_save = false; |
323 | |
334 | |
324 | disconnect (); |
335 | attachable::do_destroy (); |
325 | |
336 | |
326 | terminate_all_pets (ob); |
337 | terminate_all_pets (ob); |
327 | |
338 | |
328 | if (first_player != this) |
339 | if (first_player != this) |
329 | { |
340 | { |
… | |
… | |
345 | |
356 | |
346 | if (ob) |
357 | if (ob) |
347 | { |
358 | { |
348 | ob->destroy_inv (false); |
359 | ob->destroy_inv (false); |
349 | ob->destroy (); |
360 | ob->destroy (); |
350 | } |
|
|
351 | |
|
|
352 | if (ns) |
|
|
353 | { |
|
|
354 | client *ns = this->ns; |
|
|
355 | ns->send_packet ("goodbye"); |
|
|
356 | ns->flush (); |
|
|
357 | ns->pl = 0; |
|
|
358 | this->ns = 0; |
|
|
359 | ns->destroy (); |
|
|
360 | } |
361 | } |
361 | } |
362 | } |
362 | |
363 | |
363 | player::~player () |
364 | player::~player () |
364 | { |
365 | { |