summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/output.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-21 16:18:19 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-21 16:18:19 +0000
commitfac344b62ebbf48e7b1d2a7b5f0bcdd3608bd4a7 (patch)
tree8cc8a0b1312414c79f2c2d6e3d1e455754be41ea /crawl-ref/source/output.cc
parentb2ea8143ccf52a2cacfa48d19ce2ea603ddaab5e (diff)
downloadcrawl-ref-fac344b62ebbf48e7b1d2a7b5f0bcdd3608bd4a7.tar.gz
crawl-ref-fac344b62ebbf48e7b1d2a7b5f0bcdd3608bd4a7.zip
Eliminated it_name(), in_name(), item_name(). The function to use is
now item_def::name(). Cleaned up a lot of code in the process. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1341 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/output.cc')
-rw-r--r--crawl-ref/source/output.cc40
1 files changed, 16 insertions, 24 deletions
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index ede63e2a61..cccf6e9469 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -337,28 +337,24 @@ void print_stats(void)
cprintf(" ");
#endif
+ gotoxy(40, 13);
+
if (you.equip[EQ_WEAPON] != -1)
{
- gotoxy(40, 13);
- textcolor(you.inv[you.equip[EQ_WEAPON]].colour);
- char str_pass[ ITEMNAME_SIZE ];
- in_name( you.equip[EQ_WEAPON], DESC_INVENTORY, str_pass, false );
- int prefcol = menu_colour(str_pass);
+ const item_def& wpn = you.inv[you.equip[EQ_WEAPON]];
+ textcolor(wpn.colour);
+
+ const int prefcol = menu_colour(wpn.name(DESC_INVENTORY));
if (prefcol != -1)
textcolor(prefcol);
- in_name( you.equip[EQ_WEAPON], DESC_INVENTORY, str_pass,
- Options.terse_hand );
- str_pass[39] = 0;
-
- cprintf("%s", str_pass);
+ cprintf("%s",
+ wpn.name(DESC_INVENTORY, Options.terse_hand).c_str());
textcolor(LIGHTGREY);
}
else
{
- gotoxy(40, 13);
-
if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BLADE_HANDS)
{
textcolor(RED);
@@ -855,7 +851,6 @@ std::vector<formatted_string> get_full_detail(bool calc_unid)
cols.add_formatted(1, buf, true);
{
- char str_pass[ITEMNAME_SIZE];
const int e_order[] =
{
EQ_WEAPON, EQ_BODY_ARMOUR, EQ_SHIELD, EQ_HELMET, EQ_CLOAK,
@@ -874,12 +869,11 @@ std::vector<formatted_string> get_full_detail(bool calc_unid)
if ( you.equip[ e_order[i] ] != -1)
{
- const int inum = you.equip[e_order[i]];
- in_name( inum, DESC_PLAIN, str_pass, true );
- str_pass[38] = 0; // truncate
- const char* colname = colour_to_str(you.inv[inum].colour);
+ const item_def& item = you.inv[you.equip[e_order[i]]];
+ const char* colname = colour_to_str(item.colour);
snprintf(buf, sizeof buf, "%-7s: <%s>%s</%s>",
- slot, colname, str_pass, colname);
+ slot, colname,
+ item.name(DESC_PLAIN).substr(0,38).c_str(), colname);
}
else
{
@@ -1262,7 +1256,6 @@ void print_overview_screen()
cols.add_formatted(1, buf, false);
{
- char str_pass[ITEMNAME_SIZE];
const int e_order[] =
{
EQ_WEAPON, EQ_BODY_ARMOUR, EQ_SHIELD, EQ_HELMET, EQ_CLOAK,
@@ -1281,12 +1274,11 @@ void print_overview_screen()
if ( you.equip[ e_order[i] ] != -1)
{
- const int inum = you.equip[e_order[i]];
- in_name( inum, DESC_PLAIN, str_pass, true );
- str_pass[38] = 0; // truncate
- const char* colname = colour_to_str(you.inv[inum].colour);
+ const item_def& item = you.inv[you.equip[e_order[i]]];
+ const char* colname = colour_to_str(item.colour);
snprintf(buf, sizeof buf, "%-7s: <%s>%s</%s>",
- slot, colname, str_pass, colname);
+ slot, colname,
+ item.name(DESC_PLAIN).substr(0,37).c_str(), colname);
}
else
{