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.125 by root, Thu Aug 16 11:34:29 2007 UTC vs.
Revision 1.126 by root, Fri Aug 17 14:12:10 2007 UTC

94static int 94static int
95apply_id_altar (object *money, object *altar, object *pl) 95apply_id_altar (object *money, object *altar, object *pl)
96{ 96{
97 dynbuf_text buf; 97 dynbuf_text buf;
98 98
99 object *id, *marked;
100
101 if (pl == NULL || pl->type != PLAYER) 99 if (!pl || pl->type != PLAYER)
102 return 0; 100 return 0;
103 101
104 /* Check for MONEY type is a special hack - it prevents 'nothing needs 102 /* Check for MONEY type is a special hack - it prevents 'nothing needs
105 * identifying' from being printed out more than it needs to be. 103 * identifying' from being printed out more than it needs to be.
106 */ 104 */
107 if (!check_altar_sacrifice (altar, money) || money->type != MONEY) 105 if (!check_altar_sacrifice (altar, money) || money->type != MONEY)
108 return 0; 106 return 0;
109 107
110 marked = find_marked_object (pl);
111 /* if the player has a marked item, identify that if it needs to be 108 /* if the player has a marked item, identify that if it needs to be
112 * identified. If it doesn't, then go through the player inventory. 109 * identified. If it doesn't, then go through the player inventory.
113 */ 110 */
111 if (object *marked = find_marked_object (pl))
114 if (marked && !QUERY_FLAG (marked, FLAG_IDENTIFIED) && need_identify (marked)) 112 if (!QUERY_FLAG (marked, FLAG_IDENTIFIED) && need_identify (marked))
115 { 113 {
116 if (operate_altar (altar, &money)) 114 if (operate_altar (altar, &money))
117 { 115 {
118 identify (marked); 116 identify (marked);
119 117
120 buf.printf ("You have %s.", long_desc (marked, pl)); 118 buf.printf ("You have %s.", long_desc (marked, pl));
121 if (marked->msg) 119 if (marked->msg)
122 buf << "The item has a story:\n" << marked->msg; 120 buf << "The item has a story:\n" << marked->msg;
123 121
124 return money == NULL; 122 return !money;
125 } 123 }
126 } 124 }
127 125
128 for (id = pl->inv; id; id = id->below) 126 for (object *id = pl->inv; id; id = id->below)
129 { 127 {
130 if (!QUERY_FLAG (id, FLAG_IDENTIFIED) && !id->invisible && need_identify (id)) 128 if (!QUERY_FLAG (id, FLAG_IDENTIFIED) && !id->invisible && need_identify (id))
131 { 129 {
132 if (operate_altar (altar, &money)) 130 if (operate_altar (altar, &money))
133 { 131 {
134 identify (id); 132 identify (id);
135 133
136 buf.printf ("You have %s.", long_desc (id, pl)); 134 buf.printf ("You have %s.", long_desc (id, pl));
137 if (marked->msg) 135 if (id->msg)
138 buf << "The item has a story:\n" << marked->msg; 136 buf << "The item has a story:\n" << id->msg;
139 137
140 /* If no more money, might as well quit now */ 138 /* If no more money, might as well quit now */
141 if (money == NULL || !check_altar_sacrifice (altar, money)) 139 if (!money || !check_altar_sacrifice (altar, money))
142 break; 140 break;
143 } 141 }
144 else 142 else
145 { 143 {
146 LOG (llevError, "check_id_altar: Couldn't do sacrifice when we should have been able to\n"); 144 LOG (llevError, "check_id_altar: Couldn't do sacrifice when we should have been able to\n");
1557 goto leave; 1555 goto leave;
1558 1556
1559 case RUNE: 1557 case RUNE:
1560 case TRAP: 1558 case TRAP:
1561 if (trap->level && QUERY_FLAG (victim, FLAG_ALIVE)) 1559 if (trap->level && QUERY_FLAG (victim, FLAG_ALIVE))
1562 {
1563 spring_trap (trap, victim); 1560 spring_trap (trap, victim);
1564 }
1565 goto leave; 1561 goto leave;
1566 1562
1567 default: 1563 default:
1568 LOG (llevDebug, "name %s, arch %s, type %d with fly/walk on/off not " 1564 LOG (llevDebug, "name %s, arch %s, type %d with fly/walk on/off not "
1569 "handled in move_apply()\n", &trap->name, &trap->arch->archname, trap->type); 1565 "handled in move_apply()\n", &trap->name, &trap->arch->archname, trap->type);
3859 else 3855 else
3860 who->failmsg (format ("You attempt to light the %s with the %s and fail.", &item->name, &lighter->name)); 3856 who->failmsg (format ("You attempt to light the %s with the %s and fail.", &item->name, &lighter->name));
3861 } 3857 }
3862 else 3858 else
3863 who->failmsg ("You need to mark a lightable object."); 3859 who->failmsg ("You need to mark a lightable object.");
3864
3865} 3860}
3866 3861
3867/** 3862/**
3868 * op made some mistake with a scroll, this takes care of punishment. 3863 * op made some mistake with a scroll, this takes care of punishment.
3869 * scroll_failure()- hacked directly from spell_failure 3864 * scroll_failure()- hacked directly from spell_failure

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines