… | |
… | |
211 | player::connect (client *ns) |
211 | player::connect (client *ns) |
212 | { |
212 | { |
213 | this->ns = ns; |
213 | this->ns = ns; |
214 | ns->pl = this; |
214 | ns->pl = this; |
215 | |
215 | |
|
|
216 | run_on = 0; |
|
|
217 | fire_on = 0; |
|
|
218 | ob->container = 0; //TODO: client-specific |
|
|
219 | |
216 | ns->update_look = 0; |
220 | ns->update_look = 0; |
217 | ns->look_position = 0; |
221 | ns->look_position = 0; |
218 | |
222 | |
219 | clear_los (ob); |
223 | clear_los (ob); |
220 | |
224 | |
221 | //TODO: must move into client |
225 | 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 | |
226 | |
248 | /* make sure he's a player -- needed because of class change. */ |
227 | /* make sure he's a player -- needed because of class change. */ |
249 | ob->type = PLAYER; // we are paranoid |
228 | ob->type = PLAYER; // we are paranoid |
250 | ob->race = ob->arch->clone.race; |
229 | ob->race = ob->arch->clone.race; |
251 | |
230 | |
… | |
… | |
315 | if (active) |
294 | if (active) |
316 | INVOKE_PLAYER (LOGOUT, this, ARG_INT (0)); |
295 | INVOKE_PLAYER (LOGOUT, this, ARG_INT (0)); |
317 | |
296 | |
318 | INVOKE_PLAYER (DISCONNECT, this); |
297 | INVOKE_PLAYER (DISCONNECT, this); |
319 | |
298 | |
|
|
299 | ns->reset_stats (); |
320 | ns->pl = 0; |
300 | ns->pl = 0; |
321 | this->ns = 0; |
301 | this->ns = 0; |
322 | } |
302 | } |
323 | |
303 | |
|
|
304 | ob->container = 0; //TODO: client-specific |
324 | deactivate (); |
305 | deactivate (); |
325 | } |
306 | } |
326 | |
307 | |
327 | // the need for this function can be explained |
308 | // the need for this function can be explained |
328 | // by load_object not returning the object |
309 | // by load_object not returning the object |
… | |
… | |
351 | unapply = unapply_nochoice; |
332 | unapply = unapply_nochoice; |
352 | |
333 | |
353 | savebed_map = first_map_path; /* Init. respawn position */ |
334 | savebed_map = first_map_path; /* Init. respawn position */ |
354 | |
335 | |
355 | gen_sp_armour = 10; |
336 | gen_sp_armour = 10; |
356 | last_speed = -1; |
|
|
357 | shoottype = range_none; |
337 | shoottype = range_none; |
358 | bowtype = bow_normal; |
338 | bowtype = bow_normal; |
359 | petmode = pet_normal; |
339 | petmode = pet_normal; |
360 | listening = 10; |
340 | listening = 10; |
361 | usekeys = containers; |
341 | usekeys = containers; |
362 | last_weapon_sp = -1; |
|
|
363 | peaceful = 1; /* default peaceful */ |
342 | peaceful = 1; /* default peaceful */ |
364 | do_los = 1; |
343 | do_los = 1; |
365 | } |
344 | } |
366 | |
345 | |
367 | void |
346 | void |
… | |
… | |
916 | * to save here. |
895 | * to save here. |
917 | */ |
896 | */ |
918 | sprintf (buf, "%s/%s/%s", settings.localdir, settings.playerdir, &op->name); |
897 | sprintf (buf, "%s/%s/%s", settings.localdir, settings.playerdir, &op->name); |
919 | make_path_to_file (buf); |
898 | make_path_to_file (buf); |
920 | |
899 | |
921 | #ifdef AUTOSAVE |
|
|
922 | op->contr->last_save_tick = pticks; |
|
|
923 | #endif |
|
|
924 | start_info (op); |
900 | start_info (op); |
925 | CLEAR_FLAG (op, FLAG_WIZ); |
901 | CLEAR_FLAG (op, FLAG_WIZ); |
926 | give_initial_items (op, op->randomitems); |
902 | give_initial_items (op, op->randomitems); |
927 | link_player_skills (op); |
903 | link_player_skills (op); |
928 | esrv_send_inventory (op, op); |
904 | esrv_send_inventory (op, op); |
… | |
… | |
3549 | * not readied. |
3525 | * not readied. |
3550 | */ |
3526 | */ |
3551 | void |
3527 | void |
3552 | player_unready_range_ob (player *pl, object *ob) |
3528 | player_unready_range_ob (player *pl, object *ob) |
3553 | { |
3529 | { |
3554 | rangetype i; |
|
|
3555 | |
|
|
3556 | for (i = (rangetype) 0; i < range_size; i = (rangetype) ((int) i + 1)) |
3530 | for (rangetype i = (rangetype) 0; i < range_size; i = (rangetype) ((int) i + 1)) |
3557 | { |
|
|
3558 | if (pl->ranges[i] == ob) |
3531 | if (pl->ranges[i] == ob) |
3559 | { |
3532 | { |
3560 | pl->ranges[i] = NULL; |
3533 | pl->ranges[i] = 0; |
3561 | if (pl->shoottype == i) |
3534 | if (pl->shoottype == i) |
3562 | { |
|
|
3563 | pl->shoottype = range_none; |
3535 | pl->shoottype = range_none; |
3564 | } |
|
|
3565 | } |
3536 | } |
3566 | } |
|
|
3567 | } |
3537 | } |