summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/debug.cc23
-rw-r--r--crawl-ref/source/delay.cc2
-rw-r--r--crawl-ref/source/directn.cc5
-rw-r--r--crawl-ref/source/makeitem.cc77
-rw-r--r--crawl-ref/source/misc.cc16
-rw-r--r--crawl-ref/source/mon-util.cc25
-rw-r--r--crawl-ref/source/mon-util.h3
-rw-r--r--crawl-ref/source/monstuff.cc30
-rw-r--r--crawl-ref/source/newgame.cc41
-rw-r--r--crawl-ref/source/ouch.cc8
-rw-r--r--crawl-ref/source/religion.cc39
-rw-r--r--crawl-ref/source/spells2.cc64
-rw-r--r--crawl-ref/source/spells4.cc18
-rw-r--r--crawl-ref/source/tags.cc117
-rw-r--r--crawl-ref/source/traps.cc28
15 files changed, 250 insertions, 246 deletions
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index 21aff9341a..39d194001b 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -1050,7 +1050,7 @@ void create_spec_object()
}
}
- // allocate an item to play with:
+ // Allocate an item to play with.
thing_created = get_item_slot();
if (thing_created == NON_ITEM)
{
@@ -1127,12 +1127,12 @@ void create_spec_object()
if (class_wanted == OBJ_MISCELLANY)
{
- // Leaves object unmodified if it wasn't a rune or deck
+ // Leaves object unmodified if it wasn't a rune or deck.
rune_or_deck_from_specs(specs, mitm[thing_created]);
if (mitm[thing_created].base_type == OBJ_UNASSIGNED)
{
- // Rune or deck creation canceled, clean up item
+ // Rune or deck creation canceled, clean up item.
destroy_item(thing_created);
return;
}
@@ -1236,7 +1236,7 @@ void create_spec_object()
case OBJ_STAVES:
if (item_is_rod( mitm[thing_created] ))
{
- mitm[thing_created].plus = MAX_ROD_CHARGE * ROD_CHARGE_MULT;
+ mitm[thing_created].plus = MAX_ROD_CHARGE * ROD_CHARGE_MULT;
mitm[thing_created].plus2 = MAX_ROD_CHARGE * ROD_CHARGE_MULT;
}
break;
@@ -3677,8 +3677,17 @@ void wizard_give_monster_item(monsters *mon)
break;
case OBJ_ARMOUR:
- mon_slot = MSLOT_ARMOUR;
+ {
+ // May only return shield or armour slot.
+ equipment_type eq = get_armour_slot(item);
+
+ // Force non-shield, non-body armour to be worn anyway.
+ if (eq == EQ_NONE)
+ eq = EQ_BODY_ARMOUR;
+
+ mon_slot = equip_slot_to_mslot(eq);
break;
+ }
case OBJ_MISSILES:
mon_slot = MSLOT_MISSILE;
break;
@@ -3725,7 +3734,7 @@ void wizard_give_monster_item(monsters *mon)
return;
}
- // Move monster's old item to player's inventory as last step
+ // Move monster's old item to player's inventory as last step.
int old_eq = NON_ITEM;
if (mon->inv[mon_slot] != NON_ITEM)
{
@@ -3738,7 +3747,7 @@ void wizard_give_monster_item(monsters *mon)
}
item_def &new_item = mitm[index];
- new_item = item;
+ new_item = item;
new_item.link = NON_ITEM;
new_item.x = 0;
new_item.y = 0;
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index 09310b87b0..71a65cbd5c 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -1570,7 +1570,7 @@ inline static void monster_warning(activity_interrupt_type ai,
std::string text = mon->name(DESC_CAP_A);
// For named monsters also mention the base type.
if (!(mon->mname).empty())
- text += ", " + mons_type_name(mon->type, DESC_NOCAP_A) + ",";
+ text += " " + mons_type_name(mon->type, DESC_NOCAP_THE);
if (at.context == "thin air")
{
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index eef4efefa4..e8b7ef1f3a 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -2179,9 +2179,10 @@ std::string get_monster_desc(const monsters *mon, bool full_desc,
if (mondtype != DESC_NONE)
{
desc = mon->name(mondtype);
- // For named monsters also mention the base type.
+ // For named monsters also mention the base type in the form of
+ // "Morbeogh the orc priest".
if (!(mon->mname).empty())
- desc += ", " + mons_type_name(mon->type, DESC_NOCAP_A);
+ desc += " " + mons_type_name(mon->type, DESC_NOCAP_THE);
}
std::string weap = "";
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index 680abc135c..874455d060 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -913,7 +913,7 @@ static bool _try_make_weapon_artefact(item_def& item, int force_type,
// The other 98% are normal randarts.
make_item_randart( item );
- item.plus = random2(7);
+ item.plus = random2(7);
item.plus2 = random2(7);
if (one_chance_in(3))
@@ -1561,7 +1561,7 @@ static void _generate_weapon_item(item_def& item, bool allow_uniques,
if ((force_good || is_demonic(item) || forced_ego
|| random2(200) <= 50 + item_level)
- // nobody would bother enchanting a mundane club
+ // Nobody would bother enchanting a mundane club.
&& item.sub_type != WPN_CLUB
&& item.sub_type != WPN_GIANT_CLUB
&& item.sub_type != WPN_GIANT_SPIKED_CLUB)
@@ -1604,7 +1604,7 @@ static void _generate_weapon_item(item_def& item, bool allow_uniques,
{
if (one_chance_in(12))
{
- // make a cursed item
+ // Make a cursed item.
do_curse_item( item );
item.plus -= random2(4);
item.plus2 -= random2(4);
@@ -1615,7 +1615,7 @@ static void _generate_weapon_item(item_def& item, bool allow_uniques,
if (get_equip_race(item) == ISFLAG_ORCISH
&& !(item_race == MAKE_ITEM_ORCISH && forced_ego))
{
- // no holy wrath or slay orc and 1/2 the time no-ego
+ // No holy wrath or slay orc and 1/2 the time no-ego.
const int brand = get_weapon_brand( item );
if (brand == SPWPN_HOLY_WRATH
|| brand == SPWPN_ORC_SLAYING
@@ -2211,7 +2211,7 @@ static int _wand_max_charges(int subtype)
static void _generate_wand_item(item_def& item, int force_type)
{
- // determine sub_type
+ // Determine sub_type.
if (force_type != OBJ_RANDOM)
item.sub_type = force_type;
else
@@ -2221,7 +2221,7 @@ static void _generate_wand_item(item_def& item, int force_type)
item.plus = random2avg(_wand_max_charges(item.sub_type), 3);
// ...but 0 charges is silly
- if ( item.plus == 0 )
+ if (item.plus == 0)
item.plus++;
// plus2 tracks how many times the player has zapped it.
@@ -2595,7 +2595,7 @@ static void _generate_jewellery_item(item_def& item, bool allow_uniques,
}
// everything begins as uncursed, unenchanted jewellery {dlb}:
- item.plus = 0;
+ item.plus = 0;
item.plus2 = 0;
item.plus = _determine_ring_plus(item.sub_type);
@@ -2614,7 +2614,7 @@ static void _generate_jewellery_item(item_def& item, bool allow_uniques,
{
// make "ring of damage"
do_uncurse_item( item );
- item.plus = 0;
+ item.plus = 0;
item.plus2 += 2;
}
}
@@ -3095,8 +3095,8 @@ static item_make_species_type _give_weapon(monsters *mon, int level,
: WPN_MACE + random2(12));
if (coinflip())
{
- force_item = true;
- item_race = MAKE_ITEM_NO_RACE;
+ force_item = true;
+ item_race = MAKE_ITEM_NO_RACE;
item.plus += 1 + random2(3);
item.plus2 += 1 + random2(3);
@@ -3407,29 +3407,29 @@ static item_make_species_type _give_weapon(monsters *mon, int level,
case MONS_CENTAUR:
case MONS_CENTAUR_WARRIOR:
- item_race = MAKE_ITEM_NO_RACE;
+ item_race = MAKE_ITEM_NO_RACE;
item.base_type = OBJ_WEAPONS;
- item.sub_type = WPN_BOW;
+ item.sub_type = WPN_BOW;
if (mon->type == MONS_CENTAUR_WARRIOR && one_chance_in(3))
item.sub_type = WPN_LONGBOW;
break;
case MONS_YAKTAUR:
case MONS_YAKTAUR_CAPTAIN:
- item_race = MAKE_ITEM_NO_RACE;
+ item_race = MAKE_ITEM_NO_RACE;
item.base_type = OBJ_WEAPONS;
- item.sub_type = WPN_CROSSBOW;
+ item.sub_type = WPN_CROSSBOW;
break;
case MONS_EFREET:
case MONS_ERICA:
- force_item = true;
- item_race = MAKE_ITEM_NO_RACE;
+ force_item = true;
+ item_race = MAKE_ITEM_NO_RACE;
item.base_type = OBJ_WEAPONS;
- item.sub_type = WPN_SCIMITAR;
- item.plus = random2(5);
- item.plus2 = random2(5);
- item.colour = RED; // forced by force_item above {dlb}
+ item.sub_type = WPN_SCIMITAR;
+ item.plus = random2(5);
+ item.plus2 = random2(5);
+ item.colour = RED; // forced by force_item above {dlb}
set_item_ego_type( item, OBJ_WEAPONS, SPWPN_FLAMING );
break;
@@ -3455,13 +3455,13 @@ static item_make_species_type _give_weapon(monsters *mon, int level,
break;
case MONS_DAEVA:
- force_item = true;
- item_race = MAKE_ITEM_NO_RACE;
+ force_item = true;
+ item_race = MAKE_ITEM_NO_RACE;
item.base_type = OBJ_WEAPONS;
- item.colour = WHITE; // forced by force_item above {dlb}
+ item.colour = WHITE; // forced by force_item above {dlb}
- item.sub_type = (one_chance_in(4) ? WPN_BLESSED_EUDEMON_BLADE
- : WPN_LONG_SWORD);
+ item.sub_type = (one_chance_in(4) ? WPN_BLESSED_EUDEMON_BLADE
+ : WPN_LONG_SWORD);
set_equip_desc( item, ISFLAG_GLOWING );
set_item_ego_type( item, OBJ_WEAPONS, SPWPN_HOLY_WRATH );
@@ -3476,7 +3476,7 @@ static item_make_species_type _give_weapon(monsters *mon, int level,
{
force_item = true;
item.base_type = OBJ_WEAPONS;
- item.sub_type = WPN_LONG_SWORD + random2(3);
+ item.sub_type = WPN_LONG_SWORD + random2(3);
if (one_chance_in(7))
item.sub_type = WPN_HALBERD;
@@ -3524,9 +3524,9 @@ static item_make_species_type _give_weapon(monsters *mon, int level,
case MONS_FIRE_GIANT:
force_item = true;
item.base_type = OBJ_WEAPONS;
- item.sub_type = WPN_GREAT_SWORD;
- item.plus = 0;
- item.plus2 = 0;
+ item.sub_type = WPN_GREAT_SWORD;
+ item.plus = 0;
+ item.plus2 = 0;
set_item_ego_type( item, OBJ_WEAPONS, SPWPN_FLAMING );
item.colour = RED; // forced by force_item above {dlb}
@@ -3539,9 +3539,9 @@ static item_make_species_type _give_weapon(monsters *mon, int level,
case MONS_FROST_GIANT:
force_item = true;
item.base_type = OBJ_WEAPONS;
- item.sub_type = WPN_BATTLEAXE;
- item.plus = 0;
- item.plus2 = 0;
+ item.sub_type = WPN_BATTLEAXE;
+ item.plus = 0;
+ item.plus2 = 0;
set_item_ego_type( item, OBJ_WEAPONS, SPWPN_FREEZING );
// forced by force_item above {dlb}
@@ -3585,11 +3585,10 @@ static item_make_species_type _give_weapon(monsters *mon, int level,
break;
case MONS_GERYON:
- //mv: probably should be moved out of this switch,
- //but it's not worth of it, unless we have more
- //monsters with misc. items
+ //mv: Probably should be moved out of this switch, but it's not
+ //worth of it, unless we have more monsters with misc. items.
item.base_type = OBJ_MISCELLANY;
- item.sub_type = MISC_HORN_OF_GERYON;
+ item.sub_type = MISC_HORN_OF_GERYON;
break;
case MONS_SALAMANDER: //mv: new 8 Aug 2001
@@ -3597,7 +3596,7 @@ static item_make_species_type _give_weapon(monsters *mon, int level,
//it's almost impossible to get them
{
force_item = true;
- item_race = MAKE_ITEM_NO_RACE;
+ item_race = MAKE_ITEM_NO_RACE;
item.base_type = OBJ_WEAPONS;
const int temp_rand = random2(6);
@@ -3613,8 +3612,8 @@ static item_make_species_type _give_weapon(monsters *mon, int level,
else
set_item_ego_type( item, OBJ_WEAPONS, SPWPN_FLAMING );
- item.plus = random2(5);
- item.plus2 = random2(5);
+ item.plus = random2(5);
+ item.plus2 = random2(5);
item.colour = RED; // forced by force_item above {dlb}
break;
}
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 6424b506af..868db37481 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -339,7 +339,7 @@ void maybe_coagulate_blood_potions_floor(int obj)
return;
}
- // else, create a new stack of potions
+ // Else, create a new stack of potions.
int o = get_item_slot( 20 );
if (o == NON_ITEM)
return;
@@ -585,7 +585,7 @@ bool maybe_coagulate_blood_potions_inv(item_def &blood)
return (rot_count > 0);
}
- // else, create new stack in inventory
+ // Else, create new stack in inventory.
int freeslot = find_free_slot(blood);
if (freeslot >= 0 && freeslot < ENDOFPACK
&& !is_valid_item(you.inv[freeslot]))
@@ -1000,7 +1000,7 @@ void split_potions_into_decay( int obj, int amount, bool need_msg )
item.quantity = amount;
item.x = -1;
item.y = -1;
- // keep description as it was
+ // Keep description as it was.
item.plus = potion.plus;
item.plus2 = 0;
item.special = 0;
@@ -1012,7 +1012,7 @@ void split_potions_into_decay( int obj, int amount, bool need_msg )
}
// Okay, inventory is full.
- // check whether we can merge with an existing stack on the floor
+ // Check whether we can merge with an existing stack on the floor.
int o = igrd[you.x_pos][you.y_pos];
while (o != NON_ITEM)
{
@@ -1027,13 +1027,13 @@ void split_potions_into_decay( int obj, int amount, bool need_msg )
}
// only bother creating a distinct stack of potions
- // if it won't get destroyed right away
+ // if it won't get destroyed right away.
if (!grid_destroys_items(grd[you.x_pos][you.y_pos]))
{
item_def potion2;
potion2.base_type = OBJ_POTIONS;
potion2.sub_type = POT_DECAY;
- // keep description as it was
+ // Keep description as it was.
potion2.plus = potion.plus;
potion2.quantity = amount;
potion2.colour = potion.colour;
@@ -1043,11 +1043,11 @@ void split_potions_into_decay( int obj, int amount, bool need_msg )
copy_item_to_grid( potion2, you.x_pos, you.y_pos );
}
- // is decreased even if the decay stack goes splat
+ // Is decreased even if the decay stack goes splat.
dec_inv_item_quantity(obj, amount);
}
-// checks whether the player or a monster is capable of bleeding
+// Checks whether the player or a monster is capable of bleeding.
bool victim_can_bleed(int montype)
{
if (montype == -1) // player
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 64ebfc3324..8790c9ff9f 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -3547,7 +3547,7 @@ bool monsters::wants_armour(const item_def &item) const
return (check_armour_size(item, mons_size(this)));
}
-static mon_inv_type _equip_slot_to_mslot(equipment_type eq)
+mon_inv_type equip_slot_to_mslot(equipment_type eq)
{
switch (eq)
{
@@ -3568,7 +3568,7 @@ bool monsters::pickup_armour(item_def &item, int near, bool force)
equipment_type eq = EQ_NONE;
// Hack to allow nagas/centaurs to wear bardings. (jpeg)
- switch(item.sub_type)
+ switch (item.sub_type)
{
case ARM_NAGA_BARDING:
if (::mons_species(this->type) == MONS_NAGA)
@@ -3593,12 +3593,13 @@ bool monsters::pickup_armour(item_def &item, int near, bool force)
if (!force && eq != EQ_BODY_ARMOUR && eq != EQ_SHIELD)
return (false);
- const mon_inv_type mslot = _equip_slot_to_mslot(eq);
+ const mon_inv_type mslot = equip_slot_to_mslot(eq);
if (mslot == NUM_MONSTER_SLOTS)
return (false);
int newAC = item.armour_rating();
- // no armour yet -> get this one
+
+ // No armour yet -> get this one.
if (!mslot_item(mslot) && newAC > 0)
return pickup(item, mslot, near);
@@ -3619,7 +3620,7 @@ bool monsters::pickup_armour(item_def &item, int near, bool force)
int oldval = item_value(*existing_armour);
int newval = item_value(item);
- // vastly prefer matching racial type
+ // Vastly prefer matching racial type.
if (_item_race_matches_monster(*existing_armour, this))
oldval *= 2;
if (_item_race_matches_monster(item, this))
@@ -3984,7 +3985,7 @@ void monsters::wield_melee_weapon(int near)
item_def *monsters::slot_item(equipment_type eq)
{
- return mslot_item(_equip_slot_to_mslot(eq));
+ return mslot_item(equip_slot_to_mslot(eq));
}
item_def *monsters::mslot_item(mon_inv_type mslot) const
@@ -5380,7 +5381,7 @@ void monsters::apply_enchantment(const mon_enchant &me)
break;
}
- // assumption: mons_res_fire has already been checked
+ // Assumption: mons_res_fire has already been checked.
case ENCH_STICKY_FLAME:
{
int dam =
@@ -5586,7 +5587,7 @@ actor *monsters::get_foe() const
else if (foe == MHITYOU)
return (&you);
- // must be a monster
+ // Must be a monster!
monsters *my_foe = &menv[foe];
return (my_foe->alive()? my_foe : NULL);
}
@@ -5772,7 +5773,7 @@ bool monsters::move_to_pos(const coord_def &newpos)
}
-// returns true if the trap should be revealed to the player
+// Returns true if the trap should be revealed to the player.
bool monsters::do_shaft()
{
if (!is_valid_shaft_level())
@@ -5827,7 +5828,7 @@ bool monsters::do_shaft()
handle_items_on_shaft(this->x, this->y, false);
- // Monster is no longer on this level
+ // Monster is no longer on this level.
destroy_inventory();
monster_cleanup(this);
@@ -5955,7 +5956,7 @@ static const char *enchant_names[] =
"blood-lust", "neutral", "bug"
};
-const char *mons_enchantment_name(enchant_type ench)
+static const char *_mons_enchantment_name(enchant_type ench)
{
COMPILE_CHECK(ARRAYSZ(enchant_names) == NUM_ENCHANTMENTS+1, c1);
@@ -5974,7 +5975,7 @@ mon_enchant::mon_enchant(enchant_type e, int deg, kill_category whose,
mon_enchant::operator std::string () const
{
return make_stringf("%s (%d:%d%s)",
- mons_enchantment_name(ench),
+ _mons_enchantment_name(ench),
degree,
duration,
kill_category_desc(who));
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index cedb1f7df6..0dbc4dc974 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -624,6 +624,7 @@ bool mons_atts_aligned(mon_attitude_type fr1, mon_attitude_type fr2);
/* ***********************************************************************
* called from: monstuff acr
* *********************************************************************** */
+size_type mons_size(const monsters *m);
bool mons_friendly(const monsters *m);
bool mons_neutral(const monsters *m);
bool mons_good_neutral(const monsters *m);
@@ -719,4 +720,6 @@ std::string get_mon_shape_str(const mon_body_shape shape);
bool mons_class_can_pass(const int mclass, const dungeon_feature_type grid);
+mon_inv_type equip_slot_to_mslot(equipment_type eq);
+
#endif
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 887ffe8987..fc3cd93f58 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -101,16 +101,16 @@ void get_mimic_item( const monsters *mimic, item_def &item )
ASSERT( mimic != NULL && mons_is_mimic( mimic->type ) );
item.base_type = OBJ_UNASSIGNED;
- item.sub_type = 0;
- item.special = 0;
- item.colour = 0;
- item.flags = 0;
- item.quantity = 1;
- item.plus = 0;
- item.plus2 = 0;
- item.x = mimic->x;
- item.y = mimic->y;
- item.link = NON_ITEM;
+ item.sub_type = 0;
+ item.special = 0;
+ item.colour = 0;
+ item.flags = 0;
+ item.quantity = 1;
+ item.plus = 0;
+ item.plus2 = 0;
+ item.x = mimic->x;
+ item.y = mimic->y;
+ item.link = NON_ITEM;
int prop = 127 * mimic->x + 269 * mimic->y;
@@ -268,14 +268,15 @@ bool curse_an_item( bool decay_potions, bool quiet )
}
static void _monster_drop_ething(monsters *monster,
- bool mark_item_origins = false)
+ bool mark_item_origins = false,
+ int owner_id = NON_ITEM)
{
const bool hostile_grid = grid_destroys_items(grd(monster->pos()));
const int midx = (int) monster_index(monster);
bool destroyed = false;
- // drop weapons & missiles last (ie on top) so others pick up
+ // Drop weapons & missiles last (ie on top) so others pick up.
for (int i = NUM_MONSTER_SLOTS - 1; i >= 0; i--)
{
int item = monster->inv[i];
@@ -3946,8 +3947,8 @@ static bool _handle_wand(monsters *monster, bolt &beem)
else
set_ident_type(OBJ_WANDS, wand_type, ID_MON_TRIED_TYPE);
- // increment zap count
- if ( wand.plus2 >= 0 )
+ // Increment zap count.
+ if (wand.plus2 >= 0)
wand.plus2++;
}
@@ -4522,6 +4523,7 @@ int mons_thrown_weapon_damage(const item_def *weap)
{
if (!weap || get_weapon_brand(*weap) != SPWPN_RETURNING)
return (0);
+
return std::max(0, (property(*weap, PWPN_DAMAGE) + weap->plus2 / 2));
}
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index 67b2a69516..277ecd782e 100644
--- a/crawl-ref/source/newgame.cc
+++ b/crawl-ref/source/newgame.cc
@@ -2746,9 +2746,9 @@ static void _give_random_potion( int slot )
if (you.is_undead == US_UNDEAD)
return;
- you.inv[ slot ].quantity = 1;
+ you.inv[ slot ].quantity = 1;
you.inv[ slot ].base_type = OBJ_POTIONS;
- you.inv[ slot ].plus = 0;
+ you.inv[ slot ].plus = 0;
you.inv[ slot ].plus2 = 0;
// no Berserk for undead other than vampires
@@ -2781,11 +2781,11 @@ static void _give_random_potion( int slot )
static void _give_random_secondary_armour( int slot )
{
- you.inv[ slot ].quantity = 1;
+ you.inv[ slot ].quantity = 1;
you.inv[ slot ].base_type = OBJ_ARMOUR;
- you.inv[ slot ].special = 0;
- you.inv[ slot ].plus = 0;
- you.inv[ slot ].plus2 = 0;
+ you.inv[ slot ].special = 0;
+ you.inv[ slot ].plus = 0;
+ you.inv[ slot ].plus2 = 0;
switch (random2(4))
{
@@ -2820,7 +2820,7 @@ static void _give_random_secondary_armour( int slot )
}
}
-// Returns true if a "good" weapon is given
+// Returns true if a "good" weapon is given.
static bool _give_wanderer_weapon( int slot, int wpn_skill )
{
bool ret = false;
@@ -2829,13 +2829,13 @@ static bool _give_wanderer_weapon( int slot, int wpn_skill )
// We'll also re-fill the template, all this for later possible
// safe reuse of code in the future.
- you.inv[ slot ].quantity = 1;
+ you.inv[ slot ].quantity = 1;
you.inv[ slot ].base_type = OBJ_WEAPONS;
- you.inv[ slot ].plus = 0;
- you.inv[ slot ].plus2 = 0;
- you.inv[ slot ].special = 0;
+ you.inv[ slot ].plus = 0;
+ you.inv[ slot ].plus2 = 0;
+ you.inv[ slot ].special = 0;
- // Now fill in the type according to the random wpn_skill
+ // Now fill in the type according to the random wpn_skill.
switch (wpn_skill)
{
case SK_MACES_FLAILS:
@@ -4187,12 +4187,13 @@ bool _give_items_skills()
_newgame_make_item(1, EQ_BODY_ARMOUR, OBJ_ARMOUR, ARM_ROBE);
if (you.char_class == JOB_ENCHANTER)
{
- you.inv[0].plus = 1;
+ // Enchant starting equipment.
+ you.inv[0].plus = 1;
you.inv[0].plus2 = 1;
- you.inv[1].plus = 1;
+ you.inv[1].plus = 1;
}
- if ( you.char_class == JOB_CONJURER )
+ if (you.char_class == JOB_CONJURER)
{
if (!_choose_book( you.inv[2], BOOK_CONJURATIONS_I, 2 ))
return false;
@@ -4203,7 +4204,7 @@ bool _give_items_skills()
case JOB_SUMMONER:
_newgame_make_item(2, EQ_NONE, OBJ_BOOKS, BOOK_CALLINGS);
you.skills[SK_SUMMONINGS] = 4;
- // gets some darts - this class is difficult to start off with
+ // Gets some darts - this class is difficult to start off with.
_newgame_make_item(3, EQ_NONE, OBJ_MISSILES, MI_DART,
8 + roll_dice( 2, 8 ));
break;
@@ -4512,7 +4513,7 @@ bool _give_items_skills()
case DK_YREDELEMNUL:
you.religion = GOD_YREDELEMNUL;
you.piety = 28;
- you.inv[0].plus = 1;
+ you.inv[0].plus = 1;
you.inv[0].plus2 = 1;
you.inv[2].quantity = 0;
you.skills[SK_INVOCATIONS] = 3;
@@ -4520,9 +4521,9 @@ bool _give_items_skills()
}
you.skills[SK_FIGHTING] = 2;
- you.skills[SK_ARMOUR] = 1;
- you.skills[SK_DODGING] = 1;
- you.skills[SK_STEALTH] = 1;
+ you.skills[SK_ARMOUR] = 1;
+ you.skills[SK_DODGING] = 1;
+ you.skills[SK_STEALTH] = 1;
//you.skills [SK_SHORT_BLADES] = 2;
you.skills[SK_STABBING] = 1;
break;
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index e706ebaae1..c5cd54b0cc 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -379,7 +379,7 @@ void item_corrode( int itco )
break;
default:
// items which aren't missiles, etc... could happen if we're
- // e.g. wielding a deck
+ // e.g. wielding a deck.
return;
}
@@ -393,7 +393,7 @@ void item_corrode( int itco )
// the embedded equation may look funny, but it actually works well
// to generate a pretty probability ramp {6%, 18%, 34%, 58%, 98%}
- // for values [0,4] which closely matches the original, ugly switch
+ // for values [0,4] which closely matches the original, ugly switch.
// {dlb}
if (chance_corr >= 0 && chance_corr <= 4)
{
@@ -403,7 +403,7 @@ void item_corrode( int itco )
else
it_resists = true; // no idea how often this occurs {dlb}
- // if the checks get this far, you should hear about it {dlb}
+ // If the checks get this far, you should hear about it. {dlb}
suppress_msg = false;
}
@@ -424,7 +424,7 @@ void item_corrode( int itco )
if (item.base_type == OBJ_WEAPONS)
item.plus2 = how_rusty;
else
- item.plus = how_rusty;
+ item.plus = how_rusty;
you.redraw_armour_class = 1; // for armour, rings, etc. {dlb}
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index de30260db8..5ee6d154f4 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -3135,21 +3135,21 @@ static void _ely_dull_inventory_weapons()
if (you.inv[i].base_type == OBJ_WEAPONS
|| you.inv[i].base_type == OBJ_MISSILES)
{
- // don't dull artefacts
+ // Don't dull artefacts.
if (is_artefact(you.inv[i]))
continue;
- // don't dull weapons below -1/-1
+ // Don't dull weapons below -1/-1.
if (you.inv[i].base_type == OBJ_WEAPONS
&& you.inv[i].plus <= -1 && you.inv[i].plus2 <= -1)
{
continue;
}
- // don't dull ammo below -1
+ // Don't dull ammo below -1.
else if (you.inv[i].plus <= -1)
continue;
- // 2/3 of the time, don't do anything
+ // 2/3 of the time, don't do anything.
if (!one_chance_in(3))
continue;
@@ -3161,16 +3161,17 @@ static void _ely_dull_inventory_weapons()
if (you.inv[i].link == quiver_link)
quivered = true;
- // dull the weapon/ammo
+ // Dull the weapon/ammo.
if (you.inv[i].plus > -1)
you.inv[i].plus--;
- if ((you.inv[i].base_type == OBJ_WEAPONS)
+
+ if (you.inv[i].base_type == OBJ_WEAPONS
&& you.inv[i].plus2 > -1)
{
you.inv[i].plus2--;
}
- // update the weapon/ammo display, if necessary
+ // Update the weapon/ammo display, if necessary.
if (wielded)
you.wield_change = true;
if (quivered)
@@ -3444,54 +3445,54 @@ static bool _beogh_retribution()
// drawing the Wrath card.
for (int i = 0; i < num_to_create; i++)
{
- // create item
+ // Create item.
int slot = items(0, OBJ_WEAPONS, WPN_CLUB + random2(13),
true, you.experience_level,
(you.species == SP_HILL_ORC) ?
MAKE_ITEM_NO_RACE : MAKE_ITEM_ORCISH);
- if ( slot == -1 )
+ if (slot == -1)
continue;
item_def& item = mitm[slot];
- // set item ego type
+ // Set item ego type.
set_item_ego_type(item, OBJ_WEAPONS,
(you.species == SP_HILL_ORC) ?
SPWPN_ORC_SLAYING : SPWPN_ELECTROCUTION);
- // manually override item plusses
- item.plus = random2(3);
+ // Manually override item plusses.
+ item.plus = random2(3);
item.plus2 = random2(3);
if (coinflip())
item.flags |= ISFLAG_CURSED;
- // let the player see what he's being attacked by
+ // Let the player see what he's being attacked by.
set_ident_flags( item, ISFLAG_KNOW_TYPE );
- // now create monster
+ // Now create monster.
int mons =
create_monster(
mgen_data::alert_hostile_at(
MONS_DANCING_WEAPON,
you.pos() ));
- // hand item information over to monster
+ // Hand item information over to monster.
if (mons != -1)
{
- // destroy the old weapon
- // arguably we should use destroy_item() here
+ // Destroy the old weapon.
+ // Arguably we should use destroy_item() here.
mitm[menv[mons].inv[MSLOT_WEAPON]].clear();
menv[mons].inv[MSLOT_WEAPON] = slot;
num_created++;
- // 50% chance of weapon disappearing on "death"
+ // 50% chance of weapon disappearing on "death".
if (coinflip())
menv[mons].flags |= MF_HARD_RESET;
}
- else // didn't work out! delete item
+ else // Didn't work out! Delete item.
{
mitm[slot].clear();
}
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 9b164e2414..3c8e6c4f7c 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -272,7 +272,6 @@ int corpse_rot(int power)
}
for (adx = minx; adx != maxx; adx += xinc)
- {
for (ady = miny; ady != maxy; ady += yinc)
{
if (see_grid_no_trans(adx, ady))
@@ -296,14 +295,14 @@ int corpse_rot(int power)
else
{
mitm[objl].sub_type = CORPSE_SKELETON;
- mitm[objl].special = 200;
- mitm[objl].colour = LIGHTGREY;
+ mitm[objl].special = 200;
+ mitm[objl].colour = LIGHTGREY;
}
place_cloud(CLOUD_MIASMA, adx, ady,
4 + random2avg(16, 3), KC_YOU);
- // Don't look for more corpses here
+ // Don't look for more corpses here.
break;
}
hrg = mitm[objl].link;
@@ -311,7 +310,6 @@ int corpse_rot(int power)
}
}
}
- }
if (player_can_smell())
mpr("You smell decay.");
@@ -359,49 +357,45 @@ int animate_dead( actor *caster, int power, beh_type corps_beh,
coord_def a;
for (a.x = minx; a.x != maxx; a.x += xinc)
- {
for (a.y = miny; a.y != maxy; a.y += yinc)
{
- if (in_bounds(a) && see_grid(los, c, a))
+ if (!in_bounds(a) || !see_grid(los, c, a))
+ continue;
+
+ if (igrd(a) != NON_ITEM)
{
- if (igrd(a) != NON_ITEM)
- {
- int objl = igrd(a);
- int hrg = 0;
+ int objl = igrd(a);
+ int hrg = 0;
- // This searches all the items on the ground for a corpse
- while (objl != NON_ITEM)
+ // This searches all the items on the ground for a corpse.
+ while (objl != NON_ITEM)
+ {
+ if (is_animatable_corpse(mitm[objl])
+ && !is_being_butchered(mitm[objl]))
{
- if (is_animatable_corpse(mitm[objl])
- && !is_being_butchered(mitm[objl]))
- {
- int num = raise_corpse(objl, a.x, a.y,
- corps_beh, corps_hit, actual);
- number_raised += num;
- if (see_grid(env.show, you.pos(), a))
- number_seen += num;
- break;
- }
-
- hrg = mitm[objl].link;
- objl = hrg;
+ int num = raise_corpse(objl, a.x, a.y, corps_beh,
+ corps_hit, actual);
+ number_raised += num;
+ if (see_grid(env.show, you.pos(), a))
+ number_seen += num;
+ break;
}
- objl = 1;
+ hrg = mitm[objl].link;
+ objl = hrg;
}
+
+ objl = 1;
}
}
- }
if (actual == 0)
- return number_raised;
+ return (number_raised);
if (number_seen > 0)
- {
mpr("The dead are walking!");
- }
- return number_raised;
+ return (number_raised);
} // end animate_dead()
int animate_a_corpse( int axps, int ayps, beh_type corps_beh, int corps_hit,
@@ -419,7 +413,7 @@ int animate_a_corpse( int axps, int ayps, beh_type corps_beh, int corps_hit,
bool was_butchering = is_being_butchered(item);
rc = raise_corpse(objl, axps, ayps, corps_beh, corps_hit, 1);
- if ( rc )
+ if (rc)
{
if (is_terrain_seen(axps, ayps))
mpr("The dead are walking!");
@@ -462,8 +456,8 @@ static int raise_corpse( int corps, int corx, int cory,
const int number =
mitm[corps].props.exists(MONSTER_NUMBER)
- ? mitm[corps].props[MONSTER_NUMBER].get_short()
- : 0;
+ ? mitm[corps].props[MONSTER_NUMBER].get_short()
+ : 0;
const monster_type zombie_type =
static_cast<monster_type>(mitm[corps].plus);
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index 3004edbfe8..afec4122c8 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -1769,7 +1769,7 @@ void cast_fulsome_distillation( int powc )
break;
}
- // If not powerful enough, we downgrade the potion
+ // If not powerful enough, we downgrade the potion.
if (random2(50) > powc + 10 * rotten)
{
switch (pot_type)
@@ -1797,24 +1797,22 @@ void cast_fulsome_distillation( int powc )
}
}
- // We borrow the corpse's object to make our potion:
+ // We borrow the corpse's object to make our potion.
mitm[corpse].base_type = OBJ_POTIONS;
- mitm[corpse].sub_type = pot_type;
- mitm[corpse].quantity = 1;
- mitm[corpse].plus = 0;
- mitm[corpse].plus2 = 0;
- mitm[corpse].flags = 0;
+ mitm[corpse].sub_type = pot_type;
+ mitm[corpse].quantity = 1;
+ mitm[corpse].plus = 0;
+ mitm[corpse].plus2 = 0;
+ mitm[corpse].flags = 0;
mitm[corpse].inscription.clear();
item_colour( mitm[corpse] ); // sets special as well
mprf("You extract %s from the corpse.",
mitm[corpse].name(DESC_NOCAP_A).c_str());
- // try to move the potion to the player (for convenience)
+ // Try to move the potion to the player (for convenience).
if (move_item_to_player( corpse, 1 ) != 1)
- {
mpr( "Unfortunately, you can't carry it right now!" );
- }
}
static int rot_living(int x, int y, int pow, int message)
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index 8610f3fd9c..5e5cd91e76 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -233,7 +233,7 @@ void marshallShort(std::vector<unsigned char>& buf, short data)
buf.push_back((unsigned char) ((data & 0x00FF) ));
}
-// marshall 2 byte short in network order
+// Marshall 2 byte short in network order.
void marshallShort(writer &th, short data)
{
const char b2 = (char)(data & 0x00FF);
@@ -242,7 +242,7 @@ void marshallShort(writer &th, short data)
th.writeByte(b2);
}
-// unmarshall 2 byte short in network order
+// Unmarshall 2 byte short in network order.
short unmarshallShort(reader &th)
{
short b1 = th.readByte();
@@ -259,7 +259,7 @@ void marshallLong(std::vector<unsigned char>& buf, long data)
buf.push_back((unsigned char) ((data & 0x000000FF) ));
}
-// marshall 4 byte int in network order
+// Marshall 4 byte int in network order.
void marshallLong(writer &th, long data)
{
char b4 = (char) (data & 0x000000FF);
@@ -273,7 +273,7 @@ void marshallLong(writer &th, long data)
th.writeByte(b4);
}
-// unmarshall 4 byte int in network order
+// Unmarshall 4 byte int in network order.
long unmarshallLong(reader &th)
{
long b1 = th.readByte();
@@ -299,7 +299,7 @@ void marshallMap(writer &th, const std::map<key,value>& data,
{
marshallLong( th, data.size() );
typename std::map<key,value>::const_iterator ci;
- for ( ci = data.begin(); ci != data.end(); ++ci )
+ for (ci = data.begin(); ci != data.end(); ++ci)
{
key_marshall(th, ci->first);
value_marshall(th, ci->second);
@@ -324,7 +324,7 @@ static void unmarshall_vector(reader& th, std::vector<T>& vec,
{
vec.clear();
const long num_to_read = unmarshallLong(th);
- for ( long i = 0; i < num_to_read; ++i )
+ for (long i = 0; i < num_to_read; ++i)
vec.push_back( T_unmarshall(th) );
}
@@ -338,7 +338,7 @@ static void unmarshall_container(reader &th, T_container &container,
(container.*inserter)(unmarshal(th));
}
-// XXX: redundant with level_id.save()/load()
+// XXX: Redundant with level_id.save()/load().
void marshall_level_id( writer& th, const level_id& id )
{
marshallByte(th, id.branch );
@@ -346,7 +346,7 @@ void marshall_level_id( writer& th, const level_id& id )
marshallByte(th, id.level_type);
}
-// XXX: redundant with level_pos.save()/load()
+// XXX: Redundant with level_pos.save()/load().
void marshall_level_pos( writer& th, const level_pos& lpos )
{
marshallLong(th, lpos.pos.x);
@@ -361,7 +361,7 @@ void unmarshallMap(reader& th, map& data,
{
long i, len = unmarshallLong(th);
key k;
- for ( i = 0; i < len; ++i )
+ for (i = 0; i < len; ++i)
{
k = key_unmarshall(th);
std::pair<key, value> p(k, value_unmarshall(th));
@@ -500,14 +500,14 @@ static void marshallStringNoMax(writer &th, const std::string &data)
// string -- unmarshall length & string data
int unmarshallCString(reader &th, char *data, int maxSize)
{
- // get length
+ // Get length.
short len = unmarshallShort(th);
int copylen = len;
if (len >= maxSize && maxSize > 0)
copylen = maxSize - 1;
- // read the actual string and null terminate
+ // Read the actual string and null terminate.
th.read(data, copylen);
data[copylen] = 0;
@@ -535,7 +535,7 @@ static std::string unmarshallStringNoMax(reader &th)
return unmarshallString(th);
}
-// string -- 4 byte length, non-terminated string data
+// string -- 4 byte length, non-terminated string data.
void marshallString4(writer &th, const std::string &data)
{
marshallLong(th, data.length());
@@ -679,7 +679,7 @@ void tag_write(tag_type tagID, FILE* outf)
marshallLong(tmp, buf.size());
}
- // write tag data
+ // Write tag data.
write2(outf, &buf[0], buf.size());
}
@@ -688,7 +688,7 @@ void tag_write(tag_type tagID, FILE* outf)
// (or on an error).
//
// minorVersion is available for any sub-readers that need it
-// (like TAG_LEVEL_MONSTERS)
+// (like TAG_LEVEL_MONSTERS).
tag_type tag_read(FILE *fp, char minorVersion)
{
// Read header info and data
@@ -708,7 +708,8 @@ tag_type tag_read(FILE *fp, char minorVersion)
}
unwind_var<int> tag_minor_version(_tag_minor_version, minorVersion);
- // ok, we have data now.
+
+ // Ok, we have data now.
reader th(buf);
switch (tag_id)
{
@@ -753,16 +754,15 @@ tag_type tag_read(FILE *fp, char minorVersion)
}
-// older savefiles might want to call this to get a tag
-// properly initialized if it wasn't part of the savefile.
+// Older savefiles might want to call this to get a tag properly
+// initialized if it wasn't part of the savefile.
// For now, none are supported.
-// This function will be called AFTER all other tags for
-// the savefile are read, so everything that can be
-// initialized should have been by now.
+// This function will be called AFTER all other tags for the savefile
+// are read, so everything that can be initialized should have been by now.
-// minorVersion is available for any child functions that need
-// it (currently none)
+// minorVersion is available for any child functions that need it
+// (currently none).
void tag_missing(int tag, char minorVersion)
{
UNUSED( minorVersion );
@@ -883,7 +883,7 @@ static void tag_construct_you(writer &th)
marshallByte(th, you.experience_level);
marshallLong(th, you.exp_available);
- /* max values */
+ // max values
marshallByte(th, you.max_strength);
marshallByte(th, you.max_intel);
marshallByte(th, you.max_dex);
@@ -917,10 +917,10 @@ static void tag_construct_you(writer &th)
marshallByte(th, 50);
for (j = 0; j < 50; ++j)
{
- marshallByte(th, you.skills[j]); /* skills! */
- marshallByte(th, you.practise_skill[j]); /* skills! */
+ marshallByte(th, you.skills[j]);
+ marshallByte(th, you.practise_skill[j]);
marshallLong(th, you.skill_points[j]);
- marshallByte(th, you.skill_order[j]); /* skills ordering */
+ marshallByte(th, you.skill_order[j]); // skills ordering
}
// how many durations?
@@ -933,10 +933,10 @@ static void tag_construct_you(writer &th)
for (j = 0; j < NUM_ATTRIBUTES; ++j)
marshallByte(th, you.attribute[j]);
- // was: remembered quiver items
+ // Was: remembered quiver items.
marshallByte(th, 0);
- // sacrifice values
+ // Sacrifice values.
marshallByte(th, NUM_OBJECT_CLASSES);
for (j = 0; j < NUM_OBJECT_CLASSES; ++j)
marshallLong(th, you.sacrifice_value[j]);
@@ -977,7 +977,7 @@ static void tag_construct_you(writer &th)
// time of game start
marshallString(th, make_date_string( you.birth_time ).c_str(), 20);
- // real_time == -1 means game was started before this feature
+ // real_time == -1 means game was started before this feature.
if (you.real_time != -1)
{
const time_t now = time(NULL);
@@ -996,7 +996,7 @@ static void tag_construct_you(writer &th)
marshallShort(th, you.transit_stair);
marshallByte(th, you.entering_level);
- // list of currently beholding monsters (usually empty)
+ // List of currently beholding monsters (usually empty).
marshallByte(th, you.beheld_by.size());
for (unsigned int k = 0; k < you.beheld_by.size(); k++)
marshallByte(th, you.beheld_by[k]);
@@ -1020,7 +1020,7 @@ static void tag_construct_you_items(writer &th)
for (i = 0; i < ENDOFPACK; ++i)
marshallItem(th, you.inv[i]);
- // item descrip for each type & subtype
+ // Item descrip for each type & subtype.
// how many types?
marshallByte(th, NUM_IDESC);
// how many subtypes?
@@ -1029,7 +1029,7 @@ static void tag_construct_you_items(writer &th)
for (j = 0; j < 50; ++j)
marshallByte(th, you.item_description[i][j]);
- // identification status
+ // Identification status.
const id_arr& identy(get_typeid_array());
// how many types?
marshallByte(th, static_cast<char>(identy.width()));
@@ -1092,7 +1092,7 @@ static void tag_construct_you_dungeon(writer &th)
// how many unique creatures?
marshallShort(th, NUM_MONSTERS);
for (j = 0; j < NUM_MONSTERS; ++j)
- marshallByte(th,you.unique_creatures[j]); /* unique beasties */
+ marshallByte(th,you.unique_creatures[j]); // unique beasties
// how many branches?
marshallByte(th, NUM_BRANCHES);
@@ -1266,7 +1266,7 @@ static void tag_read_you(reader &th, char minorVersion)
you.experience_level = unmarshallByte(th);
you.exp_available = unmarshallLong(th);
- /* max values */
+ // max values
you.max_strength = unmarshallByte(th);
you.max_intel = unmarshallByte(th);
you.max_dex = unmarshallByte(th);
@@ -1316,7 +1316,7 @@ static void tag_read_you(reader &th, char minorVersion)
you.skill_order[j] = unmarshallByte(th);
}
- // set up you.total_skill_points and you.skill_cost_level
+ // Set up you.total_skill_points and you.skill_cost_level.
calc_total_skill_points();
// how many durations?
@@ -1384,7 +1384,7 @@ static void tag_read_you(reader &th, char minorVersion)
you.transit_stair = static_cast<dungeon_feature_type>(unmarshallShort(th));
you.entering_level = unmarshallByte(th);
- // list of currently beholding monsters (usually empty)
+ // List of currently beholding monsters (usually empty).
count_c = unmarshallByte(th);
for (i = 0; i < count_c; i++)
you.beheld_by.push_back(unmarshallByte(th));
@@ -1410,7 +1410,7 @@ static void tag_read_you_items(reader &th, char minorVersion)
for (i = 0; i < count_c; ++i)
unmarshallItem(th, you.inv[i]);
- // item descrip for each type & subtype
+ // Item descrip for each type & subtype.
// how many types?
count_c = unmarshallByte(th);
// how many subtypes?
@@ -1419,15 +1419,14 @@ static void tag_read_you_items(reader &th, char minorVersion)
for (j = 0; j < count_c2; ++j)
you.item_description[i][j] = unmarshallByte(th);
- // identification status
+ // Identification status.
// how many types?
count_c = unmarshallByte(th);
// how many subtypes?
count_c2 = unmarshallByte(th);
- // argh.. this is awful.
+ // Argh... this is awful!
for (i = 0; i < count_c; ++i)
- {
for (j = 0; j < count_c2; ++j)
{
const item_type_id_state_type ch =
@@ -1452,13 +1451,14 @@ static void tag_read_you_items(reader &th, char minorVersion)
break;
}
}
- }
// how many unique items?
count_c = unmarshallByte(th);
for (j = 0; j < count_c; ++j)
+ {
you.unique_items[j] =
static_cast<unique_item_status_type>(unmarshallByte(th));
+ }
// how many books?
count_c = unmarshallByte(th);
@@ -1470,8 +1470,8 @@ static void tag_read_you_items(reader &th, char minorVersion)
for (j = 0; j < count_s; ++j)
set_unrandart_exist(j, unmarshallBoolean(th));
- // # of unrandarts could certainly change. If it does,
- // the new ones won't exist yet - zero them out.
+ // # of unrandarts could certainly change.
+ // If it does, the new ones won't exist yet - zero them out.
for (; j < NO_UNRANDARTS; j++)
set_unrandart_exist(j, false);
}
@@ -1608,7 +1608,7 @@ static void tag_construct_level(writer &th)
marshallFloat(th, (float)you.elapsed_time);
- // map grids
+ // Map grids.
// how many X?
marshallShort(th, GXM);
// how many Y?
@@ -1617,7 +1617,6 @@ static void tag_construct_level(writer &th)
marshallLong(th, env.turns_on_level);
for (int count_x = 0; count_x < GXM; count_x++)
- {
for (int count_y = 0; count_y < GYM; count_y++)
{
marshallByte(th, grd[count_x][count_y]);
@@ -1627,7 +1626,6 @@ static void tag_construct_level(writer &th)
marshallShort(th, env.map[count_x][count_y].property);
marshallShort(th, env.cgrid[count_x][count_y]);
}
- }
run_length_encode(th, marshallByte, env.grid_colours, GXM, GYM);
@@ -1840,9 +1838,10 @@ void tag_construct_level_tiles(writer &th)
unsigned int tile = 0;
unsigned int last_tile = 0;
- // Ver
- marshallShort(th, 71); // tile routine subversion
- // map grids
+ // tile routine subversion
+ marshallShort(th, 71);
+
+ // Map grids.
// how many X?
marshallShort(th, GXM);
// how many Y?
@@ -1851,7 +1850,6 @@ void tag_construct_level_tiles(writer &th)
tile = env.tile_bk_bg[0][0];
// bg first
for (int count_x = 0; count_x < GXM; count_x++)
- {
for (int count_y = 0; count_y < GYM; count_y++)
{
last_tile = tile;
@@ -1877,7 +1875,7 @@ void tag_construct_level_tiles(writer &th)
rle_count = 1;
}
}
- }
+
marshallLong(th, tile);
marshallByte(th, rle_count);
@@ -1931,7 +1929,8 @@ static void tag_read_level( reader &th, char minorVersion )
env.level_flags = (unsigned long) unmarshallLong(th);
env.elapsed_time = unmarshallFloat(th);
- // map grids
+
+ // Map grids.
// how many X?
const int gx = unmarshallShort(th);
// how many Y?
@@ -2112,14 +2111,12 @@ void tag_read_level_attitude(reader &th)
void tag_missing_level_attitude()
{
- // we don't really have to do a lot here.
- // just set foe to MHITNOT; they'll pick up
- // a foe first time through handle_monster() if
+ // We don't really have to do a lot here, just set foe to MHITNOT;
+ // they'll pick up a foe first time through handle_monster() if
// there's one around.
- // as for attitude, a couple simple checks
- // can be used to determine friendly/good
- // neutral/neutral/hostile.
+ // As for attitude, a couple simple checks can be used to determine
+ // friendly/good neutral/neutral/hostile.
int i;
bool is_friendly;
unsigned int new_beh = BEH_WANDER;
@@ -2165,13 +2162,11 @@ void tag_read_level_tiles(struct reader &th)
{
#ifdef USE_TILE
for (int i = 0; i < GXM; i++)
- {
for (int j = 0; j < GYM; j++)
{
env.tile_bk_bg[i][j] = 0;
env.tile_bk_fg[i][j] = 0;
}
- }
unsigned char rle_count = 0;
unsigned int tile = 0;
@@ -2179,7 +2174,7 @@ void tag_read_level_tiles(struct reader &th)
int ver = unmarshallShort(th);
if (ver == 0) return;
- // map grids
+ // Map grids.
// how many X?
const int gx = unmarshallShort(th);
// how many Y?
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc
index 3891154632..05a9301273 100644
--- a/crawl-ref/source/traps.cc
+++ b/crawl-ref/source/traps.cc
@@ -66,7 +66,7 @@ int get_trapping_net(int x, int y, bool trapped)
}
// if there are more than one net on this square
-// split off one of them for checking/setting values
+// split off one of them for checking/setting values.
static void maybe_split_nets(item_def &item, int x, int y)
{
if (item.quantity == 1)
@@ -78,12 +78,12 @@ static void maybe_split_nets(item_def &item, int x, int y)
item_def it;
it.base_type = item.base_type;
- it.sub_type = item.sub_type;
- it.plus = item.plus;
- it.plus2 = item.plus2;
- it.flags = item.flags;
- it.special = item.special;
- it.quantity = --item.quantity;
+ it.sub_type = item.sub_type;
+ it.plus = item.plus;
+ it.plus2 = item.plus2;
+ it.flags = item.flags;
+ it.special = item.special;
+ it.quantity = --item.quantity;
item_colour(it);
item.quantity = 1;
@@ -846,14 +846,14 @@ void clear_trapping_net()
bool trap_item(object_class_type base_type, char sub_type,
char beam_x, char beam_y)
{
- item_def item;
+ item_def item;
item.base_type = base_type;
- item.sub_type = sub_type;
- item.plus = 0;
- item.plus2 = 0;
- item.flags = 0;
- item.special = 0;
- item.quantity = 1;
+ item.sub_type = sub_type;
+ item.plus = 0;
+ item.plus2 = 0;
+ item.flags = 0;
+ item.special = 0;
+ item.quantity = 1;
if (base_type == OBJ_MISSILES)
{