summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-04-05 15:21:03 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-04-05 15:21:03 +0000
commita3d677965e6a5c80754354d881c3fde7998503ca (patch)
tree9c8b4c00a04389b38077ddf17470e7c71e2c8f0f
parentb35bbebf2c3cfb01dcd429c19412452bb6024593 (diff)
downloadcrawl-ref-a3d677965e6a5c80754354d881c3fde7998503ca.tar.gz
crawl-ref-a3d677965e6a5c80754354d881c3fde7998503ca.zip
Make the toggle actually update the title for V and a.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9582 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/abl-show.cc5
-rw-r--r--crawl-ref/source/dat/database/FAQ.txt2
-rw-r--r--crawl-ref/source/directn.cc28
-rw-r--r--crawl-ref/source/invent.cc4
-rw-r--r--crawl-ref/source/invent.h3
-rw-r--r--crawl-ref/source/item_use.cc5
-rw-r--r--crawl-ref/source/menu.cc29
-rw-r--r--crawl-ref/source/menu.h4
-rw-r--r--crawl-ref/source/mon-util.cc4
-rw-r--r--crawl-ref/source/mon-util.h2
10 files changed, 61 insertions, 25 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index a9fea0082f..ea9a6b2a79 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -1925,8 +1925,11 @@ int choose_ability_menu(const std::vector<talent>& talents)
abil_menu.set_highlighter(NULL);
abil_menu.set_title(
- new MenuEntry(" Ability "
+ new MenuEntry(" Ability - do what? "
"Cost Success"));
+ abil_menu.set_title(
+ new MenuEntry(" Ability - describe what? "
+ "Cost Success"), false);
abil_menu.set_flags(MF_SINGLESELECT | MF_ANYPRINTABLE
| MF_ALWAYS_SHOW_MORE);
diff --git a/crawl-ref/source/dat/database/FAQ.txt b/crawl-ref/source/dat/database/FAQ.txt
index d401d53a92..541a314a7e 100644
--- a/crawl-ref/source/dat/database/FAQ.txt
+++ b/crawl-ref/source/dat/database/FAQ.txt
@@ -11,6 +11,8 @@
# Questions are pushed into a menu in the order the questions are defined
# in this file. Answers need not necessarily be right next to the question,
# but it's easier to read if they are.
+# There may be at most 52 questions, but it is recommended to keep the
+# number much lower than that.
#
# This file is not meant as an easy-access spoiler file, but rather
# intended to answer general questions that crop up from time to time.
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index a151b45e99..f79df0c226 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -523,22 +523,39 @@ void full_describe_view()
// FIXME: Need different title for the opposite toggle:
// "Visible Monsters/Items (select for more detail, '!' to examine):"
std::string title = "";
+ std::string action = "";
if (!list_mons.empty())
- title += "Monsters";
+ {
+ title = "Monsters";
+ action = "view"; // toggle views monster description
+ }
+ bool nonmons = false;
if (!list_items.empty())
{
if (!title.empty())
title += "/";
title += "Items";
+ nonmons = true;
}
if (!list_features.empty())
{
if (!title.empty())
title += "/";
title += "Features";
+ nonmons = true;
}
- title = "Visible " + title + " (select for more detail, '!' to view/travel):";
- desc_menu.set_title( new MenuEntry(title, MEL_TITLE));
+ if (nonmons)
+ {
+ if (!action.empty())
+ action += "/";
+ action += "travel"; // toggle travels to items/features
+ }
+ title = "Visible " + title;
+ std::string title1 = title + " (select to " + action + ", '!' to examine):";
+ title += " (select for more detail, '!' to " + action + "):";
+
+ desc_menu.set_title( new MenuEntry(title, MEL_TITLE), false);
+ desc_menu.set_title( new MenuEntry(title1, MEL_TITLE) );
desc_menu.set_tag("pickup");
desc_menu.set_type(MT_PICKUP); // necessary for sorting of the item submenu
@@ -3029,7 +3046,8 @@ static std::string _get_monster_desc(const monsters *mon)
if (mons_is_sleeping(mon))
{
text += pronoun + " appears to be "
- + (mons_is_confused(mon) ? "sleepwalking" : "resting")
+ + (mons_is_confused(mon, true) ? "sleepwalking"
+ : "resting")
+ ".\n";
}
// Applies to both friendlies and hostiles
@@ -3039,7 +3057,7 @@ static std::string _get_monster_desc(const monsters *mon)
else if (!mons_friendly(mon) && !mons_neutral(mon)
&& mon->foe != MHITYOU && !crawl_state.arena_suspended)
{
- // special case: batty monsters get set to BEH_WANDER as
+ // Special case: batty monsters get set to BEH_WANDER as
// part of their special behaviour.
if (!mons_is_batty(mon))
text += pronoun + " doesn't appear to have noticed you.\n";
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index 7486dc4667..6a7767f64c 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -351,9 +351,9 @@ void InvMenu::set_title_annotator(invtitle_annotator afn)
title_annotate = afn;
}
-void InvMenu::set_title(MenuEntry *t)
+void InvMenu::set_title(MenuEntry *t, bool first)
{
- Menu::set_title(t);
+ Menu::set_title(t, first);
}
void InvMenu::set_preselect(const std::vector<SelItem> *pre)
diff --git a/crawl-ref/source/invent.h b/crawl-ref/source/invent.h
index 366b747ea6..231535c467 100644
--- a/crawl-ref/source/invent.h
+++ b/crawl-ref/source/invent.h
@@ -134,7 +134,7 @@ public:
// effect.
void set_title_annotator(invtitle_annotator fn);
- void set_title(MenuEntry *title);
+ void set_title(MenuEntry *title, bool first = true);
void set_title(const std::string &s);
// Loads items into the menu. If "procfn" is provided, it'll be called
@@ -159,6 +159,7 @@ public:
const menu_sort_condition *find_menu_sort_condition() const;
void sort_menu(std::vector<InvEntry*> &items,
const menu_sort_condition *cond);
+
protected:
bool process_key(int key);
void do_preselect(InvEntry *ie);
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index e20ab461d5..cc1b5f89bd 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -4915,15 +4915,12 @@ void read_scroll(int slot)
if (you.level_type == LEVEL_PANDEMONIUM)
{
if (!item_type_known(scroll))
- {
mpr("You feel momentarily disoriented.");
- id_the_scroll = false;
- }
else
mpr("Your Earth magic cannot map Pandemonium.");
}
else
- id_the_scroll = magic_mapping(50, 90 + random2(11), false);
+ magic_mapping(50, 90 + random2(11), false);
break;
case SCR_TORMENT:
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index d39d1080c6..163170aa95 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -242,13 +242,21 @@ void Menu::set_highlighter( MenuHighlighter *mh )
highlighter = mh;
}
-void Menu::set_title( MenuEntry *e )
+void Menu::set_title( MenuEntry *e, bool first )
{
- if (title != e)
- delete title;
+ if (first)
+ {
+ if (title != e)
+ delete title;
- title = e;
- title->level = MEL_TITLE;
+ title = e;
+ title->level = MEL_TITLE;
+ }
+ else
+ {
+ title2 = e;
+ title2->level = MEL_TITLE;
+ }
}
void Menu::add_entry( MenuEntry *entry )
@@ -338,7 +346,7 @@ bool Menu::process_key( int keyin )
{
sel.clear();
menu_action = (action)((menu_action+1) % ACT_NUM);
-// update_title();
+ update_title();
return (true);
}
@@ -932,9 +940,14 @@ void Menu::draw_title()
void Menu::write_title()
{
- textattr( item_colour(-1, title) );
+ const bool first = (!allow_toggle || menu_action == ACT_EXECUTE);
+ if (!first)
+ ASSERT(title2);
+
+ textattr( item_colour(-1, first ? title : title2) );
- cprintf("%s", title->get_text().c_str());
+ std::string text = (first ? title->get_text() : title2->get_text());
+ cprintf("%s", text.c_str());
if (flags & MF_SHOW_PAGENUMBERS)
{
// The total number of pages is well defined, but the current
diff --git a/crawl-ref/source/menu.h b/crawl-ref/source/menu.h
index d3d358e8ac..034c5df682 100644
--- a/crawl-ref/source/menu.h
+++ b/crawl-ref/source/menu.h
@@ -296,7 +296,7 @@ public:
const formatted_string &get_more() const { return more; }
void set_highlighter( MenuHighlighter *h );
- void set_title( MenuEntry *e );
+ void set_title( MenuEntry *e, bool first = true );
void add_entry( MenuEntry *entry );
void get_selected( std::vector<MenuEntry*> *sel ) const;
@@ -336,6 +336,8 @@ public:
protected:
MenuEntry *title;
+ MenuEntry *title2;
+
int flags;
std::string tag;
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 982c671771..33f462769a 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -2627,10 +2627,10 @@ bool mons_cannot_move(const monsters *m)
return (mons_cannot_act(m) || mons_is_petrifying(m));
}
-bool mons_is_confused(const monsters *m)
+bool mons_is_confused(const monsters *m, bool class_too)
{
return (m->has_ench(ENCH_CONFUSION)
- && !mons_class_flag(m->type, M_CONFUSED));
+ && (class_too || !mons_class_flag(m->type, M_CONFUSED)));
}
bool mons_is_caught(const monsters *m)
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index 116b215a80..77e64f15df 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -760,7 +760,7 @@ bool mons_is_native_in_branch(const monsters *monster,
const branch_type branch = you.where_are_you);
bool mons_is_chaotic(const monsters *mon);
bool mons_is_poisoner(const monsters *mon);
-bool mons_is_confused(const monsters *m);
+bool mons_is_confused(const monsters *m, bool class_too = false);
bool mons_is_caught(const monsters *m);
bool mons_is_sleeping(const monsters *m);
bool mons_is_wandering(const monsters *m);