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.32 by root, Tue Dec 12 20:53:03 2006 UTC vs.
Revision 1.33 by root, Tue Dec 12 21:39:57 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 op->remove ();
650 op->destroy (0); 649 op->destroy ();
651 continue; 650 continue;
652 } 651 }
653 } 652 }
654 653
655 /* This really needs to be better - we should really give 654 /* This really needs to be better - we should really give
666 if (tmp->type == op->type && tmp->name == op->name) 665 if (tmp->type == op->type && tmp->name == op->name)
667 break; 666 break;
668 667
669 if (tmp) 668 if (tmp)
670 { 669 {
671 op->remove ();
672 op->destroy (0); 670 op->destroy ();
673 LOG (llevError, "give_initial_items: Removing duplicate object %s\n", &tmp->name); 671 LOG (llevError, "give_initial_items: Removing duplicate object %s\n", &tmp->name);
674 continue; 672 continue;
675 } 673 }
674
676 if (op->nrof > 1) 675 if (op->nrof > 1)
677 op->nrof = 1; 676 op->nrof = 1;
678 } 677 }
679 678
680 if (op->type == SPELLBOOK && op->inv) 679 if (op->type == SPELLBOOK && op->inv)
692 CLEAR_FLAG (op, FLAG_CURSED); 691 CLEAR_FLAG (op, FLAG_CURSED);
693 CLEAR_FLAG (op, FLAG_DAMNED); 692 CLEAR_FLAG (op, FLAG_DAMNED);
694 } 693 }
695 if (op->type == SPELL) 694 if (op->type == SPELL)
696 { 695 {
697 op->remove ();
698 op->destroy (0); 696 op->destroy ();
699 continue; 697 continue;
700 } 698 }
701 else if (op->type == SKILL) 699 else if (op->type == SKILL)
702 { 700 {
703 SET_FLAG (op, FLAG_CAN_USE_SKILL); 701 SET_FLAG (op, FLAG_CAN_USE_SKILL);
1097 { 1095 {
1098 object *tmp; 1096 object *tmp;
1099 char mapname[MAX_BUF]; 1097 char mapname[MAX_BUF];
1100 1098
1101 snprintf (mapname, MAX_BUF - 1, "%s/%s", first_map_ext_path, &op->arch->name); 1099 snprintf (mapname, MAX_BUF - 1, "%s/%s", first_map_ext_path, &op->arch->name);
1102 tmp = get_object (); 1100 tmp = object::create ();
1103 EXIT_PATH (tmp) = mapname; 1101 EXIT_PATH (tmp) = mapname;
1104 EXIT_X (tmp) = op->x; 1102 EXIT_X (tmp) = op->x;
1105 EXIT_Y (tmp) = op->y; 1103 EXIT_Y (tmp) = op->y;
1106 enter_exit (op, tmp); /* we don't really care if it succeeded; 1104 enter_exit (op, tmp); /* we don't really care if it succeeded;
1107 * if the map isn't there, then stay on the 1105 * if the map isn't there, then stay on the
1108 * default initial map */ 1106 * default initial map */
1109 tmp->destroy (0); 1107 tmp->destroy ();
1110 } 1108 }
1111 else 1109 else
1112 { 1110 {
1113 LOG (llevDebug, "first_map_ext_path not set\n"); 1111 LOG (llevDebug, "first_map_ext_path not set\n");
1114 } 1112 }
1126 int x = op->x, y = op->y; 1124 int x = op->x, y = op->y;
1127 1125
1128 remove_statbonus (op); 1126 remove_statbonus (op);
1129 op->remove (); 1127 op->remove ();
1130 op->arch = get_player_archetype (op->arch); 1128 op->arch = get_player_archetype (op->arch);
1131 copy_object (&op->arch->clone, op); 1129 op->arch->clone.copy_to (op);
1132 op->instantiate (); 1130 op->instantiate ();
1133 op->stats = op->contr->orig_stats; 1131 op->stats = op->contr->orig_stats;
1134 op->name = op->name_pl = name; 1132 op->name = op->name_pl = name;
1135 op->x = x; 1133 op->x = x;
1136 op->y = y; 1134 op->y = y;
1873 } 1871 }
1874 1872
1875 /* this should not happen, but sometimes does */ 1873 /* this should not happen, but sometimes does */
1876 if (arrow->nrof == 0) 1874 if (arrow->nrof == 0)
1877 { 1875 {
1878 arrow->remove ();
1879 arrow->destroy (0); 1876 arrow->destroy ();
1880 return 0; 1877 return 0;
1881 } 1878 }
1882 1879
1883 left = arrow; /* these are arrows left to the player */ 1880 left = arrow; /* these are arrows left to the player */
1884 arrow = get_split_ob (arrow, 1); 1881 arrow = get_split_ob (arrow, 1);
2604 for (tmp = op->inv; tmp != NULL; tmp = tmp->below) 2601 for (tmp = op->inv; tmp != NULL; tmp = tmp->below)
2605 if (QUERY_FLAG (tmp, FLAG_APPLIED) && QUERY_FLAG (tmp, FLAG_LIFESAVE)) 2602 if (QUERY_FLAG (tmp, FLAG_APPLIED) && QUERY_FLAG (tmp, FLAG_LIFESAVE))
2606 { 2603 {
2607 play_sound_map (op->map, op->x, op->y, SOUND_OB_EVAPORATE); 2604 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)); 2605 new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s vibrates violently, then evaporates.", query_name (tmp));
2606
2609 if (op->contr) 2607 if (op->contr)
2610 esrv_del_item (op->contr, tmp->count); 2608 esrv_del_item (op->contr, tmp->count);
2611 tmp->remove (); 2609
2612 tmp->destroy (0); 2610 tmp->destroy ();
2613 CLEAR_FLAG (op, FLAG_LIFESAVE); 2611 CLEAR_FLAG (op, FLAG_LIFESAVE);
2612
2614 if (op->stats.hp < 0) 2613 if (op->stats.hp < 0)
2615 op->stats.hp = op->stats.maxhp; 2614 op->stats.hp = op->stats.maxhp;
2615
2616 if (op->stats.food < 0) 2616 if (op->stats.food < 0)
2617 op->stats.food = 999; 2617 op->stats.food = 999;
2618
2618 fix_player (op); 2619 fix_player (op);
2619 return 1; 2620 return 1;
2620 } 2621 }
2621 LOG (llevError, "Error: LIFESAVE set without applied object.\n"); 2622 LOG (llevError, "Error: LIFESAVE set without applied object.\n");
2622 CLEAR_FLAG (op, FLAG_LIFESAVE); 2623 CLEAR_FLAG (op, FLAG_LIFESAVE);
2946 /* restore player */ 2947 /* restore player */
2947 at = archetype::find ("poisoning"); 2948 at = archetype::find ("poisoning");
2948 tmp = present_arch_in_ob (at, op); 2949 tmp = present_arch_in_ob (at, op);
2949 if (tmp) 2950 if (tmp)
2950 { 2951 {
2951 tmp->remove ();
2952 tmp->destroy (0); 2952 tmp->destroy ();
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 tmp->remove ();
2961 tmp->destroy (0); 2960 tmp->destroy ();
2962 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); 2961 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer");
2963 } 2962 }
2964 2963
2965 cure_disease (op, 0); /* remove any disease */ 2964 cure_disease (op, 0); /* remove any disease */
2966 op->stats.hp = op->stats.maxhp; 2965 op->stats.hp = op->stats.maxhp;
3176 3175
3177 /* remove any poisoning and confusion the character may be suffering. */ 3176 /* remove any poisoning and confusion the character may be suffering. */
3178 /* restore player */ 3177 /* restore player */
3179 at = archetype::find ("poisoning"); 3178 at = archetype::find ("poisoning");
3180 tmp = present_arch_in_ob (at, op); 3179 tmp = present_arch_in_ob (at, op);
3180
3181 if (tmp) 3181 if (tmp)
3182 { 3182 {
3183 tmp->remove ();
3184 tmp->destroy (0); 3183 tmp->destroy ();
3185 new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed"); 3184 new_draw_info (NDI_UNIQUE, 0, op, "Your body feels cleansed");
3186 } 3185 }
3187 3186
3188 at = archetype::find ("confusion"); 3187 at = archetype::find ("confusion");
3189 tmp = present_arch_in_ob (at, op); 3188 tmp = present_arch_in_ob (at, op);
3190 if (tmp) 3189 if (tmp)
3191 { 3190 {
3192 tmp->remove ();
3193 tmp->destroy (0); 3191 tmp->destroy ();
3194 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer"); 3192 new_draw_info (NDI_UNIQUE, 0, tmp, "Your mind feels clearer");
3195 } 3193 }
3196 3194
3197 cure_disease (op, 0); /* remove any disease */ 3195 cure_disease (op, 0); /* remove any disease */
3198 3196
3273 check_score (op); 3271 check_score (op);
3274 3272
3275 if (op->contr->ranges[range_golem]) 3273 if (op->contr->ranges[range_golem])
3276 { 3274 {
3277 remove_friendly_object (op->contr->ranges[range_golem]); 3275 remove_friendly_object (op->contr->ranges[range_golem]);
3278 op->contr->ranges[range_golem]->remove ();
3279 op->contr->ranges[range_golem]->destroy (0); 3276 op->contr->ranges[range_golem]->destroy ();
3280 op->contr->ranges[range_golem] = 0; 3277 op->contr->ranges[range_golem] = 0;
3281 } 3278 }
3282 3279
3283 loot_object (op); /* Remove some of the items for good */ 3280 loot_object (op); /* Remove some of the items for good */
3284 op->remove (); 3281 op->remove ();
3353 if (!QUERY_FLAG (tmp, FLAG_UNIQUE) && (QUERY_FLAG (tmp, FLAG_STARTEQUIP) || QUERY_FLAG (tmp, FLAG_NO_DROP) || !(RANDOM () % 3))) 3350 if (!QUERY_FLAG (tmp, FLAG_UNIQUE) && (QUERY_FLAG (tmp, FLAG_STARTEQUIP) || QUERY_FLAG (tmp, FLAG_NO_DROP) || !(RANDOM () % 3)))
3354 { 3351 {
3355 if (tmp->nrof > 1) 3352 if (tmp->nrof > 1)
3356 { 3353 {
3357 tmp2 = get_split_ob (tmp, 1 + RANDOM () % (tmp->nrof - 1)); 3354 tmp2 = get_split_ob (tmp, 1 + RANDOM () % (tmp->nrof - 1));
3358 tmp2->destroy (0); 3355 tmp2->destroy ();
3359 insert_ob_in_map (tmp, op->map, NULL, 0); 3356 insert_ob_in_map (tmp, op->map, NULL, 0);
3360 } 3357 }
3361 else 3358 else
3362 tmp->destroy (0); 3359 tmp->destroy ();
3363 } 3360 }
3364 else 3361 else
3365 insert_ob_in_map (tmp, op->map, NULL, 0); 3362 insert_ob_in_map (tmp, op->map, NULL, 0);
3366 } 3363 }
3367} 3364}
3432 if (op->type == PLAYER) 3429 if (op->type == PLAYER)
3433 new_draw_info_format (NDI_UNIQUE, 0, op, "You cast %s.", &spob->name); 3430 new_draw_info_format (NDI_UNIQUE, 0, op, "You cast %s.", &spob->name);
3434 3431
3435 cast_spell (op, throw_ob, dir, spob, NULL); 3432 cast_spell (op, throw_ob, dir, spob, NULL);
3436 3433
3437 if (!QUERY_FLAG (throw_ob, FLAG_REMOVED))
3438 throw_ob->remove ();
3439 throw_ob->destroy (0); 3434 throw_ob->destroy ();
3440} 3435}
3441 3436
3442void 3437void
3443make_visible (object *op) 3438make_visible (object *op)
3444{ 3439{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines