summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/output.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-12-20 17:58:03 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-12-20 18:08:24 +0100
commit9dfbca5a88a2f5e77e050391fe3a204b36fc04b3 (patch)
tree84ca444439eba963b39d27984831a4c9acb0a023 /crawl-ref/source/output.cc
parent7e4b512c4cf3b6269ddb3748760c8cf050b60b39 (diff)
downloadcrawl-ref-9dfbca5a88a2f5e77e050391fe3a204b36fc04b3.tar.gz
crawl-ref-9dfbca5a88a2f5e77e050391fe3a204b36fc04b3.zip
Redo hud weapon display formatting.
Should now not clear next line by accident, fixing issue #223.
Diffstat (limited to 'crawl-ref/source/output.cc')
-rw-r--r--crawl-ref/source/output.cc40
1 files changed, 19 insertions, 21 deletions
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index ccad9bd3d9..04d4b9a7ca 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -497,39 +497,37 @@ static void _print_stats_ev(int x, int y)
static void _print_stats_wp(int y)
{
- cgotoxy(1, y, GOTO_STAT);
- textcolor(Options.status_caption_colour);
- cprintf("Wp: ");
+ int col;
+ std::string text;
if (you.weapon())
{
const item_def& wpn = *you.weapon();
- textcolor(wpn.colour);
+ col = wpn.colour;
const std::string prefix = menu_colour_item_prefix(wpn);
const int prefcol = menu_colour(wpn.name(DESC_INVENTORY), prefix);
if (prefcol != -1)
- textcolor(prefcol);
+ col = prefcol;
- cprintf("%s",
- wpn.name(DESC_INVENTORY, true, false, true)
- .substr(0, crawl_view.hudsz.x - 4).c_str());
- textcolor(LIGHTGREY);
+ text = wpn.name(DESC_INVENTORY, true, false, true);
+ }
+ else if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BLADE_HANDS)
+ {
+ col = RED;
+ text = "Blade Hands";
}
else
{
- if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BLADE_HANDS)
- {
- textcolor(RED);
- cprintf("Blade Hands");
- textcolor(LIGHTGREY);
- }
- else
- {
- textcolor(LIGHTGREY);
- cprintf("Nothing wielded");
- }
+ col = LIGHTGREY;
+ text = "Nothing wielded";
}
- clear_to_end_of_line();
+ cgotoxy(1, y, GOTO_STAT);
+ textcolor(Options.status_caption_colour);
+ cprintf("Wp: ");
+ textcolor(col);
+ int w = crawl_view.hudsz.x - 4;
+ cprintf("%-*s", w, text.substr(0, w).c_str());
+ textcolor(LIGHTGREY);
}
static void _print_stats_qv(int y)