summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-04 14:47:09 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-04 14:47:09 +0000
commitca98a8399e80e0fa440298a6ddf383d706343088 (patch)
treeefb9093515837fa9c2137965baf513cc447d308d
parent7326d539ae67aba12e9a49dd94b2fe419845c759 (diff)
downloadcrawl-ref-ca98a8399e80e0fa440298a6ddf383d706343088.tar.gz
crawl-ref-ca98a8399e80e0fa440298a6ddf383d706343088.zip
Disallow vampires from draining summoned creatures to be consistent with
summoned creatures being incapable of bleeding on the floor. This makes things more difficult for Vampires; on the other hand there was a (more or less) recent change that lets them regain 1 hp *per turn* when draining corpses. We might also increase the duration of blood potions... Apart from that, various clean-ups. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6393 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/docs/034_changes.txt1
-rw-r--r--crawl-ref/source/abyss.cc16
-rw-r--r--crawl-ref/source/abyss.h2
-rw-r--r--crawl-ref/source/acr.cc154
-rw-r--r--crawl-ref/source/beam.cc37
-rw-r--r--crawl-ref/source/chardump.cc12
-rw-r--r--crawl-ref/source/clua.cc4
-rw-r--r--crawl-ref/source/decks.cc352
-rw-r--r--crawl-ref/source/delay.cc15
-rw-r--r--crawl-ref/source/describe.cc67
-rw-r--r--crawl-ref/source/dungeon.cc76
-rw-r--r--crawl-ref/source/effects.cc60
-rw-r--r--crawl-ref/source/enum.h69
-rw-r--r--crawl-ref/source/externs.h22
-rw-r--r--crawl-ref/source/fight.cc66
-rw-r--r--crawl-ref/source/files.cc3
-rw-r--r--crawl-ref/source/food.cc36
-rw-r--r--crawl-ref/source/item_use.cc45
-rw-r--r--crawl-ref/source/itemname.cc46
-rw-r--r--crawl-ref/source/itemprop.cc12
20 files changed, 547 insertions, 548 deletions
diff --git a/crawl-ref/docs/034_changes.txt b/crawl-ref/docs/034_changes.txt
index bf7688cafc..323c8adb31 100644
--- a/crawl-ref/docs/034_changes.txt
+++ b/crawl-ref/docs/034_changes.txt
@@ -26,6 +26,7 @@ them:
! annotate dungeon level
(If your annotation contains '!' you'll be prompted whenever
you attempt to enter the level.)
+ ( cycle the quiver to the next appropriate item
Ctrl-D define macros (synonym to '~')
Ctrl-G verbose list of monsters in sight
Ctrl-T change your allies' pickup behaviour
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc
index 9a128f3a58..bf8167dcab 100644
--- a/crawl-ref/source/abyss.cc
+++ b/crawl-ref/source/abyss.cc
@@ -341,11 +341,14 @@ static int _abyss_rune_nearness()
// See above comment about is_terrain_known().
for (radius_iterator ri(you.pos(), LOS_RADIUS); ri; ++ri)
+ {
if (get_screen_glyph(ri->x, ri->y) != ' ')
- for ( stack_iterator si(*ri); si; ++si )
+ {
+ for (stack_iterator si(*ri); si; ++si)
if (is_rune(*si) && si->plus == RUNE_ABYSSAL)
nearness = std::min(nearness, grid_distance(you.pos(),*ri));
-
+ }
+ }
return (nearness);
}
@@ -400,7 +403,6 @@ static void _abyss_lose_monster(monsters &mons)
#define LOS_DIAMETER (LOS_RADIUS * 2 + 1)
void area_shift(void)
-/*******************/
{
#ifdef DEBUG_ABYSS
mpr("area_shift().", MSGCH_DIAGNOSTICS);
@@ -416,7 +418,7 @@ void area_shift(void)
FixedArray<unsigned short, LOS_DIAMETER, LOS_DIAMETER> fprops;
const coord_def los_delta(LOS_RADIUS, LOS_RADIUS);
- for ( radius_iterator ri(you.pos(), LOS_RADIUS); ri; ++ri )
+ for (radius_iterator ri(you.pos(), LOS_RADIUS); ri; ++ri)
{
fprops(you.pos() - *ri + los_delta) = env.map(*ri).property;
if (env.sanctuary_pos == *ri && env.sanctuary_time > 0)
@@ -426,7 +428,7 @@ void area_shift(void)
}
}
- // If sanctuary center is outside of preserved area then just get
+ // If sanctuary centre is outside of preserved area then just get
// rid of it.
if (env.sanctuary_time > 0 && !sanct_shifted)
{
@@ -442,7 +444,7 @@ void area_shift(void)
fprops(pos) = FPROP_NONE;
}
}
- }
+ }
_xom_check_nearness_setup();
@@ -530,7 +532,7 @@ void area_shift(void)
_xom_check_nearness();
- for ( radius_iterator ri(you.pos(), LOS_RADIUS); ri; ++ri )
+ for (radius_iterator ri(you.pos(), LOS_RADIUS); ri; ++ri)
env.map(*ri).property = fprops(you.pos() - *ri + los_delta);
if (sanct_shifted)
diff --git a/crawl-ref/source/abyss.h b/crawl-ref/source/abyss.h
index 61108bae8f..cf4436152e 100644
--- a/crawl-ref/source/abyss.h
+++ b/crawl-ref/source/abyss.h
@@ -1,6 +1,6 @@
/*
* File: abyss.h
- * Summary: Misc functions (most of which don't appear to be related to priests).
+ * Summary: Misc abyss specific functions.
* Written by: Linley Henzell
*
* Modified for Crawl Reference by $Author$ on $Date$
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 305f4379bb..1549cbcc37 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -443,7 +443,7 @@ static bool _item_type_can_be_artefact( int type)
static void _handle_wizard_command( void )
{
- int wiz_command, i, j, tmp;
+ int wiz_command, tmp;
char specs[256];
// WIZ_NEVER gives protection for those who have wiz compiles,
@@ -557,22 +557,23 @@ static void _handle_wizard_command( void )
break;
case 'v':
+ {
// This command isn't very exciting... feel free to replace.
- i = prompt_invent_item( "Value of which item?", MT_INVLIST, -1 );
+ int i = prompt_invent_item( "Value of which item?", MT_INVLIST, -1 );
if (i == PROMPT_ABORT || !is_random_artefact( you.inv[i] ))
{
canned_msg( MSG_OK );
break;
}
else
- {
mprf("randart val: %d", randart_value(you.inv[i]));
- }
- break;
+ break;
+ }
case '+':
- i = prompt_invent_item( "Make an artefact out of which item?",
- MT_INVLIST, -1 );
+ {
+ int i = prompt_invent_item( "Make an artefact out of which item?",
+ MT_INVLIST, -1 );
if (i == PROMPT_ABORT)
{
canned_msg( MSG_OK );
@@ -585,6 +586,7 @@ static void _handle_wizard_command( void )
break;
}
+ int j;
// Set j == equipment slot of chosen item, remove old randart benefits.
for (j = 0; j < NUM_EQUIP; j++)
{
@@ -608,7 +610,7 @@ static void _handle_wizard_command( void )
mpr( you.inv[i].name(DESC_INVENTORY_EQUIP).c_str() );
break;
-
+ }
case '|':
// Create all unrandarts.
for (tmp = 1; tmp < NO_UNRANDARTS; tmp++)
@@ -676,8 +678,8 @@ static void _handle_wizard_command( void )
case 'C':
{
- // this command isn't very exciting... feel free to replace
- i = prompt_invent_item( "(Un)curse which item?", MT_INVLIST, -1 );
+ // This command isn't very exciting but it's useful for debugging.
+ int i = prompt_invent_item( "(Un)curse which item?", MT_INVLIST, -1 );
if (i == PROMPT_ABORT)
{
canned_msg( MSG_OK );
@@ -722,29 +724,22 @@ static void _handle_wizard_command( void )
wizard_draw_card();
break;
- case 'h':
- you.rotting = 0;
- you.duration[DUR_CONF] = 0;
- you.duration[DUR_POISONING] = 0;
- you.disease = 0;
- set_hp( abs(you.hp_max), false );
- set_hunger( 10999, true );
- break;
-
case 'H': // super-heal
- you.rotting = 0;
- you.duration[DUR_CONF] = 0;
- you.duration[DUR_POISONING] = 0;
+ you.magic_contamination = 0;
you.duration[DUR_LIQUID_FLAMES] = 0;
if (you.duration[DUR_BEHELD])
{
you.duration[DUR_BEHELD] = 0;
you.beheld_by.clear();
}
- you.magic_contamination = 0;
- you.disease = 0;
inc_hp( 10, true );
- set_hp( you.hp_max, false );
+ // intentional fall-through
+ case 'h':
+ you.rotting = 0;
+ you.disease = 0;
+ you.duration[DUR_CONF] = 0;
+ you.duration[DUR_POISONING] = 0;
+ set_hp( abs(you.hp_max), false );
set_hunger( 10999, true );
you.redraw_hit_points = true;
break;
@@ -851,8 +846,7 @@ static void _handle_wizard_command( void )
}
grd[you.x_pos][you.y_pos] = DNGN_ENTER_PORTAL_VAULT;
- map_wiz_props_marker
- *marker = new map_wiz_props_marker(you.pos());
+ map_wiz_props_marker *marker = new map_wiz_props_marker(you.pos());
marker->set_property("dst", dst);
marker->set_property("desc", "wizard portal, dest = " + dst);
env.markers.add(marker);
@@ -868,47 +862,42 @@ static void _handle_wizard_command( void )
break;
case 'i':
- {
mpr( "You feel a rush of knowledge." );
- for (i = 0; i < ENDOFPACK; i++)
+ for (int i = 0; i < ENDOFPACK; i++)
{
if (is_valid_item( you.inv[i] ))
{
set_ident_type( you.inv[i], ID_KNOWN_TYPE );
-
set_ident_flags( you.inv[i], ISFLAG_IDENT_MASK );
}
}
- you.wield_change = true;
+ you.wield_change = true;
you.redraw_quiver = true;
break;
- }
case 'I':
- {
mpr( "You feel a rush of antiknowledge." );
- for (i = 0; i < ENDOFPACK; i++)
+ for (int i = 0; i < ENDOFPACK; i++)
{
if (is_valid_item( you.inv[i] ))
{
set_ident_type( you.inv[i], ID_UNKNOWN_TYPE );
-
unset_ident_flags( you.inv[i], ISFLAG_IDENT_MASK );
}
}
- you.wield_change = true;
+ you.wield_change = true;
you.redraw_quiver = true;
- // Forget things that nearby monsters are carrying, as well
- // (for use with the "give monster an item" wizard targetting
- // command).
- for (i = 0; i < MAX_MONSTERS; i++)
+ // Forget things that nearby monsters are carrying, as well.
+ // (For use with the "give monster an item" wizard targetting
+ // command.)
+ for (int i = 0; i < MAX_MONSTERS; i++)
{
monsters* mon = &menv[i];
if (!invalid_monster(mon) && mons_near(mon))
{
- for (j = 0; j < NUM_MONSTER_SLOTS; j++)
+ for (int j = 0; j < NUM_MONSTER_SLOTS; j++)
{
if (mon->inv[j] == NON_ITEM)
continue;
@@ -919,13 +908,11 @@ static void _handle_wizard_command( void )
continue;
set_ident_type( item, ID_UNKNOWN_TYPE );
-
unset_ident_flags( item, ISFLAG_IDENT_MASK );
}
}
}
break;
- }
case CONTROL('I'):
debug_item_statistics();
@@ -1013,8 +1000,7 @@ static void _handle_wizard_command( void )
break;
case ':':
- j = 0;
- for (i = 0; i < NUM_BRANCHES; i++)
+ for (int i = 0; i < NUM_BRANCHES; i++)
{
if (branches[i].startdepth != - 1)
{
@@ -1072,9 +1058,10 @@ static void _handle_wizard_command( void )
old_piety, old_piety == MAX_PIETY ? "at" : "above");
}
- // even at maximum, you can still gain gifts
- // try at least once f. maximum, or repeat until something happens
- // Rarely, this might result in several gifts during the same round!
+ // Even at maximum, you can still gain gifts.
+ // Try at least once for maximum, or repeat until something
+ // happens. Rarely, this might result in several gifts during the
+ // same round!
do
{
gain_piety(50);
@@ -1109,7 +1096,7 @@ static void _handle_wizard_command( void )
{
bool has_shops = false;
- for (i = 0; i < MAX_SHOPS; i++)
+ for (int i = 0; i < MAX_SHOPS; i++)
if (env.shop[i].type != SHOP_UNASSIGNED)
{
has_shops = true;
@@ -1120,7 +1107,7 @@ static void _handle_wizard_command( void )
{
mpr("Shop items:");
- for (i = 0; i < MAX_SHOPS; i++)
+ for (int i = 0; i < MAX_SHOPS; i++)
if (env.shop[i].type != SHOP_UNASSIGNED)
{
int objl = igrd[0][i + 5];
@@ -1134,11 +1121,12 @@ static void _handle_wizard_command( void )
objl = item.link;
}
}
- mpr("");
- } // if (has_shops)
+
+ mpr(EOL);
+ }
mpr("Item stacks (by location and top item):");
- for (i = 0; i < MAX_ITEMS; i++)
+ for (int i = 0; i < MAX_ITEMS; i++)
{
item_def &item(mitm[i]);
if (!is_valid_item(item) || item.x == 0 || item.y == 0)
@@ -1149,11 +1137,11 @@ static void _handle_wizard_command( void )
item.name(DESC_PLAIN, false, false, false).c_str() );
}
- mpr("");
+ mpr(EOL);
mpr("Floor items (stacks only show top item):");
- for (i = 1; i < GXM; i++)
- for (j = 1; j < GYM; j++)
+ for (int i = 1; i < GXM; i++)
+ for (int j = 1; j < GYM; j++)
{
int item = igrd[i][j];
if (item != NON_ITEM)
@@ -1164,6 +1152,7 @@ static void _handle_wizard_command( void )
false).c_str() );
}
}
+
break;
}
@@ -1396,7 +1385,7 @@ static void _input()
&& kbhit())
{
// User pressed a key, so stop repeating commands and discard
- // the keypress
+ // the keypress.
crawl_state.cancel_cmd_repeat();
getchm();
return;
@@ -1414,13 +1403,12 @@ static void _input()
Options.tut_just_triggered = false;
if (you.attribute[ATTR_HELD])
- {
learned_something_new(TUT_CAUGHT_IN_NET);
- }
- // We don't want those "Whew, it's safe to rest now" messages when
- // you were just cast into the Abyss. Right?
else if (player_feels_safe && you.level_type != LEVEL_ABYSS)
{
+ // We don't want those "Whew, it's safe to rest now" messages
+ // when you were just cast into the Abyss. Right?
+
if (2 * you.hp < you.hp_max
|| 2 * you.magic_points < you.max_magic_points)
{
@@ -1690,7 +1678,7 @@ static void _go_upstairs()
if (!check_annotation_exclusion_warning())
return;
- tag_followers(); // only those beside us right now can follow
+ tag_followers(); // Only those beside us right now can follow.
start_delay( DELAY_ASCENDING_STAIRS,
1 + (you.burden_state > BS_UNENCUMBERED) );
}
@@ -1917,9 +1905,9 @@ void process_command( command_type cmd )
ASSERT(crawl_state.is_repeating_cmd());
if (crawl_state.prev_repetition_turn == you.num_turns
- && !(crawl_state.repeat_cmd == CMD_WIZARD
- || (crawl_state.repeat_cmd == CMD_PREV_CMD_AGAIN
- && crawl_state.prev_cmd == CMD_WIZARD)))
+ && crawl_state.repeat_cmd != CMD_WIZARD
+ && (crawl_state.repeat_cmd != CMD_PREV_CMD_AGAIN
+ || crawl_state.prev_cmd != CMD_WIZARD))
{
// This is a catch-all that shouldn't really happen.
// If the command always takes zero turns, then it
@@ -2193,7 +2181,7 @@ void process_command( command_type cmd )
"(v - describe square, ? - help)",
MSGCH_PROMPT);
- struct dist lmove; // will be initialized by direction()
+ struct dist lmove; // Will be initialized by direction().
direction(lmove, DIR_TARGET, TARG_ANY, -1, true);
if (lmove.isValid && lmove.isTarget && !lmove.isCancel)
start_travel( lmove.tx, lmove.ty );
@@ -2206,7 +2194,8 @@ void process_command( command_type cmd )
canned_msg(MSG_PRESENT_FORM);
break;
}
- /* randart wpns */
+
+ // Randart weapons.
if (scan_randarts(RAP_PREVENT_SPELLCASTING))
{
mpr("Something interferes with your magic!");
@@ -2516,6 +2505,7 @@ static bool _decrement_a_duration(duration_type dur, const char* endmsg = NULL,
{
if (midmsg)
mpr(midmsg, chan);
+
you.duration[dur] -= midloss;
}
}
@@ -2545,17 +2535,17 @@ static void _decrement_durations()
else
you.duration[DUR_GOURMAND] = 0;
- // must come before might/haste/berserk
+ // Must come before might/haste/berserk.
if (_decrement_a_duration(DUR_BUILDING_RAGE))
go_berserk(false);
if (_decrement_a_duration(DUR_SLEEP))
you.awake();
- // paradox: it both lasts longer & does more damage overall if you're
+ // Paradox: It both lasts longer & does more damage overall if you're
// moving slower.
- // rationalisation: I guess it gets rubbed off/falls off/etc if you
- // move around more.
+ // Rationalisation: I guess it gets rubbed off/falls off/etc if you
+ // move around more.
if (you.duration[DUR_LIQUID_FLAMES] > 0)
you.duration[DUR_LIQUID_FLAMES]--;
@@ -3424,7 +3414,7 @@ static command_type _keycode_to_command( keycode_type key )
case CK_MOUSE_DONE: return CMD_NEXT_CMD;
case CK_MOUSE_B1ITEM: return CMD_USE_ITEM;
case CK_MOUSE_B2ITEM: return CMD_VIEW_ITEM;
-#endif // USE_TILE
+#endif
case KEY_MACRO_DISABLE_MORE: return CMD_DISABLE_MORE;
case KEY_MACRO_ENABLE_MORE: return CMD_ENABLE_MORE;
@@ -3603,7 +3593,7 @@ static int _check_adjacent(dungeon_feature_type feat, int &dx, int &dy)
// Opens doors and handles some aspects of untrapping. If either move_x or
// move_y are non-zero, the pair carries a specific direction for the door
-// to be opened (eg if you type ctrl - dir).
+// to be opened (eg if you type ctrl + dir).
static void _open_door(int move_x, int move_y, bool check_confused)
{
struct dist door_move;
@@ -3723,7 +3713,7 @@ static void _open_door(int move_x, int move_y, bool check_confused)
if (you.duration[DUR_BERSERKER])
{
- // XXX: better flavour for larger doors?
+ // XXX: Better flavour for larger doors?
if (silenced(you.x_pos, you.y_pos))
mprf("The %s%s flies open!", adj, noun);
else
@@ -3849,7 +3839,7 @@ static void _close_door(int door_x, int door_y)
if (mgrd[dc.x][dc.y] != NON_MONSTER)
{
// Need to make sure that turn_is_over is set if creature is
- // invisible
+ // invisible.
if (!player_monster_visible(&menv[mgrd[dc.x][dc.y]]))
{
mprf("Something is blocking the %sway!", noun);
@@ -3955,7 +3945,7 @@ static bool _initialise(void)
init_feature_table();
init_monster_symbols();
init_properties();
- init_spell_descs(); // this needs to be way up top {dlb}
+ init_spell_descs(); // This needs to be way up top. {dlb}
init_mon_name_cache();
msg::initialise_mpr_streams();
@@ -4061,7 +4051,8 @@ static bool _initialise(void)
you.redraw_quiver = true;
you.wield_change = true;
- you.start_time = time( NULL ); // start timer on session
+ // Start timer on session.
+ you.start_time = time( NULL );
#ifdef CLUA_BINDINGS
clua.runhook("chk_startgame", "b", newc);
@@ -4221,8 +4212,8 @@ static void _move_player(int move_x, int move_y)
const unsigned short targ_monst = mgrd[ targ_x ][ targ_y ];
const bool targ_pass = you.can_pass_through(targ_x, targ_y);
- // you can swap places with a friendly or good neutral monster if
- // you're not confused, or if both of you are inside a sanctuary
+ // You can swap places with a friendly or good neutral monster if
+ // you're not confused, or if both of you are inside a sanctuary.
const bool can_swap_places = targ_monst != NON_MONSTER
&& !mons_is_stationary(&menv[targ_monst])
&& (mons_wont_attack(&menv[targ_monst])
@@ -4230,7 +4221,8 @@ static void _move_player(int move_x, int move_y)
|| is_sanctuary(you.x_pos, you.y_pos)
&& is_sanctuary(targ_x, targ_y));
- // cannot move away from mermaid but you CAN fight neighbouring squares
+ // You cannot move away from a mermaid but you CAN fight monsters on
+ // neighbouring squares.
if (you.duration[DUR_BEHELD] && !you.duration[DUR_CONF])
{
for (unsigned int i = 0; i < you.beheld_by.size(); i++)
@@ -4480,7 +4472,7 @@ static void _setup_cmd_repeat()
{
// If a "do previous command again" caused a command
// repetition to be redone, the keys to be repeated are
- // already in the key rercording buffer, so we just need to
+ // already in the key recording buffer, so we just need to
// discard all the keys saying how many times the command
// should be repeated.
do
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index cb157040c2..e8e09d2707 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -1259,7 +1259,7 @@ static void _zappy( zap_type z_type, int power, bolt &pbolt )
break;
case ZAP_NEGATIVE_ENERGY: // cap 150
- // these always auto-identify, so no generic name
+ // These always auto-identify, so no generic name.
pbolt.name = "bolt of negative energy";
pbolt.colour = DARKGREY;
pbolt.range = 7 + random2(10);
@@ -2063,7 +2063,7 @@ void fire_beam(bolt &pbolt, item_def *item, bool drop_item)
int mons_adjust_flavoured(monsters *monster, bolt &pbolt, int hurted,
bool doFlavouredEffects)
{
- // If we're not doing flavored effects, must be preliminary
+ // If we're not doing flavoured effects, must be preliminary
// damage check only.
// Do not print messages or apply any side effects!
int resist = 0;
@@ -2985,7 +2985,7 @@ static void _beam_explodes(bolt &beam, int x, int y)
// cloud producer -- FOUL VAPOR (SWAMP DRAKE?)
if (beam.name == "foul vapour")
{
- cl_type = beam.flavour == BEAM_MIASMA ? CLOUD_MIASMA : CLOUD_STINK;
+ cl_type = (beam.flavour == BEAM_MIASMA) ? CLOUD_MIASMA : CLOUD_STINK;
big_cloud( cl_type, _whose_kill(beam), x, y, 0, 9 );
return;
}
@@ -4054,7 +4054,7 @@ static int _affect_player( bolt &beam, item_def *item )
hurted = 0;
// If the beam is an actual missile or of the MMISSILE type (Earth magic)
- // might bleed on the floor.
+ // we might bleed on the floor.
if (!engulfs
&& (beam.flavour == BEAM_MISSILE || beam.flavour == BEAM_MMISSILE))
{
@@ -4152,10 +4152,10 @@ static int _affect_player( bolt &beam, item_def *item )
beam.fr_hurt++;
// Beam from player rebounded and hit player.
- if (beam.beam_source == NON_MONSTER)
- xom_is_stimulated(255);
// Xom's amusement at the player's being damaged is handled
// elsewhere.
+ if (beam.beam_source == NON_MONSTER)
+ xom_is_stimulated(255);
else if (was_affected)
xom_is_stimulated(128);
}
@@ -4671,7 +4671,7 @@ static int _affect_monster(bolt &beam, monsters *mon, item_def *item)
hurt_final = mons_adjust_flavoured(mon, beam, raw_damage);
// If the beam is an actual missile or of the MMISSILE type (Earth magic)
- // might bleed on the floor.
+ // we might bleed on the floor.
if (!engulfs
&& (beam.flavour == BEAM_MISSILE || beam.flavour == BEAM_MMISSILE)
&& !mons_is_summoned(mon) && !mons_is_submerged(mon))
@@ -5330,15 +5330,16 @@ int explosion( bolt &beam, bool hole_in_the_middle,
int r = beam.ex_size;
- // beam is now an explosion; set in_explosion_phase
+ // Beam is now an explosion.
beam.in_explosion_phase = true;
if (is_sanctuary(beam.target_x, beam.target_y))
{
- if (!beam.is_tracer && see_grid(beam.target()) && !beam.name.empty() )
+ if (!beam.is_tracer && see_grid(beam.target()) && !beam.name.empty())
+ {
mprf(MSGCH_GOD, "By Zin's power, the %s is contained.",
beam.name.c_str());
-
+ }
return (-1);
}
@@ -5350,7 +5351,7 @@ int explosion( bolt &beam, bool hole_in_the_middle,
beam.hit, beam.damage.num, beam.damage.size );
#endif
- // for now, we don't support explosions greater than 9 radius
+ // For now, we don't support explosions greater than 9 radius.
if (r > MAX_EXPLOSION_RADIUS)
r = MAX_EXPLOSION_RADIUS;
@@ -5501,24 +5502,24 @@ static void _explosion_cell(bolt &beam, int x, int y, bool drawOnly)
static void _explosion_map( bolt &beam, int x, int y,
int count, int dir, int r )
{
- // 1. check to see out of range
+ // 1. Check to see out of range.
if (x*x + y*y > r*r + r)
return;
- // 2. check count
+ // 2. Check count.
if (count > 10*r)
return;
- // 3. check sanctuary
+ // 3. Check sanctuary.
if (is_sanctuary(beam.target_x + x, beam.target_y + y))
return;
- // 3. check to see if we're blocked by something
+ // 4. Check to see if we're blocked by something
// specifically, we're blocked by WALLS. Not
// statues, idols, etc.
const int dngn_feat = grd[beam.target_x + x][beam.target_y + y];
- // special case: explosion originates from rock/statue
+ // Special case: Explosion originates from rock/statue
// (e.g. Lee's rapid deconstruction) - in this case, ignore
// solid cells at the center of the explosion.
if (dngn_feat <= DNGN_MAXWALL
@@ -5527,10 +5528,10 @@ static void _explosion_map( bolt &beam, int x, int y,
return;
}
- // hmm, I think we're ok
+ // Hmm, I think we're ok.
explode_map[x+9][y+9] = true;
- // now recurse in every direction except the one we came from
+ // Now recurse in every direction except the one we came from.
for (int i = 0; i < 4; i++)
{
if (i+1 != dir)
diff --git a/crawl-ref/source/chardump.cc b/crawl-ref/source/chardump.cc
index 359467656d..2ccf957a23 100644
--- a/crawl-ref/source/chardump.cc
+++ b/crawl-ref/source/chardump.cc
@@ -191,18 +191,6 @@ static void _sdump_header(dump_params &par)
static void _sdump_stats(dump_params &par)
{
-/*
- // This is the old dump screen and can be removed if no one wants to
- // go back.
- std::vector<formatted_string> vfs =
- get_full_detail(par.full_id, par.se? par.se->points : -1);
-
- for (unsigned int i = 0; i < vfs.size(); i++)
- {
- par.text += vfs[i];
- par.text += '\n';
- }
-*/
par.text += dump_overview_screen(par.full_id);
par.text += "\n\n";
}
diff --git a/crawl-ref/source/clua.cc b/crawl-ref/source/clua.cc
index f9682b8206..7107dc6355 100644
--- a/crawl-ref/source/clua.cc
+++ b/crawl-ref/source/clua.cc
@@ -1620,11 +1620,11 @@ static int food_eat(lua_State *ls)
static int food_rotting(lua_State *ls)
{
LUA_ITEM(item, 1);
+
bool rotting = false;
if (item && item->base_type == OBJ_FOOD && item->sub_type == FOOD_CHUNK)
- {
rotting = food_is_rotten(*item);
- }
+
lua_pushboolean(ls, rotting);
return (1);
}
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index d2a47c5ab0..17e6c65210 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -320,7 +320,7 @@ const char* card_name(card_type card)
static const deck_archetype* _random_sub_deck(unsigned char deck_type)
{
const deck_archetype *pdeck = NULL;
- switch ( deck_type )
+ switch (deck_type)
{
case MISC_DECK_OF_ESCAPE:
pdeck = (coinflip() ? deck_of_transport : deck_of_emergency);
@@ -331,7 +331,7 @@ static const deck_archetype* _random_sub_deck(unsigned char deck_type)
case MISC_DECK_OF_WONDERS: pdeck = deck_of_wonders; break;
case MISC_DECK_OF_PUNISHMENT: pdeck = deck_of_punishment; break;
case MISC_DECK_OF_WAR:
- switch ( random2(6) )
+ switch (random2(6))
{
case 0: pdeck = deck_of_destruction; break;
case 1: pdeck = deck_of_enchantments; break;
@@ -342,7 +342,7 @@ static const deck_archetype* _random_sub_deck(unsigned char deck_type)
}
break;
case MISC_DECK_OF_CHANGES:
- switch ( random2(3) )
+ switch (random2(3))
{
case 0: pdeck = deck_of_battle; break;
case 1: pdeck = deck_of_dungeons; break;
@@ -354,9 +354,9 @@ static const deck_archetype* _random_sub_deck(unsigned char deck_type)
break;
}
- ASSERT( pdeck );
+ ASSERT(pdeck);
- return pdeck;
+ return (pdeck);
}
static card_type _choose_from_archetype(const deck_archetype* pdeck,
@@ -369,15 +369,13 @@ static card_type _choose_from_archetype(const deck_archetype* pdeck,
// duplicating the implementation.
int totalweight = 0;
- int i = 0;
card_type result = NUM_CARDS;
- while ( pdeck[i].card != NUM_CARDS )
+ for (int i = 0; pdeck[i].card != NUM_CARDS; ++i)
{
const card_with_weights& cww = pdeck[i];
totalweight += cww.weight[rarity];
- if ( random2(totalweight) < cww.weight[rarity] )
+ if (random2(totalweight) < cww.weight[rarity])
result = cww.card;
- ++i;
}
return result;
}
@@ -387,7 +385,7 @@ static card_type _random_card(unsigned char deck_type, deck_rarity_type rarity,
{
const deck_archetype *pdeck = _random_sub_deck(deck_type);
- if ( one_chance_in(100) )
+ if (one_chance_in(100))
{
pdeck = deck_of_oddities;
was_oddity = true;
@@ -465,11 +463,11 @@ static void _remember_drawn_card(item_def& deck, card_type card)
const std::vector<card_type> get_drawn_cards(const item_def& deck)
{
std::vector<card_type> result;
- if ( is_deck(deck) )
+ if (is_deck(deck))
{
const CrawlHashTable &props = deck.props;
const CrawlVector &drawn = props["drawn_cards"].get_vector();
- for ( unsigned int i = 0; i < drawn.size(); ++i )
+ for (unsigned int i = 0; i < drawn.size(); ++i)
{
const char tmp = drawn[i];
result.push_back(static_cast<card_type>(tmp));
@@ -528,7 +526,7 @@ static bool _check_buggy_deck(item_def& deck)
"and whisks it away."
<< std::endl;
- if ( deck.link == you.equip[EQ_WEAPON] )
+ if (deck.link == you.equip[EQ_WEAPON])
unwield_item();
dec_inv_item_quantity( deck.link, 1 );
@@ -588,7 +586,7 @@ static bool _check_buggy_deck(item_def& deck)
<< "A swarm of software bugs snatches the deck from you "
"and whisks it away." << std::endl;
- if ( deck.link == you.equip[EQ_WEAPON] )
+ if (deck.link == you.equip[EQ_WEAPON])
unwield_item();
dec_inv_item_quantity( deck.link, 1 );
@@ -719,7 +717,7 @@ static int _choose_inventory_deck( const char* prompt )
if (prompt_failed(slot))
return -1;
- if ( !is_deck(you.inv[slot]) )
+ if (!is_deck(you.inv[slot]))
{
mpr("That isn't a deck!");
return -1;
@@ -821,8 +819,8 @@ bool deck_peek()
if (flags2 & CFLAG_SEEN)
already_seen++;
- // always increase if seen 2, 50% increase if seen 1
- if ( already_seen && random2(2) < already_seen )
+ // Always increase if seen 2, 50% increase if seen 1.
+ if (already_seen && random2(2) < already_seen)
deck.props["non_brownie_draws"]++;
mprf("You draw two cards from the deck. They are: %s and %s.",
@@ -1003,22 +1001,23 @@ bool deck_stack()
while (true)
{
const int c = getch();
- if ( c == CK_ENTER )
+ if (c == CK_ENTER)
{
cgotoxy(1,11);
textcolor(LIGHTGREY);
cprintf("Are you sure? (press y or Y to confirm)");
if (toupper(getch()) == 'Y')
break;
+
cgotoxy(1,11);
clear_to_end_of_line();
continue;
}
- if ( c >= '1' && c <= '0' + static_cast<int>(draws.size()) )
+ if (c >= '1' && c <= '0' + static_cast<int>(draws.size()))
{
const unsigned int new_selected = c - '1';
- if ( selected < draws.size() )
+ if (selected < draws.size())
{
std::swap(draws[selected], draws[new_selected]);
std::swap(flags[selected], flags[new_selected]);
@@ -1195,7 +1194,7 @@ void evoke_deck( item_def& deck )
// Passive Nemelex retribution: sometimes a card gets swapped out.
// More likely to happen with marked decks.
- if ( you.penance[GOD_NEMELEX_XOBEH] )
+ if (you.penance[GOD_NEMELEX_XOBEH])
{
int c = 1;
if ( (flags & (CFLAG_MARKED | CFLAG_SEEN))
@@ -1203,11 +1202,11 @@ void evoke_deck( item_def& deck )
{
c = 3;
}
- if ( random2(3000) < c * you.penance[GOD_NEMELEX_XOBEH] )
+ if (random2(3000) < c * you.penance[GOD_NEMELEX_XOBEH])
{
card_type old_card = card;
card = _choose_from_archetype(deck_of_punishment, rarity);
- if ( card != old_card )
+ if (card != old_card)
{
simple_god_message(" seems to have exchanged this card "
"behind your back!", GOD_NEMELEX_XOBEH);
@@ -1237,7 +1236,7 @@ void evoke_deck( item_def& deck )
// in which case we don't want an empty deck to go through the
// swapping process.
const bool deck_gone = (cards_in_deck(deck) == 0);
- if ( deck_gone )
+ if (deck_gone)
{
mpr("The deck of cards disappears in a puff of smoke.");
dec_inv_item_quantity( deck.link, 1 );
@@ -1247,7 +1246,7 @@ void evoke_deck( item_def& deck )
}
const bool fake_draw = !card_effect(card, rarity, flags, false);
- if ( fake_draw && !deck_gone )
+ if (fake_draw && !deck_gone)
props["non_brownie_draws"]++;
if (!(flags & CFLAG_MARKED))
@@ -1288,16 +1287,16 @@ void evoke_deck( item_def& deck )
int get_power_level(int power, deck_rarity_type rarity)
{
int power_level = 0;
- switch ( rarity )
+ switch (rarity)
{
case DECK_RARITY_COMMON:
break;
case DECK_RARITY_LEGENDARY:
- if ( random2(500) < power )
+ if (random2(500) < power)
++power_level;
// deliberate fall-through
case DECK_RARITY_RARE:
- if ( random2(700) < power )
+ if (random2(700) < power)
++power_level;
break;
}
@@ -1310,24 +1309,24 @@ static void _portal_card(int power, deck_rarity_type rarity)
const int control_level = get_power_level(power, rarity);
bool instant = false;
bool controlled = false;
- if ( control_level >= 2 )
+ if (control_level >= 2)
{
instant = true;
controlled = true;
}
- else if ( control_level == 1 )
+ else if (control_level == 1)
{
- if ( coinflip() )
+ if (coinflip())
instant = true;
else
controlled = true;
}
const bool was_controlled = player_control_teleport();
- if ( controlled && !was_controlled )
- you.duration[DUR_CONTROL_TELEPORT] = 6; // long enough to kick in
+ if (controlled && !was_controlled)
+ you.duration[DUR_CONTROL_TELEPORT] = 6; // Long enough to kick in.
- if ( instant )
+ if (instant)
you_teleport_now( true );
else
you_teleport();
@@ -1336,9 +1335,9 @@ static void _portal_card(int power, deck_rarity_type rarity)
static void _warp_card(int power, deck_rarity_type rarity)
{
const int control_level = get_power_level(power, rarity);
- if ( control_level >= 2 )
+ if (control_level >= 2)
blink(1000, false);
- else if ( control_level == 1 )
+ else if (control_level == 1)
cast_semi_controlled_blink(power / 4);
else
random_blink(false);
@@ -1412,7 +1411,7 @@ static void _velocity_card(int power, deck_rarity_type rarity)
const int power_level = get_power_level(power, rarity);
if (power_level >= 2)
potion_effect( POT_SPEED, random2(power / 4) );
- else if ( power_level == 1 )
+ else if (power_level == 1)
{
cast_fly( random2(power/4) );
cast_swiftness( random2(power/4) );
@@ -1423,7 +1422,7 @@ static void _velocity_card(int power, deck_rarity_type rarity)
static void _damnation_card(int power, deck_rarity_type rarity)
{
- if ( you.level_type != LEVEL_DUNGEON )
+ if (you.level_type != LEVEL_DUNGEON)
{
canned_msg(MSG_NOTHING_HAPPENS);
return;
@@ -1432,24 +1431,25 @@ static void _damnation_card(int power, deck_rarity_type rarity)
// Calculate how many extra banishments you get.
const int power_level = get_power_level(power, rarity);
int nemelex_bonus = 0;
- if ( you.religion == GOD_NEMELEX_XOBEH && !player_under_penance() )
+ if (you.religion == GOD_NEMELEX_XOBEH && !player_under_penance())
nemelex_bonus = you.piety / 20;
+
int extra_targets = power_level + random2(you.skills[SK_EVOCATIONS] +
nemelex_bonus) / 12;
- for ( int i = 0; i < 1 + extra_targets; ++i )
+ for (int i = 0; i < 1 + extra_targets; ++i)
{
- // pick a random monster nearby to banish (or yourself)
+ // Pick a random monster nearby to banish (or yourself).
monsters *mon_to_banish = choose_random_nearby_monster(1);
- // bonus banishments only banish monsters
- if ( i != 0 && !mon_to_banish )
+ // Bonus banishments only banish monsters.
+ if (i != 0 && !mon_to_banish)
continue;
- if ( !mon_to_banish ) // banish yourself!
+ if (!mon_to_banish) // Banish yourself!
{
banished(DNGN_ENTER_ABYSS, "drawing a card");
- break; // don't banish anything else
+ break; // Don't banish anything else.
}
else
mon_to_banish->banish();
@@ -1459,7 +1459,7 @@ static void _damnation_card(int power, deck_rarity_type rarity)
static void _warpwright_card(int power, deck_rarity_type rarity)
{
- if ( you.level_type == LEVEL_ABYSS )
+ if (you.level_type == LEVEL_ABYSS)
{
mpr("The power of the Abyss blocks your magic.");
return;
@@ -1467,8 +1467,8 @@ static void _warpwright_card(int power, deck_rarity_type rarity)
int count = 0;
int fx = -1, fy = -1;
- for ( int dx = -1; dx <= 1; ++dx )
- for ( int dy = -1; dy <= 1; ++dy )
+ for (int dx = -1; dx <= 1; ++dx)
+ for (int dy = -1; dy <= 1; ++dy)
{
if ( dx == 0 && dy == 0 )
continue;
@@ -1476,20 +1476,20 @@ static void _warpwright_card(int power, deck_rarity_type rarity)
const int rx = you.x_pos + dx;
const int ry = you.y_pos + dy;
- if ( grd[rx][ry] == DNGN_FLOOR && trap_at_xy(rx,ry) == -1
- && one_chance_in(++count) )
+ if (grd[rx][ry] == DNGN_FLOOR && trap_at_xy(rx,ry) == -1
+ && one_chance_in(++count))
{
fx = rx;
fy = ry;
}
}
- if ( fx >= 0 ) // found a spot
+ if (fx >= 0) // found a spot
{
- if ( place_specific_trap(fx, fy, TRAP_TELEPORT) )
+ if (place_specific_trap(fx, fy, TRAP_TELEPORT))
{
- // mark it discovered if enough power
- if ( get_power_level(power, rarity) >= 1 )
+ // Mark it discovered if enough power.
+ if (get_power_level(power, rarity) >= 1)
{
const int i = trap_at_xy(fx, fy);
if (i != -1) // should always happen
@@ -1526,7 +1526,7 @@ static void _flight_card(int power, deck_rarity_type rarity)
{
if (is_valid_shaft_level() && grd[you.x_pos][you.y_pos] == DNGN_FLOOR)
{
- if ( place_specific_trap(you.x_pos, you.y_pos, TRAP_SHAFT) )
+ if (place_specific_trap(you.x_pos, you.y_pos, TRAP_SHAFT))
{
const int i = trap_at_xy(you.x_pos, you.y_pos);
grd[you.x_pos][you.y_pos] = trap_category(env.trap[i].type);
@@ -1544,23 +1544,24 @@ static void _minefield_card(int power, deck_rarity_type rarity)
{
const int power_level = get_power_level(power, rarity);
const int radius = power_level * 2 + 2;
- for ( int dx = -radius; dx <= radius; ++dx )
- for ( int dy = -radius; dy <= radius; ++dy )
+ for (int dx = -radius; dx <= radius; ++dx)
+ for (int dy = -radius; dy <= radius; ++dy)
{
- if ( dx*dx + dy*dy > radius*radius + 1 )
+ if (dx == 0 && dy == 0)
continue;
- if ( dx == 0 && dy == 0 )
+
+ if (dx*dx + dy*dy > radius*radius + 1)
continue;
const int rx = you.x_pos + dx;
const int ry = you.y_pos + dy;
- if ( !in_bounds(rx, ry) )
+ if (!in_bounds(rx, ry))
continue;
- if ( grd[rx][ry] == DNGN_FLOOR && trap_at_xy(rx,ry) == -1
- && one_chance_in(4 - power_level) )
+ if (grd[rx][ry] == DNGN_FLOOR && trap_at_xy(rx,ry) == -1
+ && one_chance_in(4 - power_level))
{
- if ( you.level_type == LEVEL_ABYSS )
+ if (you.level_type == LEVEL_ABYSS)
grd[rx][ry] = coinflip() ? DNGN_DEEP_WATER : DNGN_LAVA;
else
place_specific_trap(rx, ry, TRAP_RANDOM);
@@ -1571,7 +1572,7 @@ static void _minefield_card(int power, deck_rarity_type rarity)
static int _drain_monsters(int x, int y, int pow, int garbage)
{
UNUSED( garbage );
- if ( coord_def(x,y) == you.pos() )
+ if (coord_def(x,y) == you.pos())
drain_exp();
else
{
@@ -1602,7 +1603,7 @@ static int _drain_monsters(int x, int y, int pow, int garbage)
if (mon.hit_dice < 1)
mon.hit_points = 0;
- if ( mon.hit_points <= 0 )
+ if (mon.hit_points <= 0)
monster_die( &mon, KILL_YOU, 0 );
}
}
@@ -1693,22 +1694,22 @@ static void _elixir_card(int power, deck_rarity_type rarity)
{
int power_level = get_power_level(power, rarity);
- if ( power_level == 1 && you.hp * 2 > you.hp_max )
+ if (power_level == 1 && you.hp * 2 > you.hp_max)
power_level = 0;
- if ( power_level == 0 )
+ if (power_level == 0)
{
- if ( coinflip() )
+ if (coinflip())
potion_effect( POT_HEAL_WOUNDS, 40 ); // power doesn't matter
else
cast_regen( random2(power / 4) );
}
- else if ( power_level == 1 )
+ else if (power_level == 1)
{
you.hp = you.hp_max;
you.magic_points = 0;
}
- else if ( power_level >= 2 )
+ else if (power_level >= 2)
{
you.hp = you.hp_max;
you.magic_points = you.max_magic_points;
@@ -1720,17 +1721,17 @@ static void _elixir_card(int power, deck_rarity_type rarity)
static void _battle_lust_card(int power, deck_rarity_type rarity)
{
const int power_level = get_power_level(power, rarity);
- if ( power_level >= 2 )
+ if (power_level >= 2)
{
you.duration[DUR_SLAYING] = random2(power/6) + 1;
mpr("You feel deadly.");
}
- else if ( power_level == 1 )
+ else if (power_level == 1)
{
you.duration[DUR_BUILDING_RAGE] = 1;
mpr("You feel your rage building.");
}
- else if ( power_level == 0 )
+ else if (power_level == 0)
potion_effect(POT_MIGHT, random2(power/4));
}
@@ -1759,36 +1760,38 @@ static void _metamorphosis_card(int power, deck_rarity_type rarity)
static void _helm_card(int power, deck_rarity_type rarity)
{
const int power_level = get_power_level(power, rarity);
- bool do_forescry = false;
+ bool do_forescry = false;
bool do_stoneskin = false;
- bool do_shield = false;
+ bool do_shield = false;
int num_resists = 0;
- if ( power_level >= 2 )
+
+ // Chances are cummulative.
+ if (power_level >= 2)
{
- if ( coinflip() ) do_forescry = true;
- if ( coinflip() ) do_stoneskin = true;
- if ( coinflip() ) do_shield = true;
+ if (coinflip()) do_forescry = true;
+ if (coinflip()) do_stoneskin = true;
+ if (coinflip()) do_shield = true;
num_resists = random2(4);
}
- if ( power_level >= 1 )
+ if (power_level >= 1)
{
- if ( coinflip() ) do_forescry = true;
- if ( coinflip() ) do_stoneskin = true;
- if ( coinflip() ) do_shield = true;
+ if (coinflip()) do_forescry = true;
+ if (coinflip()) do_stoneskin = true;
+ if (coinflip()) do_shield = true;
}
- if ( power_level >= 0 )
+ if (power_level >= 0)
{
- if ( coinflip() )
+ if (coinflip())
do_forescry = true;
else
do_stoneskin = true;
}
- if ( do_forescry )
+ if (do_forescry)
cast_forescry( random2(power/4) );
- if ( do_stoneskin )
+ if (do_stoneskin)
cast_stoneskin( random2(power/4) );
- if ( num_resists )
+ if (num_resists)
{
const duration_type possible_resists[4] = {
DUR_RESIST_POISON, DUR_INSULATION,
@@ -1798,13 +1801,13 @@ static void _helm_card(int power, deck_rarity_type rarity)
"poison", "electricity", "fire", "cold"
};
- for ( int i = 0; i < 4 && num_resists; ++i )
+ for (int i = 0; i < 4 && num_resists; ++i)
{
- // if there are n left, of which we need to choose
+ // If there are n left, of which we need to choose
// k, we have chance k/n of selecting the next item.
if ( random2(4-i) < num_resists )
{
- // Add a temporary resist
+ // Add a temporary resistance.
you.duration[possible_resists[i]] += random2(power/7) + 1;
msg::stream << "You feel resistant to " << resist_names[i]
<< '.' << std::endl;
@@ -1813,9 +1816,9 @@ static void _helm_card(int power, deck_rarity_type rarity)
}
}
- if ( do_shield )
+ if (do_shield)
{
- if ( you.duration[DUR_MAGIC_SHIELD] == 0 )
+ if (you.duration[DUR_MAGIC_SHIELD] == 0)
mpr("A magical shield forms in front of you.");
you.duration[DUR_MAGIC_SHIELD] += random2(power/6) + 1;
}
@@ -1859,7 +1862,7 @@ static void _shadow_card(int power, deck_rarity_type rarity)
{
const int power_level = get_power_level(power, rarity);
- if ( power_level >= 1 )
+ if (power_level >= 1)
{
mpr( you.duration[DUR_STEALTH] ? "You feel more catlike."
: "You feel stealthy.");
@@ -1881,10 +1884,10 @@ static void _potion_card(int power, deck_rarity_type rarity)
potion_type pot = RANDOM_ELEMENT(pot_effects);
- if ( power_level >= 1 && coinflip() )
+ if (power_level >= 1 && coinflip())
pot = (coinflip() ? POT_CURE_MUTATION : POT_MUTATION);
- if ( power_level >= 2 && one_chance_in(5) )
+ if (power_level >= 2 && one_chance_in(5))
pot = POT_MAGIC;
potion_effect(pot, random2(power/4));
@@ -1897,18 +1900,18 @@ static void _focus_card(int power, deck_rarity_type rarity)
int best_stat = 0;
int worst_stat = 0;
- for ( int i = 1; i < 3; ++i )
+ for (int i = 1; i < 3; ++i)
{
const int best_diff = *max_statp[i] - *max_statp[best_stat];
- if ( best_diff > 0 || (best_diff == 0 && coinflip()) )
+ if (best_diff > 0 || best_diff == 0 && coinflip())
best_stat = i;
const int worst_diff = *max_statp[i] - *max_statp[worst_stat];
- if ( worst_diff < 0 || (worst_diff == 0 && coinflip()) )
+ if (worst_diff < 0 || worst_diff == 0 && coinflip())
worst_stat = i;
}
- while ( best_stat == worst_stat )
+ while (best_stat == worst_stat)
{
best_stat = random2(3);
worst_stat = random2(3);
@@ -1942,14 +1945,14 @@ static void _focus_card(int power, deck_rarity_type rarity)
}
}
- for ( int i = 0; i < 3; ++i )
+ for (int i = 0; i < 3; ++i)
if (*max_statp[i] < 1 || *base_statp[i] < 1)
ouch(INSTANT_DEATH, 0, kill_types[i], cause.c_str(), true);
- // The player survived!
- you.redraw_strength = true;
+ // The player survived! Yay!
+ you.redraw_strength = true;
you.redraw_intelligence = true;
- you.redraw_dexterity = true;
+ you.redraw_dexterity = true;
burden_change();
}
@@ -1957,23 +1960,23 @@ static void _focus_card(int power, deck_rarity_type rarity)
static void _shuffle_card(int power, deck_rarity_type rarity)
{
stat_type stats[3] = {STAT_STRENGTH, STAT_DEXTERITY, STAT_INTELLIGENCE};
- int old_base[3] = { you.strength, you.dex, you.intel};
+ int old_base[3] = {you.strength, you.dex, you.intel};
int old_max[3] = {you.max_strength, you.max_dex, you.max_intel};
int modifiers[3];
int perm[3] = { 0, 1, 2 };
- for ( int i = 0; i < 3; ++i )
+ for (int i = 0; i < 3; ++i)
modifiers[i] = stat_modifier(stats[i]);
std::random_shuffle( perm, perm + 3 );
int new_base[3];
int new_max[3];
- for ( int i = 0; i < 3; ++i )
+ for (int i = 0; i < 3; ++i)
{
new_base[perm[i]] = old_base[i] - modifiers[i] + modifiers[perm[i]];
- new_max[perm[i]] = old_max[i] - modifiers[i] + modifiers[perm[i]];
+ new_max[perm[i]] = old_max[i] - modifiers[i] + modifiers[perm[i]];
}
// Did the shuffling kill the player?
@@ -1999,7 +2002,7 @@ static void _shuffle_card(int power, deck_rarity_type rarity)
}
}
- for ( int i = 0; i < 3; ++i )
+ for (int i = 0; i < 3; ++i)
if (new_base[i] < 1 || new_max[i] < 1)
ouch(INSTANT_DEATH, 0, kill_types[i], cause.c_str(), true);
@@ -2007,17 +2010,17 @@ static void _shuffle_card(int power, deck_rarity_type rarity)
// Sometimes you just long for Python.
you.strength = new_base[0];
- you.dex = new_base[1];
- you.intel = new_base[2];
+ you.dex = new_base[1];
+ you.intel = new_base[2];
you.max_strength = new_max[0];
- you.max_dex = new_max[1];
- you.max_intel = new_max[2];
+ you.max_dex = new_max[1];
+ you.max_intel = new_max[2];
- you.redraw_strength = true;
+ you.redraw_strength = true;
you.redraw_intelligence = true;
- you.redraw_dexterity = true;
- you.redraw_evasion = true;
+ you.redraw_dexterity = true;
+ you.redraw_evasion = true;
burden_change();
}
@@ -2026,13 +2029,13 @@ static void _experience_card(int power, deck_rarity_type rarity)
{
const int power_level = get_power_level(power, rarity);
- if ( you.experience_level < 27 )
+ if (you.experience_level < 27)
{
mpr("You feel more experienced.");
const unsigned long xp_cap = 1 + exp_needed(2 + you.experience_level);
- // power_level 2 means automatic level gain
- if ( power_level == 2 )
+ // power_level 2 means automatic level gain.
+ if (power_level == 2)
you.experience = xp_cap;
else
{
@@ -2041,7 +2044,7 @@ static void _experience_card(int power, deck_rarity_type rarity)
// But not guaranteed.
// Overrides archmagi effect, like potions of experience.
you.experience += power * 100;
- if ( you.experience > xp_cap )
+ if (you.experience > xp_cap)
you.experience = xp_cap;
}
}
@@ -2050,7 +2053,7 @@ static void _experience_card(int power, deck_rarity_type rarity)
// Put some free XP into pool; power_level 2 means fill pool
you.exp_available += power * 50;
- if ( power_level >= 2 || you.exp_available > 20000)
+ if (power_level >= 2 || you.exp_available > 20000)
you.exp_available = 20000;
level_change();
@@ -2066,9 +2069,9 @@ static void _helix_card(int power, deck_rarity_type rarity)
{
const int power_level = get_power_level(power, rarity);
- if ( power_level == 0 )
+ if (power_level == 0)
{
- switch ( how_mutated() ? random2(3) : 0 )
+ switch (how_mutated() ? random2(3) : 0)
{
case 0:
mutate(RANDOM_MUTATION);
@@ -2082,23 +2085,23 @@ static void _helix_card(int power, deck_rarity_type rarity)
break;
}
}
- else if ( power_level == 1 )
+ else if (power_level == 1)
{
- switch ( how_mutated() ? random2(3) : 0 )
+ switch (how_mutated() ? random2(3) : 0)
{
case 0:
mutate(coinflip() ? RANDOM_GOOD_MUTATION : RANDOM_MUTATION);
break;
case 1:
- if ( coinflip() )
+ if (coinflip())
_remove_bad_mutation();
else
delete_mutation(RANDOM_MUTATION);
break;
case 2:
- if ( coinflip() )
+ if (coinflip())
{
- if ( coinflip() )
+ if (coinflip())
{
_remove_bad_mutation();
mutate(RANDOM_MUTATION);
@@ -2119,7 +2122,7 @@ static void _helix_card(int power, deck_rarity_type rarity)
}
else
{
- switch ( random2(3) )
+ switch (random2(3))
{
case 0:
_remove_bad_mutation();
@@ -2128,7 +2131,7 @@ static void _helix_card(int power, deck_rarity_type rarity)
mutate(RANDOM_GOOD_MUTATION);
break;
case 2:
- if ( coinflip() )
+ if (coinflip())
{
// If you get unlucky, you could get here with no bad
// mutations and simply get a mutation effect. Oh well.
@@ -2149,9 +2152,9 @@ static void _sage_card(int power, deck_rarity_type rarity)
{
const int power_level = get_power_level(power, rarity);
int c; // how much to weight your skills
- if ( power_level == 0 )
+ if (power_level == 0)
c = 0;
- else if ( power_level == 1 )
+ else if (power_level == 1)
c = random2(10) + 1;
else
c = 10;
@@ -2163,22 +2166,20 @@ static void _sage_card(int power, deck_rarity_type rarity)
int result = -1;
for (int i = 0; i < NUM_SKILLS; ++i )
{
- if ( skill_name(i) == NULL )
+ if (skill_name(i) == NULL)
continue;
- if ( you.skills[i] < MAX_SKILL_LEVEL )
+ if (you.skills[i] < MAX_SKILL_LEVEL)
{
const int curweight = 1 + you.skills[i] * (40-you.skills[i]) * c;
totalweight += curweight;
- if ( random2(totalweight) < curweight )
+ if (random2(totalweight) < curweight)
result = i;
}
}
- if ( result == -1 )
- {
- mpr("You feel omnipotent."); // all skills maxed
- }
+ if (result == -1)
+ mpr("You feel omnipotent."); // All skills maxed.
else
{
you.duration[DUR_SAGE] = random2(1800) + 200;
@@ -2194,9 +2195,9 @@ static void _create_pond(const coord_def& center, int radius, bool allow_deep)
for ( ; ri; ++ri )
{
const coord_def p = *ri;
- if ( p != you.pos() && coinflip() )
+ if (p != you.pos() && coinflip())
{
- if ( grd(p) == DNGN_FLOOR )
+ if (grd(p) == DNGN_FLOOR)
{
dungeon_feature_type feat;
@@ -2220,15 +2221,15 @@ static void _deepen_water(const coord_def& center, int radius)
// same iteration, i.e., a newly-flooded square shouldn't count
// in the decision as to whether to make the next square flooded.
const coord_def p = *ri;
- if ( grd(p) == DNGN_SHALLOW_WATER &&
- p != you.pos() &&
- random2(8) < 1 + count_neighbours(p.x, p.y, DNGN_DEEP_WATER) )
+ if (grd(p) == DNGN_SHALLOW_WATER
+ && p != you.pos()
+ && random2(8) < 1 + count_neighbours(p.x, p.y, DNGN_DEEP_WATER))
{
dungeon_terrain_changed(p, DNGN_DEEP_WATER);
}
- if (grd(p) == DNGN_FLOOR &&
- random2(3) < random2(count_neighbours(p.x,p.y,DNGN_DEEP_WATER) +
- count_neighbours(p.x,p.y,DNGN_SHALLOW_WATER)))
+ if (grd(p) == DNGN_FLOOR
+ && random2(3) < random2(count_neighbours(p.x,p.y,DNGN_DEEP_WATER)
+ + count_neighbours(p.x,p.y,DNGN_SHALLOW_WATER)))
{
dungeon_terrain_changed(p, DNGN_SHALLOW_WATER);
}
@@ -2238,16 +2239,16 @@ static void _deepen_water(const coord_def& center, int radius)
static void _water_card(int power, deck_rarity_type rarity)
{
const int power_level = get_power_level(power, rarity);
- if ( power_level == 0 )
+ if (power_level == 0)
{
mpr("You create a pond!");
_create_pond(you.pos(), 4, false);
}
- else if ( power_level == 1 )
+ else if (power_level == 1)
{
mpr("You feel the tide rushing in!");
_create_pond(you.pos(), 6, true);
- for ( int i = 0; i < 2; ++i )
+ for (int i = 0; i < 2; ++i)
_deepen_water(you.pos(), 6);
}
else
@@ -2260,10 +2261,10 @@ static void _water_card(int power, deck_rarity_type rarity)
{
coord_def p = *ri;
destroy_trap(p);
- if ( grd(p) == DNGN_FLOOR )
+ if (grd(p) == DNGN_FLOOR)
{
dungeon_feature_type new_feature = DNGN_SHALLOW_WATER;
- if ( p != you.pos() && coinflip() )
+ if (p != you.pos() && coinflip())
new_feature = DNGN_DEEP_WATER;
dungeon_terrain_changed(p, new_feature);
}
@@ -2274,7 +2275,7 @@ static void _water_card(int power, deck_rarity_type rarity)
static void _glass_card(int power, deck_rarity_type rarity)
{
const int power_level = get_power_level(power, rarity);
- const int radius = ( power_level == 2 ) ? 1000 : random2(power/40) + 2;
+ const int radius = (power_level == 2) ? 1000 : random2(power/40) + 2;
vitrify_area(radius);
}
@@ -2289,7 +2290,7 @@ static void _dowsing_card(int power, deck_rarity_type rarity)
if (power_level >= 2)
{
- for ( int i = 0; i < 3; ++i )
+ for (int i = 0; i < 3; ++i)
things_to_do[i] = true;
}
@@ -2369,15 +2370,16 @@ static bool _trowel_card(int power, deck_rarity_type rarity)
num_made++;
}
- if ( num_made == 2 )
+ if (num_made == 2)
mpr("The constructs glare at each other.");
+
done_stuff = (num_made > 0);
}
else
{
// Do-nothing (effectively): create a cosmetic feature
const coord_def pos = pick_adjacent_free_square(you.pos());
- if ( pos.x >= 0 && pos.y >= 0 )
+ if (pos.x >= 0 && pos.y >= 0)
{
const dungeon_feature_type statfeat[] = {
DNGN_GRANITE_STATUE, DNGN_ORCISH_IDOL
@@ -2391,14 +2393,14 @@ static bool _trowel_card(int power, deck_rarity_type rarity)
}
else
{
- // generate an altar
- if ( grd[you.x_pos][you.y_pos] == DNGN_FLOOR )
+ // Generate an altar.
+ if (grd[you.x_pos][you.y_pos] == DNGN_FLOOR)
{
- // might get GOD_NO_GOD and no altar
+ // Might get GOD_NO_GOD and no altar.
god_type rgod = static_cast<god_type>(random2(NUM_GODS));
grd[you.x_pos][you.y_pos] = altar_for_god(rgod);
- if ( grd[you.x_pos][you.y_pos] != DNGN_FLOOR )
+ if (grd[you.x_pos][you.y_pos] != DNGN_FLOOR)
{
done_stuff = true;
mprf("An altar to %s grows from the floor before you!",
@@ -2407,15 +2409,15 @@ static bool _trowel_card(int power, deck_rarity_type rarity)
}
}
- if ( !done_stuff )
+ if (!done_stuff)
canned_msg(MSG_NOTHING_HAPPENS);
- return done_stuff;
+ return (done_stuff);
}
static void _genie_card(int power, deck_rarity_type rarity)
{
- if ( coinflip() )
+ if (coinflip())
{
mpr("A genie takes form and thunders: "
"\"Choose your reward, mortal!\"");
@@ -2462,7 +2464,7 @@ static void _curse_card(int power, deck_rarity_type rarity)
{
// Curse 1.5 items on average.
curse_an_item(false);
- if ( coinflip() )
+ if (coinflip())
curse_an_item(false);
}
}
@@ -2470,10 +2472,10 @@ static void _curse_card(int power, deck_rarity_type rarity)
static void _crusade_card(int power, deck_rarity_type rarity)
{
const int power_level = get_power_level(power, rarity);
- if ( power_level >= 1 )
+ if (power_level >= 1)
{
// A chance to convert opponents.
- for ( int i = 0; i < MAX_MONSTERS; ++i )
+ for (int i = 0; i < MAX_MONSTERS; ++i)
{
monsters* const monster = &menv[i];
if (monster->type == -1 || !mons_near(monster)
@@ -2556,14 +2558,14 @@ static void _summon_any_monster(int power, deck_rarity_type rarity)
dx = random2(3) - 1;
dy = random2(3) - 1;
}
- while ( dx == 0 && dy == 0 );
+ while (dx == 0 && dy == 0);
monster_type cur_try;
do
{
cur_try = random_monster_at_grid(you.x_pos + dx, you.y_pos + dy);
}
- while ( mons_is_unique(cur_try) );
+ while (mons_is_unique(cur_try));
if (mon_chosen == NUM_MONSTERS
|| mons_power(mon_chosen) < mons_power(cur_try))
@@ -2661,10 +2663,10 @@ static void _summon_flying(int power, deck_rarity_type rarity)
{
result = flytypes[random2(4) + power_level];
}
- while ( friendly && mons_class_flag(result, M_INVIS)
- && !player_see_invis() );
+ while (friendly && mons_class_flag(result, M_INVIS)
+ && !player_see_invis());
- for ( int i = 0; i < power_level * 5 + 2; ++i )
+ for (int i = 0; i < power_level * 5 + 2; ++i)
{
create_monster(
mgen_data(result,
@@ -2728,12 +2730,12 @@ static int _card_power(deck_rarity_type rarity)
}
result += you.skills[SK_EVOCATIONS] * 9;
- if ( rarity == DECK_RARITY_RARE )
+ if (rarity == DECK_RARITY_RARE)
result += 150;
- else if ( rarity == DECK_RARITY_LEGENDARY )
+ else if (rarity == DECK_RARITY_LEGENDARY)
result += 300;
- return result;
+ return (result);
}
bool card_effect(card_type which_card, deck_rarity_type rarity,
@@ -2820,7 +2822,7 @@ bool card_effect(card_type which_card, deck_rarity_type rarity,
case CARD_TORMENT: torment(TORMENT_CARDS, you.x_pos, you.y_pos); break;
case CARD_VENOM:
- if ( coinflip() )
+ if (coinflip())
{
mprf("You have drawn %s.", card_name(which_card));
your_spells(SPELL_OLGREBS_TOXIC_RADIANCE,random2(power/4), false);
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index 7fef1d1f86..2e20c7406b 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -228,7 +228,7 @@ static std::string _get_recite_speech(const std::string key, int weight)
if (!str.empty())
return (str);
- // in case nothing is found
+ // In case nothing is found.
if (key == "start")
return ("begin reciting the Axioms of Law.");
@@ -295,7 +295,6 @@ static void _clear_pending_delays()
}
void start_delay( delay_type type, int turns, int parm1, int parm2 )
-/***********************************************************/
{
ASSERT(!crawl_state.is_repeating_cmd() || type == DELAY_MACRO);
@@ -322,7 +321,6 @@ void start_delay( delay_type type, int turns, int parm1, int parm2 )
}
void stop_delay( bool stop_stair_travel )
-/*********************/
{
_interrupts_blocked = 0; // Just to be safe
@@ -461,7 +459,7 @@ void stop_delay( bool stop_stair_travel )
break;
case DELAY_INTERRUPTIBLE:
- // always stoppable by definition...
+ // Always stoppable by definition...
// try using a more specific type anyways. -- bwr
_pop_delay();
break;
@@ -596,10 +594,10 @@ bool is_vampire_feeding()
return (delay.type == DELAY_FEED_VAMPIRE);
}
-// Check whether there are monsters who might be influenced by Recite
-// returns 0, if no monsters found
-// returns 1, if eligible audience found
-// returns -1, if entire audience already affected or too dumb to understand.
+// Check whether there are monsters who might be influenced by Recite.
+// Returns 0, if no monsters found
+// Returns 1, if eligible audience found
+// Returns -1, if entire audience already affected or too dumb to understand.
int check_recital_audience()
{
int mid;
@@ -654,7 +652,6 @@ static void _xom_check_corpse_waste()
}
void handle_delay( void )
-/***********************/
{
if (!you_are_delayed())
return;
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 4221b884cc..2d29764cf6 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -431,7 +431,7 @@ static void _trim_randart_inscrip( item_def& item )
struct property_descriptor
{
randart_prop_type property;
- const char* desc; // If it contains %d, will be replaced by value
+ const char* desc; // If it contains %d, will be replaced by value.
bool is_graded_resist;
};
@@ -736,18 +736,18 @@ static std::string _describe_demon(const monsters &mons)
break;
case FL_NONE: // does not fly
- if ( !one_chance_in(4) )
+ if (!one_chance_in(4))
description << RANDOM_ELEMENT(nonfly_names);
break;
}
description << ".";
- if ( random2(40) < 3 )
+ if (random2(40) < 3)
{
- if ( player_can_smell() )
+ if (player_can_smell())
{
- switch ( random2(3) )
+ switch (random2(3))
{
case 0:
description << " It stinks of brimstone.";
@@ -1488,12 +1488,12 @@ static std::string _describe_deck( const item_def &item )
description += "$";
const std::vector<card_type> drawn_cards = get_drawn_cards(item);
- if ( !drawn_cards.empty() )
+ if (!drawn_cards.empty())
{
description += "Drawn card(s): ";
- for ( unsigned int i = 0; i < drawn_cards.size(); ++i )
+ for (unsigned int i = 0; i < drawn_cards.size(); ++i)
{
- if ( i != 0 )
+ if (i != 0)
description += ", ";
description += card_name(drawn_cards[i]);
}
@@ -1502,16 +1502,16 @@ static std::string _describe_deck( const item_def &item )
const int num_cards = cards_in_deck(item);
int last_known_card = -1;
- if ( top_card_is_known(item) )
+ if (top_card_is_known(item))
{
description += "Next card(s): ";
- for ( int i = 0; i < num_cards; ++i )
+ for (int i = 0; i < num_cards; ++i)
{
unsigned char flags;
const card_type card = get_card_and_flags(item, -i-1, flags);
- if ( flags & CFLAG_MARKED )
+ if (flags & CFLAG_MARKED)
{
- if ( i != 0 )
+ if (i != 0)
description += ", ";
description += card_name(card);
last_known_card = i;
@@ -1524,21 +1524,22 @@ static std::string _describe_deck( const item_def &item )
// Marked cards which we don't know straight off.
std::vector<card_type> marked_cards;
- for ( int i = last_known_card + 1; i < num_cards; ++i )
+ for (int i = last_known_card + 1; i < num_cards; ++i)
{
unsigned char flags;
const card_type card = get_card_and_flags(item, -i-1, flags);
- if ( flags & CFLAG_MARKED )
+ if (flags & CFLAG_MARKED)
marked_cards.push_back(card);
}
- if ( !marked_cards.empty() )
+ if (!marked_cards.empty())
{
std::sort(marked_cards.begin(), marked_cards.end(),
_compare_card_names);
+
description += "Marked card(s): ";
- for ( unsigned int i = 0; i < marked_cards.size(); ++i )
+ for (unsigned int i = 0; i < marked_cards.size(); ++i)
{
- if ( i != 0 )
+ if (i != 0)
description += ", ";
description += card_name(marked_cards[i]);
}
@@ -1547,22 +1548,24 @@ static std::string _describe_deck( const item_def &item )
// Seen cards in the deck.
std::vector<card_type> seen_cards;
- for ( int i = 0; i < num_cards; ++i )
+ for (int i = 0; i < num_cards; ++i)
{
unsigned char flags;
const card_type card = get_card_and_flags(item, -i-1, flags);
+
// This *might* leak a bit of information...oh well.
- if ( (flags & CFLAG_SEEN) && !(flags & CFLAG_MARKED) )
+ if ((flags & CFLAG_SEEN) && !(flags & CFLAG_MARKED))
seen_cards.push_back(card);
}
- if ( !seen_cards.empty() )
+ if (!seen_cards.empty())
{
std::sort(seen_cards.begin(), seen_cards.end(),
_compare_card_names);
+
description += "Seen card(s): ";
- for ( unsigned int i = 0; i < seen_cards.size(); ++i )
+ for (unsigned int i = 0; i < seen_cards.size(); ++i)
{
- if ( i != 0 )
+ if (i != 0)
description += ", ";
description += card_name(seen_cards[i]);
}
@@ -1584,14 +1587,14 @@ bool is_dumpable_artefact( const item_def &item, bool verbose)
{
ret = item_ident( item, ISFLAG_KNOW_PROPERTIES );
}
- else if (item.base_type == OBJ_ARMOUR
- && (verbose && item_type_known(item)))
+ else if (verbose && item.base_type == OBJ_ARMOUR
+ && item_type_known(item))
{
const int spec_ench = get_armour_ego_type( item );
ret = (spec_ench >= SPARM_RUNNING && spec_ench <= SPARM_PRESERVATION);
}
- else if (item.base_type == OBJ_JEWELLERY
- && (verbose && item_type_known(item)))
+ else if (verbose && item.base_type == OBJ_JEWELLERY
+ && item_type_known(item))
{
ret = true;
}
@@ -1890,7 +1893,7 @@ std::string get_item_description( const item_def &item, bool verbose,
<< "." << (mass % 10)
<< " aum. "; // arbitrary unit of mass
- if ( is_dumpable_artefact(item, false) )
+ if (is_dumpable_artefact(item, false))
{
if (item.base_type == OBJ_ARMOUR
|| item.base_type == OBJ_WEAPONS)
@@ -2531,14 +2534,18 @@ std::string get_ghost_description(const monsters &mons, bool concise)
(ghost.xl < 27) ? "n awesomely powerful"
: " legendary")
<< " ";
- if ( concise )
+ if (concise)
+ {
gstr << get_species_abbrev(gspecies)
<< get_class_abbrev(ghost.job);
+ }
else
+ {
gstr << species_name(gspecies,
ghost.xl)
<< " "
<< get_class_name(ghost.job);
+ }
return gstr.str();
}
@@ -2908,7 +2915,7 @@ void describe_god( god_type which_god, bool give_title )
// Print long god's name.
textcolor(colour);
cprintf( "%s", god_name(which_god, true).c_str());
- cprintf (EOL EOL);
+ cprintf(EOL EOL);
// Print god's description.
textcolor(LIGHTGREY);
@@ -3123,7 +3130,7 @@ std::string get_skill_description(int skill, bool need_title)
if (you.attribute[ATTR_TRANSFORMATION] == TRAN_DRAGON
|| player_genus(GENPC_DRACONIAN)
- || (you.species == SP_MERFOLK && player_is_swimming())
+ || you.species == SP_MERFOLK && player_is_swimming()
|| player_mutation_level( MUT_STINGER ))
{
unarmed_attacks.push_back("slap monsters with your tail");
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 7a7d29f4f1..ba9efd4a73 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -1182,7 +1182,7 @@ static void _build_dungeon_level(int level_number, int level_type)
}
// Hook up the special room (if there is one, and it hasn't
- // been hooked up already in roguey_level())
+ // been hooked up already in roguey_level()).
if (sr.created && !sr.hooked_up)
_specr_2(sr);
@@ -1519,7 +1519,7 @@ static void _place_base_islands(int margin, int num_islands, int estradius,
static void _prepare_shoals(int level_number)
{
- dgn_Layout_Type = "shaols";
+ dgn_Layout_Type = "shoals";
// dpeg's algorithm.
// We could have just used spotty_level() and changed rock to
@@ -2151,7 +2151,7 @@ static builder_rc_type _builder_normal(int level_number, char level_type,
// the basic builder for something more interesting.
bool just_roguey = coinflip();
- // sometimes roguey_levels generate a special room
+ // Sometimes _roguey_level() generates a special room.
_roguey_level(level_number, sr, just_roguey);
minivault_chance = 4;
@@ -2519,9 +2519,9 @@ static void _place_branch_entrances(int dlevel, char level_type)
// Place actual branch entrances.
for (int i = 0; i < NUM_BRANCHES; ++i)
{
- if ( branches[i].entry_stairs != NUM_FEATURES &&
- player_in_branch(branches[i].parent_branch) &&
- player_branch_depth() == branches[i].startdepth )
+ if (branches[i].entry_stairs != NUM_FEATURES
+ && player_in_branch(branches[i].parent_branch)
+ && player_branch_depth() == branches[i].startdepth)
{
// Place a stair.
#ifdef DEBUG_DIAGNOSTICS
@@ -2713,7 +2713,7 @@ static bool _make_room(int sx,int sy,int ex,int ey,int max_doors, int doorlevel)
{
int find_door = 0;
int diag_door = 0;
- int rx,ry;
+ int rx, ry;
// Check top & bottom for possible doors.
for (rx = sx; rx <= ex; rx++)
@@ -2723,7 +2723,7 @@ static bool _make_room(int sx,int sy,int ex,int ey,int max_doors, int doorlevel)
}
// Check left and right for possible doors.
- for (ry = sy+1; ry < ey; ry++)
+ for (ry = sy + 1; ry < ey; ry++)
{
find_door += _good_door_spot(sx,ry);
find_door += _good_door_spot(ex,ry);
@@ -2741,7 +2741,7 @@ static bool _make_room(int sx,int sy,int ex,int ey,int max_doors, int doorlevel)
return (false);
// Look for 'special' rock walls - don't interrupt them.
- if (_find_in_area(sx,sy,ex,ey,DNGN_BUILDER_SPECIAL_WALL))
+ if (_find_in_area(sx, sy, ex, ey, DNGN_BUILDER_SPECIAL_WALL))
return (false);
// Convert the area to floor.
@@ -2754,7 +2754,7 @@ static bool _make_room(int sx,int sy,int ex,int ey,int max_doors, int doorlevel)
// Put some doors on the sides (but not in corners),
// where it makes sense to do so.
- for (ry = sy+1; ry < ey; ry++)
+ for (ry = sy + 1; ry < ey; ry++)
{
// left side
if (grd[sx-1][ry] == DNGN_FLOOR
@@ -2776,7 +2776,7 @@ static bool _make_room(int sx,int sy,int ex,int ey,int max_doors, int doorlevel)
}
// Put some doors on the top & bottom.
- for (rx = sx+1; rx < ex; rx++)
+ for (rx = sx + 1; rx < ex; rx++)
{
// top
if (grd[rx][sy-1] == DNGN_FLOOR
@@ -2987,7 +2987,7 @@ static void _builder_monsters(int level_number, char level_type, int mon_wanted)
_place_uniques(level_number, level_type);
- if ( !player_in_branch(BRANCH_CRYPT) ) // No water creatures in the Crypt.
+ if (!player_in_branch(BRANCH_CRYPT)) // No water creatures in the Crypt.
_place_aquatic_monsters(level_number, level_type);
else
{
@@ -3014,9 +3014,7 @@ static void _builder_items(int level_number, char level_type, int items_wanted)
items_levels /= 10;
}
else if (player_in_branch( BRANCH_ORCISH_MINES ))
- {
- specif_type = OBJ_GOLD; // Lots of gold in the orcish mines.
- }
+ specif_type = OBJ_GOLD; // Lots of gold in the orcish mines.
if (player_in_branch( BRANCH_VESTIBULE_OF_HELL )
|| player_in_hell()
@@ -3946,6 +3944,7 @@ static void _pick_float_exits(vault_placement &place,
{
if (_grid_needs_exit(place.pos.x, y))
possible_exits.push_back( coord_def(place.pos.x, y) );
+
if (_grid_needs_exit(place.pos.x + place.size.x - 1, y))
{
possible_exits.push_back(
@@ -4403,9 +4402,9 @@ static void _dgn_place_item_explicit(const item_spec &spec,
}
}
- const int item_made =
- items( spec.allow_uniques, spec.base_type, spec.sub_type, true,
- level, spec.race, 0, spec.ego );
+ const int item_made = items( spec.allow_uniques, spec.base_type,
+ spec.sub_type, true, level, spec.race, 0,
+ spec.ego );
if (item_made != NON_ITEM && item_made != -1)
{
@@ -4527,9 +4526,9 @@ static void _dgn_give_mon_spec_items(mons_spec &mspec,
}
}
- const int item_made
- = items( spec.allow_uniques, spec.base_type, spec.sub_type, true,
- item_level, spec.race, 0, spec.ego );
+ const int item_made = items( spec.allow_uniques, spec.base_type,
+ spec.sub_type, true, item_level,
+ spec.race, 0, spec.ego );
if (item_made != NON_ITEM && item_made != -1)
{
@@ -4984,7 +4983,7 @@ static void _replace_area( int sx, int sy, int ex, int ey,
if (grd[x][y] == replace && unforbidden(coord_def(x, y), mapmask))
{
grd[x][y] = feature;
- if ( needs_update && is_terrain_seen(coord_def(x,y)) )
+ if (needs_update && is_terrain_seen(coord_def(x,y)))
{
set_envmap_obj(x, y, feature);
#ifdef USE_TILE
@@ -5222,14 +5221,14 @@ static void _many_pools(dungeon_feature_type pool_type)
const int num_pools = 20 + random2avg(9, 2);
int pools = 0;
- for ( int timeout = 0; pools < num_pools && timeout < 30000; ++timeout )
+ for (int timeout = 0; pools < num_pools && timeout < 30000; ++timeout)
{
const int i = random_range(X_BOUND_1 + 1, X_BOUND_2 - 21);
const int j = random_range(Y_BOUND_1 + 1, Y_BOUND_2 - 21);
const int k = i + 2 + roll_dice( 2, 9 );
const int l = j + 2 + roll_dice( 2, 9 );
- if ( count_antifeature_in_box(i, j, k, l, DNGN_FLOOR) == 0 )
+ if (count_antifeature_in_box(i, j, k, l, DNGN_FLOOR) == 0)
{
_place_pool(pool_type, i, j, k, l);
pools++;
@@ -5336,7 +5335,7 @@ static void _place_altars()
if (you.your_level < 4)
return;
- if ( you.level_type == LEVEL_DUNGEON )
+ if (you.level_type == LEVEL_DUNGEON)
{
int prob = your_branch().altar_chance;
while (prob)
@@ -5356,7 +5355,7 @@ static void _place_altars()
static void _place_altar()
{
- for ( int numtry = 0; numtry < 5000; ++numtry )
+ for (int numtry = 0; numtry < 5000; ++numtry)
{
int px = 15 + random2(55);
int py = 15 + random2(45);
@@ -5674,8 +5673,8 @@ void spotty_level(bool seeded, int iterations, bool boxy)
for (i = DNGN_STONE_STAIRS_DOWN_I; i < DNGN_ESCAPE_HATCH_UP; i++)
{
if (i == DNGN_ESCAPE_HATCH_DOWN
- || (i == DNGN_STONE_STAIRS_UP_I
- && !player_in_branch( BRANCH_SLIME_PITS )))
+ || i == DNGN_STONE_STAIRS_UP_I
+ && !player_in_branch( BRANCH_SLIME_PITS ))
{
continue;
}
@@ -6364,8 +6363,10 @@ static void _change_walls_from_centre(const dgn_region &region,
const int dist = va_arg(args, int);
if (!dist)
break;
+
const dungeon_feature_type feat =
static_cast<dungeon_feature_type>( va_arg(args, int) );
+
ldist.push_back(dist_feat(dist, feat));
}
@@ -6540,11 +6541,11 @@ static int _box_room_doors( int bx1, int bx2, int by1, int by2, int new_doors)
{
int good_doors[200]; // 1 == good spot, 2 == door placed!
int spot;
- int i,j;
+ int i, j;
int doors_placed = new_doors;
// sanity
- if ( 2 * ( (bx2 - bx1) + (by2-by1) ) > 200)
+ if (2 * (bx2-bx1 + by2-by1) > 200)
return 0;
// Go through, building list of good door spots, and replacing wall
@@ -6552,7 +6553,7 @@ static int _box_room_doors( int bx1, int bx2, int by1, int by2, int new_doors)
int spot_count = 0;
// top & bottom
- for (i = bx1+1; i < bx2; i++)
+ for (i = bx1 + 1; i < bx2; i++)
{
good_doors[spot_count ++] = _box_room_door_spot(i, by1);
good_doors[spot_count ++] = _box_room_door_spot(i, by2);
@@ -6590,7 +6591,7 @@ static int _box_room_doors( int bx1, int bx2, int by1, int by2, int new_doors)
continue;
j = 0;
- for (i = bx1+1; i < bx2; i++)
+ for (i = bx1 + 1; i < bx2; i++)
{
if (spot == j++)
{
@@ -6604,7 +6605,7 @@ static int _box_room_doors( int bx1, int bx2, int by1, int by2, int new_doors)
}
}
- for (i = by1+1; i < by2; i++)
+ for (i = by1 + 1; i < by2; i++)
{
if (spot == j++)
{
@@ -6623,7 +6624,7 @@ static int _box_room_doors( int bx1, int bx2, int by1, int by2, int new_doors)
new_doors --;
}
- return doors_placed;
+ return (doors_placed);
}
@@ -6767,7 +6768,8 @@ static bool _treasure_area(int level_number, unsigned char ta1_x,
continue;
item_made = items( 1, OBJ_RANDOM, OBJ_RANDOM, true,
- random2( level_number * 2 ), MAKE_ITEM_RANDOM_RACE );
+ random2( level_number * 2 ),
+ MAKE_ITEM_RANDOM_RACE );
if (item_made != NON_ITEM)
{
@@ -6911,9 +6913,7 @@ static void _big_room(int level_number)
// Sometimes make it a chequerboard.
if (one_chance_in(4))
- {
_chequerboard( sr, type_floor, type_floor, type_2 );
- }
// Sometimes make an inside room w/ stone wall.
else if (one_chance_in(6))
{
@@ -7521,7 +7521,7 @@ coord_def dgn_find_nearby_stair(dungeon_feature_type stair_to_find,
}
}
- if ( found )
+ if (found)
return result;
best_dist = 1 + GXM*GXM + GYM*GYM;
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 2f0bb6e661..3b0c21128e 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -816,7 +816,7 @@ static int _find_acquirement_subtype(object_class_type class_wanted,
for (int acqc = 0; acqc < ENDOFPACK; acqc++)
{
if (is_valid_item( you.inv[acqc] )
- && you.inv[acqc].base_type == class_wanted)
+ && you.inv[acqc].base_type == class_wanted)
{
ASSERT( you.inv[acqc].sub_type < max_has_value );
already_has[you.inv[acqc].sub_type] += you.inv[acqc].quantity;
@@ -1127,7 +1127,7 @@ static int _find_acquirement_subtype(object_class_type class_wanted,
break;
case OBJ_BOOKS:
- // remember, put rarer books higher in the list
+ // Remember, put rarer books higher in the list.
iteration = 1;
type_wanted = NUM_BOOKS;
@@ -1290,14 +1290,14 @@ static int _find_acquirement_subtype(object_class_type class_wanted,
*/
if (type_wanted == NUM_BOOKS && iteration == 1)
{
- best_spell = best_skill( SK_SPELLCASTING, (NUM_SKILLS - 1),
+ best_spell = best_skill( SK_SPELLCASTING, NUM_SKILLS - 1,
best_skill(SK_SPELLCASTING,
- (NUM_SKILLS - 1), 99) );
+ NUM_SKILLS - 1, 99) );
iteration++;
goto which_book;
}
- // if we don't have a book, try and get a new one.
+ // If we don't have a book, try and get a new one.
if (type_wanted == NUM_BOOKS)
{
do
@@ -1473,7 +1473,7 @@ bool acquirement(object_class_type class_wanted, int agent,
mpr("What kind of item would you like to acquire? ", MSGCH_PROMPT);
const int keyin = tolower( get_ch() );
- switch ( keyin )
+ switch (keyin)
{
case 'a': class_wanted = OBJ_WEAPONS; break;
case 'b': class_wanted = OBJ_ARMOUR; break;
@@ -1585,7 +1585,7 @@ bool acquirement(object_class_type class_wanted, int agent,
item_def& thing(mitm[thing_created]);
// Give some more gold.
- if ( class_wanted == OBJ_GOLD )
+ if (class_wanted == OBJ_GOLD)
thing.quantity += 150;
else if (quant > 1)
thing.quantity = quant;
@@ -1616,7 +1616,7 @@ bool acquirement(object_class_type class_wanted, int agent,
case RING_INTELLIGENCE:
case RING_DEXTERITY:
case RING_EVASION:
- // make sure plus is >= 1
+ // Make sure plus is >= 1.
thing.plus = abs( thing.plus );
if (thing.plus == 0)
thing.plus = 1;
@@ -1624,7 +1624,7 @@ bool acquirement(object_class_type class_wanted, int agent,
case RING_HUNGER:
case AMU_INACCURACY:
- // these are the only truly bad pieces of jewellery
+ // These are the only truly bad pieces of jewellery.
if (!one_chance_in(9))
make_item_randart( thing );
break;
@@ -1637,7 +1637,7 @@ bool acquirement(object_class_type class_wanted, int agent,
&& !is_fixed_artefact( thing )
&& !is_unrandom_artefact( thing ))
{
- // HACK: make unwieldable weapons wieldable
+ // HACK: Make unwieldable weapons wieldable.
// Note: messing with fixed artefacts is probably very bad.
switch (you.species)
{
@@ -1656,7 +1656,7 @@ bool acquirement(object_class_type class_wanted, int agent,
}
else
{
- // keep resetting seed until it's good:
+ // Keep resetting seed until it's good.
for (; brand == SPWPN_HOLY_WRATH;
brand = get_weapon_brand(thing))
{
@@ -1920,13 +1920,18 @@ void yell(bool force)
if (force)
{
if (shout_verb == "__NONE" || you.paralysed())
+ {
mprf("You feel a strong urge to %s, but "
"you are unable to make a sound!",
- shout_verb == "__NONE" ? "scream" : shout_verb.c_str());
+ shout_verb == "__NONE" ? "scream"
+ : shout_verb.c_str());
+ }
else
+ {
mprf("You feel a %s rip itself from your throat, "
"but you make no sound!",
shout_verb.c_str());
+ }
}
else
mpr("You are unable to make a sound!");
@@ -2215,25 +2220,30 @@ static void _hell_effects()
else
which_miscast = SPTYP_EARTH;
break;
+
case BRANCH_GEHENNA:
if (summon_instead)
which_beastie = MONS_FIEND;
else
which_miscast = SPTYP_FIRE;
break;
+
case BRANCH_COCYTUS:
if (summon_instead)
which_beastie = MONS_ICE_FIEND;
else
which_miscast = SPTYP_ICE;
break;
+
case BRANCH_TARTARUS:
if (summon_instead)
which_beastie = MONS_SHADOW_FIEND;
else
which_miscast = SPTYP_NECROMANCY;
break;
- default: // this is to silence gcc compiler warnings {dlb}
+
+ default:
+ // This is to silence gcc compiler warnings. {dlb}
if (summon_instead)
which_beastie = MONS_FIEND;
else
@@ -2254,12 +2264,12 @@ static void _hell_effects()
}
}
- // NB: no "else" - 8 in 27 odds that nothing happens through
- // first chain {dlb}
- // also note that the following is distinct from and in
- // addition to the above chain:
+ // NB: No "else" - 8 in 27 odds that nothing happens through
+ // first chain. {dlb}
+ // Also note that the following is distinct from and in
+ // addition to the above chain.
- // try to summon at least one and up to five random monsters {dlb}
+ // Try to summon at least one and up to five random monsters. {dlb}
if (one_chance_in(3))
{
mgen_data mg;
@@ -2268,10 +2278,8 @@ static void _hell_effects()
create_monster(mg);
for (int i = 0; i < 4; ++i)
- {
if (one_chance_in(3))
create_monster(mg);
- }
}
}
@@ -2305,7 +2313,7 @@ static bool _food_item_needs_time_check(item_def &item)
static void _rot_inventory_food(long time_delta)
{
// Update all of the corpses and food chunks in the player's
- // inventory {should be moved elsewhere - dlb}
+ // inventory. {should be moved elsewhere - dlb}
bool burden_changed_by_rot = false;
std::vector<char> rotten_items;
for (int i = 0; i < ENDOFPACK; i++)
@@ -2876,7 +2884,7 @@ void update_level(double elapsedTime)
continue;
}
- // following monsters don't get movement
+ // Following monsters don't get movement.
if (mon->flags & MF_JUST_SUMMONED)
continue;
@@ -2927,18 +2935,18 @@ static void _maybe_restart_fountain_flow(const int x, const int y,
if (!one_chance_in(100))
continue;
- // make it start flowing again
+ // Make it start flowing again.
grd[x][y] = static_cast<dungeon_feature_type> (grid
- (DNGN_DRY_FOUNTAIN_BLUE - DNGN_FOUNTAIN_BLUE));
- if ( is_terrain_seen(coord_def(x,y)) )
+ if (is_terrain_seen(coord_def(x,y)))
set_envmap_obj(x, y, grd[x][y]);
- // clean bloody floor
+ // Clean bloody floor.
if (is_bloodcovered(x,y))
env.map[x][y].property = FPROP_NONE;
- // chance of cleaning adjacent squares
+ // Chance of cleaning adjacent squares.
for (int i = -1; i <= 1; i++)
for (int j = -1; j <= 1; j++)
{
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 667f517e29..eb850c9320 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -38,35 +38,36 @@ enum ability_type
ABIL_SPIT_POISON = 1, // 1
ABIL_MAPPING,
ABIL_TELEPORTATION,
- ABIL_BREATHE_FIRE, // 5
- ABIL_BLINK,
+ ABIL_BREATHE_FIRE,
+ ABIL_BLINK, // 5
ABIL_BREATHE_FROST,
ABIL_BREATHE_POISON,
ABIL_BREATHE_LIGHTNING,
- ABIL_SPIT_ACID, // 10
- ABIL_BREATHE_POWER,
+ ABIL_SPIT_ACID,
+ ABIL_BREATHE_POWER, // 10
ABIL_EVOKE_BERSERK,
ABIL_BREATHE_STICKY_FLAME,
ABIL_BREATHE_STEAM,
- ABIL_FLY, // 15
- ABIL_SUMMON_MINOR_DEMON,
+ ABIL_FLY,
+ ABIL_SUMMON_MINOR_DEMON, // 15
ABIL_SUMMON_DEMON,
ABIL_HELLFIRE,
ABIL_TORMENT,
- ABIL_RAISE_DEAD, // 20
- ABIL_CONTROL_DEMON,
+ ABIL_RAISE_DEAD,
+ ABIL_CONTROL_DEMON, // 20
ABIL_TO_PANDEMONIUM,
ABIL_CHANNELING,
ABIL_THROW_FLAME,
- ABIL_THROW_FROST, // 25
- ABIL_BOLT_OF_DRAINING,
+ ABIL_THROW_FROST,
+ ABIL_BOLT_OF_DRAINING, // 25
ABIL_BREATHE_HELLFIRE,
ABIL_FLY_II,
ABIL_DELAYED_FIREBALL,
- ABIL_MUMMY_RESTORATION, // 30
- ABIL_EVOKE_MAPPING,
+ ABIL_MUMMY_RESTORATION,
+ ABIL_EVOKE_MAPPING, // 30
ABIL_EVOKE_TELEPORTATION,
- ABIL_EVOKE_BLINK, // 33
+ ABIL_EVOKE_BLINK, // 32
+ // 33 - 50 unused
ABIL_EVOKE_TURN_INVISIBLE = 51, // 51
ABIL_EVOKE_TURN_VISIBLE,
ABIL_EVOKE_LEVITATE,
@@ -108,20 +109,20 @@ enum ability_type
ABIL_ELYVILON_HEALING,
ABIL_ELYVILON_RESTORATION,
ABIL_ELYVILON_GREATER_HEALING, // 224
- ABIL_LUGONU_ABYSS_EXIT,
+ ABIL_LUGONU_ABYSS_EXIT, // 225
ABIL_LUGONU_BEND_SPACE,
ABIL_LUGONU_BANISH,
ABIL_LUGONU_CORRUPT,
- ABIL_LUGONU_ABYSS_ENTER, // 229
- ABIL_NEMELEX_DRAW_ONE,
+ ABIL_LUGONU_ABYSS_ENTER,
+ ABIL_NEMELEX_DRAW_ONE, // 230
ABIL_NEMELEX_PEEK_TWO,
ABIL_NEMELEX_TRIPLE_DRAW,
ABIL_NEMELEX_MARK_FOUR,
- ABIL_NEMELEX_STACK_FIVE, // 234
- ABIL_BEOGH_SMITING,
- ABIL_BEOGH_RECALL_ORCISH_FOLLOWERS, // 236
+ ABIL_NEMELEX_STACK_FIVE,
+ ABIL_BEOGH_SMITING, // 235
+ ABIL_BEOGH_RECALL_ORCISH_FOLLOWERS,
- ABIL_CHARM_SNAKE,
+ ABIL_CHARM_SNAKE, // 237
ABIL_TRAN_SERPENT_OF_HELL,
ABIL_ROTTING,
ABIL_TORMENT_II,
@@ -1264,11 +1265,11 @@ enum god_type
enum holy_word_source_type
{
- HOLY_WORD_GENERIC = -1,
- HOLY_WORD_SCROLL = -2,
- HOLY_WORD_SPELL = -3, // SPELL_HOLY_WORD
- HOLY_WORD_ZIN = -4, // Zin effect
- HOLY_WORD_SHINING_ONE = -5 // TSO effect
+ HOLY_WORD_GENERIC = -1,
+ HOLY_WORD_SCROLL = -2,
+ HOLY_WORD_SPELL = -3, // SPELL_HOLY_WORD
+ HOLY_WORD_ZIN = -4, // Zin effect
+ HOLY_WORD_SHINING_ONE = -5 // TSO effect
};
enum hunger_state // you.hunger_state
@@ -1404,16 +1405,16 @@ enum level_area_type // you.level_type
NUM_LEVEL_AREA_TYPES
};
-// reasons for entering the Abyss
+// Reasons for entering the Abyss.
enum entry_cause_type
{
EC_UNKNOWN,
EC_SELF_EXPLICIT,
- EC_SELF_RISKY, // i.e., wielding an id'd distorion weapon
- EC_SELF_ACCIDENT, // i.e., wielding an un-id'd distortion weapon
+ EC_SELF_RISKY, // i.e., wielding an id'd distorion weapon
+ EC_SELF_ACCIDENT, // i.e., wielding an un-id'd distortion weapon
EC_MISCAST,
EC_GOD_RETRIBUTION,
- EC_GOD_ACT, // Xom sending the player somewhere for amusement
+ EC_GOD_ACT, // Xom sending the player somewhere for amusement.
EC_MONSTER,
NUM_ENTRY_CAUSE_TYPES
};
@@ -2332,11 +2333,11 @@ enum skill_type
SK_SHIELDS,
SK_TRAPS_DOORS,
SK_UNARMED_COMBAT, // 19
- SK_UNUSED_2,
- SK_UNUSED_3,
- SK_UNUSED_4,
- SK_UNUSED_5,
- SK_UNUSED_6,
+ // 20
+ // 21
+ // 22
+ // 23
+ // 24
SK_SPELLCASTING = 25, // 25
SK_CONJURATIONS,
SK_ENCHANTMENTS,
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 5e241f6292..66c056c8a6 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1662,11 +1662,11 @@ public:
bool autopickup_no_burden; // don't autopickup if it changes burden
bool note_all_skill_levels; // take note for all skill levels (1-27)
- bool note_skill_max; // take note when skills reach new max
- bool note_all_spells; // take note when learning any spell
- std::string user_note_prefix;// Prefix for user notes
- int note_hp_percent; // percentage hp for notetaking
- int ood_interesting; // how many levels OOD is noteworthy?
+ bool note_skill_max; // take note when skills reach new max
+ bool note_all_spells; // take note when learning any spell
+ std::string user_note_prefix; // Prefix for user notes
+ int note_hp_percent; // percentage hp for notetaking
+ int ood_interesting; // how many levels OOD is noteworthy?
int rare_interesting; // what monster rarity is noteworthy?
confirm_level_type easy_confirm; // make yesno() confirming easier
bool easy_quit_item_prompts; // make item prompts quitable on space
@@ -1691,13 +1691,13 @@ public:
char race; // preselected race
char cls; // preselected class
bool delay_message_clear; // avoid clearing messages each turn
- unsigned friend_brand; // Attribute for branding friendly monsters
- unsigned neutral_brand; // Attribute for branding neutral monsters
- bool no_dark_brand; // Attribute for branding friendly monsters
- bool macro_meta_entry;// Allow user to use numeric sequences when
- // creating macros
+ unsigned friend_brand; // Attribute for branding friendly monsters
+ unsigned neutral_brand; // Attribute for branding neutral monsters
+ bool no_dark_brand; // Attribute for branding friendly monsters
+ bool macro_meta_entry; // Allow user to use numeric sequences when
+ // creating macros
- int fire_items_start;// index of first item for fire command
+ int fire_items_start; // index of first item for fire command
std::vector<unsigned> fire_order; // missile search order for 'f' command
bool auto_list; // automatically jump to appropriate item lists
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 1cf14969b4..c27f32abd9 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -158,10 +158,10 @@ int effective_stat_bonus( int wepType )
#endif
}
-// Returns random2(x) is random_factor is true, otherwise the mean.
+// Returns random2(x) if random_factor is true, otherwise the mean.
static int maybe_random2( int x, bool random_factor )
{
- if ( random_factor )
+ if (random_factor)
return random2(x);
else
return x / 2;
@@ -262,7 +262,7 @@ int calc_heavy_armour_penalty( bool random_factor )
// My guess is that its supposed to encourage monk-style play -- bwr
if (!ur_armed)
{
- if ( random_factor )
+ if (random_factor)
{
heavy_armour *= (coinflip() ? 3 : 2);
}
@@ -972,8 +972,8 @@ bool melee_attack::player_aux_unarmed()
case 1:
if (uattack != UNAT_HEADBUTT)
{
- if ((!player_mutation_level(MUT_HORNS)
- && you.species != SP_KENKU)
+ if (!player_mutation_level(MUT_HORNS)
+ && you.species != SP_KENKU
|| !one_chance_in(3))
{
continue;
@@ -1001,18 +1001,18 @@ bool melee_attack::player_aux_unarmed()
// +6 because of the horns.
unarmed_attack = "headbutt";
aux_damage = 5 + player_mutation_level(MUT_HORNS) * 3;
- }
- if (you.equip[EQ_HELMET] != -1)
- {
- const item_def& helmet = you.inv[you.equip[EQ_HELMET]];
- if ( is_hard_helmet(helmet) )
+ if (you.equip[EQ_HELMET] != -1)
{
- aux_damage += 2;
- if (get_helmet_desc(helmet) == THELM_DESC_SPIKED
- || get_helmet_desc(helmet) == THELM_DESC_HORNED)
+ const item_def& helmet = you.inv[you.equip[EQ_HELMET]];
+ if (is_hard_helmet(helmet))
{
- aux_damage += 3;
+ aux_damage += 2;
+ if (get_helmet_desc(helmet) == THELM_DESC_SPIKED
+ || get_helmet_desc(helmet) == THELM_DESC_HORNED)
+ {
+ aux_damage += 3;
+ }
}
}
}
@@ -1048,8 +1048,8 @@ bool melee_attack::player_aux_unarmed()
damage_brand = SPWPN_VENOM;
}
- // grey dracs have spiny tails, or something
- // maybe add this to player messaging {dlb}
+ // Grey dracs have spiny tails, or something.
+ // Maybe add this to player messaging. {dlb}
//
// STINGER mutation doesn't give extra damage here... that
// would probably be a bit much, we'll still get the
@@ -1240,8 +1240,7 @@ bool melee_attack::player_apply_aux_unarmed()
mprf("You %s %s%s.",
unarmed_attack.c_str(),
defender->name(DESC_NOCAP_THE).c_str(),
- player_monster_visible(def) ?
- ", but do no damage" : "");
+ player_monster_visible(def) ? ", but do no damage" : "");
}
if (def->hit_points < 1)
@@ -2355,8 +2354,8 @@ bool melee_attack::apply_damage_brand()
attacker->atype() == ACT_PLAYER? KILL_YOU : KILL_MON;
beam_temp.flavour = BEAM_CONFUSION;
beam_temp.beam_source =
- attacker->atype() == ACT_PLAYER ? MHITYOU
- : monster_index(atk);
+ (attacker->atype() == ACT_PLAYER) ? MHITYOU
+ : monster_index(atk);
mons_ench_f2( def, beam_temp );
}
@@ -2816,9 +2815,9 @@ int melee_attack::player_to_hit(bool random_factor)
// other stuff
if (!weapon)
{
- if ( you.duration[DUR_CONFUSING_TOUCH] )
+ if (you.duration[DUR_CONFUSING_TOUCH])
{
- // just trying to touch is easier that trying to damage
+ // Just trying to touch is easier that trying to damage.
your_to_hit += maybe_random2(you.dex, random_factor);
}
@@ -2882,41 +2881,41 @@ void melee_attack::player_stab_check()
default:
case UCAT_NO_ATTACK:
stab_attempt = false;
- stab_bonus = 0;
+ stab_bonus = 0;
break;
case UCAT_DISTRACTED:
stab_attempt = true;
- stab_bonus = 3;
+ stab_bonus = 3;
break;
case UCAT_CONFUSED:
case UCAT_FLEEING:
stab_attempt = true;
- stab_bonus = 2;
+ stab_bonus = 2;
break;
case UCAT_INVISIBLE:
stab_attempt = true;
+ stab_bonus = 2;
if (!mons_sense_invis(def))
roll -= 15;
- stab_bonus = 2;
break;
case UCAT_HELD_IN_NET:
case UCAT_PARALYSED:
stab_attempt = true;
- stab_bonus = 1;
+ stab_bonus = 1;
break;
case UCAT_SLEEPING:
stab_attempt = true;
roll_needed = false;
- stab_bonus = 1;
+ stab_bonus = 1;
break;
}
- // see if we need to roll against dexterity / stabbing
+ // See if we need to roll against dexterity / stabbing.
if (stab_attempt && roll_needed)
stab_attempt = (random2(roll) <= you.skills[SK_STABBING] + you.dex);
}
@@ -3692,7 +3691,7 @@ void melee_attack::mons_apply_attack_flavour(const mon_attack_def &attk)
break;
case AF_VAMPIRIC:
- // only may bite non-vampiric monsters (players) capable of bleeding
+ // Only may bite non-vampiric monsters (or player) capable of bleeding.
if (defender->atype() == ACT_PLAYER
&& (you.species == SP_VAMPIRE || !victim_can_bleed(-1))
|| defender->atype() == ACT_MONSTER
@@ -3701,6 +3700,11 @@ void melee_attack::mons_apply_attack_flavour(const mon_attack_def &attk)
break;
}
+ // Disallow draining of summoned monsters since they can't bleed.
+ // XXX: Is this too harsh?
+ if (mons_is_summoned(def))
+ break;
+
if (defender->res_negative_energy() > random2(3))
break;
@@ -4336,7 +4340,7 @@ static void stab_message( monsters *defender, int stab_bonus )
}
break;
case 2: // confused/fleeing
- if ( !one_chance_in(3) )
+ if (!one_chance_in(3))
{
mprf( "You catch %s completely off-guard!",
defender->name(DESC_NOCAP_THE).c_str() );
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index 96787e87e9..dc9b4e8149 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -1704,7 +1704,8 @@ static bool _get_and_validate_version(FILE *restoreFile, char &major, char &mino
std::string* reason)
{
std::string dummy;
- if (reason == 0) reason = &dummy;
+ if (reason == 0)
+ reason = &dummy;
// Read first two bytes.
char buf[2];
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index 1e71a366e1..55ef08637d 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -66,12 +66,8 @@ static void _heal_from_food(int hp_amt, int mp_amt, bool unrot,
bool restore_str);
/*
- **************************************************
- * *
- * BEGIN PUBLIC FUNCTIONS *
- * *
- **************************************************
-*/
+ * BEGIN PUBLIC FUNCTIONS
+ */
void make_hungry( int hunger_amount, bool suppress_msg, bool allow_reducing )
{
@@ -811,12 +807,8 @@ bool eat_food(bool run_hook, int slot)
}
/*
- **************************************************
- * *
- * END PUBLIC FUNCTIONS *
- * *
- **************************************************
-*/
+ * END PUBLIC FUNCTIONS
+ */
static bool _player_has_enough_food()
{
@@ -1057,7 +1049,7 @@ static bool _player_can_eat_rotten_meat(bool need_msg = false)
return (false);
}
-// should really be merged into function below -- FIXME
+// Should really be merged into function below. -- FIXME
void eat_from_inventory(int which_inventory_slot)
{
item_def& food(you.inv[which_inventory_slot]);
@@ -1309,8 +1301,8 @@ static void _say_chunk_flavour(bool likes_chunks)
mprf("This raw flesh %s", _chunk_flavour_phrase(likes_chunks));
}
-// never called directly - chunk_effect values must pass
-// through food::_determine_chunk_effect() first {dlb}:
+// Never called directly - chunk_effect values must pass
+// through food::_determine_chunk_effect() first. {dlb}:
static void _eat_chunk( int chunk_effect, bool cannibal, int mon_intel )
{
@@ -1851,7 +1843,7 @@ void vampire_nutrition_per_turn(const item_def &corpse, int feeding)
}
// Returns true if a food item (also corpses) is poisonous AND the player
-// is not poison resistant.
+// is not (known to be) poison resistant.
bool is_poisonous(const item_def &food)
{
if (food.base_type != OBJ_FOOD && food.base_type != OBJ_CORPSES)
@@ -2158,14 +2150,14 @@ bool can_ingest(int what_isit, int kindof_thing, bool suppress_msg, bool reqid,
return (survey_says);
} // end can_ingest()
-// See if you can follow along here -- except for the Amulet of the Gourmand
+// See if you can follow along here -- except for the amulet of the gourmand
// addition (long missing and requested), what follows is an expansion of how
// chunks were handled in the codebase up to this date ... {dlb}
static int _determine_chunk_effect(int which_chunk_type, bool rotten_chunk)
{
int this_chunk_effect = which_chunk_type;
- // determine the initial effect of eating a particular chunk {dlb}:
+ // Determine the initial effect of eating a particular chunk. {dlb}
switch (this_chunk_effect)
{
case CE_HCL:
@@ -2220,7 +2212,7 @@ static int _determine_chunk_effect(int which_chunk_type, bool rotten_chunk)
}
}
- // one last chance for some species to safely eat rotten food {dlb}:
+ // One last chance for some species to safely eat rotten food. {dlb}
if (this_chunk_effect == CE_ROTTEN)
{
switch (player_mutation_level(MUT_SAPROVOROUS))
@@ -2324,11 +2316,11 @@ static void _heal_from_food(int hp_amt, int mp_amt, bool unrot,
int you_max_hunger()
{
- // this case shouldn't actually happen:
+ // This case shouldn't actually happen.
if (you.is_undead == US_UNDEAD)
return 6000;
- // take care of ghouls - they can never be 'full'
+ // Take care of ghouls - they can never be 'full'.
if (you.species == SP_GHOUL)
return 6999;
@@ -2337,7 +2329,7 @@ int you_max_hunger()
int you_min_hunger()
{
- // this case shouldn't actually happen:
+ // This case shouldn't actually happen.
if (you.is_undead == US_UNDEAD)
return 6000;
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 460002a040..06c688deb7 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -142,9 +142,8 @@ bool can_wield(const item_def *weapon, bool say_reason,
return (false);
}
- // FIXME: We should use a size check here instead.
- if ((you.species == SP_HALFLING || you.species == SP_GNOME
- || you.species == SP_KOBOLD || you.species == SP_SPRIGGAN)
+ // Small species wielding large weapons...
+ if (player_size(PSIZE_BODY) < SIZE_MEDIUM
&& (weapon->sub_type == WPN_GREAT_SWORD
|| weapon->sub_type == WPN_TRIPLE_SWORD
|| weapon->sub_type == WPN_GREAT_MACE
@@ -671,8 +670,8 @@ void wield_effects(int item_wield_2, bool showMsgs)
case SPWPN_VAMPIRES_TOOTH:
if (you.is_undead != US_UNDEAD)
{
- mpr("You feel a strange hunger, and smell blood on the "
- "air...");
+ mpr("You feel a strange hunger, and smell blood in "
+ "the air...");
}
else
mpr("You feel strangely empty.");
@@ -1693,14 +1692,15 @@ int launcher_final_speed(const item_def &launcher, const item_def *shield)
speed_min = speed_min * speed_adjust / 100;
}
- // do the same when trying to shoot while held in a net
- if (you.attribute[ATTR_HELD]) // only for blowguns
+ // Do the same when trying to shoot while held in a net
+ // (only possible with blowguns).
+ if (you.attribute[ATTR_HELD])
{
- int speed_adjust = 105; // analogous to buckler and one-handed weapon
+ int speed_adjust = 105; // Analogous to buckler and one-handed weapon.
speed_adjust -= ((speed_adjust - 100) * 5 / 10)
* you.skills[SK_THROWING] / 27;
- // also reduce the speed cap.
+ // Also reduce the speed cap.
speed_base = speed_base * speed_adjust / 100;
speed_min = speed_min * speed_adjust / 100;
}
@@ -1780,9 +1780,11 @@ static void identify_floor_missiles_matching(item_def mitem, int idflags)
for (int y = 0; y < GYM; ++y)
for (int x = 0; x < GXM; ++x)
- for ( stack_iterator si(coord_def(x,y)); si; ++si )
+ for (stack_iterator si(coord_def(x,y)); si; ++si)
+ {
if ((si->flags & ISFLAG_THROWN) && items_stack(*si, mitem))
si->flags |= idflags;
+ }
}
// throw_it - currently handles player throwing only. Monster
@@ -2063,7 +2065,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
}
}
- // Lower accuracy if held in a net (needs testing).
+ // Lower accuracy if held in a net.
if (you.attribute[ATTR_HELD])
baseHit--;
@@ -3694,7 +3696,7 @@ void drink( int slot )
if (is_blood_potion(you.inv[item_slot]))
{
- // always drink oldest potion
+ // Always drink oldest potion.
remove_oldest_blood_potion(you.inv[item_slot]);
}
dec_inv_item_quantity( item_slot, 1 );
@@ -3739,7 +3741,7 @@ bool _drink_fountain()
mpr("You drink the blood.");
fountain_effect = POT_BLOOD;
}
- else // sparkling fountain
+ else
{
if (!yesno("Drink from the sparkling fountain?"))
return (false);
@@ -3796,7 +3798,8 @@ bool _drink_fountain()
gone_dry = true;
else if (random2(50) > 40)
{
- // Turn fountain into a normal fountain - without any message.
+ // Turn fountain into a normal fountain without any message
+ // but the glyph colour gives it away (lightblue vs. blue).
grd[you.x_pos][you.y_pos] = DNGN_FOUNTAIN_BLUE;
set_terrain_changed(you.x_pos, you.y_pos);
}
@@ -3952,7 +3955,7 @@ bool enchant_weapon( enchant_stat_type which_stat, bool quiet, item_def &wpn )
}
}
- // get item name now before changing enchantment
+ // Get item name now before changing enchantment.
std::string iname = wpn.name(DESC_CAP_YOUR);
if (wpn.base_type == OBJ_WEAPONS)
@@ -4075,7 +4078,7 @@ bool enchant_armour( int &ac_change, bool quiet, item_def &arm )
}
}
- // output message before changing enchantment and curse status
+ // Output message before changing enchantment and curse status.
if (!quiet)
{
mprf("%s glows green for a moment.",
@@ -4316,14 +4319,14 @@ void read_scroll( int slot )
exercise(SK_SPELLCASTING, (coinflip()? 2 : 1));
}
+ // It is the exception, not the rule, that the scroll will not
+ // be identified. {dlb}
bool id_the_scroll = true; // to prevent unnecessary repetition
- // it is the exception, not the rule, that
- // the scroll will not be identified {dlb}:
switch (which_scroll)
{
case SCR_PAPER:
- // remember paper scrolls handled as special case above, too:
+ // Remember, paper scrolls handled as special case above, too.
mpr("This scroll appears to be blank.");
if (player_mutation_level(MUT_BLURRY_VISION) == 3)
id_the_scroll = false;
@@ -4686,8 +4689,8 @@ void use_randart(item_def &item)
}
}
- // modify ability scores
- // output result even when identified (because of potential fatality)
+ // Modify ability scores.
+ // Output result even when identified (because of potential fatality).
modify_stat( STAT_STRENGTH, proprt[RAP_STRENGTH], false, item );
modify_stat( STAT_INTELLIGENCE, proprt[RAP_INTELLIGENCE], false, item );
modify_stat( STAT_DEXTERITY, proprt[RAP_DEXTERITY], false, item );
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index e26dec0123..830fa06757 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -104,7 +104,7 @@ std::string item_def::name(description_level_type descrip,
if (in_inventory(*this)) // actually in inventory
{
buff << index_to_letter(this->link);
- if ( terse)
+ if (terse)
buff << ") ";
else
buff << " - ";
@@ -117,12 +117,12 @@ std::string item_def::name(description_level_type descrip,
descrip = DESC_PLAIN;
if (this->base_type == OBJ_ORBS
- || ( (ident || item_type_known( *this ))
- && ((this->base_type == OBJ_MISCELLANY
- && this->sub_type == MISC_HORN_OF_GERYON)
- || is_artefact)))
+ || (ident || item_type_known( *this ))
+ && (this->base_type == OBJ_MISCELLANY
+ && this->sub_type == MISC_HORN_OF_GERYON
+ || is_artefact))
{
- // artefacts always get "the" unless we just want the plain name
+ // Artefacts always get "the" unless we just want the plain name.
switch (descrip)
{
case DESC_CAP_A:
@@ -247,8 +247,8 @@ std::string item_def::name(description_level_type descrip,
if (tried)
{
- item_type_id_state_type id_type =
- get_ident_type(*this);
+ item_type_id_state_type id_type = get_ident_type(*this);
+
if (id_type == ID_MON_TRIED_TYPE)
tried_str = "tried by monster";
else
@@ -258,11 +258,11 @@ std::string item_def::name(description_level_type descrip,
if ( with_inscription && !(this->inscription.empty()) )
{
buff << " {";
- if ( tried )
+ if (tried)
buff << tried_str << ", ";
buff << this->inscription << "}";
}
- else if ( tried )
+ else if (tried)
buff << " {" << tried_str << "}";
}
@@ -976,7 +976,7 @@ const char* racial_description_string(const item_def& item, bool terse)
// 0, even with showpos set, you get 0, not +0. This is a workaround.
static void output_with_sign(std::ostream& os, int val)
{
- if ( val >= 0 )
+ if (val >= 0)
os << '+';
os << val;
}
@@ -1050,7 +1050,7 @@ std::string item_def::name_aux( description_level_type desc,
if (know_pluses)
{
- if ( terse && (it_plus == item_plus2) )
+ if (terse && it_plus == item_plus2)
output_with_sign(buff, it_plus);
else
{
@@ -1398,7 +1398,7 @@ std::string item_def::name_aux( description_level_type desc,
{
if (basename)
{
- if ( jewellery_is_amulet(*this) )
+ if (jewellery_is_amulet(*this))
buff << "amulet";
else
buff << "ring";
@@ -1435,7 +1435,7 @@ std::string item_def::name_aux( description_level_type desc,
{
output_with_sign(buff, it_plus);
- if ( ring_has_pluses(*this) == 2 )
+ if (ring_has_pluses(*this) == 2)
{
buff << ',';
output_with_sign(buff, item_plus2);
@@ -1447,7 +1447,7 @@ std::string item_def::name_aux( description_level_type desc,
}
else
{
- if ( jewellery_is_amulet(*this) )
+ if (jewellery_is_amulet(*this))
{
buff << amulet_secondary_string(this->special / 13)
<< amulet_primary_string(this->special % 13)
@@ -1463,7 +1463,7 @@ std::string item_def::name_aux( description_level_type desc,
break;
}
case OBJ_MISCELLANY:
- if ( item_typ == MISC_RUNE_OF_ZOT )
+ if (item_typ == MISC_RUNE_OF_ZOT)
{
if (!dbname)
buff << rune_type_name(it_plus) << " ";
@@ -1471,7 +1471,7 @@ std::string item_def::name_aux( description_level_type desc,
}
else
{
- if ( is_deck(*this) )
+ if (is_deck(*this))
{
if (basename)
{
@@ -1487,8 +1487,8 @@ std::string item_def::name_aux( description_level_type desc,
buff << deck_rarity_name(deck_rarity(*this)) << ' ';
}
buff << misc_type_name(item_typ, know_type);
- if ( is_deck(*this) && !dbname
- && (top_card_is_known(*this) || this->plus2 != 0))
+ if (is_deck(*this) && !dbname
+ && (top_card_is_known(*this) || this->plus2 != 0))
{
buff << " {";
// A marked deck!
@@ -1709,7 +1709,7 @@ bool item_type_known( const item_def& item )
bool item_type_known(const object_class_type base_type, const int sub_type)
{
const item_type_id_type idt = objtype_to_idtype(base_type);
- if ( idt != NUM_IDTYPE && sub_type < 50 )
+ if (idt != NUM_IDTYPE && sub_type < 50 )
return (type_ids[idt][sub_type] == ID_KNOWN_TYPE);
else
return (false);
@@ -1783,7 +1783,7 @@ void set_ident_type( object_class_type basetype, int subtype,
const item_type_id_type idt = objtype_to_idtype(basetype);
- if ( idt != NUM_IDTYPE )
+ if (idt != NUM_IDTYPE)
{
if (type_ids[idt][subtype] != setting)
{
@@ -1804,7 +1804,7 @@ item_type_id_state_type get_ident_type(const item_def &item)
item_type_id_state_type get_ident_type(object_class_type basetype, int subtype)
{
const item_type_id_type idt = objtype_to_idtype(basetype);
- if ( idt != NUM_IDTYPE && subtype < type_ids.height() )
+ if (idt != NUM_IDTYPE && subtype < type_ids.height())
return type_ids[idt][subtype];
else
return ID_UNKNOWN_TYPE;
@@ -1845,7 +1845,7 @@ void check_item_knowledge()
if (type_ids[i][j] == ID_KNOWN_TYPE)
{
item_def* ptmp = new item_def;
- if ( ptmp != 0 )
+ if (ptmp != 0)
{
ptmp->base_type = idx_to_objtype[i];
ptmp->sub_type = j;
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 359ba8f0aa..90b166f487 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -804,11 +804,11 @@ void set_equip_race( item_def &item, unsigned long flags )
switch (item.base_type)
{
case OBJ_WEAPONS:
- if ((weapon_skill(item) == SK_LONG_BLADES
- && item.sub_type != WPN_FALCHION
- && item.sub_type != WPN_LONG_SWORD
- && item.sub_type != WPN_SCIMITAR
- && item.sub_type != WPN_GREAT_SWORD)
+ if (weapon_skill(item) == SK_LONG_BLADES
+ && item.sub_type != WPN_FALCHION
+ && item.sub_type != WPN_LONG_SWORD
+ && item.sub_type != WPN_SCIMITAR
+ && item.sub_type != WPN_GREAT_SWORD
|| item.sub_type == WPN_QUICK_BLADE
|| item.sub_type == WPN_LONGBOW
|| item.sub_type == WPN_HAND_CROSSBOW)
@@ -2337,7 +2337,7 @@ bool gives_ability( const item_def &item )
return (false);
}
-// Returns true if the item confers an intrinsic that is shown on the % screen.#
+// Returns true if the item confers an intrinsic that is shown on the % screen.
bool gives_resistance( const item_def &item )
{
if (!item_type_known(item))