From bea6f1793e9d3bf56739fefe6b546f837d143130 Mon Sep 17 00:00:00 2001 From: pauldubois Date: Sun, 16 Mar 2008 01:10:45 +0000 Subject: FR [ 1914596 ] Inventory header line git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3665 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/externs.h | 2 ++ crawl-ref/source/invent.cc | 23 ++++++++++++++--------- crawl-ref/source/items.cc | 10 +++++----- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 61b6c6ad8f..c4fb8497b0 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -49,6 +49,8 @@ struct TileFlavor #define MAX_NUM_GODS 21 +#define BURDEN_TO_AUM 0.1f // scale factor for converting burden to aum + extern char info[INFO_SIZE]; // defined in acr.cc {dlb} extern unsigned char show_green; // defined in view.cc {dlb} diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index c0351d28e1..ad67762d7e 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -194,7 +194,7 @@ std::string InvEntry::get_text() const const int mass = item_mass(*item) * item->quantity; tstr << std::setw(get_number_of_cols() - tstr.str().length() - 1) << std::right - << make_stringf("(%d.%d aum)", mass / 10, mass % 10); + << make_stringf("(%.1f aum)", BURDEN_TO_AUM * mass); } return tstr.str(); } @@ -303,16 +303,21 @@ void InvMenu::set_title(const std::string &s) std::string stitle = s; if (stitle.empty()) { + std::ostringstream default_title; const int cap = carrying_capacity(BS_UNENCUMBERED); - char title_buf[200]; - snprintf( title_buf, sizeof title_buf, - "Inventory: %d.%d/%d.%d aum (%d%%, %d/52 slots)", - you.burden / 10, you.burden % 10, - cap / 10, cap % 10, - (you.burden * 100) / cap, - inv_count() ); - stitle = title_buf; + default_title << make_stringf( + "Inventory: %.0f/%.0f aum (%d%%, %d/52 slots)", + BURDEN_TO_AUM * you.burden, + BURDEN_TO_AUM * cap, + (you.burden * 100) / cap, + inv_count() ); + + default_title << std::setw(get_number_of_cols() - default_title.str().length() - 1) + << std::right + << "Press item letter to examine."; + + stitle = default_title.str(); } set_title(new InvTitle(this, stitle, title_annotate)); diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 8afba9f8b8..e736224964 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -1929,14 +1929,14 @@ static std::string drop_menu_invstatus(const Menu *menu) newweight -= item_mass(*item) * se[i]->selected_qty; } - snprintf(buf, sizeof buf, ">%d.%d", newweight / 10, newweight % 10); + snprintf(buf, sizeof buf, ">%.0f", newweight * BURDEN_TO_AUM); s_newweight = buf; } - snprintf(buf, sizeof buf, "(Inv: %d.%d%s/%d.%d aum)", - you.burden / 10, you.burden % 10, - s_newweight.c_str(), - cap / 10, cap % 10); + snprintf(buf, sizeof buf, "(Inv: %.0f%s/%.0f aum)", + you.burden * BURDEN_TO_AUM, + s_newweight.c_str(), + cap * BURDEN_TO_AUM); return (buf); } -- cgit v1.2.3-54-g00ecf