ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/player.C
(Generate patch)

Comparing deliantra/server/server/player.C (file contents):
Revision 1.92 by root, Mon Jan 8 01:19:04 2007 UTC vs.
Revision 1.97 by root, Mon Jan 8 22:32:11 2007 UTC

211player::connect (client *ns) 211player::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);
224
225 ns->reset_stats ();
220 226
221 /* make sure he's a player -- needed because of class change. */ 227 /* make sure he's a player -- needed because of class change. */
222 ob->type = PLAYER; // we are paranoid 228 ob->type = PLAYER; // we are paranoid
223 ob->race = ob->arch->clone.race; 229 ob->race = ob->arch->clone.race;
224 230
288 if (active) 294 if (active)
289 INVOKE_PLAYER (LOGOUT, this, ARG_INT (0)); 295 INVOKE_PLAYER (LOGOUT, this, ARG_INT (0));
290 296
291 INVOKE_PLAYER (DISCONNECT, this); 297 INVOKE_PLAYER (DISCONNECT, this);
292 298
299 ns->reset_stats ();
293 ns->pl = 0; 300 ns->pl = 0;
294 this->ns = 0; 301 this->ns = 0;
295 } 302 }
296 303
304 ob->container = 0; //TODO: client-specific
297 deactivate (); 305 deactivate ();
298} 306}
299 307
300// the need for this function can be explained 308// the need for this function can be explained
301// by load_object not returning the object 309// by load_object not returning the object
324 unapply = unapply_nochoice; 332 unapply = unapply_nochoice;
325 333
326 savebed_map = first_map_path; /* Init. respawn position */ 334 savebed_map = first_map_path; /* Init. respawn position */
327 335
328 gen_sp_armour = 10; 336 gen_sp_armour = 10;
329 last_speed = -1;
330 shoottype = range_none; 337 shoottype = range_none;
331 bowtype = bow_normal; 338 bowtype = bow_normal;
332 petmode = pet_normal; 339 petmode = pet_normal;
333 listening = 10; 340 listening = 10;
334 usekeys = containers; 341 usekeys = containers;
335 last_weapon_sp = -1;
336 peaceful = 1; /* default peaceful */ 342 peaceful = 1; /* default peaceful */
337 do_los = 1; 343 do_los = 1;
338
339 /* we need to clear these to -1 and not zero - otherwise,
340 * if a player quits and starts a new character, we wont
341 * send new values to the client, as things like exp start
342 * at zero.
343 */
344 for (int i = 0; i < NUM_SKILLS; i++)
345 last_skill_exp[i] = -1;
346
347 for (int i = 0; i < NROFATTACKS; i++)
348 last_resist[i] = -1;
349
350 last_stats.exp = -1;
351 last_weight = (uint32) - 1;
352} 344}
353 345
354void 346void
355player::do_destroy () 347player::do_destroy ()
356{ 348{
903 * to save here. 895 * to save here.
904 */ 896 */
905 sprintf (buf, "%s/%s/%s", settings.localdir, settings.playerdir, &op->name); 897 sprintf (buf, "%s/%s/%s", settings.localdir, settings.playerdir, &op->name);
906 make_path_to_file (buf); 898 make_path_to_file (buf);
907 899
908#ifdef AUTOSAVE
909 op->contr->last_save_tick = pticks;
910#endif
911 start_info (op); 900 start_info (op);
912 CLEAR_FLAG (op, FLAG_WIZ); 901 CLEAR_FLAG (op, FLAG_WIZ);
913 give_initial_items (op, op->randomitems); 902 give_initial_items (op, op->randomitems);
914 link_player_skills (op); 903 link_player_skills (op);
915 esrv_send_inventory (op, op); 904 esrv_send_inventory (op, op);
3536 * not readied. 3525 * not readied.
3537 */ 3526 */
3538void 3527void
3539player_unready_range_ob (player *pl, object *ob) 3528player_unready_range_ob (player *pl, object *ob)
3540{ 3529{
3541 rangetype i;
3542
3543 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))
3544 {
3545 if (pl->ranges[i] == ob) 3531 if (pl->ranges[i] == ob)
3546 { 3532 {
3547 pl->ranges[i] = NULL; 3533 pl->ranges[i] = 0;
3548 if (pl->shoottype == i) 3534 if (pl->shoottype == i)
3549 {
3550 pl->shoottype = range_none; 3535 pl->shoottype = range_none;
3551 }
3552 } 3536 }
3553 }
3554} 3537}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines