… | |
… | |
586 | |
586 | |
587 | if (QUERY_FLAG (tmp, FLAG_APPLIED)) |
587 | if (QUERY_FLAG (tmp, FLAG_APPLIED)) |
588 | if (apply_special (op, tmp, AP_UNAPPLY | AP_NO_MERGE)) |
588 | if (apply_special (op, tmp, AP_UNAPPLY | AP_NO_MERGE)) |
589 | return; /* can't unapply it */ |
589 | return; /* can't unapply it */ |
590 | |
590 | |
591 | //fprintf (stderr, "ui, on space is %ld\n", op->ms ().volume ());//D |
|
|
592 | |
|
|
593 | /* We are only dropping some of the items. We split the current object |
591 | /* We are only dropping some of the items. We split the current object |
594 | * off |
592 | * off |
595 | */ |
593 | */ |
596 | if (!can_split (op, tmp, nrof)) |
594 | if (!can_split (op, tmp, nrof)) |
597 | return; |
595 | return; |
… | |
… | |
613 | * object that was dropped. |
611 | * object that was dropped. |
614 | * |
612 | * |
615 | * Make sure to check what happened with <obj> after this function returns! |
613 | * Make sure to check what happened with <obj> after this function returns! |
616 | * Otherwise you may leak this object. |
614 | * Otherwise you may leak this object. |
617 | */ |
615 | */ |
618 | |
|
|
619 | void |
616 | void |
620 | drop_object (object *dropper, object *obj) |
617 | drop_object (object *dropper, object *obj) |
621 | { |
618 | { |
622 | if (INVOKE_OBJECT (DROP, obj, ARG_OBJECT (dropper))) |
619 | if (INVOKE_OBJECT (DROP, obj, ARG_OBJECT (dropper))) |
623 | return; |
620 | return; |
… | |
… | |
706 | } |
703 | } |
707 | |
704 | |
708 | if (op->type == PLAYER && op->contr->last_used == tmp) |
705 | if (op->type == PLAYER && op->contr->last_used == tmp) |
709 | op->contr->last_used = tmp->below ? tmp->below |
706 | op->contr->last_used = tmp->below ? tmp->below |
710 | : tmp->above ? tmp->above |
707 | : tmp->above ? tmp->above |
711 | : 0; |
708 | : (object *)0; |
712 | |
709 | |
713 | if (op->container) |
710 | if (op->container) |
714 | { |
711 | { |
715 | if (op->type == PLAYER) |
712 | if (op->type == PLAYER) |
716 | put_object_in_sack (op, op->container, tmp, op->contr->count); |
713 | put_object_in_sack (op, op->container, tmp, op->contr->count); |
… | |
… | |
1145 | buf.printf ("It has %d charges left.\r", stats.food); |
1142 | buf.printf ("It has %d charges left.\r", stats.food); |
1146 | break; |
1143 | break; |
1147 | } |
1144 | } |
1148 | |
1145 | |
1149 | if (materialname && !msg) |
1146 | if (materialname && !msg) |
1150 | buf.printf ("It is made of: %s.\r", &materialname); |
1147 | buf << (nrof > 1 ? "They are made of " : "It is made of ") |
|
|
1148 | << materialname |
|
|
1149 | << '\r'; |
1151 | |
1150 | |
1152 | if (who) |
1151 | if (who) |
1153 | /* Where to wear this item */ |
1152 | /* Where to wear this item */ |
1154 | for (int i = 0; i < NUM_BODY_LOCATIONS; i++) |
1153 | for (int i = 0; i < NUM_BODY_LOCATIONS; i++) |
1155 | if (slot[i].info) |
1154 | if (slot[i].info) |
… | |
… | |
1186 | buf << "This is a buildable item.\r"; |
1185 | buf << "This is a buildable item.\r"; |
1187 | |
1186 | |
1188 | /* Does the object have a message? Don't show message for all object |
1187 | /* Does the object have a message? Don't show message for all object |
1189 | * types - especially if the first entry is a match |
1188 | * types - especially if the first entry is a match |
1190 | */ |
1189 | */ |
|
|
1190 | if (msg) |
|
|
1191 | { |
1191 | if (msg && type != EXIT && type != BOOK && type != CORPSE && !move_on && !has_dialogue ()) |
1192 | if (type != EXIT && type != BOOK && type != CORPSE && !move_on && !has_dialogue ()) |
1192 | { |
1193 | { |
|
|
1194 | buf << '\r'; |
|
|
1195 | |
1193 | /* This is just a hack so when identifying the items, we print |
1196 | /* This is just a hack so when identifying the items, we print |
1194 | * out the extra message |
1197 | * out the extra message |
1195 | */ |
1198 | */ |
1196 | if (need_identify (this) && flag [FLAG_IDENTIFIED]) |
1199 | if (need_identify (this) && flag [FLAG_IDENTIFIED]) |
1197 | buf << "The object has a story:\r"; |
1200 | buf << "The object has a story:\r"; |
1198 | |
1201 | |
1199 | buf << msg << '\n'; |
1202 | buf << msg << '\n'; |
|
|
1203 | } |
1200 | } |
1204 | } |
|
|
1205 | else if (inv && inv->type == SPELL && flag [FLAG_IDENTIFIED] |
|
|
1206 | && (type == SPELLBOOK || type == ROD || type == WAND |
|
|
1207 | || type == ROD || type == POTION || type == SCROLL)) |
|
|
1208 | // for spellbooks and other stuff that conatisn spells, print the spell message, |
|
|
1209 | // unless the object has a custom message |
|
|
1210 | buf << '\r' << inv->msg << '\n'; |
1201 | |
1211 | |
1202 | buf << '\n'; |
1212 | buf << '\n'; |
1203 | |
1213 | |
1204 | return std::string (buf.linearise (), buf.size ()); |
1214 | return std::string (buf.linearise (), buf.size ()); |
1205 | } |
1215 | } |