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.31 by pippijn, Mon Dec 11 19:46:47 2006 UTC vs.
Revision 1.32 by root, Tue Dec 12 20:53:03 2006 UTC

644 (op->type == ARMOUR || op->type == BOOTS || 644 (op->type == ARMOUR || op->type == BOOTS ||
645 op->type == CLOAK || op->type == HELMET || 645 op->type == CLOAK || op->type == HELMET ||
646 op->type == SHIELD || op->type == GLOVES || 646 op->type == SHIELD || op->type == GLOVES ||
647 op->type == BRACERS || op->type == GIRDLE)) || (!QUERY_FLAG (pl, FLAG_USE_WEAPON) && op->type == WEAPON)) 647 op->type == BRACERS || op->type == GIRDLE)) || (!QUERY_FLAG (pl, FLAG_USE_WEAPON) && op->type == WEAPON))
648 { 648 {
649 remove_ob (op); 649 op->remove ();
650 free_object (op); 650 op->destroy (0);
651 continue; 651 continue;
652 } 652 }
653 } 653 }
654 654
655 /* This really needs to be better - we should really give 655 /* This really needs to be better - we should really give
666 if (tmp->type == op->type && tmp->name == op->name) 666 if (tmp->type == op->type && tmp->name == op->name)
667 break; 667 break;
668 668
669 if (tmp) 669 if (tmp)
670 { 670 {
671 remove_ob (op); 671 op->remove ();
672 free_object (op); 672 op->destroy (0);
673 LOG (llevError, "give_initial_items: Removing duplicate object %s\n", &tmp->name); 673 LOG (llevError, "give_initial_items: Removing duplicate object %s\n", &tmp->name);
674 continue; 674 continue;
675 } 675 }
676 if (op->nrof > 1) 676 if (op->nrof > 1)
677 op->nrof = 1; 677 op->nrof = 1;
692 CLEAR_FLAG (op, FLAG_CURSED); 692 CLEAR_FLAG (op, FLAG_CURSED);
693 CLEAR_FLAG (op, FLAG_DAMNED); 693 CLEAR_FLAG (op, FLAG_DAMNED);
694 } 694 }
695 if (op->type == SPELL) 695 if (op->type == SPELL)
696 { 696 {
697 remove_ob (op); 697 op->remove ();
698 free_object (op); 698 op->destroy (0);
699 continue; 699 continue;
700 } 700 }
701 else if (op->type == SKILL) 701 else if (op->type == SKILL)
702 { 702 {
703 SET_FLAG (op, FLAG_CAN_USE_SKILL); 703 SET_FLAG (op, FLAG_CAN_USE_SKILL);
742 * removing the player - it probably makes more sense 742 * removing the player - it probably makes more sense
743 * to leave it to play_again to remove the object in all 743 * to leave it to play_again to remove the object in all
744 * cases. 744 * cases.
745 */ 745 */
746 if (!QUERY_FLAG (op, FLAG_REMOVED)) 746 if (!QUERY_FLAG (op, FLAG_REMOVED))
747 remove_ob (op); 747 op->remove ();
748 /* Need to set this to null - otherwise, it could point to garbage, 748 /* Need to set this to null - otherwise, it could point to garbage,
749 * and draw() doesn't check to see if the player is removed, only if 749 * and draw() doesn't check to see if the player is removed, only if
750 * the map is null or not swapped out. 750 * the map is null or not swapped out.
751 */ 751 */
752 op->map = NULL; 752 op->map = NULL;
1052{ 1052{
1053 int tmp_loop; 1053 int tmp_loop;
1054 1054
1055 if (key == 'q' || key == 'Q') 1055 if (key == 'q' || key == 'Q')
1056 { 1056 {
1057 remove_ob (op); 1057 op->remove ();
1058 play_again (op); 1058 play_again (op);
1059 return 0; 1059 return 0;
1060 } 1060 }
1061 if (key == 'd' || key == 'D') 1061 if (key == 'd' || key == 'D')
1062 { 1062 {
1104 EXIT_X (tmp) = op->x; 1104 EXIT_X (tmp) = op->x;
1105 EXIT_Y (tmp) = op->y; 1105 EXIT_Y (tmp) = op->y;
1106 enter_exit (op, tmp); /* we don't really care if it succeeded; 1106 enter_exit (op, tmp); /* we don't really care if it succeeded;
1107 * if the map isn't there, then stay on the 1107 * if the map isn't there, then stay on the
1108 * default initial map */ 1108 * default initial map */
1109 free_object (tmp); 1109 tmp->destroy (0);
1110 } 1110 }
1111 else 1111 else
1112 { 1112 {
1113 LOG (llevDebug, "first_map_ext_path not set\n"); 1113 LOG (llevDebug, "first_map_ext_path not set\n");
1114 } 1114 }
1124 { 1124 {
1125 shstr name = op->name; 1125 shstr name = op->name;
1126 int x = op->x, y = op->y; 1126 int x = op->x, y = op->y;
1127 1127
1128 remove_statbonus (op); 1128 remove_statbonus (op);
1129 remove_ob (op); 1129 op->remove ();
1130 op->arch = get_player_archetype (op->arch); 1130 op->arch = get_player_archetype (op->arch);
1131 copy_object (&op->arch->clone, op); 1131 copy_object (&op->arch->clone, op);
1132 op->instantiate (); 1132 op->instantiate ();
1133 op->stats = op->contr->orig_stats; 1133 op->stats = op->contr->orig_stats;
1134 op->name = op->name_pl = name; 1134 op->name = op->name_pl = name;
1873 } 1873 }
1874 1874
1875 /* this should not happen, but sometimes does */ 1875 /* this should not happen, but sometimes does */
1876 if (arrow->nrof == 0) 1876 if (arrow->nrof == 0)
1877 { 1877 {
1878 remove_ob (arrow); 1878 arrow->remove ();
1879 free_object (arrow); 1879 arrow->destroy (0);
1880 return 0; 1880 return 0;
1881 } 1881 }
1882 1882
1883 left = arrow; /* these are arrows left to the player */ 1883 left = arrow; /* these are arrows left to the player */
1884 arrow = get_split_ob (arrow, 1); 1884 arrow = get_split_ob (arrow, 1);
2606 { 2606 {
2607 play_sound_map (op->map, op->x, op->y, SOUND_OB_EVAPORATE); 2607 play_sound_map (op->map, op->x, op->y, SOUND_OB_EVAPORATE);
2608 new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s vibrates violently, then evaporates.", query_name (tmp)); 2608 new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s vibrates violently, then evaporates.", query_name (tmp));
2609 if (op->contr) 2609 if (op->contr)
2610 esrv_del_item (op->contr, tmp->count); 2610 esrv_del_item (op->contr, tmp->count);
2611 remove_ob (tmp); 2611 tmp->remove ();
2612 free_object (tmp); 2612 tmp->destroy (0);
2613 CLEAR_FLAG (op, FLAG_LIFESAVE); 2613 CLEAR_FLAG (op, FLAG_LIFESAVE);
2614 if (op->stats.hp < 0) 2614 if (op->stats.hp < 0)
2615 op->stats.hp = op->stats.maxhp; 2615 op->stats.hp = op->stats.maxhp;
2616 if (op->stats.food < 0) 2616 if (op->stats.food < 0)
2617 op->stats.food = 999; 2617 op->stats.food = 999;
2639 next = op->below; /* Make sure we have a good value, in case 2639 next = op->below; /* Make sure we have a good value, in case
2640 * we remove object 'op' 2640 * we remove object 'op'
2641 */ 2641 */
2642 if (QUERY_FLAG (op, FLAG_UNPAID)) 2642 if (QUERY_FLAG (op, FLAG_UNPAID))
2643 { 2643 {
2644 remove_ob (op); 2644 op->remove ();
2645 op->x = env->x; 2645 op->x = env->x;
2646 op->y = env->y; 2646 op->y = env->y;
2647 if (env->type == PLAYER) 2647 if (env->type == PLAYER)
2648 esrv_del_item (env->contr, op->count); 2648 esrv_del_item (env->contr, op->count);
2649 insert_ob_in_map (op, env->map, NULL, 0); 2649 insert_ob_in_map (op, env->map, NULL, 0);
2946 /* restore player */ 2946 /* restore player */
2947 at = archetype::find ("poisoning"); 2947 at = archetype::find ("poisoning");
2948 tmp = present_arch_in_ob (at, op); 2948 tmp = present_arch_in_ob (at, op);
2949 if (tmp) 2949 if (tmp)
2950 { 2950 {
2951 remove_ob (tmp); 2951 tmp->remove ();
2952 free_object (tmp); 2952 tmp->destroy (0);
2953 new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed"); 2953 new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed");
2954 } 2954 }
2955 2955
2956 at = archetype::find ("confusion"); 2956 at = archetype::find ("confusion");
2957 tmp = present_arch_in_ob (at, op); 2957 tmp = present_arch_in_ob (at, op);
2958 if (tmp) 2958 if (tmp)
2959 { 2959 {
2960 remove_ob (tmp); 2960 tmp->remove ();
2961 free_object (tmp); 2961 tmp->destroy (0);
2962 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); 2962 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer");
2963 } 2963 }
2964 2964
2965 cure_disease (op, 0); /* remove any disease */ 2965 cure_disease (op, 0); /* remove any disease */
2966 op->stats.hp = op->stats.maxhp; 2966 op->stats.hp = op->stats.maxhp;
3178 /* restore player */ 3178 /* restore player */
3179 at = archetype::find ("poisoning"); 3179 at = archetype::find ("poisoning");
3180 tmp = present_arch_in_ob (at, op); 3180 tmp = present_arch_in_ob (at, op);
3181 if (tmp) 3181 if (tmp)
3182 { 3182 {
3183 remove_ob (tmp); 3183 tmp->remove ();
3184 free_object (tmp); 3184 tmp->destroy (0);
3185 new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed"); 3185 new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed");
3186 } 3186 }
3187 3187
3188 at = archetype::find ("confusion"); 3188 at = archetype::find ("confusion");
3189 tmp = present_arch_in_ob (at, op); 3189 tmp = present_arch_in_ob (at, op);
3190 if (tmp) 3190 if (tmp)
3191 { 3191 {
3192 remove_ob (tmp); 3192 tmp->remove ();
3193 free_object (tmp); 3193 tmp->destroy (0);
3194 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); 3194 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer");
3195 } 3195 }
3196 3196
3197 cure_disease (op, 0); /* remove any disease */ 3197 cure_disease (op, 0); /* remove any disease */
3198 3198
3273 check_score (op); 3273 check_score (op);
3274 3274
3275 if (op->contr->ranges[range_golem]) 3275 if (op->contr->ranges[range_golem])
3276 { 3276 {
3277 remove_friendly_object (op->contr->ranges[range_golem]); 3277 remove_friendly_object (op->contr->ranges[range_golem]);
3278 remove_ob (op->contr->ranges[range_golem]); 3278 op->contr->ranges[range_golem]->remove ();
3279 free_object (op->contr->ranges[range_golem]); 3279 op->contr->ranges[range_golem]->destroy (0);
3280 op->contr->ranges[range_golem] = 0; 3280 op->contr->ranges[range_golem] = 0;
3281 } 3281 }
3282 3282
3283 loot_object (op); /* Remove some of the items for good */ 3283 loot_object (op); /* Remove some of the items for good */
3284 remove_ob (op); 3284 op->remove ();
3285 op->direction = 0; 3285 op->direction = 0;
3286 3286
3287 if (!QUERY_FLAG (op, FLAG_WAS_WIZ) && op->stats.exp) 3287 if (!QUERY_FLAG (op, FLAG_WAS_WIZ) && op->stats.exp)
3288 { 3288 {
3289 delete_character (op->name, 0); 3289 delete_character (op->name, 0);
3342 for (tmp = op->inv; tmp != NULL; tmp = next) 3342 for (tmp = op->inv; tmp != NULL; tmp = next)
3343 { 3343 {
3344 next = tmp->below; 3344 next = tmp->below;
3345 if (tmp->type == EXPERIENCE || tmp->invisible) 3345 if (tmp->type == EXPERIENCE || tmp->invisible)
3346 continue; 3346 continue;
3347 remove_ob (tmp); 3347 tmp->remove ();
3348 tmp->x = op->x, tmp->y = op->y; 3348 tmp->x = op->x, tmp->y = op->y;
3349 if (tmp->type == CONTAINER) 3349 if (tmp->type == CONTAINER)
3350 { /* empty container to ground */ 3350 { /* empty container to ground */
3351 loot_object (tmp); 3351 loot_object (tmp);
3352 } 3352 }
3353 if (!QUERY_FLAG (tmp, FLAG_UNIQUE) && (QUERY_FLAG (tmp, FLAG_STARTEQUIP) || QUERY_FLAG (tmp, FLAG_NO_DROP) || !(RANDOM () % 3))) 3353 if (!QUERY_FLAG (tmp, FLAG_UNIQUE) && (QUERY_FLAG (tmp, FLAG_STARTEQUIP) || QUERY_FLAG (tmp, FLAG_NO_DROP) || !(RANDOM () % 3)))
3354 { 3354 {
3355 if (tmp->nrof > 1) 3355 if (tmp->nrof > 1)
3356 { 3356 {
3357 tmp2 = get_split_ob (tmp, 1 + RANDOM () % (tmp->nrof - 1)); 3357 tmp2 = get_split_ob (tmp, 1 + RANDOM () % (tmp->nrof - 1));
3358 free_object (tmp2); 3358 tmp2->destroy (0);
3359 insert_ob_in_map (tmp, op->map, NULL, 0); 3359 insert_ob_in_map (tmp, op->map, NULL, 0);
3360 } 3360 }
3361 else 3361 else
3362 free_object (tmp); 3362 tmp->destroy (0);
3363 } 3363 }
3364 else 3364 else
3365 insert_ob_in_map (tmp, op->map, NULL, 0); 3365 insert_ob_in_map (tmp, op->map, NULL, 0);
3366 } 3366 }
3367} 3367}
3433 new_draw_info_format (NDI_UNIQUE, 0, op, "You cast %s.", &spob->name); 3433 new_draw_info_format (NDI_UNIQUE, 0, op, "You cast %s.", &spob->name);
3434 3434
3435 cast_spell (op, throw_ob, dir, spob, NULL); 3435 cast_spell (op, throw_ob, dir, spob, NULL);
3436 3436
3437 if (!QUERY_FLAG (throw_ob, FLAG_REMOVED)) 3437 if (!QUERY_FLAG (throw_ob, FLAG_REMOVED))
3438 remove_ob (throw_ob); 3438 throw_ob->remove ();
3439 free_object (throw_ob); 3439 throw_ob->destroy (0);
3440} 3440}
3441 3441
3442void 3442void
3443make_visible (object *op) 3443make_visible (object *op)
3444{ 3444{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines