summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-14 15:00:11 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-14 15:00:11 +0000
commitee2afdbd1610f7a204808056bf1a5826085b89c8 (patch)
treedebd3aee3946d707716e13b86e53d3b8539a29a0
parent4d430b2328d6922783a0dd256428de1585691eb9 (diff)
downloadcrawl-ref-ee2afdbd1610f7a204808056bf1a5826085b89c8.tar.gz
crawl-ref-ee2afdbd1610f7a204808056bf1a5826085b89c8.zip
FR 1962016: Make hydra headedness more obvious.
You now get messages like "The seven-headed hydra bites." and "You slice the 12-headed hydra." FR 1963606: Take a note when you pick up a rune (or the Orb!) for the first time. There are a couple of other files I changed, but I can't remember any big stuff, so it was probably just cleanup. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5029 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/command.cc174
-rw-r--r--crawl-ref/source/describe.cc9
-rw-r--r--crawl-ref/source/directn.cc6
-rw-r--r--crawl-ref/source/items.cc6
-rw-r--r--crawl-ref/source/misc.cc35
-rw-r--r--crawl-ref/source/mon-util.cc32
-rw-r--r--crawl-ref/source/mstuff2.cc41
-rw-r--r--crawl-ref/source/notes.cc194
-rw-r--r--crawl-ref/source/notes.h1
-rw-r--r--crawl-ref/source/player.cc43
-rw-r--r--crawl-ref/source/traps.cc19
-rw-r--r--crawl-ref/source/travel.cc23
12 files changed, 313 insertions, 270 deletions
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 527907745b..e2b57b2dd1 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -54,12 +54,9 @@
#include "view.h"
static void _adjust_item(void);
-static void adjust_spells(void);
-static void adjust_ability(void);
-static void list_wizard_commands();
-#ifdef OBSOLETE_COMMAND_HELP
-static const char *command_string( int i );
-#endif
+static void _adjust_spells(void);
+static void _adjust_ability(void);
+static void _list_wizard_commands();
static const char *features[] = {
"Stash-tracking",
@@ -110,9 +107,9 @@ void adjust(void)
if (keyin == 'i')
_adjust_item();
else if (keyin == 's')
- adjust_spells();
+ _adjust_spells();
else if (keyin == 'a')
- adjust_ability();
+ _adjust_ability();
else if (keyin == ESCAPE)
canned_msg( MSG_OK );
else
@@ -189,9 +186,9 @@ static void _adjust_item(void)
}
swap_inv_slots(from_slot, to_slot, true);
-} // end _adjust_item()
+}
-static void adjust_spells(void)
+static void _adjust_spells(void)
{
if (!you.spell_no)
{
@@ -262,9 +259,9 @@ static void adjust_spells(void)
if (spell != SPELL_NO_SPELL)
mprf("%c - %s", input_1, spell_title(spell) );
-} // end adjust_spells()
+} // end _adjust_spells()
-static void adjust_ability(void)
+static void _adjust_ability(void)
{
const std::vector<talent> talents = your_talents(false);
@@ -362,7 +359,7 @@ static void adjust_ability(void)
ability_type tmp = you.ability_letter_table[index2];
you.ability_letter_table[index2] = you.ability_letter_table[index1];
you.ability_letter_table[index1] = tmp;
-}
+} // end _adjust_ability()
void list_armour()
{
@@ -541,7 +538,7 @@ void list_weapons(void)
mpr( wstring.c_str(), MSGCH_EQUIPMENT, colour );
} // end list_weapons()
-static bool cmdhelp_textfilter(const std::string &tag)
+static bool _cmdhelp_textfilter(const std::string &tag)
{
#ifdef WIZARD
if (tag == "wiz")
@@ -597,8 +594,8 @@ static const char *targeting_help_2 =
// start of the contents of the file.
// If auto_hotkeys is true, the function will try to identify
// sections and add appropriate hotkeys.
-static void add_file_to_scroller(FILE* fp, formatted_scroller& m,
- int first_hotkey, bool auto_hotkeys )
+static void _add_file_to_scroller(FILE* fp, formatted_scroller& m,
+ int first_hotkey, bool auto_hotkeys )
{
bool next_is_hotkey = false;
bool is_first = true;
@@ -660,7 +657,7 @@ help_file help_files[] = {
{ NULL, 0, false }
};
-static bool compare_mon_names(MenuEntry *entry_a, MenuEntry* entry_b)
+static bool _compare_mon_names(MenuEntry *entry_a, MenuEntry* entry_b)
{
monster_type *a = static_cast<monster_type*>( entry_a->data );
monster_type *b = static_cast<monster_type*>( entry_b->data );
@@ -675,7 +672,7 @@ static bool compare_mon_names(MenuEntry *entry_a, MenuEntry* entry_b)
// Compare monsters by location-independant level, or by hitdice if
// levels are equal, or by name if both level and hitdice are equal.
-static bool compare_mon_toughness(MenuEntry *entry_a, MenuEntry* entry_b)
+static bool _compare_mon_toughness(MenuEntry *entry_a, MenuEntry* entry_b)
{
monster_type *a = static_cast<monster_type*>( entry_a->data );
monster_type *b = static_cast<monster_type*>( entry_b->data );
@@ -739,9 +736,9 @@ public:
return;
if (sort_alpha)
- std::sort(items.begin(), items.end(), compare_mon_names);
+ std::sort(items.begin(), items.end(), _compare_mon_names);
else
- std::sort(items.begin(), items.end(), compare_mon_toughness);
+ std::sort(items.begin(), items.end(), _compare_mon_toughness);
for (unsigned int i = 0, size = items.size(); i < size; i++)
{
@@ -764,8 +761,8 @@ public:
}
};
-static std::vector<std::string> get_desc_keys(std::string regex,
- db_find_filter filter)
+static std::vector<std::string> _get_desc_keys(std::string regex,
+ db_find_filter filter)
{
std::vector<std::string> key_matches = getLongDescKeysByRegex(regex,
filter);
@@ -790,14 +787,12 @@ static std::vector<std::string> get_desc_keys(std::string regex,
std::vector<std::string> all_matches;
for (unsigned int i = 0, size = tmp.size(); i < size; i++)
if (i == 0 || all_matches[all_matches.size() - 1] != tmp[i])
- {
all_matches.push_back(tmp[i]);
- }
return (all_matches);
}
-static std::vector<std::string> get_monster_keys(unsigned char showchar)
+static std::vector<std::string> _get_monster_keys(unsigned char showchar)
{
std::vector<std::string> mon_keys;
@@ -824,7 +819,7 @@ static std::vector<std::string> get_monster_keys(unsigned char showchar)
return (mon_keys);
}
-static std::vector<std::string> get_god_keys()
+static std::vector<std::string> _get_god_keys()
{
std::vector<std::string> names;
@@ -838,7 +833,7 @@ static std::vector<std::string> get_god_keys()
return names;
}
-static std::vector<std::string> get_branch_keys()
+static std::vector<std::string> _get_branch_keys()
{
std::vector<std::string> names;
@@ -857,30 +852,30 @@ static std::vector<std::string> get_branch_keys()
return names;
}
-static bool monster_filter(std::string key, std::string body)
+static bool _monster_filter(std::string key, std::string body)
{
int mon_num = get_monster_by_name(key.c_str(), true);
return (mon_num == MONS_PROGRAM_BUG || mons_global_level(mon_num) == 0);
}
-static bool spell_filter(std::string key, std::string body)
+static bool _spell_filter(std::string key, std::string body)
{
return (spell_by_name(key) == SPELL_NO_SPELL);
}
-static bool item_filter(std::string key, std::string body)
+static bool _item_filter(std::string key, std::string body)
{
return (item_types_by_name(key).base_type == OBJ_UNASSIGNED);
}
-static bool feature_filter(std::string key, std::string body)
+static bool _feature_filter(std::string key, std::string body)
{
return (feat_by_desc(key) == DNGN_UNSEEN);
}
typedef void (*db_keys_recap)(std::vector<std::string>&);
-static void recap_mon_keys(std::vector<std::string> &keys)
+static void _recap_mon_keys(std::vector<std::string> &keys)
{
for (unsigned int i = 0, size = keys.size(); i < size; i++)
{
@@ -889,7 +884,7 @@ static void recap_mon_keys(std::vector<std::string> &keys)
}
}
-static void recap_feat_keys(std::vector<std::string> &keys)
+static void _recap_feat_keys(std::vector<std::string> &keys)
{
for (unsigned int i = 0, size = keys.size(); i < size; i++)
{
@@ -904,7 +899,7 @@ static void recap_feat_keys(std::vector<std::string> &keys)
}
}
-static bool do_description(std::string key, std::string footer = "")
+static bool _do_description(std::string key, std::string footer = "")
{
std::string desc = getLongDescription(key);
@@ -974,7 +969,7 @@ static bool do_description(std::string key, std::string footer = "")
return (true);
}
-static bool find_description(bool &again, std::string& error_inout)
+static bool _find_description(bool &again, std::string& error_inout)
{
again = true;
@@ -1004,26 +999,26 @@ static bool find_description(bool &again, std::string& error_inout)
case 'M':
type = "monster";
extra = " Enter a single letter to list monsters displayed by "
- "that symbol.";
- filter = monster_filter;
- recap = recap_mon_keys;
+ "that symbol.";
+ filter = _monster_filter;
+ recap = _recap_mon_keys;
doing_mons = true;
break;
case 'S':
type = "spell";
- filter = spell_filter;
+ filter = _spell_filter;
break;
case 'I':
type = "item";
- extra = " Enter a single letter to list items displayed by "
- "that symbol.";
- filter = item_filter;
+ extra = " Enter a single letter to list items displayed by "
+ "that symbol.";
+ filter = _item_filter;
doing_items = true;
break;
case 'F':
type = "feature";
- filter = feature_filter;
- recap = recap_feat_keys;
+ filter = _feature_filter;
+ recap = _recap_feat_keys;
break;
case 'G':
type = "god";
@@ -1093,15 +1088,15 @@ static bool find_description(bool &again, std::string& error_inout)
std::vector<std::string> key_list;
if (by_mon_symbol)
- key_list = get_monster_keys(regex[0]);
+ key_list = _get_monster_keys(regex[0]);
else if (by_item_symbol)
key_list = item_name_list_for_glyph(regex[0]);
else if (doing_gods)
- key_list = get_god_keys();
+ key_list = _get_god_keys();
else if (doing_branches)
- key_list = get_branch_keys();
+ key_list = _get_branch_keys();
else
- key_list = get_desc_keys(regex, filter);
+ key_list = _get_desc_keys(regex, filter);
if (recap != NULL)
(*recap)(key_list);
@@ -1146,9 +1141,7 @@ static bool find_description(bool &again, std::string& error_inout)
return (false);
}
else if (key_list.size() == 1)
- {
- return do_description(key_list[0]);
- }
+ return _do_description(key_list[0]);
if (exact_match)
{
@@ -1156,7 +1149,7 @@ static bool find_description(bool &again, std::string& error_inout)
footer += regex;
footer += "'. To see non-exact matches, press space.";
- if (!do_description(regex, footer))
+ if (!_do_description(regex, footer))
{
DEBUGSTR("do_description() returned false for exact_match");
return (false);
@@ -1234,16 +1227,18 @@ static bool find_description(bool &again, std::string& error_inout)
else
key = *((std::string*) sel[0]->data);
- if (do_description(key))
+ if (_do_description(key))
+ {
if ( getch() == 0 )
getch();
+ }
}
}
return (false);
}
-static int keyhelp_keyfilter(int ch)
+static int _keyhelp_keyfilter(int ch)
{
switch (ch)
{
@@ -1263,7 +1258,7 @@ static int keyhelp_keyfilter(int ch)
do
{
// resets 'again'
- if (find_description(again, error) && getch() == 0 )
+ if (_find_description(again, error) && getch() == 0 )
getch();
if (again)
@@ -1320,9 +1315,9 @@ std::string help_highlighter::get_species_key() const
}
////////////////////////////////////////////////////////////////////////////
-static void show_keyhelp_menu(const std::vector<formatted_string> &lines,
- bool with_manual, bool easy_exit = false,
- int hotkey = 0)
+static void _show_keyhelp_menu(const std::vector<formatted_string> &lines,
+ bool with_manual, bool easy_exit = false,
+ int hotkey = 0)
{
formatted_scroller cmd_help;
@@ -1342,7 +1337,7 @@ static void show_keyhelp_menu(const std::vector<formatted_string> &lines,
if ( with_manual )
{
cmd_help.set_highlighter(new help_highlighter);
- cmd_help.f_keyfilter = keyhelp_keyfilter;
+ cmd_help.f_keyfilter = _keyhelp_keyfilter;
column_composer cols(2, 40);
cols.add_formatted(
@@ -1366,7 +1361,7 @@ static void show_keyhelp_menu(const std::vector<formatted_string> &lines,
#endif
"<w>V</w>: Version information\n"
"<w>Home</w>: This screen\n",
- true, true, cmdhelp_textfilter);
+ true, true, _cmdhelp_textfilter);
cols.add_formatted(
1,
@@ -1392,7 +1387,7 @@ static void show_keyhelp_menu(const std::vector<formatted_string> &lines,
"<w>4</w>. Keys and Commands\n"
"<w>5</w>. List of Enchantments\n"
"<w>6</w>. Inscriptions\n",
- true, true, cmdhelp_textfilter);
+ true, true, _cmdhelp_textfilter);
std::vector<formatted_string> blines = cols.formatted_lines();
unsigned i;
@@ -1424,8 +1419,8 @@ static void show_keyhelp_menu(const std::vector<formatted_string> &lines,
cmd_help.add_item_string("");
// and the file itself
- add_file_to_scroller(fp, cmd_help, help_files[i].hotkey,
- help_files[i].auto_hotkey);
+ _add_file_to_scroller(fp, cmd_help, help_files[i].hotkey,
+ help_files[i].auto_hotkey);
// done with this file
fclose(fp);
@@ -1443,10 +1438,12 @@ void show_specific_help( const std::string &help )
std::vector<std::string> lines = split_string("\n", help, false, true);
std::vector<formatted_string> formatted_lines;
for (int i = 0, size = lines.size(); i < size; ++i)
+ {
formatted_lines.push_back(
formatted_string::parse_string(
- lines[i], true, cmdhelp_textfilter));
- show_keyhelp_menu(formatted_lines, false, true);
+ lines[i], true, _cmdhelp_textfilter));
+ }
+ _show_keyhelp_menu(formatted_lines, false, true);
}
void show_levelmap_help()
@@ -1462,7 +1459,7 @@ void show_targeting_help()
cols.add_formatted(0, targeting_help_1, true, true);
cols.add_formatted(1, targeting_help_2, true, true);
- show_keyhelp_menu(cols.formatted_lines(), false, true);
+ _show_keyhelp_menu(cols.formatted_lines(), false, true);
}
void show_interlevel_travel_branch_help()
@@ -1480,7 +1477,7 @@ void show_stash_search_help()
show_specific_help( getHelpString("stash-search.prompt") );
}
-static void add_formatted_keyhelp(column_composer &cols)
+static void _add_formatted_keyhelp(column_composer &cols)
{
cols.add_formatted(
0,
@@ -1494,7 +1491,7 @@ static void add_formatted_keyhelp(column_composer &cols)
" <w>h</w>-<w>.</w>-<w>l</w>\n"
" /|\\ /|\\\n"
" <w>7 8 9 b j n\n",
- true, true, cmdhelp_textfilter);
+ true, true, _cmdhelp_textfilter);
cols.add_formatted(
0,
@@ -1504,7 +1501,7 @@ static void add_formatted_keyhelp(column_composer &cols)
"<w>5</w> : rest and long search; stops when\n"
" HP or Magic full, something found \n"
" or 100 turns over (<w>Shift-numpad-5</w>)\n",
- true, true, cmdhelp_textfilter);
+ true, true, _cmdhelp_textfilter);
cols.add_formatted(
0,
@@ -1516,7 +1513,7 @@ static void add_formatted_keyhelp(column_composer &cols)
"<w>/ Dir.</w>, <w>Shift-Dir.</w>: long walk\n"
"<w>* Dir.</w>, <w>Ctrl-Dir.</w> : open/close door, \n"
" untrap, attack without move\n",
- true, true, cmdhelp_textfilter);
+ true, true, _cmdhelp_textfilter);
cols.add_formatted(
0,
@@ -1537,7 +1534,7 @@ static void add_formatted_keyhelp(column_composer &cols)
"<lightmagenta>0</lightmagenta> : the Orb of Zot (Carry the Orb \n"
" to the surface and win!)\n"
"<yellow>$</yellow> : gold\n",
- true, true, cmdhelp_textfilter);
+ true, true, _cmdhelp_textfilter);
cols.add_formatted(
0,
@@ -1548,7 +1545,7 @@ static void add_formatted_keyhelp(column_composer &cols)
"<w>t</w> : tell allies (<w>tt</w> to shout)\n"
"<w>`</w> : re-do previous command\n"
"<w>0</w> : repeat next command # of times\n",
- true, true, cmdhelp_textfilter);
+ true, true, _cmdhelp_textfilter);
cols.add_formatted(
0,
@@ -1563,7 +1560,7 @@ static void add_formatted_keyhelp(column_composer &cols)
"<w>=</w> : reassign inventory/spell letters\n"
"<w>_</w> : read messages (online play only)"
" \n",
- true, true, cmdhelp_textfilter);
+ true, true, _cmdhelp_textfilter);
cols.add_formatted(
1,
@@ -1571,7 +1568,7 @@ static void add_formatted_keyhelp(column_composer &cols)
"<w>S</w> : Save game and exit \n"
"<w>Q</w> : Quit without saving\n"
"<w>Ctrl-X</w> : save game without query\n",
- true, true, cmdhelp_textfilter);
+ true, true, _cmdhelp_textfilter);
cols.add_formatted(
1,
@@ -1586,7 +1583,7 @@ static void add_formatted_keyhelp(column_composer &cols)
"<w>)</w> : display current weapons\n"
"<w>\"</w> : display worn jewellery\n"
"<w>E</w> : display experience info\n",
- true, true, cmdhelp_textfilter);
+ true, true, _cmdhelp_textfilter);
cols.add_formatted(
1,
@@ -1599,7 +1596,7 @@ static void add_formatted_keyhelp(column_composer &cols)
"<w>Ctrl-O</w> : show dungeon Overview\n"
"<w>Ctrl-A</w> : toggle auto-pickup\n"
"<w>Ctrl-T</w> : toggle ally pickup behaviour\n",
- true, true, cmdhelp_textfilter);
+ true, true, _cmdhelp_textfilter);
cols.add_formatted(
1,
@@ -1619,7 +1616,7 @@ static void add_formatted_keyhelp(column_composer &cols)
"<w>v</w> : evoke power of wielded item\n"
"<w>W</w>/<w>T</w> : Wear or Take off armour\n"
"<w>P</w>/<w>R</w> : Put on or Remove jewellery\n",
- true, true, cmdhelp_textfilter);
+ true, true, _cmdhelp_textfilter);
cols.add_formatted(
1,
@@ -1630,7 +1627,7 @@ static void add_formatted_keyhelp(column_composer &cols)
"<w>d#</w>: Drop exact number of items \n"
"<w>c</w> : Chop up a corpse \n"
"<w>e</w> : Eat food from floor \n",
- true, true, cmdhelp_textfilter);
+ true, true, _cmdhelp_textfilter);
cols.add_formatted(
1,
@@ -1639,10 +1636,10 @@ static void add_formatted_keyhelp(column_composer &cols)
"help, among them <w>X</w>, <w>x</w>, <w>f</w> (or any \n"
"form of targeting), <w>Ctrl-F</w> and <w>Ctrl-G</w>."
"\n",
- true, true, cmdhelp_textfilter);
+ true, true, _cmdhelp_textfilter);
}
-static void add_formatted_tutorial_help(column_composer &cols)
+static void _add_formatted_tutorial_help(column_composer &cols)
{
unsigned ch;
unsigned short colour;
@@ -1682,7 +1679,7 @@ static void add_formatted_tutorial_help(column_composer &cols)
cols.add_formatted(
0, text.str(),
- true, true, cmdhelp_textfilter);
+ true, true, _cmdhelp_textfilter);
cols.add_formatted(
1,
@@ -1705,14 +1702,14 @@ static void add_formatted_tutorial_help(column_composer &cols)
"If the previous target is still alive\n"
"and in sight, one of <w>f</w> or <w>p</w> fires at it\n"
"again (without selecting anything).\n",
- true, true, cmdhelp_textfilter, 40);
+ true, true, _cmdhelp_textfilter, 40);
}
void list_commands(bool wizard, int hotkey, bool do_redraw_screen)
{
if (wizard)
{
- list_wizard_commands();
+ _list_wizard_commands();
if (do_redraw_screen)
redraw_screen();
@@ -1727,11 +1724,11 @@ void list_commands(bool wizard, int hotkey, bool do_redraw_screen)
cols.set_pagesize(get_number_of_lines() - 1);
if (Options.tutorial_left)
- add_formatted_tutorial_help(cols);
+ _add_formatted_tutorial_help(cols);
else
- add_formatted_keyhelp(cols);
+ _add_formatted_keyhelp(cols);
- show_keyhelp_menu(cols.formatted_lines(), true, false, hotkey);
+ _show_keyhelp_menu(cols.formatted_lines(), true, false, hotkey);
if (do_redraw_screen)
{
@@ -1740,7 +1737,7 @@ void list_commands(bool wizard, int hotkey, bool do_redraw_screen)
}
}
-static void list_wizard_commands()
+static void _list_wizard_commands()
{
#ifdef WIZARD
// 2 columns
@@ -1803,6 +1800,7 @@ static void list_wizard_commands()
"@ : set Str Int Dex\n"
"\\ : make a shop\n",
true, true);
- show_keyhelp_menu(cols.formatted_lines(), false, true);
+
+ _show_keyhelp_menu(cols.formatted_lines(), false, true);
#endif
}
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 802325817b..31a44be7ea 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -512,19 +512,20 @@ int str_to_trap(const std::string &s)
{
ASSERT(NUM_TRAPS == sizeof(trap_names) / sizeof(*trap_names));
+ // allow a couple of synonyms
if (s == "random" || s == "any")
return (TRAP_RANDOM);
else if (s == "suitable")
return (TRAP_INDEPTH);
- else if (s == "nonteleport" || s == "noteleport" || s == "nontele"
- || s == "notele")
+ else if (s == "nonteleport" || s == "noteleport"
+ || s == "nontele" || s == "notele")
+ {
return (TRAP_NONTELEPORT);
+ }
for (int i = 0; i < NUM_TRAPS; ++i)
- {
if (trap_names[i] == s)
return (i);
- }
return (-1);
}
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 4ee98dbd58..1622723094 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -2071,12 +2071,6 @@ static void describe_monster(const monsters *mon)
if (player_beheld_by(mon))
mpr("You are beheld by her song.", MSGCH_EXAMINE);
- // XXX: Not strictly correct if we add any other monster with a
- // variable number of attacks.
- if (mon->has_hydra_multi_attack())
- mprf(MSGCH_EXAMINE, "It has %d head%s.", mon->number,
- (mon->number > 1? "s" : ""));
-
print_wounds(mon);
if (!mons_is_mimic(mon->type) && mons_behaviour_perceptible(mon))
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 7e213f7a0d..fa1daf4aae 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -1448,6 +1448,8 @@ static void _got_item(item_def& item, int quant)
}
item.flags |= ISFLAG_BEEN_IN_INV;
+ take_note(Note(NOTE_FOUND_ORB_OR_RUNE, 0, 0,
+ item.name(DESC_NOCAP_A).c_str()));
}
// Returns quantity of items moved into player's inventory and -1 if
@@ -1607,6 +1609,10 @@ int move_item_to_player( int obj, int quant_got, bool quiet )
if (item.base_type == OBJ_ORBS
&& you.char_direction == GDT_DESCENDING)
{
+ // Take a note!
+ take_note(Note(NOTE_FOUND_ORB_OR_RUNE, 0, 0,
+ item.name(DESC_NOCAP_A).c_str()));
+
if (!quiet)
mpr("Now all you have to do is get back out of the dungeon!");
you.char_direction = GDT_ASCENDING;
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index b5d5eb23e7..6c2ecfa7cd 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -1160,12 +1160,11 @@ void search_around( bool only_adjacent )
if ( max_dist < 1 )
max_dist = 1;
- for ( int srx = you.x_pos - max_dist; srx <= you.x_pos + max_dist; ++srx )
- {
- for ( int sry=you.y_pos - max_dist; sry<=you.y_pos + max_dist; ++sry )
+ for (int srx = you.x_pos - max_dist; srx <= you.x_pos + max_dist; ++srx)
+ for (int sry = you.y_pos - max_dist; sry <= you.y_pos + max_dist; ++sry)
{
// must have LOS, with no translucent walls in the way.
- if ( see_grid_no_trans(srx,sry) )
+ if (see_grid_no_trans(srx, sry))
{
// maybe we want distance() instead of grid_distance()?
int dist = grid_distance(srx, sry, you.x_pos, you.y_pos);
@@ -1177,16 +1176,15 @@ void search_around( bool only_adjacent )
// making this harsher by removing the old +1
int effective = you.skills[SK_TRAPS_DOORS] / (2*dist - 1);
- if (grd[srx][sry] == DNGN_SECRET_DOOR &&
- random2(17) <= effective)
+ if (grd[srx][sry] == DNGN_SECRET_DOOR
+ && random2(17) <= effective)
{
reveal_secret_door(srx, sry);
mpr("You found a secret door!");
- exercise(SK_TRAPS_DOORS, ((coinflip()) ? 2 : 1));
+ exercise(SK_TRAPS_DOORS, (coinflip() ? 2 : 1));
}
-
- if (grd[srx][sry] == DNGN_UNDISCOVERED_TRAP &&
- random2(17) <= effective)
+ else if (grd[srx][sry] == DNGN_UNDISCOVERED_TRAP
+ && random2(17) <= effective)
{
i = trap_at_xy(srx, sry);
@@ -1194,7 +1192,7 @@ void search_around( bool only_adjacent )
{
grd[srx][sry] = trap_category(env.trap[i].type);
mpr("You found a trap!");
- exercise(SK_TRAPS_DOORS, ((coinflip()) ? 2 : 1));
+ exercise(SK_TRAPS_DOORS, (coinflip() ? 2 : 1));
}
else
{
@@ -1209,7 +1207,6 @@ void search_around( bool only_adjacent )
}
}
}
- }
return;
} // end search_around()
@@ -1441,8 +1438,7 @@ static void climb_message(dungeon_feature_type stair, bool going_up,
else
{
mprf("You %s downwards.", you.flight_mode() == FL_FLY? "fly" :
- (player_is_airborne()? "float" :
- "slide"));
+ (player_is_airborne()? "float" : "slide"));
}
}
else
@@ -1471,11 +1467,8 @@ static void set_entry_cause(entry_cause_type default_cause,
{
ASSERT(default_cause != NUM_ENTRY_CAUSE_TYPES);
- if (!(old_level_type != you.level_type
- || you.entry_cause == EC_UNKNOWN))
- {
+ if (old_level_type == you.level_type && you.entry_cause != EC_UNKNOWN)
return;
- }
if (crawl_state.is_god_acting())
{
@@ -1585,8 +1578,8 @@ void up_stairs(dungeon_feature_type force_stair,
// check before that one. -- bwr
if (!player_is_airborne()
&& you.duration[DUR_CONF]
- && (stair_find >= DNGN_STONE_STAIRS_UP_I
- && stair_find <= DNGN_STONE_STAIRS_UP_III)
+ && stair_find >= DNGN_STONE_STAIRS_UP_I
+ && stair_find <= DNGN_STONE_STAIRS_UP_III
&& random2(100) > you.dex)
{
mpr("In your confused state, you trip and fall back down the stairs.");
@@ -2012,7 +2005,7 @@ void down_stairs( int old_level, dungeon_feature_type force_stair,
{
std::string lname = make_filename(you.your_name, you.your_level,
you.where_are_you,
- you.level_type, false );
+ you.level_type, false);
#if DEBUG_DIAGNOSTICS
mprf( MSGCH_DIAGNOSTICS, "Deleting: %s", lname.c_str() );
#endif
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index a10a56b0ab..2ed46d37f8 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -730,7 +730,7 @@ mon_attack_def mons_attack_spec(const monsters *mons, int attk_number)
int mc = mons->type;
const bool zombified = mons_is_zombified(mons);
- if ((attk_number < 0 || attk_number > 3) || mons->has_hydra_multi_attack())
+ if (attk_number < 0 || attk_number > 3 || mons->has_hydra_multi_attack())
attk_number = 0;
if (mc == MONS_PLAYER_GHOST || mc == MONS_PANDEMONIUM_DEMON)
@@ -1690,6 +1690,32 @@ static std::string _str_monam(const monsters& mon, description_level_type desc,
result += draconian_colour_name(mon.base_monster) + " ";
break;
+ case MONS_HYDRA:
+ if (mon.number < 1 || desc == DESC_PLAIN || desc == DESC_DBNAME)
+ break;
+
+ if (mon.number < 11)
+ {
+ result += (mon.number == 1) ? "one" :
+ (mon.number == 2) ? "two" :
+ (mon.number == 3) ? "three" :
+ (mon.number == 4) ? "four" :
+ (mon.number == 5) ? "five" :
+ (mon.number == 6) ? "six" :
+ (mon.number == 7) ? "seven" :
+ (mon.number == 8) ? "eight" :
+ (mon.number == 9) ? "nine"
+ : "ten";
+ }
+ else
+ {
+ snprintf(info, INFO_SIZE, "%d", mon.number);
+ result += info;
+ }
+
+ result += "-headed ";
+ break;
+
default:
break;
}
@@ -4546,8 +4572,8 @@ void monsters::load_spells(mon_spellbook_type book)
bool monsters::has_hydra_multi_attack() const
{
- return (type == MONS_HYDRA ||
- (mons_is_zombified(this) && base_monster == MONS_HYDRA));
+ return (type == MONS_HYDRA
+ || (mons_is_zombified(this) && base_monster == MONS_HYDRA));
}
bool monsters::has_ench(enchant_type ench) const
diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc
index 53efe61242..1be90d48ca 100644
--- a/crawl-ref/source/mstuff2.cc
+++ b/crawl-ref/source/mstuff2.cc
@@ -650,7 +650,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast)
for (sumcount = 0; sumcount < sumcount2; sumcount++)
{
create_monster(
- mgen_data( summon_any_demon(DEMON_LESSER),
+ mgen_data( summon_any_demon(DEMON_LESSER),
SAME_ATTITUDE(monster),
duration, monster->pos(),
monster->foe ));
@@ -692,7 +692,7 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast)
for (int i = 0; i < sumcount2; ++i)
{
create_monster(
- mgen_data(MONS_WANDERING_MUSHROOM,
+ mgen_data(MONS_WANDERING_MUSHROOM,
SAME_ATTITUDE(monster),
duration,
monster->pos(),
@@ -735,10 +735,10 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast)
for (sumcount = 0; sumcount < sumcount2; sumcount++)
{
create_monster(
- mgen_data(summon_any_demon(DEMON_GREATER),
+ mgen_data(summon_any_demon(DEMON_GREATER),
SAME_ATTITUDE(monster),
duration,
- monster->pos(),
+ monster->pos(),
monster->foe));
}
return;
@@ -1114,21 +1114,24 @@ void setup_dragon(struct monsters *monster, struct bolt &pbolt)
break;
}
- pbolt.range = 4;
- pbolt.rangeMax = 13;
- pbolt.damage = dice_def( 3, (monster->hit_dice * 2) );
+ pbolt.range = 4;
+ pbolt.rangeMax = 13;
+ pbolt.damage = dice_def( 3, (monster->hit_dice * 2) );
pbolt.damage.size = scaling * pbolt.damage.size / 100;
- pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP);
- pbolt.hit = 30;
+ pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP);
+ pbolt.hit = 30;
pbolt.beam_source = monster_index(monster);
- pbolt.thrower = KILL_MON;
- pbolt.is_beam = true;
-
- // accuracy is halved if the dragon is attacking a target that's
- // wielding a weapon of dragon slaying (which makes the
- // dragon/draconian avoid looking at the foe).
- if ((mons_genus(monster->type) == MONS_DRAGON
- || mons_genus(monster->type) == MONS_DRACONIAN))
+ pbolt.thrower = KILL_MON;
+ pbolt.is_beam = true;
+
+ // Accuracy is lowered by one quarter if the dragon is attacking a
+ // a target thatis wielding a weapon of dragon slaying (which
+ // makes the dragon/draconian avoid looking at the foe).
+ // FIXME: This effect is not yet implemented for player draconians
+ // or characters in dragon form breathing at monsters wielding a
+ // weapon with this brand.
+ if (mons_genus(monster->type) == MONS_DRAGON
+ || mons_genus(monster->type) == MONS_DRACONIAN)
{
if (actor *foe = monster->get_foe())
{
@@ -1138,7 +1141,7 @@ void setup_dragon(struct monsters *monster, struct bolt &pbolt)
{
pbolt.hit *= 3;
pbolt.hit /= 4;
- }
+ }
}
}
}
@@ -1150,7 +1153,7 @@ void setup_generic_throw(struct monsters *monster, struct bolt &pbolt)
pbolt.rangeMax = 9;
pbolt.beam_source = monster_index(monster);
- pbolt.type = dchar_glyph(DCHAR_FIRED_MISSILE);
+ pbolt.type = dchar_glyph(DCHAR_FIRED_MISSILE);
pbolt.flavour = BEAM_MISSILE;
pbolt.thrower = KILL_MON_MISSILE;
pbolt.aux_source.clear();
diff --git a/crawl-ref/source/notes.cc b/crawl-ref/source/notes.cc
index 901fe8ea0b..3b269070dd 100644
--- a/crawl-ref/source/notes.cc
+++ b/crawl-ref/source/notes.cc
@@ -34,26 +34,29 @@ std::vector<Note> note_list;
// return the real number of the power (casting out nonexistent powers),
// starting from 0, or -1 if the power doesn't exist
-static int real_god_power( int religion, int idx )
+static int _real_god_power( int religion, int idx )
{
- if ( god_gain_power_messages[religion][idx][0] == 0 )
+ if (god_gain_power_messages[religion][idx][0] == 0)
return -1;
+
int count = 0;
- for ( int j = 0; j < idx; ++j )
- if ( god_gain_power_messages[religion][j][0] )
+ for (int j = 0; j < idx; ++j)
+ if (god_gain_power_messages[religion][j][0])
++count;
+
return count;
}
-static bool is_noteworthy_skill_level( int level )
+static bool _is_noteworthy_skill_level( int level )
{
- for ( unsigned int i = 0; i < Options.note_skill_levels.size(); ++i )
- if ( level == Options.note_skill_levels[i] )
+ for (unsigned int i = 0; i < Options.note_skill_levels.size(); ++i)
+ if (level == Options.note_skill_levels[i])
return true;
+
return false;
}
-static bool is_highest_skill( int skill )
+static bool _is_highest_skill( int skill )
{
for ( int i = 0; i < NUM_SKILLS; ++i )
{
@@ -65,135 +68,149 @@ static bool is_highest_skill( int skill )
return true;
}
-static bool is_noteworthy_hp( int hp, int maxhp )
+static bool _is_noteworthy_hp( int hp, int maxhp )
{
- return (hp > 0 && Options.note_hp_percent &&
- hp <= (maxhp * Options.note_hp_percent) / 100);
+ return (hp > 0 && Options.note_hp_percent
+ && hp <= (maxhp * Options.note_hp_percent) / 100);
}
-static int dungeon_branch_depth( unsigned char branch )
+static int _dungeon_branch_depth( unsigned char branch )
{
if ( branch >= NUM_BRANCHES )
return -1;
return branches[branch].depth;
}
-static bool is_noteworthy_dlevel( unsigned short place )
+static bool _is_noteworthy_dlevel( unsigned short place )
{
const unsigned char branch =
static_cast<unsigned char>((place >> 8) & 0xFF);
const int lev = (place & 0xFF);
/* Special levels (Abyss, etc.) are always interesting */
- if ( lev == 0xFF )
+ if (lev == 0xFF)
return true;
-
- if ( lev == dungeon_branch_depth(branch) ||
- (branch == BRANCH_MAIN_DUNGEON && (lev % 5) == 0) ||
- (branch != BRANCH_MAIN_DUNGEON && lev == 1) )
+
+ if (lev == _dungeon_branch_depth(branch)
+ || branch == BRANCH_MAIN_DUNGEON && (lev % 5) == 0
+ || branch != BRANCH_MAIN_DUNGEON && lev == 1)
+ {
return true;
+ }
return false;
}
-/* Is a note worth taking?
- This function assumes that game state has not changed since
- the note was taken, e.g. you.* is valid.
- */
-static bool is_noteworthy( const Note& note )
+// Is a note worth taking?
+// This function assumes that game state has not changed since
+// the note was taken, e.g. you.* is valid.
+static bool _is_noteworthy( const Note& note )
{
/* always noteworthy */
- if ( note.type == NOTE_XP_LEVEL_CHANGE ||
- note.type == NOTE_GET_GOD ||
- note.type == NOTE_GOD_GIFT ||
- note.type == NOTE_GET_MUTATION ||
- note.type == NOTE_LOSE_MUTATION ||
- note.type == NOTE_GET_ITEM ||
- note.type == NOTE_ID_ITEM ||
- note.type == NOTE_SEEN_MONSTER ||
- note.type == NOTE_KILL_MONSTER ||
- note.type == NOTE_POLY_MONSTER ||
- note.type == NOTE_USER_NOTE ||
- note.type == NOTE_MESSAGE ||
- note.type == NOTE_LOSE_GOD ||
- note.type == NOTE_PENANCE ||
- note.type == NOTE_MOLLIFY_GOD ||
- note.type == NOTE_DEATH )
+ if (note.type == NOTE_XP_LEVEL_CHANGE
+ || note.type == NOTE_GET_GOD
+ || note.type == NOTE_GOD_GIFT
+ || note.type == NOTE_GET_MUTATION
+ || note.type == NOTE_LOSE_MUTATION
+ || note.type == NOTE_GET_ITEM
+ || note.type == NOTE_ID_ITEM
+ || note.type == NOTE_SEEN_MONSTER
+ || note.type == NOTE_KILL_MONSTER
+ || note.type == NOTE_POLY_MONSTER
+ || note.type == NOTE_USER_NOTE
+ || note.type == NOTE_MESSAGE
+ || note.type == NOTE_FOUND_ORB_OR_RUNE
+ || note.type == NOTE_LOSE_GOD
+ || note.type == NOTE_PENANCE
+ || note.type == NOTE_MOLLIFY_GOD
+ || note.type == NOTE_DEATH)
+ {
return true;
-
+ }
+
/* never noteworthy, hooked up for fun or future use */
- if ( note.type == NOTE_MP_CHANGE ||
- note.type == NOTE_MAXHP_CHANGE ||
- note.type == NOTE_MAXMP_CHANGE )
+ if (note.type == NOTE_MP_CHANGE
+ || note.type == NOTE_MAXHP_CHANGE
+ || note.type == NOTE_MAXMP_CHANGE)
+ {
return false;
+ }
/* god powers might be noteworthy if it's an actual power */
- if ( note.type == NOTE_GOD_POWER &&
- real_god_power(note.first, note.second) == -1 )
+ if (note.type == NOTE_GOD_POWER
+ && _real_god_power(note.first, note.second) == -1)
+ {
return false;
+ }
/* hp noteworthiness is handled in its own function */
- if ( note.type == NOTE_HP_CHANGE &&
- !is_noteworthy_hp(note.first, note.second) )
+ if (note.type == NOTE_HP_CHANGE
+ && !_is_noteworthy_hp(note.first, note.second))
{
return false;
}
/* skills are noteworthy if in the skill value list or if
it's a new maximal skill (depending on options) */
- if ( note.type == NOTE_GAIN_SKILL )
+ if (note.type == NOTE_GAIN_SKILL)
{
- if ( Options.note_all_skill_levels )
- return true;
- if ( is_noteworthy_skill_level(note.second) )
- return true;
- if ( Options.note_skill_max && is_highest_skill(note.first) )
+ if (Options.note_all_skill_levels
+ || _is_noteworthy_skill_level(note.second)
+ || Options.note_skill_max && _is_highest_skill(note.first))
+ {
return true;
+ }
return false;
}
- if ( note.type == NOTE_DUNGEON_LEVEL_CHANGE )
+ if (note.type == NOTE_DUNGEON_LEVEL_CHANGE)
{
- if ( !is_noteworthy_dlevel(note.packed_place) )
+ if (!_is_noteworthy_dlevel(note.packed_place))
return false;
+
// labyrinths are always interesting
- if ( (note.packed_place & 0xFF) == 0xFF &&
- (note.packed_place >> 8) == LEVEL_LABYRINTH )
+ if ((note.packed_place & 0xFF) == 0xFF
+ && (note.packed_place >> 8) == LEVEL_LABYRINTH)
+ {
return true;
+ }
}
-
+
/* Learning a spell is always noteworthy if note_all_spells is set */
- if ( note.type == NOTE_LEARN_SPELL && Options.note_all_spells )
+ if (note.type == NOTE_LEARN_SPELL && Options.note_all_spells)
return true;
- for ( unsigned i = 0; i < note_list.size(); ++i )
+ for (unsigned i = 0; i < note_list.size(); ++i)
{
- if ( note_list[i].type != note.type )
+ if (note_list[i].type != note.type)
continue;
+
const Note& rnote( note_list[i] );
- switch ( note.type )
+ switch (note.type)
{
case NOTE_DUNGEON_LEVEL_CHANGE:
- if ( rnote.packed_place == note.packed_place )
+ if (rnote.packed_place == note.packed_place)
return false;
break;
case NOTE_LEARN_SPELL:
- if (spell_difficulty(static_cast<spell_type>(rnote.first)) >=
- spell_difficulty(static_cast<spell_type>(note.first)))
+ if (spell_difficulty(static_cast<spell_type>(rnote.first))
+ >= spell_difficulty(static_cast<spell_type>(note.first)))
{
return false;
}
break;
case NOTE_GOD_POWER:
- if ( rnote.first == note.first && rnote.second == note.second )
+ if (rnote.first == note.first && rnote.second == note.second)
return false;
break;
case NOTE_HP_CHANGE:
- /* not if we have a recent warning */
- if ( (note.turn - rnote.turn < 5) &&
- /* unless we've lost half our HP since then */
- (note.first * 2 >= rnote.first) )
+ // Not if we have a recent warning
+ // unless we've lost half our HP since then.
+ if (note.turn - rnote.turn < 5
+ && note.first * 2 >= rnote.first)
+ {
return false;
+ }
break;
default:
mpr("Buggy note passed: unknown note type");
@@ -205,13 +222,13 @@ static bool is_noteworthy( const Note& note )
return true;
}
-static const char* number_to_ordinal( int number )
+static const char* _number_to_ordinal( int number )
{
- const char* ordinals[5] = { "first", "second", "third", "fourth",
- "fifth" };
- if ( number < 1)
+ const char* ordinals[5] = { "first", "second", "third", "fourth", "fifth" };
+
+ if (number < 1)
return "[unknown ordinal (too small)]";
- if ( number > 5 )
+ if (number > 5)
return "[unknown ordinal (too big)]";
return ordinals[number-1];
}
@@ -221,16 +238,16 @@ std::string Note::describe( bool when, bool where, bool what ) const
std::ostringstream result;
- if ( when )
+ if (when)
result << std::setw(6) << turn << " ";
- if ( where )
+ if (where)
{
result << "| " << std::setw(7) << std::left
<< short_place_name(packed_place) << " | ";
}
- if ( what )
+ if (what)
{
switch ( type )
{
@@ -308,7 +325,7 @@ std::string Note::describe( bool when, bool where, bool what ) const
case NOTE_GOD_POWER:
result << "Acquired "
<< god_name(static_cast<god_type>(first)) << "'s "
- << number_to_ordinal(real_god_power(first, second)+1)
+ << _number_to_ordinal(_real_god_power(first, second)+1)
<< " power";
break;
case NOTE_GET_MUTATION:
@@ -324,6 +341,9 @@ std::string Note::describe( bool when, bool where, bool what ) const
case NOTE_DEATH:
result << name;
break;
+ case NOTE_FOUND_ORB_OR_RUNE:
+ result << "Found " << name;
+ break;
case NOTE_USER_NOTE:
result << Options.user_note_prefix << name;
break;
@@ -368,15 +388,15 @@ void Note::check_milestone() const
std::string branch = place_name(packed_place, true, false).c_str();
if (branch.find("The ") == 0)
branch[0] = tolower(branch[0]);
-
+
if (dep == 1)
mark_milestone("enter", "entered " + branch + ".");
- else if (dep == dungeon_branch_depth(br))
+ else if (dep == _dungeon_branch_depth(br))
{
std::string level = place_name(packed_place, true, true);
if (level.find("Level ") == 0)
level[0] = tolower(level[0]);
-
+
std::ostringstream branch_finale;
branch_finale << "reached " << level << ".";
mark_milestone("branch-finale", branch_finale.str());
@@ -410,26 +430,26 @@ void Note::load(reader& inf)
bool notes_active = false;
-bool notes_are_active()
+bool notes_are_active()
{
return notes_active;
}
void take_note( const Note& note, bool force )
{
- if ( notes_active && (force || is_noteworthy(note)) )
+ if ( notes_active && (force || _is_noteworthy(note)) )
{
note_list.push_back( note );
note.check_milestone();
}
}
-void activate_notes( bool active )
+void activate_notes( bool active )
{
notes_active = active;
}
-void save_notes(writer& outf)
+void save_notes(writer& outf)
{
marshallLong( outf, NOTES_VERSION_NUMBER );
marshallLong( outf, note_list.size() );
@@ -437,7 +457,7 @@ void save_notes(writer& outf)
note_list[i].save(outf);
}
-void load_notes(reader& inf)
+void load_notes(reader& inf)
{
if ( unmarshallLong(inf) != NOTES_VERSION_NUMBER )
return;
diff --git a/crawl-ref/source/notes.h b/crawl-ref/source/notes.h
index 7e8366bb3a..b9bbbe2253 100644
--- a/crawl-ref/source/notes.h
+++ b/crawl-ref/source/notes.h
@@ -46,6 +46,7 @@ enum NOTE_TYPES
NOTE_PENANCE, /* needs: god id */
NOTE_MOLLIFY_GOD, /* needs: god id */
NOTE_DEATH, /* needs: death cause */
+ NOTE_FOUND_ORB_OR_RUNE, /* needs: item name (string) */
NOTE_NUM_TYPES
};
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 1f70d801f2..b131b2a2f8 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -102,9 +102,9 @@ static void _attribute_increase();
// Use this function whenever the player enters (or lands and thus re-enters)
// a grid.
//
-// stepped - normal walking moves
+// stepped - normal walking moves
// allow_shift - allowed to scramble in any direction out of lava/water
-// force - ignore safety checks, move must happen (traps, lava/water).
+// force - ignore safety checks, move must happen (traps, lava/water).
bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift,
bool force )
{
@@ -114,7 +114,7 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift,
// assuming that entering the same square means coming from above (levitate)
const bool from_above = (you.x_pos == x && you.y_pos == y);
const dungeon_feature_type old_grid = (from_above) ? DNGN_FLOOR
- : grd[you.x_pos][you.y_pos];
+ : grd[you.x_pos][you.y_pos];
const dungeon_feature_type new_grid = grd[x][y];
// really must be clear
@@ -128,7 +128,7 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift,
if (cloud != EMPTY_CLOUD)
{
const cloud_type ctype = env.cloud[ cloud ].type;
- // don't prompt if already in a cloud of the same type
+ // Don't prompt if already in a cloud of the same type.
if (is_damaging_cloud(ctype, false)
&& (env.cgrid[you.x_pos][you.y_pos] == EMPTY_CLOUD
|| ctype != env.cloud[ env.cgrid[you.x_pos][you.y_pos] ].type))
@@ -146,7 +146,7 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift,
}
}
- // if we're walking along, give a chance to avoid trap
+ // If we're walking along, give a chance to avoid traps.
if (stepped && !force && !you.confused())
{
if (new_grid == DNGN_UNDISCOVERED_TRAP)
@@ -160,6 +160,7 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift,
mprf( MSGCH_WARN,
"Wait a moment, %s! Do you really want to step there?",
you.your_name );
+
if (!you.running.is_any_travel())
more();
@@ -173,7 +174,7 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift,
return (false);
}
- } // unknown trap
+ }
else if (new_grid == DNGN_TRAP_MAGICAL
#ifdef CLUA_BINDINGS
|| new_grid == DNGN_TRAP_MECHANICAL
@@ -297,8 +298,8 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift,
#ifdef USE_TILE
// We could check for this above, but we need to do this post-move
// to force the merfolk tile to be out of water.
- if ((!grid_is_water(new_grid) && grid_is_water(old_grid) ||
- grid_is_water(new_grid) && !grid_is_water(old_grid))
+ if ((!grid_is_water(new_grid) && grid_is_water(old_grid)
+ || grid_is_water(new_grid) && !grid_is_water(old_grid))
&& you.species == SP_MERFOLK)
{
TilePlayerRefresh();
@@ -335,12 +336,12 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift,
set_envmap_obj(you.x_pos, you.y_pos, type);
}
- // not easy to blink onto a trap without setting it off:
+ // It's not easy to blink onto a trap without setting it off.
if (!stepped)
trap_known = false;
// mechanical traps and shafts cannot be set off if the
- // player is flying or levitating
+ // player is flying or levitating
if (!player_is_airborne()
|| trap_category( env.trap[id].type ) == DNGN_TRAP_MAGICAL)
{
@@ -2692,7 +2693,7 @@ int player_sust_abil(bool calc_unid)
int carrying_capacity( burden_state_type bs )
{
- int cap = 3500+(you.strength * 100)+(player_is_airborne() ? 1000 : 0);
+ int cap = 3500 + (you.strength * 100) + (player_is_airborne() ? 1000 : 0);
if ( bs == BS_UNENCUMBERED )
return (cap * 5) / 6;
else if ( bs == BS_ENCUMBERED )
@@ -6218,20 +6219,20 @@ flight_type player::flight_mode() const
bool player::permanent_levitation() const
{
- return airborne() &&
- (permanent_flight() ||
- // Boots of levitation keep you with DUR_LEVITATION >= 2 at
- // all times. This is so that you can evoke stop-levitation
- // in order to actually cancel levitation (by setting
- // DUR_LEVITATION to 1.) Note that antimagic() won't do this.
- (player_equip_ego_type( EQ_BOOTS, SPARM_LEVITATION ) &&
- you.duration[DUR_LEVITATION] > 1));
+ // Boots of levitation keep you with DUR_LEVITATION >= 2 at
+ // all times. This is so that you can evoke stop-levitation
+ // in order to actually cancel levitation (by setting
+ // DUR_LEVITATION to 1.) Note that antimagic() won't do this.
+ return (airborne()
+ && (permanent_flight()
+ || player_equip_ego_type( EQ_BOOTS, SPARM_LEVITATION )
+ && you.duration[DUR_LEVITATION] > 1));
}
bool player::permanent_flight() const
{
- return airborne() &&
- (you.species == SP_KENKU && you.experience_level >= 15);
+ return (airborne()
+ && you.species == SP_KENKU && you.experience_level >= 15);
}
bool player::light_flight() const
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc
index 4f2c4ca6fc..c55a50d2b9 100644
--- a/crawl-ref/source/traps.cc
+++ b/crawl-ref/source/traps.cc
@@ -382,7 +382,7 @@ void handle_traps(trap_type trt, int i, bool trap_known)
if (trap_known && one_chance_in(3))
mpr("You avoid triggering a blade trap.");
else if (random2limit(player_evasion(), 40)
- + (random2(you.dex) / 3) + (trap_known ? 3 : 0) > 8)
+ + (random2(you.dex) / 3) + (trap_known ? 3 : 0) > 8)
{
mpr("A huge blade swings just past you!");
}
@@ -402,7 +402,7 @@ void handle_traps(trap_type trt, int i, bool trap_known)
else
{
if (random2limit(player_evasion(), 40)
- + (random2(you.dex) / 3) + (trap_known ? 3 : 0) > 12)
+ + (random2(you.dex) / 3) + (trap_known ? 3 : 0) > 12)
{
mpr("A net drops to the ground!");
}
@@ -447,13 +447,10 @@ void handle_traps(trap_type trt, int i, bool trap_known)
return;
}
- if (!you.do_shaft())
+ if (!you.do_shaft() && !trap_known)
{
- if (!trap_known)
- {
- grd[you.x_pos][you.y_pos] = DNGN_UNDISCOVERED_TRAP;
- return;
- }
+ grd[you.x_pos][you.y_pos] = DNGN_UNDISCOVERED_TRAP;
+ return;
}
break;
@@ -471,7 +468,7 @@ void handle_traps(trap_type trt, int i, bool trap_known)
if (!trap_known) // Now you know...
exercise(SK_TRAPS_DOORS, ((coinflip()) ? 2 : 1));
-} // end handle_traps()
+}
void destroy_trap( const coord_def& pos )
{
@@ -528,8 +525,8 @@ void disarm_trap( struct dist &disa )
exercise(SK_TRAPS_DOORS, 1 + random2(you.your_level / 5));
else
{
- if (env.trap[i].type == TRAP_NET &&
- (env.trap[i].x != you.x_pos || env.trap[i].y != you.y_pos))
+ if (env.trap[i].type == TRAP_NET
+ && (env.trap[i].x != you.x_pos || env.trap[i].y != you.y_pos))
{
if (coinflip())
return;
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index ddd295e162..d93c31df8d 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -144,7 +144,8 @@ inline bool is_trap(int x, int y)
return grid_is_trap( grd[x][y] );
}
-// Returns true if this feature takes extra time to cross.
+// Returns an estimate for the time needed to cross this feature.
+// This is done, so traps etc. will usually be circumvented where possible.
inline int feature_traverse_cost(dungeon_feature_type feature)
{
if (feature == DNGN_SHALLOW_WATER || feature == DNGN_CLOSED_DOOR)
@@ -412,9 +413,10 @@ static bool is_reseedable(int x, int y)
{
if (is_excluded(coord_def(x, y)))
return (true);
+
int grid = grd[x][y];
- return (grid == DNGN_DEEP_WATER || grid == DNGN_SHALLOW_WATER ||
- grid == DNGN_LAVA || is_trap(x, y) || is_monster_blocked(x, y));
+ return (grid == DNGN_DEEP_WATER || grid == DNGN_SHALLOW_WATER
+ || grid == DNGN_LAVA || is_trap(x, y) || is_monster_blocked(x, y));
}
/*
@@ -452,13 +454,12 @@ bool is_travelsafe_square(int x, int y, bool ignore_hostile,
return (is_traversable(grid)
#ifdef CLUA_BINDINGS
- ||
- (is_trap(x, y) &&
- clua.callbooleanfn(false, "ch_cross_trap",
- "s", trap_name(x, y)))
+ || (is_trap(x, y)
+ && clua.callbooleanfn(false, "ch_cross_trap",
+ "s", trap_name(x, y)))
#endif
)
- && !is_excluded(coord_def(x, y));
+ && !is_excluded(coord_def(x, y));
}
// Returns true if the location at (x,y) is monster-free and contains no clouds.
@@ -488,7 +489,9 @@ static bool is_safe_move(int x, int y)
"s", trap_name(x, y))
#endif
)
+ {
return (false);
+ }
const int cloud = env.cgrid[x][y];
if (cloud == EMPTY_CLOUD)
@@ -1691,8 +1694,8 @@ bool travel_pathfind::path_flood(const coord_def &c, const coord_def &dc)
// this number, since this square is unsafe for travel.
point_distance[dc.x][dc.y] =
is_exclude_root(dc) ? PD_EXCLUDED :
- is_excluded(dc) ? PD_EXCLUDED_RADIUS :
- PD_TRAP;
+ is_excluded(dc) ? PD_EXCLUDED_RADIUS
+ : PD_TRAP;
}
return (false);
}