summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/output.cc
diff options
context:
space:
mode:
authorpauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-11 10:53:20 +0000
committerpauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-11 10:53:20 +0000
commit172fd76cadb63cb41be2758b044b3f16c29a5fbf (patch)
treed4227118067bfdf56d6660eb797d53244fcc7a40 /crawl-ref/source/output.cc
parentd0130f07f42c2755c4b654e0ac70b147b2e5ba48 (diff)
downloadcrawl-ref-172fd76cadb63cb41be2758b044b3f16c29a5fbf.tar.gz
crawl-ref-172fd76cadb63cb41be2758b044b3f16c29a5fbf.zip
redraw overview from scratch after viewing item.
also contains a bunch of other changes for the quiver git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4190 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/output.cc')
-rw-r--r--crawl-ref/source/output.cc58
1 files changed, 48 insertions, 10 deletions
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 8be78aadbb..4b327f57ad 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -41,6 +41,7 @@
#include "newgame.h"
#include "ouch.h"
#include "player.h"
+#include "quiver.h"
#include "religion.h"
#include "skills2.h"
#include "stuff.h"
@@ -458,11 +459,14 @@ static void _print_stats_qv(int y)
textcolor(Options.status_caption_colour);
cprintf("Qv: ");
- int q = you.quiver[get_quiver_type()] = get_current_fire_item();
+ const item_def* item;
+ int q;
+ you.m_quiver->get_desired_item(&item, &q);
- if (q != ENDOFPACK)
+ ASSERT(q >= -1 && q < ENDOFPACK);
+ if (q != -1)
{
- const item_def& quiver = you.inv[q];
+ const item_def& quiver = *item;
textcolor(quiver.colour);
const std::string prefix = menu_colour_item_prefix(quiver);
@@ -475,10 +479,21 @@ static void _print_stats_qv(int y)
quiver.name(DESC_INVENTORY, true)
.substr(0, crawl_view.hudsz.x - 4)
.c_str());
- textcolor(LIGHTGREY);
+ }
+ else if (item != NULL && is_valid_item(*item))
+ {
+ textcolor(item->colour);
+ cprintf("-) %s", item->name(DESC_PLAIN, true).c_str());
+ textcolor(RED);
+ cprintf(" (empty)");
}
else
- textcolor(LIGHTGREY);
+ {
+ textcolor(DARKGREY);
+ cprintf("-) (nothing)");
+ }
+
+ textcolor(LIGHTGREY);
clear_to_end_of_line();
}
@@ -807,9 +822,29 @@ void print_stats(void)
clear_to_end_of_line();
you.redraw_experience = false;
}
- if (you.wield_change) { you.wield_change = false; _print_stats_wp(10); }
- if (you.quiver_change) { you.quiver_change = false; _print_stats_qv(11); }
+ if (you.wield_change)
+ {
+ // weapon_change is set in a billion places; probably not all
+ // of them actually mean the user changed their weapon. Calling
+ // on_weapon_changed redundantly is normally OK; but if the user
+ // is wielding a bow and throwing javelins, the on_weapon_changed
+ // will switch them back to arrows, which will be annoying.
+ // Perhaps there should be another bool besides wield_change
+ // that's set in fewer places?
+ // Also, it's a little bogus to change simulation state in
+ // render code. We should find a better place for this.
+ you.m_quiver->on_weapon_changed();
+ _print_stats_wp(10);
+ }
+
+ if (you.quiver_change || you.wield_change)
+ {
+ _print_stats_qv(11);
+ }
+
+ you.wield_change = false;
+ you.quiver_change = false;
if (you.redraw_status_flags & REDRAW_LINE_1_MASK)
_print_stats_line1(12);
@@ -1675,7 +1710,7 @@ static std::string _overview_screen_title()
// new scrollable status overview screen,
// including stats, mutations etc.
-void print_overview_screen()
+std::vector<MenuEntry *> _get_overview_screen_results()
{
bool calc_unid = false;
formatted_scroller overview;
@@ -1895,12 +1930,15 @@ void print_overview_screen()
}
overview.add_text(" ");
-
overview.add_text(_status_mut_abilities());
+ return overview.show();
+}
+void print_overview_screen()
+{
while (true)
{
- std::vector<MenuEntry *> results = overview.show();
+ std::vector<MenuEntry *> results = _get_overview_screen_results();
if (results.size() == 0)
{
redraw_screen();