… | |
… | |
23 | |
23 | |
24 | #include <global.h> |
24 | #include <global.h> |
25 | #include <funcpoint.h> |
25 | #include <funcpoint.h> |
26 | #include <living.h> |
26 | #include <living.h> |
27 | #include <spells.h> |
27 | #include <spells.h> |
|
|
28 | |
|
|
29 | const char *const coins[NUM_COINS + 1] = { "royalty", "platinacoin", "goldcoin", "silvercoin", 0 }; |
28 | |
30 | |
29 | /* the ordering of this is actually doesn't make a difference |
31 | /* the ordering of this is actually doesn't make a difference |
30 | * However, for ease of use, new entries should go at the end |
32 | * However, for ease of use, new entries should go at the end |
31 | * so those people that debug the code that get used to something |
33 | * so those people that debug the code that get used to something |
32 | * being in the location 4 don't get confused. |
34 | * being in the location 4 don't get confused. |
… | |
… | |
536 | * contain any information about object status (worn/cursed/etc.) |
538 | * contain any information about object status (worn/cursed/etc.) |
537 | */ |
539 | */ |
538 | const char * |
540 | const char * |
539 | query_short_name (const object *op) |
541 | query_short_name (const object *op) |
540 | { |
542 | { |
|
|
543 | if (op->name == 0) |
|
|
544 | return "(null)"; |
|
|
545 | |
|
|
546 | if (!op->nrof |
|
|
547 | && !op->weight |
|
|
548 | && !op->title |
|
|
549 | && !is_magical (op) |
|
|
550 | && op->slaying != shstr_money) |
|
|
551 | return op->name; /* To speed things up (or make things slower?) */ |
|
|
552 | |
541 | static dynbuf_text buf; buf.clear (); |
553 | static dynbuf_text buf; buf.clear (); |
542 | |
|
|
543 | if (op->name == NULL) |
|
|
544 | return "(null)"; |
|
|
545 | |
|
|
546 | if (!op->nrof && !op->weight && !op->title && !is_magical (op)) |
|
|
547 | return op->name; /* To speed things up (or make things slower?) */ |
|
|
548 | |
554 | |
549 | buf << (op->nrof <= 1 ? op->name : op->name_pl); |
555 | buf << (op->nrof <= 1 ? op->name : op->name_pl); |
550 | |
556 | |
551 | if (op->title && QUERY_FLAG (op, FLAG_IDENTIFIED)) |
557 | if (op->title && QUERY_FLAG (op, FLAG_IDENTIFIED)) |
552 | buf << ' ' << op->title; |
558 | buf << ' ' << op->title; |
… | |
… | |
565 | if (op->type != SPELLBOOK) |
571 | if (op->type != SPELLBOOK) |
566 | buf.printf (" (lvl %d)", op->level); |
572 | buf.printf (" (lvl %d)", op->level); |
567 | } |
573 | } |
568 | break; |
574 | break; |
569 | |
575 | |
|
|
576 | case ALTAR: |
|
|
577 | case TRIGGER_ALTAR: |
|
|
578 | case IDENTIFY_ALTAR: |
|
|
579 | if (op->slaying == shstr_money) |
|
|
580 | { |
|
|
581 | bool wrap = !!buf.size (); |
|
|
582 | |
|
|
583 | if (wrap) buf << " ["; |
|
|
584 | |
|
|
585 | archetype *coin = 0; |
|
|
586 | |
|
|
587 | for (char const *const *c = coins; *coins; ++c) |
|
|
588 | if ((coin = archetype::find (*c))) |
|
|
589 | if (op->stats.food % coin->value == 0) |
|
|
590 | break; |
|
|
591 | |
|
|
592 | sint32 coins = op->stats.food / coin->value; |
|
|
593 | |
|
|
594 | buf.printf ("drop %d %s", coins, coins == 1 ? &coin->name : &coin->name_pl); |
|
|
595 | |
|
|
596 | if (wrap) buf << ']'; |
|
|
597 | } |
|
|
598 | break; |
|
|
599 | |
570 | case SKILL: |
600 | case SKILL: |
571 | case AMULET: |
601 | case AMULET: |
572 | case RING: |
602 | case RING: |
573 | if (!op->title) |
603 | if (!op->title) |
574 | { |
604 | { |
… | |
… | |
577 | |
607 | |
578 | if (s && *s) |
608 | if (s && *s) |
579 | buf << " " << s; |
609 | buf << " " << s; |
580 | } |
610 | } |
581 | break; |
611 | break; |
|
|
612 | |
582 | default: |
613 | default: |
583 | if (op->magic && ((QUERY_FLAG (op, FLAG_BEEN_APPLIED) && need_identify (op)) || QUERY_FLAG (op, FLAG_IDENTIFIED))) |
614 | if (op->magic && ((QUERY_FLAG (op, FLAG_BEEN_APPLIED) && need_identify (op)) || QUERY_FLAG (op, FLAG_IDENTIFIED))) |
584 | buf.printf (" %+d", op->magic); |
615 | buf.printf (" %+d", op->magic); |
585 | } |
616 | } |
586 | |
617 | |