summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/command.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-15 23:12:03 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-15 23:12:03 +0000
commitfef9f681531bf38dc5a969ba9d502418239f89c4 (patch)
tree254823fdbf77bb313f407aed250963cfa3fb275e /crawl-ref/source/command.cc
parent640681c01424da536a923083e0f39d346e219f44 (diff)
downloadcrawl-ref-fef9f681531bf38dc5a969ba9d502418239f89c4.tar.gz
crawl-ref-fef9f681531bf38dc5a969ba9d502418239f89c4.zip
Move the tutorial descriptions of gods' likes and dislikes into
functions of their own, and reuse them in the god descriptions ('^' screen, when praying at altars, and when searching the database). What's still missing is some sort of "What this god offers you". The current handling makes gods like Lugonu, who have no restrictions and demand very little, appear like no-brainers, when of course the whole thing is much more complicated. I'll also be adding some extended information for the ^ screen (thus for your own god only). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5870 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/command.cc')
-rw-r--r--crawl-ref/source/command.cc106
1 files changed, 64 insertions, 42 deletions
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 2a597731ed..83ebe47426 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -1069,53 +1069,71 @@ static void _recap_feat_keys(std::vector<std::string> &keys)
static bool _do_description(std::string key, std::string footer = "")
{
std::string desc = getLongDescription(key);
+ int width = get_number_of_cols();
+ if (width > 80)
+ width = 80;
- monster_type mon_num = get_monster_by_name(key, true);
- if (mon_num != MONS_PROGRAM_BUG)
+ god_type which_god = string_to_god(key.c_str());
+ if (which_god != GOD_NO_GOD)
{
- if (mons_genus(mon_num) == MONS_DRACONIAN)
+ desc += EOL EOL;
+ desc += print_god_likes(which_god);
+
+ std::string help = print_god_dislikes(which_god);
+ if (!help.empty())
+ {
+ desc += EOL EOL;
+ desc += help;
+ }
+ }
+ else
+ {
+ monster_type mon_num = get_monster_by_name(key, true);
+ if (mon_num != MONS_PROGRAM_BUG)
{
- monsters mon;
+ if (mons_genus(mon_num) == MONS_DRACONIAN)
+ {
+ monsters mon;
- mon.type = mon_num;
+ mon.type = mon_num;
- switch (mon_num)
- {
- case MONS_BLACK_DRACONIAN:
- case MONS_MOTTLED_DRACONIAN:
- case MONS_YELLOW_DRACONIAN:
- case MONS_GREEN_DRACONIAN:
- case MONS_PURPLE_DRACONIAN:
- case MONS_RED_DRACONIAN:
- case MONS_WHITE_DRACONIAN:
- case MONS_PALE_DRACONIAN:
- mon.base_monster = mon_num;
- break;
- default:
- mon.base_monster = MONS_PROGRAM_BUG;
- break;
- }
+ switch (mon_num)
+ {
+ case MONS_BLACK_DRACONIAN:
+ case MONS_MOTTLED_DRACONIAN:
+ case MONS_YELLOW_DRACONIAN:
+ case MONS_GREEN_DRACONIAN:
+ case MONS_PURPLE_DRACONIAN:
+ case MONS_RED_DRACONIAN:
+ case MONS_WHITE_DRACONIAN:
+ case MONS_PALE_DRACONIAN:
+ mon.base_monster = mon_num;
+ break;
+ default:
+ mon.base_monster = MONS_PROGRAM_BUG;
+ break;
+ }
- describe_monsters(mon);
- return (false);
- }
+ describe_monsters(mon);
+ return (false);
+ }
- std::string symbol = "";
- symbol += get_monster_data(mon_num)->showchar;
- if (isupper(symbol[0]))
- symbol = "cap-" + symbol;
+ std::string symbol = "";
+ symbol += get_monster_data(mon_num)->showchar;
+ if (isupper(symbol[0]))
+ symbol = "cap-" + symbol;
- std::string symbol_prefix = "__";
- symbol_prefix += symbol;
- symbol_prefix += "_prefix";
- desc = getLongDescription(symbol_prefix) + desc;
+ std::string symbol_prefix = "__";
+ symbol_prefix += symbol;
+ symbol_prefix += "_prefix";
+ desc = getLongDescription(symbol_prefix) + desc;
- std::string symbol_suffix = "__";
- symbol_suffix += symbol;
- symbol_suffix += "_suffix";
- desc += getLongDescription(symbol_suffix);
+ std::string symbol_suffix = "__";
+ symbol_suffix += symbol;
+ symbol_suffix += "_suffix";
+ desc += getLongDescription(symbol_suffix);
+ }
}
-
key = uppercase_first(key);
key += "$$";
@@ -1124,11 +1142,14 @@ static bool _do_description(std::string key, std::string footer = "")
if (footer != "")
{
- const int numcols = get_number_of_cols();
- int num_lines = linebreak_string2(footer, numcols);
+ int num_lines = linebreak_string2(footer, width);
num_lines++;
- cgotoxy(1, get_number_of_lines() - num_lines);
+ // So the footer doesn't get lonely on large displays. :)
+ int bottom_line = get_number_of_lines();
+ if (bottom_line > 30)
+ bottom_line = 30;
+ cgotoxy(1, bottom_line - num_lines);
cprintf(footer.c_str());
}
@@ -1215,6 +1236,7 @@ static bool _find_description(bool &again, std::string& error_inout)
mprf(MSGCH_PROMPT,
"Describe a %s; partial names and regexps are fine.%s",
type.c_str(), extra.c_str());
+
mpr("Describe what? ", MSGCH_PROMPT);
char buf[80];
if (cancelable_get_line(buf, sizeof(buf)) || buf[0] == '\0')
@@ -1231,7 +1253,7 @@ static bool _find_description(bool &again, std::string& error_inout)
if (regex == "")
{
error_inout = "Description must contain at least "
- "one non-space.";
+ "one non-space.";
return (false);
}
}
@@ -1396,7 +1418,7 @@ static bool _find_description(bool &again, std::string& error_inout)
if (_do_description(key))
{
- if ( getch() == 0 )
+ if (getch() == 0)
getch();
}
}