… | |
… | |
1100 | examine_monster (object *op, object *tmp) |
1100 | examine_monster (object *op, object *tmp) |
1101 | { |
1101 | { |
1102 | new_draw_info (NDI_UNIQUE, 0, op, tmp->describe_monster (op).c_str ()); |
1102 | new_draw_info (NDI_UNIQUE, 0, op, tmp->describe_monster (op).c_str ()); |
1103 | } |
1103 | } |
1104 | |
1104 | |
|
|
1105 | static void |
|
|
1106 | describe_dump_object (dynbuf &buf, object *ob) |
|
|
1107 | { |
|
|
1108 | char *txt = dump_object (ob); |
|
|
1109 | for (char *p = txt; *p; ++p) if (*p == '\n') *p = '\r'; |
|
|
1110 | buf << "\n" << txt << "\n"; |
|
|
1111 | |
|
|
1112 | if (!ob->is_arch ()) |
|
|
1113 | describe_dump_object (buf, ob->arch); |
|
|
1114 | } |
|
|
1115 | |
1105 | std::string |
1116 | std::string |
1106 | object::describe (object *who) |
1117 | object::describe (object *who) |
1107 | { |
1118 | { |
1108 | dynbuf_text buf (1024, 1024); |
1119 | dynbuf_text buf (1024, 1024); |
1109 | |
1120 | |
… | |
… | |
1203 | } |
1214 | } |
1204 | } |
1215 | } |
1205 | else if (inv && inv->type == SPELL && flag [FLAG_IDENTIFIED] |
1216 | else if (inv && inv->type == SPELL && flag [FLAG_IDENTIFIED] |
1206 | && (type == SPELLBOOK || type == ROD || type == WAND |
1217 | && (type == SPELLBOOK || type == ROD || type == WAND |
1207 | || type == ROD || type == POTION || type == SCROLL)) |
1218 | || type == ROD || type == POTION || type == SCROLL)) |
1208 | // for spellbooks and other stuff that conatisn spells, print the spell message, |
1219 | // for spellbooks and other stuff that contains spells, print the spell message, |
1209 | // unless the object has a custom message |
1220 | // unless the object has a custom message handled above. |
1210 | buf << '\r' << inv->msg << '\n'; |
1221 | buf << '\r' << inv->msg << '\n'; |
1211 | |
1222 | |
|
|
1223 | // try to display the duration for some potions and scrolls |
|
|
1224 | // this includes change ability potions and group spells, |
|
|
1225 | // but does not handle protection potions |
|
|
1226 | if (inv && inv->type == SPELL && flag [FLAG_IDENTIFIED] |
|
|
1227 | && (type == POTION || type == SCROLL)) |
|
|
1228 | { |
|
|
1229 | object *spell = inv; |
|
|
1230 | |
|
|
1231 | if (spell->subtype == SP_PARTY_SPELL) |
|
|
1232 | spell = spell->other_arch; |
|
|
1233 | |
|
|
1234 | if (spell->subtype == SP_CHANGE_ABILITY) |
|
|
1235 | buf.printf ("\nH<The effect will last about %.10g seconds.>", |
|
|
1236 | TICK2TIME (change_ability_duration (spell, this))); |
|
|
1237 | } |
|
|
1238 | |
1212 | buf << '\n'; |
1239 | buf << '\n'; |
1213 | |
1240 | |
1214 | /* the dungeon master additionally gets a complete dump */ |
1241 | // the dungeon master additionally gets a complete dump |
1215 | if (who && who->flag [FLAG_WIZ]) |
1242 | if (who && who->flag [FLAG_WIZ]) |
1216 | { |
1243 | { |
1217 | char *ob = dump_object (this); |
1244 | buf << "\nT<Object>\n"; |
1218 | for (char *p = ob; *p; ++p) if (*p == '\n') *p = '\r'; |
1245 | describe_dump_object (buf, this); |
1219 | buf << "\n" << ob << "\n"; |
|
|
1220 | |
1246 | |
1221 | ob = dump_object (arch); |
1247 | if (inv) |
1222 | for (char *p = ob; *p; ++p) if (*p == '\n') *p = '\r'; |
1248 | { |
1223 | buf << "\n" << ob << "\n"; |
1249 | buf << "\nT<Top Inventory>\n"; |
|
|
1250 | describe_dump_object (buf, inv); |
|
|
1251 | } |
1224 | } |
1252 | } |
1225 | |
1253 | |
1226 | return std::string (buf.linearise (), buf.size ()); |
1254 | return std::string (buf.linearise (), buf.size ()); |
1227 | } |
1255 | } |
1228 | |
1256 | |