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

Comparing deliantra/server/server/apply.C (file contents):
Revision 1.39 by root, Wed Dec 13 00:42:04 2006 UTC vs.
Revision 1.43 by root, Tue Dec 19 05:12:52 2006 UTC

1029 if (sack == NULL || sack->type != CONTAINER) 1029 if (sack == NULL || sack->type != CONTAINER)
1030 { 1030 {
1031 LOG (llevError, "apply_container: %s is not container!\n", sack ? &sack->name : "[nullobject]"); 1031 LOG (llevError, "apply_container: %s is not container!\n", sack ? &sack->name : "[nullobject]");
1032 return 0; 1032 return 0;
1033 } 1033 }
1034 op->contr->last_used = NULL; 1034
1035 op->contr->last_used_id = 0; 1035 op->contr->last_used = 0;
1036 1036
1037 if (sack->env != op) 1037 if (sack->env != op)
1038 { 1038 {
1039 if (sack->other_arch == NULL || sack->env != NULL) 1039 if (sack->other_arch == NULL || sack->env != NULL)
1040 { 1040 {
1041 new_draw_info (NDI_UNIQUE, 0, op, "You must get it first."); 1041 new_draw_info (NDI_UNIQUE, 0, op, "You must get it first.");
1042 return 1; 1042 return 1;
1043 } 1043 }
1044
1044 /* It's on the ground, the problems begin */ 1045 /* It's on the ground, the problems begin */
1045 if (op->container != sack) 1046 if (op->container != sack)
1046 { 1047 {
1047 /* it's closed OR some player has opened it */ 1048 /* it's closed OR some player has opened it */
1048 if (QUERY_FLAG (sack, FLAG_APPLIED)) 1049 if (QUERY_FLAG (sack, FLAG_APPLIED))
1143 apply_container (op, sack); 1144 apply_container (op, sack);
1144 return 1; 1145 return 1;
1145 } 1146 }
1146 } 1147 }
1147 } 1148 }
1149
1148 new_draw_info (NDI_UNIQUE, 0, op, buf); 1150 new_draw_info (NDI_UNIQUE, 0, op, buf);
1151
1149 if (op->contr) 1152 if (op->contr)
1150 op->contr->socket.update_look = 1; 1153 op->contr->socket->floorbox_update ();
1154
1151 return 1; 1155 return 1;
1152} 1156}
1153 1157
1154/** 1158/**
1155 * Eneq(@csd.uu.se): Handle apply on containers. This is for containers 1159 * Eneq(@csd.uu.se): Handle apply on containers. This is for containers
1786 1790
1787 if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED)) 1791 if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED))
1788 { 1792 {
1789 /*exp_gain *= 2; because they just identified it too */ 1793 /*exp_gain *= 2; because they just identified it too */
1790 SET_FLAG (tmp, FLAG_IDENTIFIED); 1794 SET_FLAG (tmp, FLAG_IDENTIFIED);
1795
1791 /* If in a container, update how it looks */ 1796 /* If in a container, update how it looks */
1792 if (tmp->env) 1797 if (tmp->env)
1793 esrv_update_item (UPD_FLAGS | UPD_NAME, op, tmp); 1798 esrv_update_item (UPD_FLAGS | UPD_NAME, op, tmp);
1794 else 1799 else
1795 op->contr->socket.update_look = 1; 1800 op->contr->socket->floorbox_update ();
1796 } 1801 }
1802
1797 change_exp (op, exp_gain, skill_ob->skill, 0); 1803 change_exp (op, exp_gain, skill_ob->skill, 0);
1798 SET_FLAG (tmp, FLAG_NO_SKILL_IDENT); /* so no more xp gained from this book */ 1804 SET_FLAG (tmp, FLAG_NO_SKILL_IDENT); /* so no more xp gained from this book */
1799 } 1805 }
1800} 1806}
1801 1807
1948 new_draw_info_format (NDI_UNIQUE, 0, op, "The spellbook contains the %s level spell %s.", get_levelnumber (spell->level), &spell->name); 1954 new_draw_info_format (NDI_UNIQUE, 0, op, "The spellbook contains the %s level spell %s.", get_levelnumber (spell->level), &spell->name);
1949 1955
1950 if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED)) 1956 if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED))
1951 { 1957 {
1952 identify (tmp); 1958 identify (tmp);
1959
1953 if (tmp->env) 1960 if (tmp->env)
1954 esrv_update_item (UPD_FLAGS | UPD_NAME, op, tmp); 1961 esrv_update_item (UPD_FLAGS | UPD_NAME, op, tmp);
1955 else 1962 else
1956 op->contr->socket.update_look = 1; 1963 op->contr->socket->floorbox_update ();
1957 } 1964 }
1958 1965
1959 /* I removed the check for special_prayer_mark here - it didn't make 1966 /* I removed the check for special_prayer_mark here - it didn't make
1960 * a lot of sense - special prayers are not found in spellbooks, and 1967 * a lot of sense - special prayers are not found in spellbooks, and
1961 * if the player doesn't know the spell, doesn't make a lot of sense that 1968 * if the player doesn't know the spell, doesn't make a lot of sense that
2808 op->destroy (); 2815 op->destroy ();
2809 return 1; 2816 return 1;
2810 } 2817 }
2811 2818
2812 pl->contr->last_used = op; 2819 pl->contr->last_used = op;
2813 pl->contr->last_used_id = op->count;
2814 2820
2815 tmp = manual_apply (pl, op, aflag); 2821 tmp = manual_apply (pl, op, aflag);
2816 if (!quiet) 2822 if (!quiet)
2817 { 2823 {
2818 if (tmp == 0) 2824 if (tmp == 0)
3648 int i; 3654 int i;
3649 3655
3650 switch (op->type) 3656 switch (op->type)
3651 { 3657 {
3652 case SHOP_FLOOR: 3658 case SHOP_FLOOR:
3653 if (!HAS_RANDOM_ITEMS (op)) 3659 if (!op->has_random_items ())
3654 return 0; 3660 return 0;
3655 3661
3656 do 3662 do
3657 { 3663 {
3658 i = 10; /* let's give it 10 tries */ 3664 i = 10; /* let's give it 10 tries */
3735 { 3741 {
3736 invnext = invtmp->below; 3742 invnext = invtmp->below;
3737 3743
3738 if (QUERY_FLAG (invtmp, FLAG_AUTO_APPLY)) 3744 if (QUERY_FLAG (invtmp, FLAG_AUTO_APPLY))
3739 auto_apply (invtmp); 3745 auto_apply (invtmp);
3740 else if (invtmp->type == TREASURE && HAS_RANDOM_ITEMS (invtmp)) 3746 else if (invtmp->type == TREASURE && invtmp->has_random_items ())
3741 { 3747 {
3742 while ((invtmp->stats.hp--) > 0) 3748 while ((invtmp->stats.hp--) > 0)
3743 create_treasure (invtmp->randomitems, invtmp, 0, m->difficulty, 0); 3749 create_treasure (invtmp->randomitems, invtmp, 0, m->difficulty, 0);
3744 3750
3745 invtmp->randomitems = NULL; 3751 invtmp->randomitems = NULL;
3746 } 3752 }
3747 else if (invtmp && invtmp->arch 3753 else if (invtmp && invtmp->arch
3748 && invtmp->type != TREASURE && invtmp->type != SPELL && invtmp->type != CLASS && HAS_RANDOM_ITEMS (invtmp)) 3754 && invtmp->type != TREASURE && invtmp->type != SPELL && invtmp->type != CLASS && invtmp->has_random_items ())
3749 { 3755 {
3750 create_treasure (invtmp->randomitems, invtmp, 0, m->difficulty, 0); 3756 create_treasure (invtmp->randomitems, invtmp, 0, m->difficulty, 0);
3751 /* Need to clear this so that we never try to create 3757 /* Need to clear this so that we never try to create
3752 * treasure again for this object 3758 * treasure again for this object
3753 */ 3759 */
3770 3776
3771 } 3777 }
3772 3778
3773 if (QUERY_FLAG (tmp, FLAG_AUTO_APPLY)) 3779 if (QUERY_FLAG (tmp, FLAG_AUTO_APPLY))
3774 auto_apply (tmp); 3780 auto_apply (tmp);
3775 else if ((tmp->type == TREASURE || (tmp->type == CONTAINER)) && HAS_RANDOM_ITEMS (tmp)) 3781 else if ((tmp->type == TREASURE || (tmp->type == CONTAINER)) && tmp->has_random_items ())
3776 { 3782 {
3777 while ((tmp->stats.hp--) > 0) 3783 while ((tmp->stats.hp--) > 0)
3778 create_treasure (tmp->randomitems, tmp, 0, m->difficulty, 0); 3784 create_treasure (tmp->randomitems, tmp, 0, m->difficulty, 0);
3779 tmp->randomitems = NULL; 3785 tmp->randomitems = NULL;
3780 } 3786 }
3795 * This is a problem for the above objects, because they have counters 3801 * This is a problem for the above objects, because they have counters
3796 * which say how many times to make the treasure. 3802 * which say how many times to make the treasure.
3797 */ 3803 */
3798 else if (tmp && tmp->arch && tmp->type != PLAYER 3804 else if (tmp && tmp->arch && tmp->type != PLAYER
3799 && tmp->type != TREASURE && tmp->type != SPELL 3805 && tmp->type != TREASURE && tmp->type != SPELL
3800 && tmp->type != PLAYER_CHANGER && tmp->type != CLASS && HAS_RANDOM_ITEMS (tmp)) 3806 && tmp->type != PLAYER_CHANGER && tmp->type != CLASS && tmp->has_random_items ())
3801 { 3807 {
3802 create_treasure (tmp->randomitems, tmp, GT_APPLY, m->difficulty, 0); 3808 create_treasure (tmp->randomitems, tmp, GT_APPLY, m->difficulty, 0);
3803 tmp->randomitems = NULL; 3809 tmp->randomitems = NULL;
3804 } 3810 }
3805 } 3811 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines