summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-24 20:52:31 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-24 20:52:31 +0000
commit989c9485083c303472aa7eadc84dd578993f8a9c (patch)
tree36b890167490e2376a9b610ec568d5f418db5b8f
parentb3f9dc0237ef7b87dffd6867b4ffeace74e28851 (diff)
downloadcrawl-ref-989c9485083c303472aa7eadc84dd578993f8a9c.tar.gz
crawl-ref-989c9485083c303472aa7eadc84dd578993f8a9c.zip
Move the mpr version of the monster list to output.cc and add it to
the dumped information in the morgue. Change monster naming to the precise listing of zombie sub types etc. but list monster types in brackets for non-unique named monsters, so you can now find information like the following in your morgue file: "You can see a goblin, an orc, two orc warriors, thirteen friendly orcs, and the friendly Bogrim (orc priest)." Since the concise version of the monster list is still an in-game command ('F'), this also neatly solves the problem of orc players not knowing the type of their followers. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5223 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/docs/options_guide.txt4
-rw-r--r--crawl-ref/init.txt2
-rw-r--r--crawl-ref/source/acr.cc145
-rw-r--r--crawl-ref/source/chardump.cc12
-rw-r--r--crawl-ref/source/initfile.cc13
-rw-r--r--crawl-ref/source/libutil.cc61
-rw-r--r--crawl-ref/source/output.cc205
-rw-r--r--crawl-ref/source/output.h13
-rw-r--r--crawl-ref/source/religion.cc2
9 files changed, 243 insertions, 214 deletions
diff --git a/crawl-ref/docs/options_guide.txt b/crawl-ref/docs/options_guide.txt
index 85be2119a1..38a7979f5c 100644
--- a/crawl-ref/docs/options_guide.txt
+++ b/crawl-ref/docs/options_guide.txt
@@ -1436,8 +1436,8 @@ dump_message_count = 7
files.
dump_order = header,hiscore,stats,misc,notes,inventory,
-dump_order += skills,spells,overview,mutations,messages,screenshot
-dump_order += kills
+dump_order += skills,spells,overview,mutations,messages,screenshot,
+dump_order += monlist,kills
Controls the order of sections in the dump. You can use multiple
dump_order lines - all lines but the first must use
dump_order +=
diff --git a/crawl-ref/init.txt b/crawl-ref/init.txt
index 1c9e5bdf1c..1e31156b5c 100644
--- a/crawl-ref/init.txt
+++ b/crawl-ref/init.txt
@@ -320,7 +320,7 @@ tile_show_items = !?/%=([)X}+\_.
# dump_message_count = 7
# dump_order = header,hiscore,stats,misc,notes,inventory,
# dump_order += turns_by_place,skills,spells,overview,mutations,
-# dump_order += messages,screenshot,kills_by_place,kills
+# dump_order += messages,screenshot,monlist,kills_by_place,kills
##### 5-b Notes #################################
#
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 92d10ac2ca..88d22351ad 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -1706,149 +1706,6 @@ static void _experience_check()
#endif
}
-static bool _mons_hostile(const monsters *mon)
-{
- return (!mons_friendly(mon) && !mons_neutral(mon));
-}
-
-static const char* _get_monster_name(const monsters *mon, bool list_a = false)
-{
- std::string desc = "";
- bool adj = false;
- if (mons_friendly(mon))
- {
- desc += "friendly ";
- adj = true;
- }
- else if (mons_neutral(mon))
- {
- desc += "neutral ";
- adj = true;
- }
-
- if (adj && list_a)
- {
- desc = "a " + desc;
- list_a = false;
- }
- desc += mons_type_name(mon->type, (list_a ? DESC_NOCAP_A : DESC_PLAIN));
-
- return desc.c_str();
-}
-
-// Returns true if the first monster is more aggressive (in terms of
-// hostile/neutral/friendly) than the second or, if both monsters share the
-// same attitude, if the first monster has a lower type.
-// If monster type and attitude are the same, return false.
-static bool _compare_monsters_attitude( const monsters *m1, const monsters *m2 )
-{
- if (_mons_hostile(m1) && !_mons_hostile(m2))
- return (true);
-
- if (mons_neutral(m1))
- {
- if (mons_friendly(m2))
- return (true);
- if (_mons_hostile(m2))
- return (false);
- }
-
- if (mons_friendly(m1) && !mons_friendly(m2))
- return (false);
-
- // If we get here then monsters have the same attitude.
- // FIX ME: replace with difficulty comparison
- return (m1->type < m2->type);
-}
-
-void get_visible_monsters(std::vector<std::string>& describe)
-{
- int ystart = you.y_pos - 9, xstart = you.x_pos - 9;
- int yend = you.y_pos + 9, xend = you.x_pos + 9;
- if ( xstart < 0 ) xstart = 0;
- if ( ystart < 0 ) ystart = 0;
- if ( xend >= GXM ) xend = GXM;
- if ( yend >= GYM ) yend = GYM;
-
- std::vector<const monsters*> mons;
- // monster check
- for ( int y = ystart; y < yend; ++y )
- for ( int x = xstart; x < xend; ++x )
- if ( see_grid(x,y) )
- {
- const unsigned short targ_monst = mgrd[x][y];
- if ( targ_monst != NON_MONSTER )
- {
- const monsters *mon = &menv[targ_monst];
- if ( player_monster_visible(mon)
- && !mons_is_submerged(mon)
- && !mons_is_mimic(mon->type))
- {
- mons.push_back(mon);
- }
- }
- }
-
- if (mons.empty())
- return;
-
- std::sort( mons.begin(), mons.end(), _compare_monsters_attitude );
-
- int count = 0;
- int size = mons.size();
- for (int i = 0; i < size; ++i)
- {
- if (i > 0 && _compare_monsters_attitude(mons[i-1], mons[i]))
- {
- if (count == 1)
- describe.push_back(_get_monster_name(mons[i-1], true));
- else
- {
- describe.push_back(number_in_words(count) + " "
- + pluralise(_get_monster_name(mons[i-1])));
- }
- count = 0;
- }
- count++;
- }
- // handle last monster
- if (mons.size() == 1 ||
- _compare_monsters_attitude(mons[size-2], mons[size-1]))
- {
- describe.push_back(_get_monster_name(mons[size-1], true));
- }
- else
- {
- describe.push_back(number_in_words(count) + " "
- + pluralise(_get_monster_name(mons[size-1])));
- }
-}
-
-static void _mpr_monsters()
-{
- std::vector<std::string> describe;
- get_visible_monsters(describe);
-
- if (describe.empty())
- {
- mpr("There are no monsters in sight!");
- }
- else if (describe.size() == 1)
- {
- mprf("You can see %s.", describe[0].c_str());
- }
- else
- {
- std::string msg = "You can see ";
- msg += comma_separated_line(describe.begin(),
- describe.end(),
- ", and ", ", ");
- msg += ".";
- mpr(msg.c_str());
- }
-
-}
-
static void _print_friendly_pickup_setting(bool was_changed)
{
std::string now = (was_changed? "now " : "");
@@ -2135,7 +1992,7 @@ void process_command( command_type cmd )
break;
case CMD_FULL_VIEW:
- _mpr_monsters();
+ mpr(mpr_monster_list().c_str());
break;
case CMD_WIELD_WEAPON:
diff --git a/crawl-ref/source/chardump.cc b/crawl-ref/source/chardump.cc
index 9199e35024..d83264c6ed 100644
--- a/crawl-ref/source/chardump.cc
+++ b/crawl-ref/source/chardump.cc
@@ -88,6 +88,7 @@ static void sdump_kills(dump_params &);
static void sdump_newline(dump_params &);
static void sdump_overview(dump_params &);
static void sdump_hiscore(dump_params &);
+static void sdump_monster_list(dump_params &);
static void sdump_separator(dump_params &);
#ifdef CLUA_BINDINGS
static void sdump_lua(dump_params &);
@@ -139,6 +140,7 @@ static dump_section_handler dump_handlers[] = {
{ "kills", sdump_kills },
{ "overview", sdump_overview },
{ "hiscore", sdump_hiscore },
+ { "monlist", sdump_monster_list },
// Conveniences for the .crawlrc artist.
{ "", sdump_newline },
@@ -1064,9 +1066,7 @@ static void sdump_kills_by_place(dump_params &par)
}
if (result.length() > 0)
- {
text += header + result + footer + "\n";
- }
}
static void sdump_overview(dump_params &par)
@@ -1089,6 +1089,14 @@ static void sdump_hiscore(dump_params &par)
par.text += "\n\n";
}
+static void sdump_monster_list(dump_params &par)
+{
+ std::string monlist = mpr_monster_list(par.se);
+ trim_string(monlist);
+ par.text += monlist;
+ par.text += "\n\n";
+}
+
static void sdump_mutations(dump_params &par)
{
std::string &text(par.text);
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 2c090643d7..5b8ecad4f2 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -439,7 +439,6 @@ void game_options::new_dump_fields(const std::string &text, bool add)
else
{
for (int f = 0, size = fields.size(); f < size; ++f)
- {
for (int i = 0, dsize = dump_order.size(); i < dsize; ++i)
{
if (dump_order[i] == fields[f])
@@ -448,7 +447,6 @@ void game_options::new_dump_fields(const std::string &text, bool add)
break;
}
}
- }
}
}
@@ -856,8 +854,8 @@ void game_options::reset_options()
// Clear vector options.
dump_order.clear();
new_dump_fields("header,hiscore,stats,misc,inventory,"
- "skills,spells,overview,mutations,messages,screenshot,"
- "kills,notes");
+ "skills,spells,overview,mutations,messages,"
+ "screenshot,monlist,kills,notes");
hp_colour.clear();
hp_colour.push_back(std::pair<int,int>(50, YELLOW));
@@ -2505,10 +2503,9 @@ void game_options::read_option_line(const std::string &str, bool runscript)
}
else if (key == "dump_kill_places")
{
- dump_kill_places =
- field == "none"? KDO_NO_PLACES :
- field == "all" ? KDO_ALL_PLACES :
- KDO_ONE_PLACE;
+ dump_kill_places = (field == "none" ? KDO_NO_PLACES :
+ field == "all" ? KDO_ALL_PLACES
+ : KDO_ONE_PLACE);
}
else if (key == "kill_map")
{
diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc
index 722091bd9a..4a1540ffb4 100644
--- a/crawl-ref/source/libutil.cc
+++ b/crawl-ref/source/libutil.cc
@@ -54,7 +54,7 @@ description_level_type description_type_by_name(const char *desc)
{
if (!desc)
return DESC_PLAIN;
-
+
if (!strcmp("The", desc))
return DESC_CAP_THE;
else if (!strcmp("the", desc))
@@ -124,7 +124,7 @@ void play_sound( const char *file )
// Check whether file exists, is readable, etc.?
if (file && *file)
sndPlaySound(file, SND_ASYNC | SND_NODEFAULT);
-
+
#elif defined(SOUND_PLAY_COMMAND)
char command[255];
command[0] = 0;
@@ -159,7 +159,7 @@ std::string &uppercase(std::string &s)
{
for (unsigned i = 0, sz = s.size(); i < sz; ++i)
s[i] = toupper(s[i]);
-
+
return (s);
}
@@ -167,7 +167,7 @@ std::string &lowercase(std::string &s)
{
for (unsigned i = 0, sz = s.size(); i < sz; ++i)
s[i] = tolower(s[i]);
-
+
return (s);
}
@@ -181,7 +181,7 @@ int ends_with(const std::string &s, const char *suffixes[])
{
if (!suffixes)
return (0);
-
+
for (int i = 0; suffixes[i]; ++i)
if (ends_with(s, suffixes[i]))
return (1 + i);
@@ -210,7 +210,7 @@ bool strip_tag(std::string &s, const std::string &tag, bool skip_padding)
}
return (false);
}
-
+
if ((pos = s.find(" " + tag + " ")) != std::string::npos)
{
// Leave one space intact.
@@ -233,19 +233,19 @@ bool strip_tag(std::string &s, const std::string &tag, bool skip_padding)
std::string strip_tag_prefix(std::string &s, const std::string &tagprefix)
{
std::string::size_type pos = s.find(tagprefix);
-
+
while (pos && pos != std::string::npos && !isspace(s[pos - 1]))
{
pos = s.find(tagprefix, pos + 1);
}
-
+
if (pos == std::string::npos)
return ("");
std::string::size_type ns = s.find(" ", pos);
if (ns == std::string::npos)
ns = s.length();
-
+
const std::string argument =
s.substr(pos + tagprefix.length(), ns - pos - tagprefix.length());
@@ -266,7 +266,7 @@ std::string article_a(const std::string &name, bool lowercase)
{
if (!name.length())
return name;
-
+
const char *a = lowercase? "a " : "A ";
const char *an = lowercase? "an " : "An ";
switch (name[0])
@@ -295,7 +295,7 @@ std::string pluralise(const std::string &name,
if (qualifiers)
{
for (int i = 0; qualifiers[i]; ++i)
- if ((pos = name.find(qualifiers[i])) != std::string::npos
+ if ((pos = name.find(qualifiers[i])) != std::string::npos
&& !ends_with(name, no_qualifier))
{
return pluralise(name.substr(0, pos)) + name.substr(pos);
@@ -307,7 +307,7 @@ std::string pluralise(const std::string &name,
{
return (pluralise(name.substr(0, pos)) + name.substr(pos));
}
-
+
if (ends_with(name, "us"))
{
// Fungus, ufetubus, for instance.
@@ -352,7 +352,7 @@ std::string pluralise(const std::string &name,
// Maybe we should generalise 'manes' to ends_with("es")?
return name;
}
- else if (ends_with(name, "ch") || ends_with(name, "sh")
+ else if (ends_with(name, "ch") || ends_with(name, "sh")
|| ends_with(name, "x"))
{
// To handle cockroaches and sphinxes, and in case there's some monster
@@ -411,7 +411,7 @@ static std::string tens_in_words(unsigned num)
return numbers[num];
int ten = num / 10, digit = num % 10;
- return std::string(tens[ten])
+ return std::string(tens[ten])
+ (digit ? std::string("-") + numbers[digit] : "");
}
@@ -419,7 +419,7 @@ static std::string join_strings(const std::string &a, const std::string &b)
{
if (!a.empty() && !b.empty())
return (a + " " + b);
-
+
return (a.empty() ? b : a);
}
@@ -441,8 +441,9 @@ std::string number_in_words(unsigned num, int pow)
return ("zero");
return join_strings((rest? number_in_words(rest, pow + 3) : ""),
- (thousands? hundreds_in_words(thousands) + pow_in_words(pow)
- : ""));
+ (thousands? hundreds_in_words(thousands)
+ + pow_in_words(pow)
+ : ""));
}
std::string replace_all(std::string s,
@@ -451,7 +452,7 @@ std::string replace_all(std::string s,
{
std::string::size_type start = 0;
std::string::size_type found;
-
+
while ((found = s.find(find, start)) != std::string::npos)
{
s.replace( found, find.length(), repl );
@@ -469,7 +470,7 @@ std::string replace_all_of(std::string s,
{
std::string::size_type start = 0;
std::string::size_type found;
-
+
while ((found = s.find_first_of(tofind, start)) != std::string::npos)
{
s.replace( found, 1, replacement );
@@ -540,9 +541,9 @@ std::vector<std::string> split_string( const std::string &sep,
{
add_segment(segments, s.substr(0, pos),
trim_segments, accept_empty_segments);
-
+
s.erase(0, pos + separator_length);
-
+
if (nsplits > 0)
--nsplits;
}
@@ -553,7 +554,7 @@ std::vector<std::string> split_string( const std::string &sep,
return segments;
}
-// The old school way of doing short delays via low level I/O sync.
+// The old school way of doing short delays via low level I/O sync.
// Good for systems like old versions of Solaris that don't have usleep.
#ifdef NEED_USLEEP
@@ -572,10 +573,10 @@ void usleep(unsigned long time)
}
#endif
-// Not the greatest version of snprintf, but a functional one that's
+// Not the greatest version of snprintf, but a functional one that's
// a bit safer than raw sprintf(). Note that this doesn't do the
-// special behaviour for size == 0, largely because the return value
-// in that case varies depending on which standard is being used (SUSv2
+// special behaviour for size == 0, largely because the return value
+// in that case varies depending on which standard is being used (SUSv2
// returns an unspecified value < 1, whereas C99 allows str == NULL
// and returns the number of characters that would have been written). -- bwr
#ifdef NEED_SNPRINTF
@@ -587,7 +588,7 @@ int snprintf( char *str, size_t size, const char *format, ... )
va_list argp;
va_start( argp, format );
- char *buff = new char [ 10 * size ]; // hopefully enough
+ char *buff = new char [ 10 * size ]; // hopefully enough
if (!buff)
end(1, false, "Out of memory\n");
@@ -595,7 +596,7 @@ int snprintf( char *str, size_t size, const char *format, ... )
strncpy( str, buff, size );
str[ size - 1 ] = 0;
- int ret = strlen( str );
+ int ret = strlen( str );
if ((unsigned int) ret == size - 1 && strlen( buff ) >= size)
ret = -1;
@@ -670,7 +671,7 @@ static bool glob_match( const char *pattern, const char *text, bool icase )
// Try to match exactly at the current text position...
if (!*pattern || glob_match(pattern, text - 1, icase))
return true;
-
+
// Or skip one character in the text and try the wildcard match
// again. If this is the end of the text, the match has failed.
return (t ? glob_match(pattern - 1, text, icase) : false);
@@ -689,7 +690,7 @@ struct glob_info
bool ignore_case;
};
-void *compile_glob_pattern(const char *pattern, bool icase)
+void *compile_glob_pattern(const char *pattern, bool icase)
{
// If we're using simple globs, we need to box the pattern with '*'
std::string s = std::string("*") + pattern + "*";
@@ -723,7 +724,7 @@ void *compile_pattern(const char *pattern, bool icase)
const char *error;
int erroffset;
int flags = icase? PCRE_CASELESS : 0;
- return pcre_compile(pattern,
+ return pcre_compile(pattern,
flags,
&error,
&erroffset,
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 41084a1c79..5fdbcbebe7 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -1012,6 +1012,166 @@ void draw_border(void)
// Monster pane
// ----------------------------------------------------------------------
+static bool _mons_hostile(const monsters *mon)
+{
+ return (!mons_friendly(mon) && !mons_neutral(mon));
+}
+
+static const char* _get_monster_name(const monsters *mon, bool list_a = false)
+{
+ std::string desc = "";
+
+ bool adj = false;
+ if (mons_friendly(mon))
+ {
+ desc += "friendly ";
+ adj = true;
+ }
+ else if (mons_neutral(mon))
+ {
+ desc += "neutral ";
+ adj = true;
+ }
+
+ if (adj && list_a)
+ {
+ desc = (mon->is_named() ? "the " : "a ") + desc;
+ list_a = false;
+ }
+
+ desc += mon->name(list_a ? DESC_NOCAP_A : DESC_PLAIN);
+ if (!(mon->mname).empty())
+ {
+ desc += " (";
+ desc += mons_type_name(mon->type, DESC_PLAIN);
+ desc += ")";
+ }
+
+ return desc.c_str();
+}
+
+// Returns true if the first monster is more aggressive (in terms of
+// hostile/neutral/friendly) than the second, or, if both monsters share the
+// same attitude, if the first monster has a lower type.
+// If monster type and attitude are the same, return false.
+static bool _compare_monsters_attitude( const monsters *m1, const monsters *m2 )
+{
+ if (_mons_hostile(m1) && !_mons_hostile(m2))
+ return (true);
+
+ if (mons_neutral(m1))
+ {
+ if (mons_friendly(m2))
+ return (true);
+ if (_mons_hostile(m2))
+ return (false);
+ }
+
+ if (mons_friendly(m1) && !mons_friendly(m2))
+ return (false);
+
+ // If we get here then monsters have the same attitude.
+ // FIXME: replace with difficulty comparison
+ return (m1->type < m2->type);
+}
+
+static void _get_visible_monsters(std::vector<std::string>& describe)
+{
+ int ystart = you.y_pos - 9, xstart = you.x_pos - 9;
+ int yend = you.y_pos + 9, xend = you.x_pos + 9;
+ if ( xstart < 0 ) xstart = 0;
+ if ( ystart < 0 ) ystart = 0;
+ if ( xend >= GXM ) xend = GXM;
+ if ( yend >= GYM ) yend = GYM;
+
+ std::vector<const monsters*> mons;
+
+ // monster check
+ for (int y = ystart; y < yend; ++y)
+ for (int x = xstart; x < xend; ++x)
+ if (see_grid(x,y))
+ {
+ const unsigned short targ_monst = mgrd[x][y];
+ if (targ_monst != NON_MONSTER)
+ {
+ const monsters *mon = &menv[targ_monst];
+ if (player_monster_visible(mon)
+ && !mons_is_submerged(mon)
+ && !mons_is_mimic(mon->type))
+ {
+ mons.push_back(mon);
+ }
+ }
+ }
+
+ if (mons.empty())
+ return;
+
+ std::sort( mons.begin(), mons.end(), _compare_monsters_attitude );
+
+ int count = 0;
+ int size = mons.size();
+ for (int i = 0; i < size; ++i)
+ {
+ if (i > 0 && _compare_monsters_attitude(mons[i-1], mons[i]))
+ {
+ if (count == 1)
+ describe.push_back(_get_monster_name(mons[i-1], true));
+ else
+ {
+ describe.push_back(number_in_words(count) + " "
+ + pluralise(_get_monster_name(mons[i-1])));
+ }
+ count = 0;
+ }
+ count++;
+ }
+ // handle last monster
+ if (mons.size() == 1
+ || _compare_monsters_attitude(mons[size-2], mons[size-1]))
+ {
+ describe.push_back(_get_monster_name(mons[size-1], true));
+ }
+ else
+ {
+ describe.push_back(number_in_words(count) + " "
+ + pluralise(_get_monster_name(mons[size-1])));
+ }
+}
+
+// If past is true, the messages should be printed in the past tense
+// because they're needed for the morgue dump.
+std::string mpr_monster_list(bool past)
+{
+ std::vector<std::string> describe;
+ _get_visible_monsters(describe);
+
+ std::string msg = "";
+ if (describe.empty())
+ {
+ msg = "There ";
+ msg += (past ? "were" : "are");
+ msg += " no monsters in sight!";
+
+ return (msg);
+ }
+
+ msg = "You ";
+ msg += (past ? "could" : "can");
+ msg += " see ";
+
+ if (describe.size() == 1)
+ msg += describe[0];
+ else
+ {
+ msg += comma_separated_line(describe.begin(), describe.end(),
+ ", and ", ", ");
+ }
+ msg += ".";
+
+ return (msg);
+}
+
#ifndef USE_TILE
// Monster info used by the pane; precomputes some data
@@ -1031,11 +1191,11 @@ class monster_pane_info
// much info?
const monsterentry* me = get_monster_data(m->type);
m_difficulty = me->hpdice[0] * (me->hpdice[1] + (me->hpdice[2]>>1))
- + me->hpdice[3];
+ + me->hpdice[3];
m_brands = 0;
- if (mons_looks_stabbable(m)) m_brands |= 1;
- if (mons_looks_distracted(m)) m_brands |= 2;
+ if (mons_looks_stabbable(m)) m_brands |= 1;
+ if (mons_looks_distracted(m)) m_brands |= 2;
if (m->has_ench(ENCH_BERSERK)) m_brands |= 4;
}
@@ -1083,11 +1243,8 @@ monster_pane_info::less_than(const monster_pane_info& m1,
return false;
}
-void
-monster_pane_info::to_string(
- int count,
- std::string& desc,
- int& desc_color) const
+void monster_pane_info::to_string( int count, std::string& desc,
+ int& desc_color) const
{
std::ostringstream out;
@@ -1327,8 +1484,8 @@ const char *equip_slot_to_name(int equip)
if (equip == EQ_RINGS || equip == EQ_LEFT_RING || equip == EQ_RIGHT_RING)
return "Ring";
- if (equip == EQ_BOOTS &&
- (you.species == SP_CENTAUR || you.species == SP_NAGA))
+ if (equip == EQ_BOOTS
+ && (you.species == SP_CENTAUR || you.species == SP_NAGA))
{
return "Barding";
}
@@ -1821,15 +1978,19 @@ char _get_overview_screen_results()
if (you.intel == you.max_intel)
snprintf(buf, sizeof buf, "Int %2d", you.intel);
else
+ {
snprintf(buf, sizeof buf, "Int <yellow>%2d</yellow> (%d)",
you.intel, you.max_intel);
+ }
cols1.add_formatted(1, buf, false);
if (you.dex == you.max_dex)
snprintf(buf, sizeof buf, "Dex %2d", you.dex);
else
+ {
snprintf(buf, sizeof buf, "Dex <yellow>%2d</yellow> (%d)",
you.dex, you.max_dex);
+ }
cols1.add_formatted(1, buf, false);
snprintf(buf, sizeof buf, "AC %2d" , player_AC());
@@ -1850,9 +2011,9 @@ char _get_overview_screen_results()
char god_colour_tag[20];
god_colour_tag[0] = 0;
std::string godpowers(god_name(you.religion));
- if ( you.religion != GOD_NO_GOD )
+ if (you.religion != GOD_NO_GOD)
{
- if ( player_under_penance() )
+ if (player_under_penance())
strcpy(god_colour_tag, "<red>*");
else
{
@@ -1860,12 +2021,13 @@ char _get_overview_screen_results()
colour_to_str(god_colour(you.religion)));
// piety rankings
int prank = piety_rank() - 1;
- if ( prank < 0 || you.religion == GOD_XOM)
+ if (prank < 0 || you.religion == GOD_XOM)
prank = 0;
+
// Careful about overflow. We erase some of the god's name
// if necessary.
- godpowers = godpowers.substr(0, 29 - prank) + " " +
- std::string(prank, '*');
+ godpowers = godpowers.substr(0, 29 - prank)
+ + " " + std::string(prank, '*');
}
}
@@ -1878,7 +2040,8 @@ char _get_overview_screen_results()
(you.experience_level < 27?
make_stringf(", need: %d", xp_needed).c_str() : ""),
god_colour_tag, godpowers.c_str(),
- you.spell_no, player_spell_levels(), (player_spell_levels() == 1) ? "" : "s");
+ you.spell_no, player_spell_levels(),
+ (player_spell_levels() == 1) ? "" : "s");
cols1.add_formatted(3, buf, false);
{
@@ -1897,9 +2060,9 @@ char _get_overview_screen_results()
const int rpois = player_res_poison(calc_unid);
const int relec = player_res_electricity(calc_unid);
const int rsust = player_sust_abil(calc_unid);
- const int rmuta = wearing_amulet(AMU_RESIST_MUTATION, calc_unid)
- || player_mutation_level(MUT_MUTATION_RESISTANCE) == 3
- || you.religion == GOD_ZIN && you.piety >= 150;
+ const int rmuta = (wearing_amulet(AMU_RESIST_MUTATION, calc_unid)
+ || player_mutation_level(MUT_MUTATION_RESISTANCE) == 3
+ || you.religion == GOD_ZIN && you.piety >= 150);
const int rslow = wearing_amulet(AMU_RESIST_SLOW, calc_unid);
@@ -1964,8 +2127,10 @@ char _get_overview_screen_results()
cols.add_formatted(1, buf, false);
if ( scan_randarts(RAP_PREVENT_TELEPORTATION, calc_unid) )
+ {
snprintf(buf, sizeof buf, "\n%sPrev.Telep.: %s",
_determine_color_string(-1), itosym1(1));
+ }
else
{
const int rrtel = !!player_teleport(calc_unid);
@@ -1993,7 +2158,7 @@ char _get_overview_screen_results()
std::vector<formatted_string> blines = cols.formatted_lines();
for (unsigned int i = 0; i < blines.size(); ++i )
{
- // Kind of a hack -- we don't care really what items these
+ // Kind of a hack -- we don't really care what items these
// hotkeys go to. So just pick the first few.
const char hotkey = (i < equip_chars.size()) ? equip_chars[i] : 0;
overview.add_item_formatted_string(blines[i], hotkey);
diff --git a/crawl-ref/source/output.h b/crawl-ref/source/output.h
index c1bc15b614..981bf76251 100644
--- a/crawl-ref/source/output.h
+++ b/crawl-ref/source/output.h
@@ -43,16 +43,17 @@ enum status_redraw_flag_type
};
#ifdef DGL_SIMPLE_MESSAGING
-void update_message_status();
+void update_message_status(void);
#endif
-void update_turn_count();
+void update_turn_count(void);
-void print_stats();
-void print_stats_level();
-void draw_border();
+void print_stats(void);
+void print_stats_level(void);
+void draw_border(void);
+std::string mpr_monster_list(bool past = false);
void redraw_skill(const std::string &your_name, const std::string &class_name);
-void update_monster_pane();
+void update_monster_pane(void);
std::vector<formatted_string> get_full_detail(bool calc_unid, long score = -1);
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index b49ebecc5b..4fe18bfc17 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -1375,7 +1375,7 @@ blessing_done:
snprintf(info, INFO_SIZE, " blesses %s with %s.",
whom.c_str(), result.c_str());
- simple_god_message(info);
+ simple_god_message(info, god);
#ifndef USE_TILE
if (see_follower)