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

Comparing deliantra/server/common/item.C (file contents):
Revision 1.41 by root, Thu Nov 8 19:43:23 2007 UTC vs.
Revision 1.43 by root, Sun Apr 13 20:21:50 2008 UTC

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
29const 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 */
538const char * 540const char *
539query_short_name (const object *op) 541query_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 case CONVERTER:
580 if (op->slaying == shstr_money)
581 {
582 bool wrap = !!buf.size ();
583
584 if (wrap) buf << " [";
585
586 archetype *coin = 0;
587
588 for (char const *const *c = coins; *coins; ++c)
589 if ((coin = archetype::find (*c)))
590 if (op->stats.food % coin->value == 0)
591 break;
592
593 sint32 coins = op->stats.food / coin->value;
594
595 buf.printf ("drop %d %s", coins, coins == 1 ? &coin->name : &coin->name_pl);
596
597 if (wrap) buf << ']';
598 }
599 break;
600
570 case SKILL: 601 case SKILL:
571 case AMULET: 602 case AMULET:
572 case RING: 603 case RING:
573 if (!op->title) 604 if (!op->title)
574 { 605 {
577 608
578 if (s && *s) 609 if (s && *s)
579 buf << " " << s; 610 buf << " " << s;
580 } 611 }
581 break; 612 break;
613
582 default: 614 default:
583 if (op->magic && ((QUERY_FLAG (op, FLAG_BEEN_APPLIED) && need_identify (op)) || QUERY_FLAG (op, FLAG_IDENTIFIED))) 615 if (op->magic && ((QUERY_FLAG (op, FLAG_BEEN_APPLIED) && need_identify (op)) || QUERY_FLAG (op, FLAG_IDENTIFIED)))
584 buf.printf (" %+d", op->magic); 616 buf.printf (" %+d", op->magic);
585 } 617 }
586 618

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines