|
From: <gi...@cr...> - 2013-07-28 16:55:17
|
via cce9a79def4c052420329fcce7c2a3035f7aeb9f (commit)
via a2406f0aada94b5ef9fce04820fa88a257ce3e2a (commit)
from f61e71f529e8ec9710ddd2fe4b89d64ca5481858 (commit)
-----------------------------------------------------------------------
commit cce9a79def4c052420329fcce7c2a3035f7aeb9f
Author: Neil Moore <ne...@s-...>
Date: Sun Jul 28 12:53:30 2013 -0400
Don't pretend &=~ is a single operator.
commit a2406f0aada94b5ef9fce04820fa88a257ce3e2a
Author: Chris Oelmueller <chr...@gm...>
Date: Fri Jul 26 00:23:19 2013 +0200
Pad some ternary operators with spaces on the left
While this is not explicitly mentioned as a rule in coding_conventions,
all examples listed there apply it as well. The dungeon.cc chunk did
overflow max. columns before already, but could still be looked at.
-----------------------------------------------------------------------
Summary of changes:
crawl-ref/source/abyss.cc | 2 +-
crawl-ref/source/cloud.cc | 2 +-
crawl-ref/source/dgn-shoals.cc | 6 +++---
crawl-ref/source/dungeon.cc | 6 +++---
crawl-ref/source/hiscores.cc | 2 +-
crawl-ref/source/item_use.cc | 4 ++--
crawl-ref/source/kills.cc | 6 +++---
crawl-ref/source/l_item.cc | 2 +-
crawl-ref/source/macro.cc | 2 +-
crawl-ref/source/map_knowledge.cc | 4 ++--
crawl-ref/source/mapdef.cc | 4 ++--
crawl-ref/source/maps.cc | 8 ++++----
crawl-ref/source/mon-ench.cc | 6 +++---
crawl-ref/source/mon-gear.cc | 2 +-
crawl-ref/source/tags.cc | 2 +-
crawl-ref/source/travel.cc | 2 +-
crawl-ref/source/viewmap.cc | 4 ++--
crawl-ref/source/xom.cc | 4 ++--
18 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc
index 3053990..e7a130f 100644
--- a/crawl-ref/source/abyss.cc
+++ b/crawl-ref/source/abyss.cc
@@ -1181,7 +1181,7 @@ static void _abyss_apply_terrain(const map_bitmask &abyss_genlevel_mask,
: 7500 - 1250 * (you.depth - 1);
// Except for the altar on the starting position, don't place any altars.
- const int altar_chance = you.char_direction != GDT_GAME_START? 10000 : 0;
+ const int altar_chance = you.char_direction != GDT_GAME_START ? 10000 : 0;
int exits_wanted = 0;
int altars_wanted = 0;
diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc
index 80a1735..40f5658 100644
--- a/crawl-ref/source/cloud.cc
+++ b/crawl-ref/source/cloud.cc
@@ -997,7 +997,7 @@ static int _actor_cloud_base_damage(actor *act,
const int cloud_raw_base_damage =
_cloud_base_damage(act, cloud, maximum_damage);
- const int cloud_base_damage = (resist == MAG_IMMUNE?
+ const int cloud_base_damage = (resist == MAG_IMMUNE ?
0 : cloud_raw_base_damage);
return cloud_base_damage;
}
diff --git a/crawl-ref/source/dgn-shoals.cc b/crawl-ref/source/dgn-shoals.cc
index 0447ff0..d51e20e 100644
--- a/crawl-ref/source/dgn-shoals.cc
+++ b/crawl-ref/source/dgn-shoals.cc
@@ -83,9 +83,9 @@ static int shoals_plant_quota = 0;
static dungeon_feature_type _shoals_feature_by_height(int height)
{
return height >= SHT_STONE ? DNGN_STONE_WALL :
- height >= SHT_ROCK? DNGN_ROCK_WALL :
- height >= SHT_FLOOR? DNGN_FLOOR :
- height >= SHT_SHALLOW_WATER? DNGN_SHALLOW_WATER
+ height >= SHT_ROCK ? DNGN_ROCK_WALL :
+ height >= SHT_FLOOR ? DNGN_FLOOR :
+ height >= SHT_SHALLOW_WATER ? DNGN_SHALLOW_WATER
: DNGN_DEEP_WATER;
}
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index f131f37..053349d 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -4082,7 +4082,7 @@ const vault_placement *dgn_safe_place_map(const map_def *mdef,
vault_placement *dgn_vault_at(coord_def p)
{
const int map_index = env.level_map_ids(p);
- return (map_index == INVALID_MAP_INDEX? NULL : env.level_vaults[map_index]);
+ return (map_index == INVALID_MAP_INDEX ? NULL : env.level_vaults[map_index]);
}
void dgn_seen_vault_at(coord_def p)
@@ -4170,7 +4170,7 @@ _build_vault_impl(const map_def *vault,
dprf("Map: %s; placed: %s; place: (%d,%d), size: (%d,%d)",
vault->name.c_str(),
- placed_vault_orientation != MAP_NONE? "yes" : "no",
+ placed_vault_orientation != MAP_NONE ? "yes" : "no",
place.pos.x, place.pos.y, place.size.x, place.size.y);
if (placed_vault_orientation == MAP_NONE)
@@ -5538,7 +5538,7 @@ static void _place_spec_shop(const coord_def& where,
int plojy = 5 + random2avg(12, 3);
if (representative)
- plojy = env.shop[i].type == SHOP_WAND? NUM_WANDS : 16;
+ plojy = env.shop[i].type == SHOP_WAND ? NUM_WANDS : 16;
if (spec->use_all && !spec->items.empty())
{
diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc
index b98195a..c153461 100644
--- a/crawl-ref/source/hiscores.cc
+++ b/crawl-ref/source/hiscores.cc
@@ -1011,7 +1011,7 @@ void scorefile_entry::set_base_xlog_fields() const
fields->add_field("ev", "%d", ev);
fields->add_field("sh", "%d", sh);
- fields->add_field("god", "%s", god == GOD_NO_GOD? "" :
+ fields->add_field("god", "%s", god == GOD_NO_GOD ? "" :
god_name(god).c_str());
if (wiz_mode)
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index d3fbfd6..4b6cd87 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -432,8 +432,8 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages,
static const char *shield_base_name(const item_def *shield)
{
- return (shield->sub_type == ARM_BUCKLER? "buckler"
- : "shield");
+ return (shield->sub_type == ARM_BUCKLER ? "buckler"
+ : "shield");
}
static const char *shield_impact_degree(int impact)
diff --git a/crawl-ref/source/kills.cc b/crawl-ref/source/kills.cc
index 9a038bd..7540e3a 100644
--- a/crawl-ref/source/kills.cc
+++ b/crawl-ref/source/kills.cc
@@ -154,8 +154,8 @@ string KillMaster::kill_info() const
add_kill_info(killtext,
kills,
count,
- i == KC_YOU? NULL :
- category_name((kill_category) i),
+ i == KC_YOU ? NULL
+ : category_name((kill_category) i),
needseparator);
needseparator = true;
}
@@ -639,7 +639,7 @@ kill_ghost::kill_ghost(const monster* mon)
string kill_ghost::info() const
{
return ghost_name
- + (Options.dump_kill_places != KDO_NO_PLACES?
+ + (Options.dump_kill_places != KDO_NO_PLACES ?
" (" + short_place_name(place) + ")" : string(""));
}
diff --git a/crawl-ref/source/l_item.cc b/crawl-ref/source/l_item.cc
index 05176fc..22df765 100644
--- a/crawl-ref/source/l_item.cc
+++ b/crawl-ref/source/l_item.cc
@@ -481,7 +481,7 @@ IDEF(equip_type)
else if (item->base_type == OBJ_ARMOUR)
eq = get_armour_slot(*item);
else if (item->base_type == OBJ_JEWELLERY)
- eq = item->sub_type >= AMU_RAGE? EQ_AMULET : EQ_RINGS;
+ eq = item->sub_type >= AMU_RAGE ? EQ_AMULET : EQ_RINGS;
if (eq != EQ_NONE)
{
diff --git a/crawl-ref/source/macro.cc b/crawl-ref/source/macro.cc
index 9a8f61d..5df2840 100644
--- a/crawl-ref/source/macro.cc
+++ b/crawl-ref/source/macro.cc
@@ -108,7 +108,7 @@ static KeymapContext _context_for_command(command_type cmd);
static inline int userfunc_index(int key)
{
- int index = (key <= USERFUNCBASE? USERFUNCBASE - key : -1);
+ int index = (key <= USERFUNCBASE ? USERFUNCBASE - key : -1);
return (index < 0 || index >= (int) userfunctions.size()? -1 : index);
}
diff --git a/crawl-ref/source/map_knowledge.cc b/crawl-ref/source/map_knowledge.cc
index 901ea07..2ffb960 100644
--- a/crawl-ref/source/map_knowledge.cc
+++ b/crawl-ref/source/map_knowledge.cc
@@ -152,13 +152,13 @@ void set_terrain_visible(const coord_def &c)
cell->flags |= MAP_VISIBLE_FLAG;
env.visible.insert(c);
}
- cell->flags &=~ (MAP_DETECTED_MONSTER | MAP_DETECTED_ITEM);
+ cell->flags &= ~(MAP_DETECTED_MONSTER | MAP_DETECTED_ITEM);
}
void clear_terrain_visibility()
{
for (set<coord_def>::iterator i = env.visible.begin(); i != env.visible.end(); ++i)
- env.map_knowledge(*i).flags &=~ MAP_VISIBLE_FLAG;
+ env.map_knowledge(*i).flags &= ~MAP_VISIBLE_FLAG;
env.visible.clear();
}
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index cc94ae3..a2cfd9f 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -93,7 +93,7 @@ static int find_weight(string &s, int defweight = TAG_UNFOUND)
int weight = strip_number_tag(s, "weight:");
if (weight == TAG_UNFOUND)
weight = strip_number_tag(s, "w:");
- return (weight == TAG_UNFOUND? defweight : weight);
+ return (weight == TAG_UNFOUND ? defweight : weight);
}
void clear_subvault_stack(void)
@@ -263,7 +263,7 @@ string level_range::describe() const
{
return make_stringf("%s%s%s",
deny? "!" : "",
- branch == NUM_BRANCHES? "Any" :
+ branch == NUM_BRANCHES ? "Any" :
branches[branch].abbrevname,
str_depth_range().c_str());
}
diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc
index b0ffdfe..d1b192e 100644
--- a/crawl-ref/source/maps.cc
+++ b/crawl-ref/source/maps.cc
@@ -638,7 +638,7 @@ static map_section_type _apply_vault_definition(
return MAP_NONE;
const map_section_type orient = def.orient;
- return (orient == MAP_NONE? MAP_NORTH : orient);
+ return (orient == MAP_NONE ? MAP_NORTH : orient);
}
///////////////////////////////////////////////////////////////////////////
@@ -869,13 +869,13 @@ void map_selector::announce(const map_def *vault) const
else
{
const char *format =
- sel == PLACE? "[PLACE] Found map %s for %s" :
- sel == DEPTH? "[DEPTH] Found random map %s for %s" :
+ sel == PLACE ? "[PLACE] Found map %s for %s" :
+ sel == DEPTH ? "[DEPTH] Found random map %s for %s" :
"[TAG] Found map %s tagged '%s'";
mprf(MSGCH_DIAGNOSTICS, format,
vault->name.c_str(),
- sel == TAG? tag.c_str() : place.describe().c_str());
+ sel == TAG ? tag.c_str() : place.describe().c_str());
}
}
#endif
diff --git a/crawl-ref/source/mon-ench.cc b/crawl-ref/source/mon-ench.cc
index 1f14a16..eef0344 100644
--- a/crawl-ref/source/mon-ench.cc
+++ b/crawl-ref/source/mon-ench.cc
@@ -1990,8 +1990,8 @@ mon_enchant::operator string () const
const char *mon_enchant::kill_category_desc(kill_category k) const
{
- return (k == KC_YOU? " you" :
- k == KC_FRIENDLY? " pet" : "");
+ return (k == KC_YOU ? " you" :
+ k == KC_FRIENDLY ? " pet" : "");
}
void mon_enchant::merge_killer(kill_category k, mid_t m)
@@ -2043,7 +2043,7 @@ killer_type mon_enchant::killer() const
int mon_enchant::kill_agent() const
{
- return (who == KC_FRIENDLY? ANON_FRIENDLY_MONSTER : 0);
+ return (who == KC_FRIENDLY ? ANON_FRIENDLY_MONSTER : 0);
}
actor* mon_enchant::agent() const
diff --git a/crawl-ref/source/mon-gear.cc b/crawl-ref/source/mon-gear.cc
index b51058d..5490e16 100644
--- a/crawl-ref/source/mon-gear.cc
+++ b/crawl-ref/source/mon-gear.cc
@@ -1799,7 +1799,7 @@ static void _give_ammo(monster* mon, int level,
w.quantity = qty;
_give_monster_item(mon, thing_created, false,
- (weap_class == OBJ_WEAPONS?
+ (weap_class == OBJ_WEAPONS ?
&monster::pickup_melee_weapon
: &monster::pickup_throwable_weapon));
}
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index bc4d610..14edb01 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -3675,7 +3675,7 @@ static void tag_read_level(reader &th)
if (env.map_knowledge[i][j].cloudinfo())
env.map_knowledge[i][j].cloudinfo()->pos = coord_def(i, j);
- env.map_knowledge[i][j].flags &=~ MAP_VISIBLE_FLAG;
+ env.map_knowledge[i][j].flags &= ~MAP_VISIBLE_FLAG;
env.pgrid[i][j] = unmarshallInt(th);
mgrd[i][j] = NON_MONSTER;
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index 221b9af..bbd8f1d 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -3224,7 +3224,7 @@ string stair_info::describe() const
return make_stringf(" (-> %s@(%d,%d)%s%s)", lp.id.describe().c_str(),
lp.pos.x, lp.pos.y,
guessed_pos? " guess" : "",
- type == PLACEHOLDER? " placeholder" : "");
+ type == PLACEHOLDER ? " placeholder" : "");
}
else if (destination.id.is_valid())
return make_stringf(" (->%s (?))", destination.id.describe().c_str());
diff --git a/crawl-ref/source/viewmap.cc b/crawl-ref/source/viewmap.cc
index ef8fabd..e4946ed 100644
--- a/crawl-ref/source/viewmap.cc
+++ b/crawl-ref/source/viewmap.cc
@@ -57,8 +57,8 @@ static unsigned _get_travel_colour(const coord_def& p)
return Options.tc_excluded;
short dist = travel_point_distance[p.x][p.y];
return dist > 0? Options.tc_reachable :
- dist == PD_EXCLUDED? Options.tc_excluded :
- dist == PD_EXCLUDED_RADIUS? Options.tc_exclude_circle :
+ dist == PD_EXCLUDED ? Options.tc_excluded :
+ dist == PD_EXCLUDED_RADIUS ? Options.tc_exclude_circle :
dist < 0? Options.tc_dangerous :
Options.tc_disconnected;
}
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index 21cf03c..6d727bd 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -291,8 +291,8 @@ void xom_tick()
{
// Xom semi-randomly drifts your piety.
const string old_xom_favour = describe_xom_favour();
- const bool good = (you.piety == HALF_MAX_PIETY? coinflip()
- : you.piety > HALF_MAX_PIETY);
+ const bool good = (you.piety == HALF_MAX_PIETY ? coinflip()
+ : you.piety > HALF_MAX_PIETY);
int size = abs(you.piety - HALF_MAX_PIETY);
// Piety slowly drifts towards the extremes.
--
Dungeon Crawl Stone Soup
|