summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2012-08-01 16:09:16 -0400
committerNeil Moore <neil@s-z.org>2012-08-01 17:08:37 -0400
commit1cc90225baf47270bbe2a22c1ecbbc839eaa2b90 (patch)
treebd8816720989c3d2193ccaa82cbca5f7b6f2deca
parenta0a9240421e89e77aac6011671931521d7e60f0a (diff)
downloadcrawl-ref-1cc90225baf47270bbe2a22c1ecbbc839eaa2b90.tar.gz
crawl-ref-1cc90225baf47270bbe2a22c1ecbbc839eaa2b90.zip
Massive style fix (braces, indentation, etc.)
-rw-r--r--crawl-ref/source/abl-show.cc5
-rw-r--r--crawl-ref/source/abyss.cc4
-rw-r--r--crawl-ref/source/arena.cc12
-rw-r--r--crawl-ref/source/artefact.cc5
-rw-r--r--crawl-ref/source/beam.cc19
-rw-r--r--crawl-ref/source/cloud.cc12
-rw-r--r--crawl-ref/source/clua.cc2
-rw-r--r--crawl-ref/source/cluautil.cc2
-rw-r--r--crawl-ref/source/command.cc2
-rw-r--r--crawl-ref/source/dbg-asrt.cc2
-rw-r--r--crawl-ref/source/dbg-maps.cc4
-rw-r--r--crawl-ref/source/delay.cc2
-rw-r--r--crawl-ref/source/describe.cc6
-rw-r--r--crawl-ref/source/dgn-overview.cc5
-rw-r--r--crawl-ref/source/dgn-shoals.cc5
-rw-r--r--crawl-ref/source/directn.cc2
-rw-r--r--crawl-ref/source/dlua.cc2
-rw-r--r--crawl-ref/source/dungeon.cc14
-rw-r--r--crawl-ref/source/effects.cc4
-rw-r--r--crawl-ref/source/evoke.cc2
-rw-r--r--crawl-ref/source/fight.cc2
-rw-r--r--crawl-ref/source/food.cc2
-rw-r--r--crawl-ref/source/godabil.cc5
-rw-r--r--crawl-ref/source/goditem.cc2
-rw-r--r--crawl-ref/source/godpassive.cc2
-rw-r--r--crawl-ref/source/godwrath.cc2
-rw-r--r--crawl-ref/source/hiscores.cc2
-rw-r--r--crawl-ref/source/initfile.cc10
-rw-r--r--crawl-ref/source/item_use.cc4
-rw-r--r--crawl-ref/source/itemprop.cc18
-rw-r--r--crawl-ref/source/items.cc6
-rw-r--r--crawl-ref/source/kills.cc6
-rw-r--r--crawl-ref/source/l_crawl.cc2
-rw-r--r--crawl-ref/source/l_dgn.cc2
-rw-r--r--crawl-ref/source/l_dgnbld.cc4
-rw-r--r--crawl-ref/source/l_dgnit.cc4
-rw-r--r--crawl-ref/source/l_dgnlvl.cc3
-rw-r--r--crawl-ref/source/los.cc8
-rw-r--r--crawl-ref/source/main.cc7
-rw-r--r--crawl-ref/source/makeitem.cc9
-rw-r--r--crawl-ref/source/mapdef.cc32
-rw-r--r--crawl-ref/source/mapmark.cc10
-rw-r--r--crawl-ref/source/melee_attack.cc18
-rw-r--r--crawl-ref/source/menu.cc22
-rw-r--r--crawl-ref/source/misc.cc16
-rw-r--r--crawl-ref/source/mon-abil.cc7
-rw-r--r--crawl-ref/source/mon-act.cc20
-rw-r--r--crawl-ref/source/mon-cast.cc12
-rw-r--r--crawl-ref/source/mon-death.cc8
-rw-r--r--crawl-ref/source/mon-ench.cc2
-rw-r--r--crawl-ref/source/mon-place.cc4
-rw-r--r--crawl-ref/source/mon-speak.cc2
-rw-r--r--crawl-ref/source/mon-stuff.cc28
-rw-r--r--crawl-ref/source/mon-util.cc10
-rw-r--r--crawl-ref/source/monster.cc5
-rw-r--r--crawl-ref/source/mutation.cc10
-rw-r--r--crawl-ref/source/newgame.cc8
-rw-r--r--crawl-ref/source/output.cc3
-rw-r--r--crawl-ref/source/package.cc2
-rw-r--r--crawl-ref/source/place-info.cc6
-rw-r--r--crawl-ref/source/player-equip.cc4
-rw-r--r--crawl-ref/source/player-stats.cc2
-rw-r--r--crawl-ref/source/player.cc12
-rw-r--r--crawl-ref/source/religion.cc30
-rw-r--r--crawl-ref/source/shopping.cc6
-rw-r--r--crawl-ref/source/shout.cc8
-rw-r--r--crawl-ref/source/skills.cc2
-rw-r--r--crawl-ref/source/spl-clouds.cc8
-rw-r--r--crawl-ref/source/spl-damage.cc29
-rw-r--r--crawl-ref/source/spl-other.cc3
-rw-r--r--crawl-ref/source/spl-summoning.cc4
-rw-r--r--crawl-ref/source/spl-tornado.cc3
-rw-r--r--crawl-ref/source/stairs.cc6
-rw-r--r--crawl-ref/source/stuff.cc6
-rw-r--r--crawl-ref/source/tags.cc4
-rw-r--r--crawl-ref/source/terrain.cc4
-rw-r--r--crawl-ref/source/throw.cc2
-rw-r--r--crawl-ref/source/tilepick.cc3
-rw-r--r--crawl-ref/source/tileweb.cc46
-rw-r--r--crawl-ref/source/travel.cc9
-rw-r--r--crawl-ref/source/view.cc2
-rw-r--r--crawl-ref/source/wcwidth.cc3
-rw-r--r--crawl-ref/source/wiz-fsim.cc2
-rw-r--r--crawl-ref/source/wiz-mon.cc2
-rw-r--r--crawl-ref/source/xom.cc2
85 files changed, 482 insertions, 156 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 7434fc33e2..ea31e6b922 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -2140,7 +2140,9 @@ static bool _do_ability(const ability_def& abil)
case ABIL_HELLFIRE:
if (your_spells(SPELL_HELLFIRE,
you.experience_level * 10, false) == SPRET_ABORT)
+ {
return false;
+ }
break;
case ABIL_EVOKE_TURN_INVISIBLE: // ring, randarts, darkness items
@@ -3149,7 +3151,8 @@ std::vector<talent> your_talents(bool check_confused)
_add_talent(talents, ABIL_DELAYED_FIREBALL, check_confused);
// Evocations from items.
- if (!you.suppressed()) {
+ if (!you.suppressed())
+ {
if (scan_artefacts(ARTP_BLINK))
_add_talent(talents, ABIL_EVOKE_BLINK, check_confused);
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc
index 5442dd4975..82c464e925 100644
--- a/crawl-ref/source/abyss.cc
+++ b/crawl-ref/source/abyss.cc
@@ -611,8 +611,10 @@ static void _abyss_move_sanctuary(const coord_def abyss_shift_start_centre,
if (env.sanctuary_time > 0 && in_bounds(env.sanctuary_pos))
{
if (you.see_cell(env.sanctuary_pos))
+ {
env.sanctuary_pos += (abyss_shift_end_centre -
abyss_shift_start_centre);
+ }
else
remove_sanctuary(false);
}
@@ -635,8 +637,10 @@ static void _place_displaced_monsters()
{
maybe_bloodify_square(mon->pos());
if (you.can_see(mon))
+ {
simple_monster_message(mon, " is pulled into the abyss.",
MSGCH_BANISHMENT);
+ }
_abyss_lose_monster(*mon);
}
diff --git a/crawl-ref/source/arena.cc b/crawl-ref/source/arena.cc
index c51b7810b3..b7a8147480 100644
--- a/crawl-ref/source/arena.cc
+++ b/crawl-ref/source/arena.cc
@@ -265,8 +265,10 @@ namespace arena
ASSERT(map);
bool success = dgn_place_map(map, false, true);
if (!success)
+ {
throw make_stringf("Failed to create arena named \"%s\"",
arena_type.c_str());
+ }
link_items();
if (!env.rock_colour)
@@ -324,8 +326,10 @@ namespace arena
summon_throttle = strip_number_tag(spec, "summon_throttle:");
if (real_summons && respawn)
+ {
throw (std::string("Can't set real_summons and respawn at "
"same time."));
+ }
if (summon_throttle <= 0)
summon_throttle = INT_MAX;
@@ -337,7 +341,9 @@ namespace arena
const int ntrials = strip_number_tag(spec, "t:");
if (ntrials != TAG_UNFOUND && ntrials >= 1 && ntrials <= 99
&& !total_trials)
+ {
total_trials = ntrials;
+ }
arena_type = strip_tag_prefix(spec, "arena:");
@@ -374,8 +380,10 @@ namespace arena
factions = split_string(" vs ", spec);
if (factions.size() != 2)
+ {
throw make_stringf("Expected arena monster spec \"xxx v yyy\", "
"but got \"%s\"", spec.c_str());
+ }
try
{
@@ -524,12 +532,16 @@ namespace arena
int orig_b = faction_b.active_members;
if (orig_a < 0)
+ {
mpr("Book-keeping says faction_a has negative active members.",
MSGCH_ERROR);
+ }
if (orig_b < 0)
+ {
mpr("Book-keeping says faction_b has negative active members.",
MSGCH_ERROR);
+ }
faction_a.active_members = 0;
faction_b.active_members = 0;
diff --git a/crawl-ref/source/artefact.cc b/crawl-ref/source/artefact.cc
index 82a7d306bf..722c87aaf8 100644
--- a/crawl-ref/source/artefact.cc
+++ b/crawl-ref/source/artefact.cc
@@ -1170,8 +1170,10 @@ static bool _init_artefact_book(item_def &book)
book.plus2 = plus2;
if (book.sub_type == BOOK_RANDART_LEVEL)
+ {
// The parameters to this call are in book.plus and plus2.
book_good = make_book_level_randart(book, book.plus);
+ }
else
book_good = make_book_theme_randart(book);
@@ -1839,8 +1841,7 @@ static void _artefact_setup_prop_vectors(item_def &item)
{
CrawlHashTable &props = item.props;
if (!props.exists(ARTEFACT_PROPS_KEY))
- props[ARTEFACT_PROPS_KEY].new_vector(SV_SHORT)
- .resize(ART_PROPERTIES);
+ props[ARTEFACT_PROPS_KEY].new_vector(SV_SHORT).resize(ART_PROPERTIES);
CrawlVector &rap = props[ARTEFACT_PROPS_KEY].get_vector();
rap.set_max_size(ART_PROPERTIES);
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 8835abdacc..8af30719ce 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -1222,9 +1222,11 @@ void bolt::affect_cell()
// affected the player on this square. -cao
const bool still_wall = (was_solid && old_pos == pos());
if ((!hit_player || is_beam || is_explosion) && !still_wall)
- if (monster* m = monster_at(pos()))
- if (can_affect_actor(m))
- affect_monster(m);
+ {
+ monster *m = monster_at(pos());
+ if (m && can_affect_actor(m))
+ affect_monster(m);
+ }
if (!feat_is_solid(grd(pos())))
affect_ground();
@@ -2264,8 +2266,7 @@ bool imb_can_splash(coord_def origin, coord_def center,
static void _imb_explosion(bolt *parent, coord_def center)
{
const int dist = grid_distance(parent->source, center);
- if (dist == 0
- || (!parent->is_tracer && !x_chance_in_y(3, 2 + 2 * dist)))
+ if (dist == 0 || (!parent->is_tracer && !x_chance_in_y(3, 2 + 2 * dist)))
return;
bolt beam;
beam.name = "mystic blast";
@@ -3910,8 +3911,10 @@ bool bolt::determine_damage(monster* mon, int& preac, int& postac, int& final,
// All these are invalid if we return false.
if (is_tracer)
+ {
// Was mean between min and max;
preac = preac_max_damage;
+ }
else
preac = damage.roll();
@@ -4191,8 +4194,8 @@ void bolt::monster_post_hit(monster* mon, int dmg)
_curare_hits_monster(agent(), mon, 2);
}
- if (name == "bolt of energy"
- || origin_spell == SPELL_QUICKSILVER_BOLT) // purple draconian breath
+ // purple draconian breath
+ if (name == "bolt of energy" || origin_spell == SPELL_QUICKSILVER_BOLT)
debuff_monster(mon);
if (dmg)
@@ -4946,7 +4949,9 @@ mon_resist_type bolt::apply_enchantment_to_monster(monster* mon)
// No KILL_YOU_CONF, or we get "You heal ..."
if (cast_healing(5 + damage.roll(), 5 + damage.num * damage.size,
false, mon->pos()) > 0)
+ {
obvious_effect = true;
+ }
msg_generated = true; // to avoid duplicate "nothing happens"
}
else if (mon->heal(5 + damage.roll()))
diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc
index 8494e4f045..08ba2f6304 100644
--- a/crawl-ref/source/cloud.cc
+++ b/crawl-ref/source/cloud.cc
@@ -367,13 +367,19 @@ void manage_clouds()
{
int count = 0;
for (adjacent_iterator ai(cloud.pos); ai; ++ai)
- if (env.cgrid(*ai) != EMPTY_CLOUD)
- if (env.cloud[env.cgrid(*ai)].type == CLOUD_GLOOM)
+ {
+ if (env.cgrid(*ai) != EMPTY_CLOUD
+ && env.cloud[env.cgrid(*ai)].type == CLOUD_GLOOM)
+ {
count++;
+ }
+ }
if (!umbraed(cloud.pos) && haloed(cloud.pos)
&& !silenced(cloud.pos))
+ {
count = 0;
+ }
if (count < 4)
dissipate *= 50;
@@ -1127,8 +1133,10 @@ int actor_apply_cloud(actor *act)
actor *oppressor = find_agent(cloud.source, cloud.whose);
if (player)
+ {
ouch(final_damage, oppressor? oppressor->mindex() : NON_MONSTER,
KILLED_BY_CLOUD, cloud.cloud_name("", true).c_str());
+ }
else
mons->hurt(oppressor, final_damage, BEAM_MISSILE);
}
diff --git a/crawl-ref/source/clua.cc b/crawl-ref/source/clua.cc
index 5762c77a8b..b8b3f759e1 100644
--- a/crawl-ref/source/clua.cc
+++ b/crawl-ref/source/clua.cc
@@ -272,8 +272,10 @@ int CLua::execfile(const char *filename, bool trusted, bool die_on_fail,
err = lua_pcall(ls, 0, 0, 0);
set_error(err);
if (die_on_fail && !error.empty())
+ {
end(1, false, "Lua execfile error (%s): %s",
filename, dlua.error.c_str());
+ }
return err;
}
diff --git a/crawl-ref/source/cluautil.cc b/crawl-ref/source/cluautil.cc
index e86e264437..1238cde369 100644
--- a/crawl-ref/source/cluautil.cc
+++ b/crawl-ref/source/cluautil.cc
@@ -110,7 +110,9 @@ int clua_pushpoint(lua_State *ls, const coord_def &pos)
lua_pushnumber(ls, pos.y);
CLua &vm(CLua::get_vm(ls));
if (!vm.callfn("dgn.point", 2, 1))
+ {
luaL_error(ls, "dgn.point(%d,%d) failed: %s",
pos.x, pos.y, vm.error.c_str());
+ }
return 1;
}
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 2087c4b153..49f8bffdb1 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -558,7 +558,9 @@ void list_jewellery(void)
{
if ((you.species != SP_OCTOPODE && i > EQ_AMULET)
|| (you.species == SP_OCTOPODE && i < EQ_AMULET))
+ {
continue;
+ }
const int jewellery_id = you.equip[i];
int colour = MSGCOL_BLACK;
diff --git a/crawl-ref/source/dbg-asrt.cc b/crawl-ref/source/dbg-asrt.cc
index a47e3f6e20..0fa2c988be 100644
--- a/crawl-ref/source/dbg-asrt.cc
+++ b/crawl-ref/source/dbg-asrt.cc
@@ -504,8 +504,10 @@ static void _debug_dump_lua_persist(FILE* file)
std::string result;
if (!dlua.callfn("persist_to_string", 0, 1))
+ {
result = make_stringf("error (persist_to_string): %s",
dlua.error.c_str());
+ }
else if (lua_isstring(dlua, -1))
result = lua_tostring(dlua, -1);
else
diff --git a/crawl-ref/source/dbg-maps.cc b/crawl-ref/source/dbg-maps.cc
index fbd04b05b1..739dd21ebc 100644
--- a/crawl-ref/source/dbg-maps.cc
+++ b/crawl-ref/source/dbg-maps.cc
@@ -53,7 +53,9 @@ static bool _mg_is_disconnected_level()
// Don't care about non-Dungeon levels.
if (!player_in_connected_branch()
|| (branches[you.where_are_you].branch_flags & BFLAG_ISLANDED))
+ {
return false;
+ }
return dgn_count_disconnected_zones(true);
}
@@ -360,7 +362,9 @@ static void _write_mapgen_stats()
std::multimap<int, std::string> usedmaps;
for (std::map<std::string, int>::const_iterator i =
mapgen_try_count.begin(); i != mapgen_try_count.end(); ++i)
+ {
usedmaps.insert(std::pair<int, std::string>(i->second, i->first));
+ }
for (std::multimap<int, std::string>::reverse_iterator i =
usedmaps.rbegin(); i != usedmaps.rend(); ++i)
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index 37707bc03d..280311c795 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -1635,7 +1635,9 @@ inline static bool _monster_warning(activity_interrupt_type ai,
return false;
if (!delay_is_run(atype) && !_is_butcher_delay(atype)
&& !(atype == DELAY_NOT_DELAYED))
+ {
return false;
+ }
if (at.context != SC_NEWLY_SEEN && atype == DELAY_NOT_DELAYED)
return false;
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 5d88400f0a..67a6e4d534 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -1023,8 +1023,10 @@ static std::string _describe_weapon(const item_def &item, bool verbose)
iflags_t race = get_equip_race(item);
if (race == ISFLAG_DWARVEN)
+ {
description += "\nIt is well-crafted and durable. Dwarves "
"deal slightly more damage with it.";
+ }
if (race == ISFLAG_ORCISH)
description += "\nOrcs deal slightly more damage with it.";
@@ -2169,8 +2171,10 @@ std::string get_item_description(const item_def &item, bool verbose,
description << "\n" << origin_desc(item) << ".";
if (verbose)
+ {
description << "\n\n" << "Stash search prefixes: "
<< userdef_annotate_item(STASH_LUA_SEARCH_ANNOTATE, &item);
+ }
return description.str();
}
@@ -3177,8 +3181,10 @@ static std::string _monster_stat_description(const monster_info& mi)
const char* pronoun = mi.pronoun(PRONOUN_SUBJECTIVE);
if (mi.threat != MTHRT_UNDEF)
+ {
result << uppercase_first(pronoun) << " looks "
<< _get_threat_desc(mi.threat) << ".\n";
+ }
if (!resist_descriptions.empty())
{
diff --git a/crawl-ref/source/dgn-overview.cc b/crawl-ref/source/dgn-overview.cc
index 4fca7d22a5..afd5a1be64 100644
--- a/crawl-ref/source/dgn-overview.cc
+++ b/crawl-ref/source/dgn-overview.cc
@@ -455,8 +455,7 @@ static std::string _print_altars_for_gods(const std::vector<god_type>& gods,
if (has_altar_been_seen)
colour = "white";
// Good gods don't inflict penance unless they hate your god.
- if (you.penance[god]
- && (!is_good_god(god) || god_hates_your_god(god)))
+ if (you.penance[god] && (!is_good_god(god) || god_hates_your_god(god)))
colour = (you.penance[god] > 10) ? "red" : "lightred";
// Indicate good gods that you've abandoned, though.
else if (you.penance[god])
@@ -756,7 +755,9 @@ static std::string unique_name(monster* mons)
{
if (strstr(name.c_str(), "royal jelly")
|| strstr(name.c_str(), "Royal Jelly"))
+ {
name = "Royal Jelly";
+ }
if (strstr(name.c_str(), "Lernaean hydra"))
name = "Lernaean hydra";
if (strstr(name.c_str(), "Serpent of Hell"))
diff --git a/crawl-ref/source/dgn-shoals.cc b/crawl-ref/source/dgn-shoals.cc
index c84666cf8a..4fe96f3362 100644
--- a/crawl-ref/source/dgn-shoals.cc
+++ b/crawl-ref/source/dgn-shoals.cc
@@ -747,8 +747,7 @@ static void _shoals_run_tide(int &tide, int &acc)
tide += acc;
tide = std::max(std::min(tide, HIGH_TIDE), LOW_TIDE);
- if ((tide == HIGH_TIDE && acc > 0)
- || (tide == LOW_TIDE && acc < 0))
+ if ((tide == HIGH_TIDE && acc > 0) || (tide == LOW_TIDE && acc < 0))
acc = -acc;
bool in_decel_margin =
(abs(tide - HIGH_TIDE) < TIDE_DECEL_MARGIN)
@@ -1010,8 +1009,10 @@ static void _shoals_apply_tide(int tide, bool incremental_tide)
const bool was_wet(_shoals_tide_passable_feat(herefeat));
seen_points(c) = true;
if (_shoals_tide_susceptible_feat(herefeat))
+ {
_shoals_apply_tide_at(c, _shoals_tide_at(c, tide),
incremental_tide);
+ }
const bool is_wet(feat_is_water(grd(c)));
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 512bf1ad5d..0f5dfcbc4f 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -3681,8 +3681,10 @@ std::string get_monster_equipment_desc(const monster_info& mi,
if (mon_arm)
{
if (found_sth)
+ {
desc += (!mon_shd && !mon_rng && !mon_qvr && !mon_carry)
? " and" : ",";
+ }
else
found_sth = true;
diff --git a/crawl-ref/source/dlua.cc b/crawl-ref/source/dlua.cc
index 35cf25da2f..643f75d94c 100644
--- a/crawl-ref/source/dlua.cc
+++ b/crawl-ref/source/dlua.cc
@@ -125,8 +125,10 @@ void dlua_chunk::add(int line, const std::string &s)
first = line;
if (line != last && last != -1)
+ {
while (last++ < line)
chunk += '\n';
+ }
chunk += " ";
chunk += s;
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index ce0926691b..ae550f8d1f 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -1817,8 +1817,8 @@ static void _dgn_verify_connectivity(unsigned nvaults)
// in the order their altars are placed.
static void _build_overflow_temples()
{
+ // Levels built while in testing mode.
if (!you.props.exists(OVERFLOW_TEMPLES_KEY))
- // Levels built while in testing mode.
return;
CrawlVector &levels = you.props[OVERFLOW_TEMPLES_KEY].get_vector();
@@ -3061,12 +3061,16 @@ void dgn_place_stone_stairs(bool maybe_place_hatches)
for (int i = 0; i < pair_count; ++i)
{
if (!existing[i])
+ {
_dgn_place_feature_at_random_floor_square(
static_cast<dungeon_feature_type>(DNGN_STONE_STAIRS_DOWN_I + i));
+ }
if (!existing[DNGN_STONE_STAIRS_UP_I - stair_start + i])
+ {
_dgn_place_feature_at_random_floor_square(
static_cast<dungeon_feature_type>(DNGN_STONE_STAIRS_UP_I + i));
+ }
}
}
@@ -3890,8 +3894,10 @@ static bool _build_vault_impl(const map_def *vault,
// here is an automatic veto. Note that the post-place hook must
// be run only after _build_postvault_level.
if (!place.map.run_postplace_hook())
+ {
throw dgn_veto_exception("Post-place hook failed for: "
+ place.map.name);
+ }
return true;
}
@@ -3960,8 +3966,10 @@ static int _dgn_item_corpse(const item_spec &ispec, const coord_def where)
item_def &corpse(mitm[corpse_index]);
if (ispec.props.exists(CORPSE_NEVER_DECAYS))
+ {
corpse.props[CORPSE_NEVER_DECAYS].get_bool() =
ispec.props[CORPSE_NEVER_DECAYS].get_bool();
+ }
if (ispec.base_type == OBJ_CORPSES && ispec.sub_type == CORPSE_SKELETON)
turn_corpse_into_skeleton(corpse);
@@ -3969,8 +3977,10 @@ static int _dgn_item_corpse(const item_spec &ispec, const coord_def where)
turn_corpse_into_chunks(corpse, false, false);
if (ispec.props.exists(MONSTER_HIT_DICE))
+ {
corpse.props[MONSTER_HIT_DICE].get_short() =
ispec.props[MONSTER_HIT_DICE].get_short();
+ }
if (ispec.qty && ispec.base_type == OBJ_FOOD)
corpse.quantity = ispec.qty;
@@ -5385,8 +5395,10 @@ static bool _connect_spotty(const coord_def& from)
}
if (success)
+ {
for (it = flatten.begin(); it != flatten.end(); ++it)
grd(*it) = DNGN_FLOOR;
+ }
return success;
}
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index c25cf5424b..9c361aa773 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -2042,11 +2042,15 @@ void handle_time()
if (you.species == SP_VAMPIRE)
{
if (you.hunger_state == HS_STARVING)
+ {
// No stat recovery for starving vampires.
recovery = false;
+ }
else if (you.hunger_state <= HS_HUNGRY)
+ {
// Halved stat recovery for hungry vampires.
recovery = coinflip();
+ }
}
// Slow heal mutation. Applied last.
diff --git a/crawl-ref/source/evoke.cc b/crawl-ref/source/evoke.cc
index 5caaf16ea8..bcfbb7ea81 100644
--- a/crawl-ref/source/evoke.cc
+++ b/crawl-ref/source/evoke.cc
@@ -185,8 +185,10 @@ static bool _reaching_weapon_attack(const item_def& wpn)
// of invisible monsters.
if (you.confused())
+ {
mprf("You swing wildly%s", beam.isMe() ?
" and almost hit yourself!" : ".");
+ }
else
mpr("You attack empty space.");
return true;
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 6903c21092..615e40f629 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -58,7 +58,9 @@ bool fight_melee(actor *attacker, actor *defender, bool *did_hit, bool simu)
// Friendly and good neutral monsters won't attack unless confused.
if (attacker->as_monster()->wont_attack() &&
!mons_is_confused(attacker->as_monster()))
+ {
return false;
+ }
// It's hard to attack from within a shell.
if (attacker->as_monster()->withdrawn())
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index 2e2a4f4900..5eec02420d 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -2232,7 +2232,9 @@ bool is_contaminated(const item_def &food)
{
if ((food.base_type != OBJ_FOOD || food.sub_type != FOOD_CHUNK)
&& food.base_type != OBJ_CORPSES)
+ {
return false;
+ }
const corpse_effect_type chunk_type = mons_corpse_effect(food.mon_type);
return (chunk_type == CE_CONTAMINATED
diff --git a/crawl-ref/source/godabil.cc b/crawl-ref/source/godabil.cc
index 95fb4a4b0a..80adaabf08 100644
--- a/crawl-ref/source/godabil.cc
+++ b/crawl-ref/source/godabil.cc
@@ -3279,9 +3279,8 @@ void cheibriados_time_step(int pow) // pow is the number of turns to skip
bool ashenzari_transfer_knowledge()
{
- if (you.transfer_skill_points > 0)
- if (!ashenzari_end_transfer())
- return false;
+ if (you.transfer_skill_points > 0 && !ashenzari_end_transfer())
+ return false;
while (true)
{
diff --git a/crawl-ref/source/goditem.cc b/crawl-ref/source/goditem.cc
index b8286ebec6..7d17a0290d 100644
--- a/crawl-ref/source/goditem.cc
+++ b/crawl-ref/source/goditem.cc
@@ -33,7 +33,9 @@ static bool _is_bookrod_type(const item_def& item,
// (== NUM_{BOOKS,RODS} in most cases, OBJ_RANDOM for acquirement)
if (item.sub_type == get_max_subtype(item.base_type)
|| item.sub_type == OBJ_RANDOM)
+ {
return false;
+ }
int total = 0;
int total_liked = 0;
diff --git a/crawl-ref/source/godpassive.cc b/crawl-ref/source/godpassive.cc
index c7dda4d42a..75d3ebb887 100644
--- a/crawl-ref/source/godpassive.cc
+++ b/crawl-ref/source/godpassive.cc
@@ -244,9 +244,11 @@ void ash_check_bondage(bool msg)
int flags = 0;
if (msg)
+ {
for (int s = ET_WEAPON; s < NUM_ET; s++)
if (new_bondage[s] != you.bondage[s])
flags |= 1 << s;
+ }
you.skill_boost.clear();
for (int s = ET_WEAPON; s < NUM_ET; s++)
diff --git a/crawl-ref/source/godwrath.cc b/crawl-ref/source/godwrath.cc
index c74b0ec62e..9edf7fb9b4 100644
--- a/crawl-ref/source/godwrath.cc
+++ b/crawl-ref/source/godwrath.cc
@@ -816,7 +816,7 @@ static bool _sif_muna_retribution()
case 7:
if (!forget_spell())
mpr("You get a splitting headache.");
- break;
+ break;
case 8:
if (you.magic_points > 0)
diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc
index 511f4b3f8e..60ed12c3b7 100644
--- a/crawl-ref/source/hiscores.cc
+++ b/crawl-ref/source/hiscores.cc
@@ -992,8 +992,10 @@ void scorefile_entry::set_base_xlog_fields() const
// Don't write No God to save some space.
if (god != -1)
+ {
fields->add_field("god", "%s", god == GOD_NO_GOD? "" :
god_name(god).c_str());
+ }
if (wiz_mode)
fields->add_field("wiz", "%d", wiz_mode);
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index b9f9ebefbc..a5c6c0c30c 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -1393,8 +1393,10 @@ std::string read_init_file(bool runscript)
if (f.error())
{
if (!init_file_name.empty())
+ {
return make_stringf("(\"%s\" is not readable)",
init_file_name.c_str());
+ }
#ifdef UNIX
return "(~/.crawlrc missing)";
@@ -3772,8 +3774,10 @@ bool parse_args(int argc, char **argv, bool rc_only)
arg_seen[i] = false;
if (SysEnv.cmd_args.empty())
+ {
for (int i = 1; i < argc; ++i)
SysEnv.cmd_args.push_back(argv[i]);
+ }
while (current < argc)
{
@@ -4115,9 +4119,10 @@ bool parse_args(int argc, char **argv, bool rc_only)
if (!next_is_param)
return false;
+ // Don't print the help message if the opt was wrong
if (!_check_extra_opt(next_arg))
- // Don't print the help message if the opt was wrong
return true;
+
SysEnv.extra_opts_first.push_back(next_arg);
nextUsed = true;
@@ -4129,9 +4134,10 @@ bool parse_args(int argc, char **argv, bool rc_only)
if (!next_is_param)
return false;
+ // Don't print the help message if the opt was wrong
if (!_check_extra_opt(next_arg))
- // Don't print the help message if the opt was wrong
return true;
+
SysEnv.extra_opts_last.push_back(next_arg);
nextUsed = true;
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 56c928dbd7..d002843fc5 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -357,8 +357,10 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages,
if (you.weapon())
{
if (unwield_item(show_weff_messages))
+ {
// Enable skills so they can be re-disabled later
update_can_train();
+ }
else
return false;
}
@@ -594,8 +596,10 @@ bool can_wear_armour(const item_def &item, bool verbose, bool ignore_temporary)
if (player_genus(GENPC_DRACONIAN) && slot == EQ_BODY_ARMOUR)
{
if (verbose)
+ {
mprf("Your wings%s won't fit in that.", you.mutation[MUT_BIG_WINGS]
? "" : ", even vestigial as they are,");
+ }
return false;
}
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 7b37080900..feb10836a3 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -1853,8 +1853,13 @@ static bool _slot_blocked(const item_def &item)
}
for (int i = eq_from; i <= eq_to; ++i)
- if (you.equip[i] == -1 || _item_is_swappable(you.inv[you.equip[i]], false))
+ {
+ if (you.equip[i] == -1
+ || _item_is_swappable(you.inv[you.equip[i]], false))
+ {
return false;
+ }
+ }
// No free slot found.
return true;
@@ -1867,7 +1872,8 @@ static bool _slot_blocked(const item_def &item)
return true;
}
- return (you.equip[eq] != -1 && !_item_is_swappable(you.inv[you.equip[eq]], eq, false));
+ return (you.equip[eq] != -1
+ && !_item_is_swappable(you.inv[you.equip[eq]], eq, false));
}
bool item_skills(const item_def &item, std::set<skill_type> &skills)
@@ -2575,15 +2581,17 @@ int property(const item_def &item, int prop_type)
case OBJ_WEAPONS:
if (is_unrandom_artefact(item))
{
- if (prop_type == PWPN_DAMAGE)
+ switch (prop_type) {
+ case PWPN_DAMAGE:
return (Weapon_prop[ Weapon_index[item.sub_type] ].dam
+ artefact_wpn_property(item, ARTP_BASE_DAM));
- else if (prop_type == PWPN_HIT)
+ case PWPN_HIT:
return (Weapon_prop[ Weapon_index[item.sub_type] ].hit
+ artefact_wpn_property(item, ARTP_BASE_ACC));
- else if (prop_type == PWPN_SPEED)
+ case PWPN_SPEED:
return (Weapon_prop[ Weapon_index[item.sub_type] ].speed
+ artefact_wpn_property(item, ARTP_BASE_DELAY));
+ }
}
if (prop_type == PWPN_DAMAGE)
return (Weapon_prop[ Weapon_index[item.sub_type] ].dam);
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 609b15cae8..9b56087173 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -2568,8 +2568,10 @@ static bool _is_option_autopickup(const item_def &item, std::string &iname)
bool res = clua.callbooleanfn(false, "ch_force_autopickup", "is",
&item, iname.c_str());
if (!clua.error.empty())
+ {
mprf(MSGCH_ERROR, "ch_force_autopickup failed: %s",
clua.error.c_str());
+ }
if (res)
return true;
@@ -2577,8 +2579,10 @@ static bool _is_option_autopickup(const item_def &item, std::string &iname)
res = clua.callbooleanfn(false, "ch_deny_autopickup", "is",
&item, iname.c_str());
if (!clua.error.empty())
+ {
mprf(MSGCH_ERROR, "ch_deny_autopickup failed: %s",
clua.error.c_str());
+ }
if (res)
return false;
@@ -3241,8 +3245,10 @@ static void _rune_from_specs(const char* _specs, item_def &item)
item.sub_type = MISC_RUNE_OF_ZOT;
if (strstr(_specs, "rune of zot"))
+ {
strlcpy(specs, _specs, std::min(strlen(_specs) - strlen(" of zot") + 1,
sizeof(specs)));
+ }
else
strlcpy(specs, _specs, sizeof(specs));
diff --git a/crawl-ref/source/kills.cc b/crawl-ref/source/kills.cc
index dd99cc4d57..376001195a 100644
--- a/crawl-ref/source/kills.cc
+++ b/crawl-ref/source/kills.cc
@@ -859,8 +859,10 @@ static int kill_lualc_holiness(lua_State *ls)
case MH_PLANT: verdict = "plant"; break;
}
if (ke->modifier != kill_monster_desc::M_NORMAL
- && ke->modifier != kill_monster_desc::M_SHAPESHIFTER)
+ && ke->modifier != kill_monster_desc::M_SHAPESHIFTER)
+ {
verdict = "undead";
+ }
lua_pushstring(ls, verdict);
return 1;
}
@@ -992,8 +994,10 @@ static int kill_lualc_summary(lua_State *ls)
char buf[120];
*buf = 0;
if (count)
+ {
snprintf(buf, sizeof buf, "%u creature%s vanquished.",
count, count > 1? "s" : "");
+ }
lua_pushstring(ls, buf);
return 1;
}
diff --git a/crawl-ref/source/l_crawl.cc b/crawl-ref/source/l_crawl.cc
index e537c28cb0..10558f7328 100644
--- a/crawl-ref/source/l_crawl.cc
+++ b/crawl-ref/source/l_crawl.cc
@@ -950,8 +950,10 @@ LUAFN(_crawl_millis)
struct timezone tz;
const int error = gettimeofday(&tv, &tz);
if (error)
+ {
luaL_error(ls, make_stringf("Failed to get time: %s",
strerror(error)).c_str());
+ }
lua_pushnumber(ls, tv.tv_sec * 1000 + tv.tv_usec / 1000);
return 1;
diff --git a/crawl-ref/source/l_dgn.cc b/crawl-ref/source/l_dgn.cc
index 4dc11ff707..b55f56bd4d 100644
--- a/crawl-ref/source/l_dgn.cc
+++ b/crawl-ref/source/l_dgn.cc
@@ -420,8 +420,10 @@ static int dgn_map(lua_State *ls)
const std::string newline = luaL_checkstring(ls, 3);
if (which_line < 0)
+ {
luaL_error(ls,
make_stringf("Index %d out of range", which_line).c_str());
+ }
if (which_line < (int) lines.size())
{
diff --git a/crawl-ref/source/l_dgnbld.cc b/crawl-ref/source/l_dgnbld.cc
index 5ea02da510..e549382497 100644
--- a/crawl-ref/source/l_dgnbld.cc
+++ b/crawl-ref/source/l_dgnbld.cc
@@ -184,11 +184,15 @@ static std::vector<coord_def> _box_side(int x1, int y1, int x2, int y2, int side
x = start_x; y = start_y;
if (start_x == stop_x)
+ {
for (y = start_y+1; y < stop_y; y++)
line.push_back(coord_def(x, y));
+ }
else
+ {
for (x = start_x+1; x < stop_x; x++)
line.push_back(coord_def(x, y));
+ }
return line;
}
diff --git a/crawl-ref/source/l_dgnit.cc b/crawl-ref/source/l_dgnit.cc
index 7318815b8d..8827ee7630 100644
--- a/crawl-ref/source/l_dgnit.cc
+++ b/crawl-ref/source/l_dgnit.cc
@@ -104,8 +104,10 @@ static int dgn_item_property_set(lua_State *ls)
const std::string key = luaL_checkstring(ls, 2);
const std::string type = luaL_checkstring(ls, 3);
if (type.empty() || type.length() > 1)
+ {
luaL_error(ls, "Expected type: [BbSifsC], got: '%s'",
type.c_str());
+ }
switch (type[0])
{
@@ -146,8 +148,10 @@ static int dgn_item_property(lua_State *ls)
const std::string key = luaL_checkstring(ls, 2);
const std::string type = luaL_checkstring(ls, 3);
if (type.empty() || type.length() > 1)
+ {
luaL_error(ls, "Expected type: [BbSifsC], got: '%s'",
type.c_str());
+ }
if (!item->props.exists(key))
{
diff --git a/crawl-ref/source/l_dgnlvl.cc b/crawl-ref/source/l_dgnlvl.cc
index 9b32ed0215..d16811b557 100644
--- a/crawl-ref/source/l_dgnlvl.cc
+++ b/crawl-ref/source/l_dgnlvl.cc
@@ -57,8 +57,7 @@ LUAFN(dgn_br_exists)
luaL_argerror(ls, 1, "No such branch");
}
- if (branches[brn].parent_branch == NUM_BRANCHES
- || startdepth[brn] != -1)
+ if (branches[brn].parent_branch == NUM_BRANCHES || startdepth[brn] != -1)
exists = true;
PLUARET(boolean, exists);
diff --git a/crawl-ref/source/los.cc b/crawl-ref/source/los.cc
index 116b7b1eaa..808d377c6c 100644
--- a/crawl-ref/source/los.cc
+++ b/crawl-ref/source/los.cc
@@ -903,9 +903,11 @@ opacity_type mons_opacity(const monster* mon, los_type how)
dungeon_feature_type feat = get_mimic_feat(mon);
if (how == LOS_SOLID)
return feat_is_solid(feat) ? OPC_OPAQUE : OPC_CLEAR;
- if (how == LOS_NO_TRANS)
- if (feat_is_wall(feat) || feat_is_tree(feat))
- return OPC_OPAQUE;
+ if (how == LOS_NO_TRANS
+ && (feat_is_wall(feat) || feat_is_tree(feat)))
+ {
+ return OPC_OPAQUE;
+ }
if (feat_is_opaque(get_mimic_feat(mon)))
return OPC_OPAQUE;
}
diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc
index 0e539fc9ed..30ee49195c 100644
--- a/crawl-ref/source/main.cc
+++ b/crawl-ref/source/main.cc
@@ -1628,8 +1628,10 @@ static void _experience_check()
<< std::endl;
#ifdef DEBUG_DIAGNOSTICS
if (wearing_amulet(AMU_THE_GOURMAND))
+ {
mprf(MSGCH_DIAGNOSTICS, "Gourmand charge: %d",
you.duration[DUR_GOURMAND]);
+ }
mprf(MSGCH_DIAGNOSTICS, "Turns spent on this level: %d",
env.turns_on_level);
@@ -2700,9 +2702,8 @@ static void _decrement_durations()
you.redraw_quiver = true; // Can throw again.
}
- if (_decrement_a_duration(DUR_CORONA, delay))
- if (!you.backlit())
- mpr("You are no longer glowing.", MSGCH_DURATION);
+ if (_decrement_a_duration(DUR_CORONA, delay) && !you.backlit())
+ mpr("You are no longer glowing.", MSGCH_DURATION);
// Leak piety from the piety pool into actual piety.
// Note that changes of religious status without corresponding actions
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index df6293ac6f..913a28de71 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -2348,8 +2348,13 @@ static void _generate_armour_item(item_def& item, bool allow_uniques,
{
int i;
for (i = 0; i < 100; ++i)
- if (_try_make_armour_artefact(item, force_type, 0, true) && is_artefact(item))
+ {
+ if (_try_make_armour_artefact(item, force_type, 0, true)
+ && is_artefact(item))
+ {
return;
+ }
+ }
// fall back to an ordinary item
item_level = MAKE_GOOD_ITEM;
}
@@ -2958,8 +2963,10 @@ static void _generate_jewellery_item(item_def& item, bool allow_uniques,
else
{
if (item.plus > 0)
+ {
item.plus = 2 + (one_chance_in(3) ? random2(4)
: 1 + random2avg(5, 2));
+ }
item.plus2 = 2 + (one_chance_in(3) ? random2(4)
: 1 + random2avg(5, 2));
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index cb47569e30..cd598fce22 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -120,8 +120,10 @@ std::string mapdef_split_key_item(const std::string &s,
const std::string::size_type sep = norm < fixe? norm : fixe;
if (sep == std::string::npos)
+ {
return make_stringf("malformed declaration - must use = or : in '%s'",
s.c_str());
+ }
*key = trimmed_string(s.substr(0, sep));
std::string substitute = trimmed_string(s.substr(sep + 1));
@@ -135,8 +137,10 @@ std::string mapdef_split_key_item(const std::string &s,
}
if (substitute.empty())
+ {
return make_stringf("no substitute defined in '%s'",
s.c_str());
+ }
*arg = substitute;
*separator = s[sep];
@@ -546,8 +550,10 @@ void map_lines::apply_grid_overlay(const coord_def &c)
const int property = (*overlay)(x, y).property;
if (property >= FPROP_BLOODY)
+ {
// Over-ride whatever property is already there.
env.pgrid(gc) |= property;
+ }
const int fheight = (*overlay)(x, y).height;
if (fheight != INVALID_HEIGHT)
@@ -932,8 +938,10 @@ std::string map_lines::add_nsubst(const std::string &s)
subst_spec spec;
err = parse_nsubst_spec(ns, spec);
if (!err.empty())
+ {
return (make_stringf("Bad NSUBST spec: %s (%s)",
s.c_str(), err.c_str()));
+ }
substs.push_back(spec);
}
@@ -1991,8 +1999,10 @@ dlua_set_map::dlua_set_map(map_def *map)
{
clua_push_map(dlua, map);
if (!dlua.callfn("dgn_set_map", 1, 1))
+ {
mprf(MSGCH_ERROR, "dgn_set_map failed for '%s': %s",
map->name.c_str(), dlua.error.c_str());
+ }
// Save the returned map as a lua_datum
old_map.reset(new lua_datum(dlua));
}
@@ -2353,8 +2363,10 @@ static map_chance _unmarshall_map_chance(reader &th)
void map_def::write_index(writer& outf) const
{
if (!cache_offset)
+ {
end(1, false, "Map %s: can't write index - cache offset not set!",
name.c_str());
+ }
marshallString4(outf, name);
marshallString4(outf, place_loaded_from.filename);
marshallInt(outf, place_loaded_from.lineno);
@@ -2508,11 +2520,15 @@ bool map_def::test_lua_boolchunk(dlua_chunk &chunk, bool defval,
else
{
if (die_on_lua_error)
+ {
end(1, false, "Lua error: %s",
rewrite_chunk_errors(dlua.error).c_str());
+ }
else
+ {
mprf(MSGCH_ERROR, "Lua error: %s",
rewrite_chunk_errors(dlua.error).c_str());
+ }
}
return result;
}
@@ -2744,21 +2760,27 @@ std::string map_def::validate_map_def(const depth_ranges &default_depths)
{
case MAP_NORTH: case MAP_SOUTH:
if (map.height() > GYM * 2 / 3)
+ {
return make_stringf("Map too large - height %d (max %d)",
map.height(), GYM * 2 / 3);
+ }
break;
case MAP_EAST: case MAP_WEST:
if (map.width() > GXM * 2 / 3)
+ {
return make_stringf("Map too large - width %d (max %d)",
map.width(), GXM * 2 / 3);
+ }
break;
case MAP_NORTHEAST: case MAP_SOUTHEAST:
case MAP_NORTHWEST: case MAP_SOUTHWEST:
case MAP_FLOAT:
if (map.width() > GXM * 2 / 3 || map.height() > GYM * 2 / 3)
+ {
return make_stringf("Map too large - %dx%d (max %dx%d)",
map.width(), map.height(),
GXM * 2 / 3, GYM * 2 / 3);
+ }
break;
default:
break;
@@ -3626,8 +3648,7 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec)
if (!colour.empty())
{
if (colour == "any")
- // XXX: Hack
- mspec.colour = -1;
+ mspec.colour = -1; // XXX: Hack
else
{
mspec.colour = str_to_colour(colour, BLACK);
@@ -4009,8 +4030,7 @@ mons_spec mons_list::drac_monspec(std::string name) const
// Request for any draconian?
if (starts_with(name, "any "))
- // Strip "any "
- name = name.substr(4);
+ name = name.substr(4); // Strip "any "
if (starts_with(name, "base "))
{
@@ -4726,8 +4746,10 @@ item_spec item_list::parse_single_spec(std::string s)
if (!acquirement_source.empty() || strip_tag(s, "acquire"))
{
if (!acquirement_source.empty())
+ {
result.acquirement_source =
parse_acquirement_source(acquirement_source);
+ }
// If requesting acquirement, must specify item base type or
// "any".
result.level = ISPEC_ACQUIREMENT;
@@ -5306,8 +5328,10 @@ std::string map_marker_spec::apply_transform(map_lines &map)
{
map_marker *mark = create_marker();
if (!mark)
+ {
return make_stringf("Unable to parse marker from %s",
marker.c_str());
+ }
mark->pos = positions[i];
map.add_marker(mark);
}
diff --git a/crawl-ref/source/mapmark.cc b/crawl-ref/source/mapmark.cc
index 0d5953c5b4..beca96b07a 100644
--- a/crawl-ref/source/mapmark.cc
+++ b/crawl-ref/source/mapmark.cc
@@ -147,8 +147,10 @@ map_marker *map_feature_marker::parse(
const dungeon_feature_type ft = dungeon_feature_by_name(raw);
if (ft == DNGN_UNSEEN)
+ {
throw make_stringf("Bad feature marker: %s (unknown feature '%s')",
s.c_str(), raw.c_str());
+ }
return new map_feature_marker(coord_def(0, 0), ft);
}
@@ -260,8 +262,10 @@ void map_lua_marker::write(writer &outf) const
// Right, what's on top should be a table name. Save it.
if (!lua_isstring(dlua, -1))
+ {
end(1, false, "Expected marker class name (string) to save, got %s",
lua_typename(dlua, lua_type(dlua, -1)));
+ }
const std::string marker_class(lua_tostring(dlua, -1));
marshallString(outf, marker_class);
@@ -398,8 +402,7 @@ std::string map_lua_marker::debug_to_string() const
return "Unable to get table for lua marker.";
if (!dlua.callfn("table_to_string", 1, 1))
- return make_stringf("error (table_to_string): %s",
- dlua.error.c_str());
+ return make_stringf("error (table_to_string): %s", dlua.error.c_str());
std::string result;
if (lua_isstring(dlua, -1))
@@ -998,8 +1001,7 @@ std::string map_markers::property_at(const coord_def &c, map_marker_type type,
void map_markers::clear()
{
- for (dgn_marker_map::iterator i = markers.begin();
- i != markers.end(); ++i)
+ for (dgn_marker_map::iterator i = markers.begin(); i != markers.end(); ++i)
delete i->second;
markers.clear();
check_empty();
diff --git a/crawl-ref/source/melee_attack.cc b/crawl-ref/source/melee_attack.cc
index 527e9d3b86..b4e7643694 100644
--- a/crawl-ref/source/melee_attack.cc
+++ b/crawl-ref/source/melee_attack.cc
@@ -1236,8 +1236,10 @@ unarmed_attack_type melee_attack::player_aux_choose_uc_attack()
// No punching with a shield or 2-handed wpn, except staves.
// Octopodes aren't affected by this, though!
if (you.species != SP_OCTOPODE && uc_attack == UNAT_PUNCH
- && !you.has_usable_offhand())
+ && !you.has_usable_offhand())
+ {
uc_attack = UNAT_NO_ATTACK;
+ }
if (_tran_forbid_aux_attack(uc_attack))
uc_attack = UNAT_NO_ATTACK;
@@ -2770,7 +2772,9 @@ brand_type melee_attack::random_chaos_brand()
case SPWPN_ANTIMAGIC:
if (defender->as_monster() &&
!defender->as_monster()->can_use_spells())
+ {
susceptible = false;
+ }
break;
default:
break;
@@ -3229,8 +3233,10 @@ bool melee_attack::chop_hydra_head(int dam,
defender->as_monster()->number--;
if (!defender->is_summoned())
+ {
bleed_onto_floor(defender->pos(), defender->type,
defender->as_monster()->hit_points, true);
+ }
defender->hurt(attacker, INSTANT_DEATH);
@@ -3647,7 +3653,9 @@ int melee_attack::calc_to_hit(bool random)
// This can only help if you're visible!
if (defender->is_player()
&& player_mutation_level(MUT_TRANSLUCENT_SKIN) >= 3)
+ {
mhit -= 5;
+ }
if (defender->backlit(true, false))
mhit += 2 + random2(8);
@@ -4723,8 +4731,7 @@ bool melee_attack::do_knockback(bool trample)
{
monster* def_monster = defender->as_monster();
if (def_monster && mons_is_stationary(def_monster))
- // don't even print a message
- return false;
+ return false; // don't even print a message
int size_diff =
attacker->body_size(PSIZE_BODY) - defender->body_size(PSIZE_BODY);
@@ -4735,8 +4742,11 @@ bool melee_attack::do_knockback(bool trample)
coord_def new_pos = defender->pos() + defender->pos() - attacker->pos();
// need a valid tile
- if (grd(new_pos) < DNGN_SHALLOW_WATER && !defender->is_habitable(new_pos))
+ if (grd(new_pos) < DNGN_SHALLOW_WATER
+ && !defender->is_habitable(new_pos))
+ {
break;
+ }
// don't trample into a monster - or do we want to cause a chain
// reaction here?
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index de1dbc1775..ce0a28e41c 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -3495,18 +3495,17 @@ bool MenuFreeform::select_item(MenuItem* item)
bool MenuFreeform::attach_item(MenuItem* item)
{
// is the item inside boundaries?
- if (item->get_min_coord().x < m_min_coord.x
- || item->get_min_coord().x > m_max_coord.x)
- return false;
- if (item->get_min_coord().y < m_min_coord.y
- || item->get_min_coord().y > m_max_coord.y)
- return false;
- if (item->get_max_coord().x < m_min_coord.x
- || item->get_max_coord().x > m_max_coord.x)
- return false;
- if (item->get_max_coord().y < m_min_coord.y
+ if ( item->get_min_coord().x < m_min_coord.x
+ || item->get_min_coord().x > m_max_coord.x
+ || item->get_min_coord().y < m_min_coord.y
+ || item->get_min_coord().y > m_max_coord.y
+ || item->get_max_coord().x < m_min_coord.x
+ || item->get_max_coord().x > m_max_coord.x
+ || item->get_max_coord().y < m_min_coord.y
|| item->get_max_coord().y > m_max_coord.y)
+ {
return false;
+ }
// It's inside boundaries
m_entries.push_back(item);
@@ -4025,8 +4024,7 @@ void MenuScroller::_place_items()
if (m_currently_active < 0)
break; // all space allocated
if (one_past_last > m_currently_active)
- /// we included our active one, ok!
- break;
+ break; // we included our active one, ok!
else
{
// active one didn't fit, chop the first one and run the loop
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 10b3c1c139..d6f5338db5 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -357,8 +357,7 @@ void maybe_coagulate_blood_potions_floor(int obj)
}
if (!rot_count && !coag_count)
- // Nothing to be done.
- return;
+ return; // Nothing to be done.
#ifdef DEBUG_BLOOD_POTIONS
mprf(MSGCH_DIAGNOSTICS, "in maybe_coagulate_blood_potions_FLOOR "
@@ -1833,8 +1832,7 @@ static void _drop_tomb(const coord_def& pos, bool premature)
if (count)
{
if (seen_change && !zin)
- mprf("The walls disappear%s!",
- premature ? " prematurely" : "");
+ mprf("The walls disappear%s!", premature ? " prematurely" : "");
else if (seen_change && zin)
{
mprf("Zin %s %s %s.",
@@ -2202,9 +2200,13 @@ coord_def pick_adjacent_free_square(const coord_def& p)
coord_def result(-1, -1);
for (adjacent_iterator ai(p); ai; ++ai)
- if (grd(*ai) == DNGN_FLOOR && monster_at(*ai) == NULL)
- if (one_chance_in(++num_ok))
- result = *ai;
+ {
+ if (grd(*ai) == DNGN_FLOOR && monster_at(*ai) == NULL
+ && one_chance_in(++num_ok))
+ {
+ result = *ai;
+ }
+ }
return result;
}
diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc
index 8a5cef76aa..95eff3c107 100644
--- a/crawl-ref/source/mon-abil.cc
+++ b/crawl-ref/source/mon-abil.cc
@@ -2427,8 +2427,11 @@ bool mon_special_ability(monster* mons, bolt & beem)
bool spit = one_chance_in(3);
if (mons->type == MONS_OKLOB_PLANT)
+ {
+ // reduced chance in zotdef
spit = x_chance_in_y(mons->hit_dice,
- crawl_state.game_is_zotdef() ? 40 : 30); // reduced chance in zotdef
+ crawl_state.game_is_zotdef() ? 40 : 30);
+ }
if (mons->type == MONS_OKLOB_SAPLING)
spit = one_chance_in(4);
@@ -2486,7 +2489,9 @@ bool mon_special_ability(monster* mons, bolt & beem)
case MONS_QUEEN_BEE:
if (one_chance_in(4)
|| mons->hit_points < mons->max_hit_points / 3 && one_chance_in(2))
+ {
used = _queen_incite_worker(mons);
+ }
break;
case MONS_SNORG:
diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc
index 5a62a55f1e..43a7daf2cf 100644
--- a/crawl-ref/source/mon-act.cc
+++ b/crawl-ref/source/mon-act.cc
@@ -138,7 +138,9 @@ static bool _swap_monsters(monster* mover, monster* moved)
// with the main body.
if (mons_is_stationary(moved)
&& moved->type != MONS_KRAKEN_TENTACLE)
+ {
return false;
+ }
// If the target monster is constricted it is stuck
// and not eligible to be swapped with
@@ -2243,9 +2245,11 @@ static bool _jelly_divide(monster* parent)
// First, find a suitable spot for the child {dlb}:
for (adjacent_iterator ai(parent->pos()); ai; ++ai)
- if (actor_at(*ai) == NULL && parent->can_pass_through(*ai))
- if (one_chance_in(++num_spots))
- child_spot = *ai;
+ if (actor_at(*ai) == NULL && parent->can_pass_through(*ai)
+ && one_chance_in(++num_spots))
+ {
+ child_spot = *ai;
+ }
if (num_spots == 0)
return false;
@@ -2275,9 +2279,11 @@ static bool _jelly_divide(monster* parent)
mgrd(child->pos()) = child->mindex();
- if (!simple_monster_message(parent, " splits in two!"))
- if (player_can_hear(parent->pos()) || player_can_hear(child->pos()))
- mpr("You hear a squelching noise.", MSGCH_SOUND);
+ if (!simple_monster_message(parent, " splits in two!")
+ && (player_can_hear(parent->pos()) || player_can_hear(child->pos())))
+ {
+ mpr("You hear a squelching noise.", MSGCH_SOUND);
+ }
if (crawl_state.game_is_arena())
arena_placed_monster(child);
@@ -2381,8 +2387,10 @@ static bool _monster_eat_item(monster* mons, bool nearby)
item_was_destroyed(*si, mons->mindex());
if (is_blood_potion(*si))
+ {
for (int i = 0; i < quant; ++i)
remove_oldest_blood_potion(*si);
+ }
dec_mitm_item_quantity(si.link(), quant);
}
diff --git a/crawl-ref/source/mon-cast.cc b/crawl-ref/source/mon-cast.cc
index ad6d4e1773..19a64741de 100644
--- a/crawl-ref/source/mon-cast.cc
+++ b/crawl-ref/source/mon-cast.cc
@@ -955,8 +955,10 @@ bolt mons_spells(monster* mons, spell_type spell_cast, int power,
}
if (!is_valid_spell(real_spell))
+ {
die("Invalid spell #%d cast by %s", (int) real_spell,
mons->name(DESC_PLAIN, true).c_str());
+ }
die("Unknown monster spell '%s' cast by %s",
spell_title(real_spell),
@@ -3113,8 +3115,7 @@ void mons_cast(monster* mons, bolt &pbolt, spell_type spell_cast,
if (monsterNearby)
{
if (do_noise)
- mons_cast_noise(mons, pbolt, spell_cast,
- special_ability);
+ mons_cast_noise(mons, pbolt, spell_cast, special_ability);
direct_effect(mons, spell_cast, pbolt, &you);
}
return;
@@ -4246,8 +4247,11 @@ static unsigned int _noise_keys(std::vector<std::string>& key_list,
// Last, generic wizard, priest or demon.
if (wizard)
- key_list.push_back((std::string)((shape <= MON_SHAPE_NAGA) ? "" : "non-humanoid ")
- + "wizard" + cast_str);
+ {
+ key_list.push_back(make_stringf("%swizard%s",
+ shape <= MON_SHAPE_NAGA ? "" : "non-humanoid ",
+ cast_str.c_str()));
+ }
else if (priest)
key_list.push_back("priest" + cast_str);
else if (mons_is_demon(mons->type))
diff --git a/crawl-ref/source/mon-death.cc b/crawl-ref/source/mon-death.cc
index 83e9cfc5e6..ca9a159d74 100644
--- a/crawl-ref/source/mon-death.cc
+++ b/crawl-ref/source/mon-death.cc
@@ -197,11 +197,15 @@ void hogs_to_humans()
else if (any > 1)
{
if (any == human)
+ {
mpr("No longer under Kirke's spell, all hogs revert to their "
"human forms!");
+ }
else
+ {
mpr("No longer under Kirke's spell, all hogs revert to their "
"original forms!");
+ }
}
// Revert the player as well.
@@ -351,11 +355,15 @@ void elven_twin_died(monster* twin, bool in_transit, killer_type killer, int kil
if (found_duvessa)
{
if (mons_near(mons))
+ {
// Provides its own flavour message.
mons->go_berserk(true);
+ }
else
+ {
// She'll go berserk the next time she sees you
mons->props["duvessa_berserk"] = bool(true);
+ }
}
else if (found_dowan)
{
diff --git a/crawl-ref/source/mon-ench.cc b/crawl-ref/source/mon-ench.cc
index 0d269b9699..377ded6bf3 100644
--- a/crawl-ref/source/mon-ench.cc
+++ b/crawl-ref/source/mon-ench.cc
@@ -464,8 +464,10 @@ void monster::remove_enchantment_effect(const mon_enchant &me, bool quiet)
case ENCH_TEMP_PACIF:
if (!quiet)
+ {
simple_monster_message(this, (" seems to come to "
+ pronoun(PRONOUN_POSSESSIVE) + " senses.").c_str());
+ }
// Yeah, this _is_ offensive to Zin, but hey, he deserves it (1KB).
behaviour_event(this, ME_EVAL);
diff --git a/crawl-ref/source/mon-place.cc b/crawl-ref/source/mon-place.cc
index 8f36c07377..bbad197003 100644
--- a/crawl-ref/source/mon-place.cc
+++ b/crawl-ref/source/mon-place.cc
@@ -311,8 +311,10 @@ static int _fuzz_mons_level(int level)
const int fuzz = std::max(0, random_range(-fuzzspan, fuzzspan, 2));
if (fuzz)
+ {
dprf("Monster level fuzz: %d (old: %d, new: %d)",
fuzz, level, level + fuzz);
+ }
return level + fuzz;
}
@@ -1481,7 +1483,9 @@ static monster* _place_monster_aux(const mgen_data &mg, const monster *leader,
invalidate_agrid(true);
if (mg.cls == MONS_SILENT_SPECTRE || mg.cls == MONS_PROFANE_SERVITOR
|| mg.cls == MONS_MOTH_OF_SUPPRESSION)
+ {
invalidate_agrid(true);
+ }
// If the caller requested a specific colour for this monster, apply
// it now.
diff --git a/crawl-ref/source/mon-speak.cc b/crawl-ref/source/mon-speak.cc
index b0f4495635..1de5a118f4 100644
--- a/crawl-ref/source/mon-speak.cc
+++ b/crawl-ref/source/mon-speak.cc
@@ -374,7 +374,9 @@ void maybe_mons_speaks(monster* mons)
// a lot of them. Except for uniques.
if (testbits(mons->flags, MF_BAND_MEMBER)
&& !mons_is_unique(mons->type))
+ {
chance *= 10;
+ }
// However, confused and fleeing monsters are more interesting.
if (mons_is_fleeing(mons))
diff --git a/crawl-ref/source/mon-stuff.cc b/crawl-ref/source/mon-stuff.cc
index 7399fc769e..8b9a3e2561 100644
--- a/crawl-ref/source/mon-stuff.cc
+++ b/crawl-ref/source/mon-stuff.cc
@@ -1957,12 +1957,10 @@ int monster_die(monster* mons, killer_type killer,
{
const int mon_intel = mons_class_intel(mons->type) - I_ANIMAL;
- if (mon_intel > 0)
- did_god_conduct(DID_SOULED_FRIEND_DIED, 1 + (mons->hit_dice / 2),
- true, mons);
- else
- did_god_conduct(DID_FRIEND_DIED, 1 + (mons->hit_dice / 2),
- true, mons);
+ did_god_conduct(mon_intel > 0 ? DID_SOULED_FRIEND_DIED
+ : DID_FRIEND_DIED,
+ 1 + (mons->hit_dice / 2),
+ true, mons);
}
if (pet_kill && fedhas_protects(mons))
@@ -2447,9 +2445,8 @@ int monster_die(monster* mons, killer_type killer,
if (fake)
{
- if (corpse != -1)
- if (_reaping(mons))
- corpse = -1;
+ if (corpse != -1 && _reaping(mons))
+ corpse = -1;
_give_experience(player_exp, monster_exp, killer, killer_index,
pet_kill, was_visible);
@@ -2502,9 +2499,8 @@ int monster_die(monster* mons, killer_type killer,
if (mons_near(mons) && mons->has_ench(ENCH_INVIS))
autotoggle_autopickup(false);
- if (corpse != -1)
- if (_reaping(mons))
- corpse = -1;
+ if (corpse != -1 && _reaping(mons))
+ corpse = -1;
crawl_state.dec_mon_acting(mons);
monster_cleanup(mons);
@@ -2779,9 +2775,11 @@ void change_monster_type(monster* mons, monster_type targetc)
// which would make things a lot simpler.
// See also record_monster_defeat.
bool old_mon_unique = mons_is_unique(mons->type);
- if (mons->props.exists("original_was_unique"))
- if (mons->props["original_was_unique"].get_bool())
- old_mon_unique = true;
+ if (mons->props.exists("original_was_unique")
+ && mons->props["original_was_unique"].get_bool())
+ {
+ old_mon_unique = true;
+ }
mon_enchant abj = mons->get_ench(ENCH_ABJ);
mon_enchant fabj = mons->get_ench(ENCH_FAKE_ABJURATION);
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index c633f1dd36..62fcfdf52a 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -4015,8 +4015,10 @@ mon_body_shape get_mon_shape(const monster_type mc)
return MON_SHAPE_HUMANOID;
case 'W': // wraiths, humanoid if not a spectral thing
if (mc == MONS_SPECTRAL_THING)
+ {
// constructed type, not enough info to determine shape
return MON_SHAPE_MISC;
+ }
else
return MON_SHAPE_HUMANOID;
case 'X': // large abominations
@@ -4240,15 +4242,23 @@ mon_threat_level_type mons_threat_level(const monster *mon, bool real)
const int tension = exper_value(mon, real) / (1 + factor);
if (tension <= 0)
+ {
// Conjurators use melee to conserve mana, MDFis switch plates...
return MTHRT_TRIVIAL;
+ }
else if (tension <= 5)
+ {
// An easy fight but not ignorable.
return MTHRT_EASY;
+ }
else if (tension <= 32)
+ {
// Hard but reasonable.
return MTHRT_TOUGH;
+ }
else
+ {
// Check all wands/jewels several times, wear brown pants...
return MTHRT_NASTY;
+ }
}
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index 542741ee6f..e3633281cb 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -4170,8 +4170,10 @@ int monster::hurt(const actor *agent, int amount, beam_type flavour,
react_to_damage(agent, amount, flavour);
if (has_ench(ENCH_MIRROR_DAMAGE))
+ {
add_final_effect(FINEFF_MIRROR_DAMAGE, agent, this,
coord_def(0, 0), amount);
+ }
blame_damage(agent, amount);
behaviour_event(this, ME_HURT);
@@ -5398,8 +5400,7 @@ void monster::react_to_damage(const actor *oppressor, int damage,
if (type == MONS_SIXFIRHY && flavour == BEAM_ELECTRICITY)
{
if (!alive()) // overcharging is deadly
- simple_monster_message(this,
- " explodes in a shower of sparks!");
+ simple_monster_message(this, " explodes in a shower of sparks!");
else if (heal(damage*2, false))
simple_monster_message(this, " seems to be charged up!");
return;
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc
index 1d883120af..21be975419 100644
--- a/crawl-ref/source/mutation.cc
+++ b/crawl-ref/source/mutation.cc
@@ -1016,8 +1016,10 @@ static int _handle_conflicting_mutations(mutation_type mutation,
// Ignore if not forced, otherwise override.
// All cases but regen:slowmeta will currently trade off.
if (override)
+ {
while (delete_mutation(b, reason, true, true))
;
+ }
break;
case 1:
// If we have one of the pair, delete a level of the
@@ -2093,9 +2095,11 @@ bool perma_mutate(mutation_type which_mut, int how_much,
int levels = 0;
while (how_much-- > 0)
{
- if (you.mutation[which_mut] < cap)
- if (!mutate(which_mut, reason, false, true, false, false, true))
- return levels; // a partial success was still possible
+ if (you.mutation[which_mut] < cap
+ && !mutate(which_mut, reason, false, true, false, false, true))
+ {
+ return levels; // a partial success was still possible
+ }
levels++;
}
you.innate_mutations[which_mut] += levels;
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index 2c153cd8e6..9c6cbfba46 100644
--- a/crawl-ref/source/newgame.cc
+++ b/crawl-ref/source/newgame.cc
@@ -1758,9 +1758,11 @@ static bool _choose_weapon(newgame_def* ng, newgame_def* ng_choice,
return true;
}
- if (ng_choice->weapon == WPN_UNKNOWN)
- if (!_prompt_weapon(ng, ng_choice, defaults, weapons))
- return false;
+ if (ng_choice->weapon == WPN_UNKNOWN
+ && !_prompt_weapon(ng, ng_choice, defaults, weapons))
+ {
+ return false;
+ }
_resolve_weapon(ng, ng_choice, weapons);
return true;
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 7291fa036b..6809d975b6 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -1489,8 +1489,7 @@ static std::string _god_powers(bool simple)
else if (you.religion != GOD_NO_GOD)
{
if (player_under_penance())
- return (simple ? "*"
- : colour_string("*" + godpowers, RED));
+ return (simple ? "*" : colour_string("*" + godpowers, RED));
else
{
// piety rankings
diff --git a/crawl-ref/source/package.cc b/crawl-ref/source/package.cc
index b39e8402b4..56092a4610 100644
--- a/crawl-ref/source/package.cc
+++ b/crawl-ref/source/package.cc
@@ -163,8 +163,10 @@ void package::load()
corrupted("save file (%s) corrupted -- header truncated", filename.c_str());
if (htole(head.magic) != PACKAGE_MAGIC)
+ {
corrupted("save file (%s) corrupted -- not a DCSS save file",
filename.c_str());
+ }
off_t len = lseek(fd, 0, SEEK_END);
if (len == -1)
sysfail("save file (%s) is not seekable", filename.c_str());
diff --git a/crawl-ref/source/place-info.cc b/crawl-ref/source/place-info.cc
index cd3c41d3c1..531d19ae29 100644
--- a/crawl-ref/source/place-info.cc
+++ b/crawl-ref/source/place-info.cc
@@ -34,9 +34,9 @@ void PlaceInfo::assert_validity() const
ASSERT(num_visits == 0 && levels_seen == 0
|| num_visits > 0 && levels_seen > 0);
- if (branch >= 0) // global data is -1
- if (brdepth[branch] != -1 && is_connected_branch(branch))
- ASSERT((int)levels_seen <= brdepth[branch]);
+ // global data is -1
+ if (branch >= 0 && brdepth[branch] != -1 && is_connected_branch(branch))
+ ASSERT((int)levels_seen <= brdepth[branch]);
ASSERT(turns_total == (turns_explore + turns_travel + turns_interlevel
+ turns_resting + turns_other));
diff --git a/crawl-ref/source/player-equip.cc b/crawl-ref/source/player-equip.cc
index 7cb059ad21..76e94c15c3 100644
--- a/crawl-ref/source/player-equip.cc
+++ b/crawl-ref/source/player-equip.cc
@@ -494,7 +494,9 @@ static void _equip_weapon_effect(item_def& item, bool showMsgs, bool unmeld)
if ((you.max_magic_points + 13) *
(1.0+player_mutation_level(MUT_HIGH_MAGIC)/10.0) > 50)
+ {
mpr("You feel your mana capacity is already quite full.");
+ }
else
canned_msg(MSG_MANA_INCREASE);
@@ -1267,7 +1269,9 @@ static void _equip_jewellery_effect(item_def &item, bool unmeld)
case RING_MAGICAL_POWER:
if ((you.max_magic_points + 9) *
(1.0+player_mutation_level(MUT_HIGH_MAGIC)/10.0) > 50)
+ {
mpr("You feel your mana capacity is already quite full.");
+ }
else
canned_msg(MSG_MANA_INCREASE);
diff --git a/crawl-ref/source/player-stats.cc b/crawl-ref/source/player-stats.cc
index 135b64dbf5..36b758fca5 100644
--- a/crawl-ref/source/player-stats.cc
+++ b/crawl-ref/source/player-stats.cc
@@ -557,7 +557,7 @@ bool restore_stat(stat_type which_stat, int stat_gain,
{
bool stat_restored = false;
for (int i = 0; i < NUM_STATS; ++i)
- if (restore_stat(static_cast<stat_type>(i), stat_gain, suppress_msg))
+ if (restore_stat((stat_type) i, stat_gain, suppress_msg))
stat_restored = true;
return stat_restored;
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 904b5e6a92..66844b1cb0 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -1285,17 +1285,25 @@ int player_regen()
if (you.species == SP_VAMPIRE)
{
if (you.hunger_state == HS_STARVING)
+ {
// No regeneration for starving vampires.
rr = 0;
+ }
else if (you.hunger_state == HS_ENGORGED)
+ {
// More bonus regeneration for engorged vampires.
rr += 20;
+ }
else if (you.hunger_state < HS_SATIATED)
+ {
// Halved regeneration for hungry vampires.
rr /= 2;
+ }
else if (you.hunger_state >= HS_FULL)
+ {
// Bonus regeneration for full vampires.
rr += 10;
+ }
}
// Slow heal mutation. Each level reduces your natural healing by
@@ -4911,7 +4919,9 @@ int get_real_mp(bool include_items)
if (include_items && player_equip_ego_type(EQ_WEAPON, SPWPN_ANTIMAGIC)
&& !you.suppressed())
+ {
enp /= 3;
+ }
enp = std::max(enp, 0);
@@ -5768,7 +5778,7 @@ void player::init()
global_info.make_global();
global_info.assert_validity();
- if (m_quiver)
+ if (m_quiver)
delete m_quiver;
m_quiver = new player_quiver;
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index c243a1bfee..bce7799c46 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -2802,17 +2802,25 @@ void lose_piety(int pgn)
you.redraw_title = true;
if (you.religion == GOD_ZIN)
+ {
simple_god_message(
" is no longer ready to cure all your mutations.");
+ }
else if (you.religion == GOD_SHINING_ONE)
+ {
simple_god_message(
" is no longer ready to bless your weapon.");
+ }
else if (you.religion == GOD_KIKUBAAQUDGHA)
+ {
simple_god_message(
" is no longer ready to enhance your necromancy.");
+ }
else if (you.religion == GOD_LUGONU)
+ {
simple_god_message(
" is no longer ready to corrupt your weapon.");
+ }
}
for (int i = 0; i < MAX_GOD_ABILITIES; ++i)
@@ -3392,14 +3400,22 @@ void god_pitch(god_type which_god)
{
you.turn_is_over = false;
if (which_god == GOD_SIF_MUNA)
+ {
simple_god_message(" does not accept worship from the ignorant!",
which_god);
+ }
else if (!_transformed_player_can_join_god(which_god))
- simple_god_message(" says: How dare you come in such a loathsome form!",
+ {
+ simple_god_message(" says: How dare you come"
+ " in such a loathsome form!",
which_god);
+ }
else
- simple_god_message(" does not accept worship from those such as you!",
+ {
+ simple_god_message(" does not accept worship"
+ " from those such as you!",
which_god);
+ }
return;
}
@@ -3492,9 +3508,11 @@ void god_pitch(god_type which_god)
// We disable all magical skills to avoid accidentally angering Trog.
if (you.religion == GOD_TROG)
+ {
for (int sk = SK_SPELLCASTING; sk <= SK_LAST_MAGIC; ++sk)
if (you.skills[sk])
you.train[sk] = 0;
+ }
// Elyvilon gives you invocations immediately.
if (you.religion == GOD_ELYVILON)
@@ -3815,9 +3833,11 @@ bool god_protects_from_harm()
return true;
}
- if (god_can_protect_from_harm(you.religion))
- if (one_chance_in(10) || x_chance_in_y(piety_scale(you.piety), 1000))
- return true;
+ if (god_can_protect_from_harm(you.religion)
+ && (one_chance_in(10) || x_chance_in_y(piety_scale(you.piety), 1000)))
+ {
+ return true;
+ }
return false;
}
diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc
index 8000bf7c95..c2a59fbe95 100644
--- a/crawl-ref/source/shopping.cc
+++ b/crawl-ref/source/shopping.cc
@@ -2564,8 +2564,7 @@ bool ShoppingList::items_are_same(const item_def& item_a,
void ShoppingList::move_things(const coord_def &_src, const coord_def &_dst)
{
if (crawl_state.map_stat_gen || crawl_state.test)
- // Shopping list is unitialized and uneeded.
- return;
+ return; // Shopping list is unitialized and uneeded.
const level_pos src(level_id::current(), _src);
const level_pos dst(level_id::current(), _dst);
@@ -2582,8 +2581,7 @@ void ShoppingList::move_things(const coord_def &_src, const coord_def &_dst)
void ShoppingList::forget_pos(const level_pos &pos)
{
if (!crawl_state.need_save)
- // Shopping list is unitialized and uneeded.
- return;
+ return; // Shopping list is unitialized and uneeded.
for (unsigned int i = 0; i < list->size(); i++)
{
diff --git a/crawl-ref/source/shout.cc b/crawl-ref/source/shout.cc
index f64e9913f2..31b96b9f64 100644
--- a/crawl-ref/source/shout.cc
+++ b/crawl-ref/source/shout.cc
@@ -766,7 +766,9 @@ int noise_cell::turn_angle(const coord_def &next_delta) const
// Going in reverse?
if (next_delta.x == -neighbour_delta.x
&& next_delta.y == -neighbour_delta.y)
+ {
return 4;
+ }
const int xdiff = std::abs(neighbour_delta.x - next_delta.x);
const int ydiff = std::abs(neighbour_delta.y - next_delta.y);
@@ -886,9 +888,11 @@ bool noise_grid::propagate_noise_to_neighbour(int base_attenuation,
const coord_def &next_pos)
{
noise_cell &neighbour(cells(next_pos));
- if (!neighbour.can_apply_noise(cell.noise_intensity_millis -
- base_attenuation))
+ if (!neighbour.can_apply_noise(cell.noise_intensity_millis
+ - base_attenuation))
+ {
return false;
+ }
// Diagonals cost more.
if ((next_pos - current_pos).abs() == 2)
diff --git a/crawl-ref/source/skills.cc b/crawl-ref/source/skills.cc
index 488429bdb4..45a27c867c 100644
--- a/crawl-ref/source/skills.cc
+++ b/crawl-ref/source/skills.cc
@@ -667,9 +667,11 @@ void reset_training()
// The selected skills have not been exercised recently. Give them all
// a default weight of 1 (or 2 for focus skills).
if (empty)
+ {
for (int sk = 0; sk < NUM_SKILLS; ++sk)
if (skill_trained(sk))
you.training[sk] = you.train[sk];
+ }
// Focused skills get at least 20% training.
for (int sk = 0; sk < NUM_SKILLS; ++sk)
diff --git a/crawl-ref/source/spl-clouds.cc b/crawl-ref/source/spl-clouds.cc
index 67b963527d..8caa6ccba1 100644
--- a/crawl-ref/source/spl-clouds.cc
+++ b/crawl-ref/source/spl-clouds.cc
@@ -237,9 +237,11 @@ void manage_fire_shield(int delay)
you.duration[DUR_FIRE_SHIELD] = 0;
// Remove fire clouds on top of you
- if (env.cgrid(you.pos()) != EMPTY_CLOUD)
- if (env.cloud[env.cgrid(you.pos())].type == CLOUD_FIRE)
- delete_cloud_at(you.pos());
+ if (env.cgrid(you.pos()) != EMPTY_CLOUD
+ && env.cloud[env.cgrid(you.pos())].type == CLOUD_FIRE)
+ {
+ delete_cloud_at(you.pos());
+ }
if (!you.duration[DUR_FIRE_SHIELD])
{
diff --git a/crawl-ref/source/spl-damage.cc b/crawl-ref/source/spl-damage.cc
index 45ffbe891d..e80474c6ce 100644
--- a/crawl-ref/source/spl-damage.cc
+++ b/crawl-ref/source/spl-damage.cc
@@ -765,11 +765,9 @@ spret_type cast_freeze(int pow, monster* mons, bool fail)
spret_type cast_airstrike(int pow, const dist &beam, bool fail)
{
monster* mons = monster_at(beam.target);
- if (mons && (mons->submerged() ||
- (cell_is_solid(beam.target) && mons_wall_shielded(mons))))
- mons = NULL;
-
- if (mons == NULL)
+ if (!mons
+ || mons->submerged()
+ || (cell_is_solid(beam.target) && mons_wall_shielded(mons)))
{
fail_check();
canned_msg(MSG_SPELL_FIZZLES);
@@ -1140,10 +1138,11 @@ void shillelagh(actor *wielder, coord_def where, int pow)
{
monster *mon = monster_at(*ai);
if (!mon || !mon->alive() || mon->submerged()
- || mon->is_insubstantial() || !you.can_see(mon))
- continue;
- if (mon == wielder)
+ || mon->is_insubstantial() || !you.can_see(mon)
+ || mon == wielder)
+ {
continue;
+ }
affected_monsters.add(mon);
}
if (!affected_monsters.empty())
@@ -1232,11 +1231,17 @@ static int _ignite_poison_affect_item(item_def& item, bool in_inv)
if (in_inv)
{
if (item.base_type == OBJ_POTIONS)
+ {
mprf("%s explode%s!",
- item.name(DESC_PLAIN).c_str(), item.quantity == 1 ? "s" : "");
+ item.name(DESC_PLAIN).c_str(),
+ item.quantity == 1 ? "s" : "");
+ }
else
+ {
mprf("Your %s burn%s!",
- item.name(DESC_PLAIN).c_str(), item.quantity == 1 ? "s" : "");
+ item.name(DESC_PLAIN).c_str(),
+ item.quantity == 1 ? "s" : "");
+ }
}
if (item.base_type == OBJ_CORPSES &&
@@ -1798,8 +1803,10 @@ bool setup_fragmentation_beam(bolt &beam, int pow, const actor *caster,
"veto_fragmentation") == "veto")
{
if (caster->is_player() && !quiet)
+ {
mprf("%s seems to be unnaturally hard.",
feature_description_at(target, false, DESC_THE, false).c_str());
+ }
return false;
}
@@ -1936,7 +1943,9 @@ spret_type cast_fragmentation(int pow, const actor *caster,
if (!setup_fragmentation_beam(beam, pow, caster, target, true, false,
false, &what, destroy_wall, hole))
+ {
return SPRET_ABORT;
+ }
if (caster->is_player())
{
diff --git a/crawl-ref/source/spl-other.cc b/crawl-ref/source/spl-other.cc
index 12832b501f..9a4ec2998b 100644
--- a/crawl-ref/source/spl-other.cc
+++ b/crawl-ref/source/spl-other.cc
@@ -281,7 +281,8 @@ spret_type cast_passwall(const coord_def& delta, int pow, bool fail)
coord_def dest;
for (dest = you.pos() + delta;
in_bounds(dest) && _feat_is_passwallable(grd(dest));
- dest += delta) ;
+ dest += delta)
+ {}
int walls = (dest - you.pos()).rdist() - 1;
if (walls == 0)
diff --git a/crawl-ref/source/spl-summoning.cc b/crawl-ref/source/spl-summoning.cc
index 5ba58d1e9c..c5a09ea46b 100644
--- a/crawl-ref/source/spl-summoning.cc
+++ b/crawl-ref/source/spl-summoning.cc
@@ -2305,11 +2305,15 @@ spret_type cast_haunt(int pow, const coord_def& where, god_type god, bool fail)
}
if (success > 1)
+ {
mpr(friendly ? "Insubstantial figures form in the air."
: "You sense hostile presences.");
+ }
else if (success)
+ {
mpr(friendly ? "An insubstantial figure forms in the air."
: "You sense a hostile presence.");
+ }
else
{
canned_msg(MSG_NOTHING_HAPPENS);
diff --git a/crawl-ref/source/spl-tornado.cc b/crawl-ref/source/spl-tornado.cc
index 5a01aa4b25..b3b8cae8d6 100644
--- a/crawl-ref/source/spl-tornado.cc
+++ b/crawl-ref/source/spl-tornado.cc
@@ -345,8 +345,7 @@ void tornado_damage(actor *caster, int dur)
dmg = 0;
dprf("damage done: %d", dmg);
if (victim->is_player())
- ouch(dmg, caster->mindex(), KILLED_BY_BEAM,
- "tornado");
+ ouch(dmg, caster->mindex(), KILLED_BY_BEAM, "tornado");
else
victim->hurt(caster, dmg);
}
diff --git a/crawl-ref/source/stairs.cc b/crawl-ref/source/stairs.cc
index 00eeac273a..558465d63a 100644
--- a/crawl-ref/source/stairs.cc
+++ b/crawl-ref/source/stairs.cc
@@ -699,8 +699,10 @@ void down_stairs(dungeon_feature_type force_stair)
}
if (!known_trap && shaft_dest.depth - you.depth > 1)
- mark_milestone("shaft", "fell down a shaft to " +
- short_place_name(shaft_dest) + ".");
+ {
+ mark_milestone("shaft", "fell down a shaft to "
+ + short_place_name(shaft_dest) + ".");
+ }
if (you.flight_mode() != FL_FLY || force_stair)
mpr("You fall through a shaft!");
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc
index a5a9600c78..a167cf187e 100644
--- a/crawl-ref/source/stuff.cc
+++ b/crawl-ref/source/stuff.cc
@@ -724,11 +724,9 @@ char index_to_letter(int the_index)
int letter_to_index(int the_letter)
{
if (the_letter >= 'a' && the_letter <= 'z')
- // returns range [0-25] {dlb}
- return (the_letter - 'a');
+ return (the_letter - 'a'); // returns range [0-25] {dlb}
else if (the_letter >= 'A' && the_letter <= 'Z')
- // returns range [26-51] {dlb}
- return (the_letter - 'A' + 26);
+ return (the_letter - 'A' + 26); // returns range [26-51] {dlb}
die("slot not a letter: %s (%d)", the_letter ?
stringize_glyph(the_letter).c_str() : "null", the_letter);
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index 05f11fd3a8..263cce6bdd 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -2223,8 +2223,10 @@ static void tag_read_you(reader &th)
you.octopus_king_rings = unmarshallUByte(th);
if (!dlua.callfn("dgn_load_data", "u", &th))
+ {
mprf(MSGCH_ERROR, "Failed to load Lua persist table: %s",
dlua.error.c_str());
+ }
unmarshallString(th);
@@ -2370,9 +2372,11 @@ static void tag_read_you_items(reader &th)
#if TAG_MAJOR_VERSION == 33
// Reset old broken force_autopickup tables.
if (th.getMinorVersion() < TAG_MINOR_CLEAR_APTABLE)
+ {
for (i = 0; i < iclasses; i++)
for (j = 0; j < count2; j++)
you.force_autopickup[i][j] = 0;
+ }
if (th.getMinorVersion() < TAG_MINOR_DETECT_CURSE_REMOVAL)
for (j = SCR_REMOVE_CURSE + 1; j + 1 < MAX_SUBTYPES; ++j)
diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc
index ee3ea02c81..a6048c4b57 100644
--- a/crawl-ref/source/terrain.cc
+++ b/crawl-ref/source/terrain.cc
@@ -1818,10 +1818,14 @@ bool cell_can_cling_to(const coord_def& from, const coord_def to)
return false;
for (orth_adjacent_iterator ai(from); ai; ++ai)
+ {
if (feat_is_wall(env.grid(*ai)))
+ {
for (orth_adjacent_iterator ai2(to, false); ai2; ++ai2)
if (feat_is_wall(env.grid(*ai2)) && distance(*ai, *ai2) <= 1)
return true;
+ }
+ }
return false;
}
diff --git a/crawl-ref/source/throw.cc b/crawl-ref/source/throw.cc
index 1484e0a6fd..ab066e578f 100644
--- a/crawl-ref/source/throw.cc
+++ b/crawl-ref/source/throw.cc
@@ -356,8 +356,10 @@ bool fire_warn_if_impossible(bool silent)
else if (weapon->sub_type != WPN_BLOWGUN)
{
if (!silent)
+ {
mprf("You cannot shoot with your %s while %s.",
weapon->name(DESC_BASENAME).c_str(), held_status());
+ }
return true;
}
// Else shooting is possible.
diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc
index 4c31de75ad..3277630c36 100644
--- a/crawl-ref/source/tilepick.cc
+++ b/crawl-ref/source/tilepick.cc
@@ -807,8 +807,7 @@ static tileidx_t _tileidx_monster_zombified(const monster_info& mon)
if (z_type == MONS_SPECTRAL_THING)
z_tile = _zombie_tile_to_spectral(z_tile);
- if (z_type == MONS_SIMULACRUM_SMALL
- || z_type == MONS_SIMULACRUM_LARGE)
+ if (z_type == MONS_SIMULACRUM_SMALL || z_type == MONS_SIMULACRUM_LARGE)
z_tile = _zombie_tile_to_simulacrum(z_tile);
return z_tile;
diff --git a/crawl-ref/source/tileweb.cc b/crawl-ref/source/tileweb.cc
index 30f5135036..25bfa07a68 100644
--- a/crawl-ref/source/tileweb.cc
+++ b/crawl-ref/source/tileweb.cc
@@ -586,8 +586,10 @@ static void _send_mcache(mcache_entry *entry, bool submerged)
tile_draw_info dinfo[mcache_entry::MAX_INFO_COUNT];
int draw_info_count = entry->info(&dinfo[0]);
for (int i = 0; i < draw_info_count; i++)
+ {
tiles.write_message("[%u,%d,%d],", (unsigned int) dinfo[i].idx,
dinfo[i].ofs_x, dinfo[i].ofs_y);
+ }
tiles.write_message("],");
}
@@ -604,7 +606,9 @@ static bool _needs_flavour(const packed_cell &cell)
return true; // Needs flv.floor
if (cell.is_liquefied || cell.is_bloody ||
cell.is_moldy || cell.glowing_mold)
+ {
return true; // Needs flv.special
+ }
return false;
}
@@ -707,59 +711,85 @@ void TilesFramework::_send_cell(const coord_def &gc,
if ((force_full && next_pc.is_bloody)
|| next_pc.is_bloody != current_pc.is_bloody)
+ {
write_message("bloody:%u,", next_pc.is_bloody);
+ }
if ((force_full && next_pc.old_blood)
|| next_pc.old_blood != current_pc.old_blood)
+ {
write_message("old_blood:%u,", next_pc.old_blood);
+ }
if ((force_full && next_pc.is_silenced)
|| next_pc.is_silenced != current_pc.is_silenced)
+ {
write_message("silenced:%u,", next_pc.is_silenced);
+ }
if ((force_full && next_pc.is_suppressed)
|| next_pc.is_suppressed != current_pc.is_suppressed)
+ {
write_message("suppressed:%u,", next_pc.is_suppressed);
+ }
if ((force_full && next_pc.halo)
|| next_pc.halo != current_pc.halo)
+ {
write_message("halo:%u,", next_pc.halo);
+ }
if ((force_full && next_pc.is_moldy)
|| next_pc.is_moldy != current_pc.is_moldy)
+ {
write_message("moldy:%u,", next_pc.is_moldy);
+ }
if ((force_full && next_pc.glowing_mold)
|| next_pc.glowing_mold != current_pc.glowing_mold)
+ {
write_message("glowing_mold:%u,", next_pc.glowing_mold);
+ }
if ((force_full && next_pc.is_sanctuary)
|| next_pc.is_sanctuary != current_pc.is_sanctuary)
+ {
write_message("sanctuary:%u,", next_pc.is_sanctuary);
+ }
if ((force_full && next_pc.is_liquefied)
|| next_pc.is_liquefied != current_pc.is_liquefied)
+ {
write_message("liquefied:%u,", next_pc.is_liquefied);
+ }
if ((force_full && next_pc.orb_glow)
|| next_pc.orb_glow != current_pc.orb_glow)
+ {
write_message("orb_glow:%u,", next_pc.orb_glow);
+ }
if ((force_full && next_pc.mangrove_water)
|| next_pc.mangrove_water != current_pc.mangrove_water)
+ {
write_message("swtree:%u,", next_pc.mangrove_water);
+ }
if ((force_full && next_pc.blood_rotation)
|| next_pc.blood_rotation != current_pc.blood_rotation)
+ {
write_message("bloodrot:%d,", next_pc.blood_rotation);
+ }
if ((force_full && next_pc.travel_trail)
|| next_pc.travel_trail != current_pc.travel_trail)
+ {
write_message("tt:%d,", next_pc.travel_trail);
+ }
if (_needs_flavour(next_pc) &&
- ((next_pc.flv.floor != current_pc.flv.floor)
- || (next_pc.flv.special != current_pc.flv.special)
+ (next_pc.flv.floor != current_pc.flv.floor
+ || next_pc.flv.special != current_pc.flv.special
|| !_needs_flavour(current_pc)
|| force_full))
{
@@ -937,12 +967,16 @@ void TilesFramework::_send_monster(const coord_def &gc, const monster_info* m,
force_full = true;
if (force_full || (last->full_name() != m->full_name()))
+ {
write_message("name:'%s',",
replace_all_of(m->full_name(), "'", "\\'").c_str());
+ }
if (force_full || (last->pluralised_name() != m->pluralised_name()))
+ {
write_message("plural:'%s',",
replace_all_of(m->pluralised_name(), "'", "\\'").c_str());
+ }
if (force_full || (last->type != m->type))
{
@@ -1201,8 +1235,7 @@ void TilesFramework::redraw()
void TilesFramework::update_minimap(const coord_def& gc)
{
- if (gc.x < 0 || gc.x >= GXM ||
- gc.y < 0 || gc.y >= GYM)
+ if (gc.x < 0 || gc.x >= GXM || gc.y < 0 || gc.y >= GYM)
return;
mark_for_redraw(gc);
@@ -1357,8 +1390,10 @@ void TilesFramework::put_ucs_string(ucs_t *str)
}
if (m_print_y < m_print_area->my)
+ {
m_print_area->put_character(*str, m_print_fg, m_print_bg,
m_print_x, m_print_y);
+ }
m_print_x++;
}
@@ -1369,8 +1404,7 @@ void TilesFramework::put_ucs_string(ucs_t *str)
void TilesFramework::clear_to_end_of_line()
{
- if (m_print_area == NULL ||
- m_print_y >= m_print_area->my)
+ if (m_print_area == NULL || m_print_y >= m_print_area->my)
return;
for (int x = m_print_x; x < m_print_area->mx; ++x)
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index c7ad3ac671..89ca7dc73b 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -1043,8 +1043,10 @@ command_type direction_to_command(int x, int y)
if (x == -1 && y == 1) return CMD_MOVE_DOWN_LEFT;
if (x == 0 && y == -1) return CMD_MOVE_UP;
if (x == 0 && y == 0)
+ {
return (you.running == RMODE_EXPLORE_GREEDY ? CMD_INSPECT_FLOOR
: CMD_NO_CMD);
+ }
if (x == 0 && y == 1) return CMD_MOVE_DOWN;
if (x == 1 && y == -1) return CMD_MOVE_UP_RIGHT;
if (x == 1 && y == 0) return CMD_MOVE_RIGHT;
@@ -1498,8 +1500,10 @@ bool travel_pathfind::path_flood(const coord_def &c, const coord_def &dc)
int dist = traveled_distance;
if (need_for_greed && Options.explore_item_greed > 0)
+ {
// Penalize distance to favor item pickup
dist += Options.explore_item_greed;
+ }
if (Options.explore_wall_bias)
{
@@ -4171,9 +4175,8 @@ void explore_discoveries::found_item(const coord_def &pos, const item_def &i)
can_autopickup
&& _is_greed_inducing_square(current_level, pos);
- if (greed_inducing
- && (Options.explore_stop & ES_GREEDY_ITEM))
- ; // Stop for this conditions
+ if (greed_inducing && (Options.explore_stop & ES_GREEDY_ITEM))
+ ; // Stop for this condition
else if (!greed_inducing
&& ((Options.explore_stop & ES_ITEM)
|| ((Options.explore_stop & ES_GLOWING_ITEM)
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index fbf21929bf..f3926199d6 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -579,8 +579,10 @@ bool magic_mapping(int map_radius, int proportion, bool suppress_msg,
std::vector<std::string> sensed;
if (num_altars > 0)
+ {
sensed.push_back(make_stringf("%d altar%s", num_altars,
num_altars > 1 ? "s" : ""));
+ }
if (num_shops_portals > 0)
{
diff --git a/crawl-ref/source/wcwidth.cc b/crawl-ref/source/wcwidth.cc
index 42eaf751af..9b8e61287a 100644
--- a/crawl-ref/source/wcwidth.cc
+++ b/crawl-ref/source/wcwidth.cc
@@ -210,8 +210,7 @@ int wcwidth(ucs_t ucs)
return -1;
/* binary search in table of non-spacing characters */
- if (bisearch(ucs, combining,
- sizeof(combining) / sizeof(struct interval) - 1))
+ if (bisearch(ucs, combining, ARRAYSZ(combining) - 1))
return 0;
/* if we arrive here, ucs is not a combining or C0/C1 control character */
diff --git a/crawl-ref/source/wiz-fsim.cc b/crawl-ref/source/wiz-fsim.cc
index 5abc307389..d86332dc1b 100644
--- a/crawl-ref/source/wiz-fsim.cc
+++ b/crawl-ref/source/wiz-fsim.cc
@@ -252,9 +252,11 @@ static monster* _init_fsim()
// this probably works best in the arena, or at least somewhere
// where there's no water or anything weird to interfere
if (!adjacent(mon->pos(), you.pos()))
+ {
for (adjacent_iterator ai(you.pos()); ai; ++ai)
if (mon->move_to_pos(*ai))
break;
+ }
if (!adjacent(mon->pos(), you.pos()))
{
diff --git a/crawl-ref/source/wiz-mon.cc b/crawl-ref/source/wiz-mon.cc
index 3c5840231d..a3ef2cf2c7 100644
--- a/crawl-ref/source/wiz-mon.cc
+++ b/crawl-ref/source/wiz-mon.cc
@@ -408,8 +408,10 @@ void debug_list_monsters()
{
char buf[80];
if (count > 1)
+ {
snprintf(buf, sizeof(buf), "%d %s", count,
pluralise(prev_name).c_str());
+ }
else
snprintf(buf, sizeof(buf), "%s", prev_name.c_str());
mons.push_back(buf);
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index 5fe7a693b8..4abeb3ada8 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -2487,8 +2487,10 @@ static void _xom_zero_miscast()
}
if (in_view[DNGN_STONE_ARCH])
+ {
priority.push_back("The stone arch briefly shows a sunny meadow on "
"the other side.");
+ }
const dungeon_feature_type feat = grd(you.pos());