… | |
… | |
194 | return; |
194 | return; |
195 | |
195 | |
196 | terminate_all_pets (ob); |
196 | terminate_all_pets (ob); |
197 | remove_friendly_object (ob); |
197 | remove_friendly_object (ob); |
198 | ob->deactivate_recursive (); |
198 | ob->deactivate_recursive (); |
|
|
199 | maplevel = ob->map->path; |
199 | ob->remove (); |
200 | ob->remove (); |
200 | ob->map = 0; |
201 | ob->map = 0; |
201 | |
202 | |
202 | // for weird reasons, this is often "ob", keeping a circular reference |
203 | // for weird reasons, this is often "ob", keeping a circular reference |
203 | ranges [range_skill] = 0; |
204 | ranges [range_skill] = 0; |
… | |
… | |
211 | player::connect (client *ns) |
212 | player::connect (client *ns) |
212 | { |
213 | { |
213 | this->ns = ns; |
214 | this->ns = ns; |
214 | ns->pl = this; |
215 | ns->pl = this; |
215 | |
216 | |
|
|
217 | run_on = 0; |
|
|
218 | fire_on = 0; |
|
|
219 | ob->container = 0; //TODO: client-specific |
|
|
220 | |
216 | ns->update_look = 0; |
221 | ns->update_look = 0; |
217 | ns->look_position = 0; |
222 | ns->look_position = 0; |
218 | |
223 | |
219 | clear_los (ob); |
224 | clear_los (ob); |
220 | |
225 | |
221 | //TODO: must move into client |
226 | ns->reset_stats (); |
222 | /* we need to clear these to -1 and not zero - otherwise, |
|
|
223 | * if a player quits and starts a new character, we wont |
|
|
224 | * send new values to the client, as things like exp start |
|
|
225 | * at zero. |
|
|
226 | */ |
|
|
227 | for (int i = 0; i < NUM_SKILLS; i++) |
|
|
228 | last_skill_exp[i] = -1; |
|
|
229 | |
|
|
230 | for (int i = 0; i < NROFATTACKS; i++) |
|
|
231 | last_resist[i] = -1; |
|
|
232 | |
|
|
233 | last_weapon_sp = -1; |
|
|
234 | last_level = -1; |
|
|
235 | last_stats.exp = -1; |
|
|
236 | last_weight = (uint32) - 1; |
|
|
237 | last_flags = 0; |
|
|
238 | last_weight = 0; |
|
|
239 | last_weight_limit = 0; |
|
|
240 | last_path_attuned = 0; |
|
|
241 | last_path_repelled = 0; |
|
|
242 | last_path_denied = 0; |
|
|
243 | last_speed = 0; |
|
|
244 | run_on = 0; |
|
|
245 | fire_on = 0; |
|
|
246 | memset (&last_stats, 0, sizeof (living)); //TODO dirty |
|
|
247 | |
227 | |
248 | /* make sure he's a player -- needed because of class change. */ |
228 | /* make sure he's a player -- needed because of class change. */ |
249 | ob->type = PLAYER; // we are paranoid |
229 | ob->type = PLAYER; // we are paranoid |
250 | ob->race = ob->arch->clone.race; |
230 | ob->race = ob->arch->clone.race; |
251 | |
231 | |
… | |
… | |
315 | if (active) |
295 | if (active) |
316 | INVOKE_PLAYER (LOGOUT, this, ARG_INT (0)); |
296 | INVOKE_PLAYER (LOGOUT, this, ARG_INT (0)); |
317 | |
297 | |
318 | INVOKE_PLAYER (DISCONNECT, this); |
298 | INVOKE_PLAYER (DISCONNECT, this); |
319 | |
299 | |
|
|
300 | ns->reset_stats (); |
320 | ns->pl = 0; |
301 | ns->pl = 0; |
321 | this->ns = 0; |
302 | this->ns = 0; |
322 | } |
303 | } |
323 | |
304 | |
|
|
305 | ob->container = 0; //TODO: client-specific |
324 | deactivate (); |
306 | deactivate (); |
325 | } |
307 | } |
326 | |
308 | |
327 | // the need for this function can be explained |
309 | // the need for this function can be explained |
328 | // by load_object not returning the object |
310 | // by load_object not returning the object |
… | |
… | |
914 | * to save here. |
896 | * to save here. |
915 | */ |
897 | */ |
916 | sprintf (buf, "%s/%s/%s", settings.localdir, settings.playerdir, &op->name); |
898 | sprintf (buf, "%s/%s/%s", settings.localdir, settings.playerdir, &op->name); |
917 | make_path_to_file (buf); |
899 | make_path_to_file (buf); |
918 | |
900 | |
919 | #ifdef AUTOSAVE |
|
|
920 | op->contr->last_save_tick = pticks; |
|
|
921 | #endif |
|
|
922 | start_info (op); |
901 | start_info (op); |
923 | CLEAR_FLAG (op, FLAG_WIZ); |
902 | CLEAR_FLAG (op, FLAG_WIZ); |
924 | give_initial_items (op, op->randomitems); |
903 | give_initial_items (op, op->randomitems); |
925 | link_player_skills (op); |
904 | link_player_skills (op); |
926 | esrv_send_inventory (op, op); |
905 | esrv_send_inventory (op, op); |
… | |
… | |
3547 | * not readied. |
3526 | * not readied. |
3548 | */ |
3527 | */ |
3549 | void |
3528 | void |
3550 | player_unready_range_ob (player *pl, object *ob) |
3529 | player_unready_range_ob (player *pl, object *ob) |
3551 | { |
3530 | { |
3552 | rangetype i; |
|
|
3553 | |
|
|
3554 | for (i = (rangetype) 0; i < range_size; i = (rangetype) ((int) i + 1)) |
3531 | for (rangetype i = (rangetype) 0; i < range_size; i = (rangetype) ((int) i + 1)) |
3555 | { |
|
|
3556 | if (pl->ranges[i] == ob) |
3532 | if (pl->ranges[i] == ob) |
3557 | { |
3533 | { |
3558 | pl->ranges[i] = NULL; |
3534 | pl->ranges[i] = 0; |
3559 | if (pl->shoottype == i) |
3535 | if (pl->shoottype == i) |
3560 | { |
|
|
3561 | pl->shoottype = range_none; |
3536 | pl->shoottype = range_none; |
3562 | } |
|
|
3563 | } |
3537 | } |
3564 | } |
|
|
3565 | } |
3538 | } |