summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-13 21:10:05 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-13 21:10:05 +0000
commit725e6975fd33e7e0c164bf757778d3b3cc867f34 (patch)
tree19cc9442f128a7af03697ede44fff9415bf28a57 /crawl-ref/source
parent6d6703ddc09ee848464bdcbb4ae69cbfcda70993 (diff)
downloadcrawl-ref-725e6975fd33e7e0c164bf757778d3b3cc867f34.tar.gz
crawl-ref-725e6975fd33e7e0c164bf757778d3b3cc867f34.zip
Requesting help when choosing race/class jumps you to the appropriate section of the
manual. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1034 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/command.cc10
-rw-r--r--crawl-ref/source/command.h2
-rw-r--r--crawl-ref/source/menu.cc20
-rw-r--r--crawl-ref/source/menu.h1
-rw-r--r--crawl-ref/source/newgame.cc4
5 files changed, 21 insertions, 16 deletions
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 5c5dd851d7..f2e9b37c73 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -692,7 +692,7 @@ static int keyhelp_keyfilter(int ch)
}
static void show_keyhelp_menu(const std::vector<formatted_string> &lines,
- bool with_manual)
+ bool with_manual, int hotkey = 0)
{
formatted_scroller cmd_help;
@@ -788,6 +788,10 @@ static void show_keyhelp_menu(const std::vector<formatted_string> &lines,
fclose(fp);
}
}
+
+ if ( hotkey )
+ cmd_help.jump_to_hotkey(hotkey);
+
cmd_help.show();
}
@@ -813,7 +817,7 @@ void show_targeting_help()
}
-void list_commands(bool wizard)
+void list_commands(bool wizard, int hotkey)
{
if (wizard)
{
@@ -1035,7 +1039,7 @@ void list_commands(bool wizard)
"stashes, and <w>Ctrl-E</w> to erase them.\n",
true, true, cmdhelp_textfilter);
- show_keyhelp_menu(cols.formatted_lines(), true);
+ show_keyhelp_menu(cols.formatted_lines(), true, hotkey);
}
void list_tutorial_help()
diff --git a/crawl-ref/source/command.h b/crawl-ref/source/command.h
index 37ed7353c3..d1155b7f4f 100644
--- a/crawl-ref/source/command.h
+++ b/crawl-ref/source/command.h
@@ -61,7 +61,7 @@ void swap_inv_slots(int slot1, int slot2, bool verbose);
void show_levelmap_help();
void show_targeting_help();
-void list_commands(bool wizard);
+void list_commands(bool wizard, int hotkey = 0);
void list_tutorial_help(void);
// Actually defined in acr.cc; we may want to move this to command.cc
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index 8b312c7878..49f4f52e84 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -1226,6 +1226,15 @@ bool formatted_scroller::line_up()
return false;
}
+bool formatted_scroller::jump_to_hotkey( int keyin )
+{
+ for ( unsigned int i = 0; i < items.size(); ++i )
+ if ( items[i]->is_hotkey(keyin) )
+ return jump_to(i);
+ return false;
+}
+
+
bool formatted_scroller::process_key( int keyin )
{
@@ -1264,16 +1273,7 @@ bool formatted_scroller::process_key( int keyin )
break;
}
default:
- // look for it as a hotkey
- for ( unsigned int i = 0; i < items.size(); ++i )
- {
- // found it
- if ( items[i]->is_hotkey(keyin) )
- {
- repaint = jump_to(i);
- break;
- }
- }
+ repaint = jump_to_hotkey(keyin);
break;
}
diff --git a/crawl-ref/source/menu.h b/crawl-ref/source/menu.h
index 84e0d44df4..3a8eb8769e 100644
--- a/crawl-ref/source/menu.h
+++ b/crawl-ref/source/menu.h
@@ -358,6 +358,7 @@ public:
int hotkey = 0);
virtual void add_item_string(const std::string& s, int hotkey = 0);
virtual void add_text(const std::string& s);
+ virtual bool jump_to_hotkey( int keyin );
virtual ~formatted_scroller();
protected:
virtual bool page_down();
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index 6104e957fb..a2a29570a8 100644
--- a/crawl-ref/source/newgame.cc
+++ b/crawl-ref/source/newgame.cc
@@ -3018,7 +3018,7 @@ spec_query:
if ( keyn == '?' )
{
- list_commands(false);
+ list_commands(false, '1');
return choose_race();
}
@@ -3226,7 +3226,7 @@ job_query:
if ( keyn == '?' )
{
- list_commands(false);
+ list_commands(false, '2');
return choose_class();
}