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.201 by root, Sun Aug 17 01:26:35 2008 UTC vs.
Revision 1.206 by root, Mon Sep 29 10:20:49 2008 UTC

219 /* make sure he's a player -- needed because of class change. */ 219 /* make sure he's a player -- needed because of class change. */
220 ob->type = PLAYER; // we are paranoid 220 ob->type = PLAYER; // we are paranoid
221 ob->race = ob->arch->race; 221 ob->race = ob->arch->race;
222 222
223 ob->update_weight (); 223 ob->update_weight ();
224 link_player_skills (ob); 224 link_skills ();
225 225
226 CLEAR_FLAG (ob, FLAG_NO_FIX_PLAYER); 226 CLEAR_FLAG (ob, FLAG_NO_FIX_PLAYER);
227 227
228 assign (title, ob->arch->object::name); 228 assign (title, ob->arch->object::name);
229 229
348 savebed_map = first_map_path; /* Init. respawn position */ 348 savebed_map = first_map_path; /* Init. respawn position */
349 349
350 gen_sp_armour = 10; 350 gen_sp_armour = 10;
351 bowtype = bow_normal; 351 bowtype = bow_normal;
352 petmode = pet_normal; 352 petmode = pet_normal;
353 listening = 10;
354 usekeys = containers; 353 usekeys = containers;
355 peaceful = 1; /* default peaceful */ 354 peaceful = 1; /* default peaceful */
356 do_los = 1; 355 do_los = 1;
357 356
358 weapon_sp = 1.0f; 357 weapon_sp = 1.0f;
367 attachable::do_destroy (); 366 attachable::do_destroy ();
368 367
369 if (ob) 368 if (ob)
370 { 369 {
371 ob->destroy_inv (false); 370 ob->destroy_inv (false);
372 ob->destroy (); 371 ob->destroy (true);
373 } 372 }
374 373
375 ob = observe = 0; 374 ob = observe = 0;
376} 375}
377 376
669 || op->type == CLOAK || op->type == HELMET 668 || op->type == CLOAK || op->type == HELMET
670 || op->type == SHIELD || op->type == GLOVES 669 || op->type == SHIELD || op->type == GLOVES
671 || op->type == BRACERS || op->type == GIRDLE)) 670 || op->type == BRACERS || op->type == GIRDLE))
672 || (!QUERY_FLAG (pl, FLAG_USE_WEAPON) && op->type == WEAPON)) 671 || (!QUERY_FLAG (pl, FLAG_USE_WEAPON) && op->type == WEAPON))
673 { 672 {
674 op->destroy (); 673 op->destroy (true);
675 continue; 674 continue;
676 } 675 }
677 } 676 }
678 677
679 /* This really needs to be better - we should really give 678 /* This really needs to be better - we should really give
690 if (tmp->type == op->type && tmp->name == op->name) 689 if (tmp->type == op->type && tmp->name == op->name)
691 break; 690 break;
692 691
693 if (tmp) 692 if (tmp)
694 { 693 {
695 op->destroy (); 694 op->destroy (true);
696 LOG (llevError, "give_initial_items: Removing duplicate object %s\n", &tmp->name); 695 LOG (llevError, "give_initial_items: Removing duplicate object %s\n", &tmp->name);
697 continue; 696 continue;
698 } 697 }
699 698
700 if (op->nrof > 1) 699 if (op->nrof > 1)
715 CLEAR_FLAG (op, FLAG_DAMNED); 714 CLEAR_FLAG (op, FLAG_DAMNED);
716 } 715 }
717 716
718 if (op->type == SPELL) 717 if (op->type == SPELL)
719 { 718 {
720 op->destroy (); 719 op->destroy (true);
721 continue; 720 continue;
722 } 721 }
723 else if (op->type == SKILL) 722 else if (op->type == SKILL)
724 { 723 {
725 SET_FLAG (op, FLAG_CAN_USE_SKILL); 724 SET_FLAG (op, FLAG_CAN_USE_SKILL);
729 else /* lock all 'normal items by default */ 728 else /* lock all 'normal items by default */
730 SET_FLAG (op, FLAG_INV_LOCKED); 729 SET_FLAG (op, FLAG_INV_LOCKED);
731 } /* for loop of objects in player inv */ 730 } /* for loop of objects in player inv */
732 731
733 /* Need to set up the skill pointers */ 732 /* Need to set up the skill pointers */
734 link_player_skills (pl); 733 pl->contr->link_skills ();
735} 734}
736 735
737void 736void
738get_party_password (object *op, partylist *party) 737get_party_password (object *op, partylist *party)
739{ 738{
871 ob->msg = 0; 870 ob->msg = 0;
872 871
873 start_info (ob); 872 start_info (ob);
874 CLEAR_FLAG (ob, FLAG_WIZ); 873 CLEAR_FLAG (ob, FLAG_WIZ);
875 give_initial_items (ob, ob->randomitems); 874 give_initial_items (ob, ob->randomitems);
876 link_player_skills (ob);
877 esrv_send_inventory (ob, ob); 875 esrv_send_inventory (ob, ob);
878 ob->update_stats (); 876 ob->update_stats ();
879 877
880 /* This moves the player to a different start map, if there 878 /* This moves the player to a different start map, if there
881 * is one for this race 879 * is one for this race
1580 } 1578 }
1581 1579
1582 /* this should not happen, but sometimes does */ 1580 /* this should not happen, but sometimes does */
1583 if (arrow->nrof == 0) 1581 if (arrow->nrof == 0)
1584 { 1582 {
1583 LOG (llevError | logBacktrace, "arrow (%s) has nrof 0\n", arrow->debug_desc ());
1585 arrow->destroy (); 1584 arrow->destroy (true);
1586 return 0; 1585 return 0;
1587 } 1586 }
1588 1587
1589 left = arrow; /* these are arrows left to the player */ 1588 left = arrow; /* these are arrows left to the player */
1590 arrow = arrow->split (); 1589 arrow = arrow->split ();
2254 if (QUERY_FLAG (tmp, FLAG_APPLIED) && QUERY_FLAG (tmp, FLAG_LIFESAVE)) 2253 if (QUERY_FLAG (tmp, FLAG_APPLIED) && QUERY_FLAG (tmp, FLAG_LIFESAVE))
2255 { 2254 {
2256 op->play_sound (sound_find ("ob_evaporate")); 2255 op->play_sound (sound_find ("ob_evaporate"));
2257 new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s vibrates violently, then evaporates.", query_name (tmp)); 2256 new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s vibrates violently, then evaporates.", query_name (tmp));
2258 2257
2259 tmp->destroy (); 2258 tmp->destroy (true);
2260 CLEAR_FLAG (op, FLAG_LIFESAVE); 2259 CLEAR_FLAG (op, FLAG_LIFESAVE);
2261 2260
2262 if (op->stats.hp < 0) 2261 if (op->stats.hp < 0)
2263 op->stats.hp = op->stats.maxhp; 2262 op->stats.hp = op->stats.maxhp;
2264 2263
2313const char * 2312const char *
2314gravestone_text (object *op) 2313gravestone_text (object *op)
2315{ 2314{
2316 static dynbuf_text buf; 2315 static dynbuf_text buf;
2317 2316
2318 buf << "---- R.I.P. ----\n\n"; 2317 buf << "---- R.I.P. ----\n\n"
2319 op->name; 2318 << op->name;
2320 2319
2321 if (op->type == PLAYER) 2320 if (op->type == PLAYER)
2322 buf << " the " << op->contr->title; 2321 buf << " the " << op->contr->title;
2323 2322
2324 buf << "\n\n"; 2323 buf << "\n\n";
2570 op->stats.food = 0; 2569 op->stats.food = 0;
2571 2570
2572 if (op->stats.hp < 0) 2571 if (op->stats.hp < 0)
2573 { 2572 {
2574 op->contr->killer = archetype::get ("killer_starvation"); 2573 op->contr->killer = archetype::get ("killer_starvation");
2575 op->contr->killer->destroy (); 2574 op->contr->killer->destroy (true);
2576 } 2575 }
2577 } 2576 }
2578 2577
2579 /* killer should be set here already */ 2578 /* killer should be set here already */
2580 if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ)) 2579 if (op->stats.hp < 0 && !QUERY_FLAG (op, FLAG_WIZ))
2611 2610
2612 /* restore player */ 2611 /* restore player */
2613 at = archetype::find ("poisoning"); 2612 at = archetype::find ("poisoning");
2614 if (object *tmp = present_arch_in_ob (at, op)) 2613 if (object *tmp = present_arch_in_ob (at, op))
2615 { 2614 {
2616 tmp->destroy (); 2615 tmp->destroy (true);
2617 new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed"); 2616 new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed");
2618 } 2617 }
2619 2618
2620 at = archetype::find ("confusion"); 2619 at = archetype::find ("confusion");
2621 if (object *tmp = present_arch_in_ob (at, op)) 2620 if (object *tmp = present_arch_in_ob (at, op))
2622 { 2621 {
2623 tmp->destroy (); 2622 tmp->destroy (true);
2624 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); 2623 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer");
2625 } 2624 }
2626 2625
2627 cure_disease (op, 0, 0); /* remove any disease */ 2626 cure_disease (op, 0, 0); /* remove any disease */
2628 op->stats.hp = op->stats.maxhp; 2627 op->stats.hp = op->stats.maxhp;
2793 * exp loss on the stone. 2792 * exp loss on the stone.
2794 */ 2793 */
2795 tmp = arch_to_object (archetype::find ("gravestone")); 2794 tmp = arch_to_object (archetype::find ("gravestone"));
2796 tmp->name = format ("%s's gravestone", &op->name); 2795 tmp->name = format ("%s's gravestone", &op->name);
2797 tmp->name_pl = format ("%s's gravestones", &op->name); 2796 tmp->name_pl = format ("%s's gravestones", &op->name);
2798 tmp->msg = format ("RIP\nHere rests the hero %s the %s,\nwho was killed\nby %s.\n", &op->name, op->contr->title, op->contr->killer_name ()); 2797 tmp->msg = format ("T<RIP>\n\nHere rests the hero %s the %s,\rwho was killed\rby %s.\n",
2798 &op->name, op->contr->title, op->contr->killer_name ());
2799 tmp->x = op->x, tmp->y = op->y; 2799 tmp->x = op->x, tmp->y = op->y;
2800 insert_ob_in_map (tmp, op->map, NULL, 0); 2800 insert_ob_in_map (tmp, op->map, NULL, 0);
2801 2801
2802 /**************************************/ 2802 /**************************************/
2803 /* */ 2803 /* */
2812 at = archetype::find ("poisoning"); 2812 at = archetype::find ("poisoning");
2813 tmp = present_arch_in_ob (at, op); 2813 tmp = present_arch_in_ob (at, op);
2814 2814
2815 if (tmp) 2815 if (tmp)
2816 { 2816 {
2817 tmp->destroy (); 2817 tmp->destroy (true);
2818 new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed"); 2818 new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed");
2819 } 2819 }
2820 2820
2821 at = archetype::find ("confusion"); 2821 at = archetype::find ("confusion");
2822 tmp = present_arch_in_ob (at, op); 2822 tmp = present_arch_in_ob (at, op);
2823 if (tmp) 2823 if (tmp)
2824 { 2824 {
2825 tmp->destroy (); 2825 tmp->destroy (true);
2826 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); 2826 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer");
2827 } 2827 }
2828 2828
2829 cure_disease (op, 0, 0); /* remove any disease */ 2829 cure_disease (op, 0, 0); /* remove any disease */
2830 2830
2833 for (object *item = op->inv; item; ) 2833 for (object *item = op->inv; item; )
2834 { 2834 {
2835 object *next = item->below; 2835 object *next = item->below;
2836 2836
2837 if (item->type == SPELL_EFFECT && item->active) 2837 if (item->type == SPELL_EFFECT && item->active)
2838 item->destroy (); 2838 item->destroy (true);
2839 2839
2840 item = next; 2840 item = next;
2841 } 2841 }
2842 2842
2843 /*add_exp(op, (op->stats.exp * -0.20)); */ 2843 /*add_exp(op, (op->stats.exp * -0.20)); */
2891 if (will_kill_again & (1 << at)) 2891 if (will_kill_again & (1 << at))
2892 force->resist[at] = 100; 2892 force->resist[at] = 100;
2893 2893
2894 insert_ob_in_ob (force, op); 2894 insert_ob_in_ob (force, op);
2895 op->update_stats (); 2895 op->update_stats ();
2896
2897 } 2896 }
2898 2897
2899 new_draw_info (NDI_UNIQUE, 0, op, "YOU HAVE DIED."); 2898 new_draw_info (NDI_UNIQUE, 0, op, "YOU HAVE DIED.");
2900} 2899}
2901 2900
2925 { 2924 {
2926 tmp->decrease (rndm (1, tmp->nrof - 1)); 2925 tmp->decrease (rndm (1, tmp->nrof - 1));
2927 insert_ob_in_map (tmp, op->map, NULL, 0); 2926 insert_ob_in_map (tmp, op->map, NULL, 0);
2928 } 2927 }
2929 else 2928 else
2930 tmp->destroy (); 2929 tmp->destroy (true);
2931 } 2930 }
2932 else 2931 else
2933 insert_ob_in_map (tmp, op->map, NULL, 0); 2932 insert_ob_in_map (tmp, op->map, NULL, 0);
2934 } 2933 }
2935} 2934}
2996 if (op->type == PLAYER) 2995 if (op->type == PLAYER)
2997 new_draw_info_format (NDI_UNIQUE, 0, op, "You cast %s.", &spob->name); 2996 new_draw_info_format (NDI_UNIQUE, 0, op, "You cast %s.", &spob->name);
2998 2997
2999 cast_spell (op, throw_ob, dir, spob, NULL); 2998 cast_spell (op, throw_ob, dir, spob, NULL);
3000 2999
3001 throw_ob->destroy (); 3000 throw_ob->destroy (true);
3002} 3001}
3003 3002
3004void 3003void
3005make_visible (object *op) 3004make_visible (object *op)
3006{ 3005{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines