summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorJohanna Ploog <j-p-e-g@users.sourceforge.net>2009-12-10 14:24:40 +0100
committerJohanna Ploog <j-p-e-g@users.sourceforge.net>2009-12-10 14:24:40 +0100
commitf1ef80cc67b73ae63865564ece8032e9b2276234 (patch)
treeabad1e086f495500e06f76b60e6268a1a7c8eb75 /crawl-ref/source
parent4b71037efe0a72b312c377bbc39f2ffd279edaab (diff)
downloadcrawl-ref-f1ef80cc67b73ae63865564ece8032e9b2276234.tar.gz
crawl-ref-f1ef80cc67b73ae63865564ece8032e9b2276234.zip
Tidy up bracket placement according to our coding conventions.
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/SDLMain.m31
-rw-r--r--crawl-ref/source/beam.cc7
-rw-r--r--crawl-ref/source/cloud.cc5
-rw-r--r--crawl-ref/source/crash-u.cc3
-rw-r--r--crawl-ref/source/dungeon.cc4
-rw-r--r--crawl-ref/source/effects.cc12
-rw-r--r--crawl-ref/source/hiscores.cc6
-rw-r--r--crawl-ref/source/initfile.cc3
-rw-r--r--crawl-ref/source/item_use.cc3
-rw-r--r--crawl-ref/source/items.cc3
-rw-r--r--crawl-ref/source/l_mons.cc41
-rw-r--r--crawl-ref/source/mon-stuff.cc7
-rw-r--r--crawl-ref/source/spells3.cc18
-rw-r--r--crawl-ref/source/teleport.cc4
14 files changed, 85 insertions, 62 deletions
diff --git a/crawl-ref/source/SDLMain.m b/crawl-ref/source/SDLMain.m
index 94f1ee450a..658c817619 100644
--- a/crawl-ref/source/SDLMain.m
+++ b/crawl-ref/source/SDLMain.m
@@ -26,8 +26,8 @@
/* Portions of CPS.h */
typedef struct CPSProcessSerNum
{
- UInt32 lo;
- UInt32 hi;
+ UInt32 lo;
+ UInt32 hi;
} CPSProcessSerNum;
extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
@@ -87,15 +87,16 @@ static NSString *getApplicationName(void)
if (shouldChdir)
{
char parentdir[MAXPATHLEN];
- CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
- CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
- if (CFURLGetFileSystemRepresentation(url2, true, (UInt8 *)parentdir, MAXPATHLEN)) {
- assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */
- }
- CFRelease(url);
- CFRelease(url2);
- }
-
+ CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
+ CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
+ if (CFURLGetFileSystemRepresentation(url2, true, (UInt8 *)parentdir,
+ MAXPATHLEN))
+ {
+ assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */
+ }
+ CFRelease(url);
+ CFRelease(url2);
+ }
}
#if SDL_USE_NIB_FILE
@@ -358,13 +359,16 @@ int main (int argc, char **argv)
{
/* Copy the arguments into a global variable */
/* This is passed if we are launched by double-clicking */
- if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
+ if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 )
+ {
gArgv = (char **) SDL_malloc(sizeof (char *) * 2);
gArgv[0] = argv[0];
gArgv[1] = NULL;
gArgc = 1;
gFinderLaunch = YES;
- } else {
+ }
+ else
+ {
int i;
gArgc = argc;
gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1));
@@ -381,4 +385,3 @@ int main (int argc, char **argv)
#endif
return 0;
}
-
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index f531c50491..7f44ec6ffc 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -4948,7 +4948,9 @@ void bolt::affect_monster(monsters* mon)
{
msg::stream << mon->name(DESC_CAP_THE) << " deflects the "
<< name << '!' << std::endl;
- } else {
+ }
+ else
+ {
msg::stream << "The " << name << " misses "
<< mon->name(DESC_NOCAP_THE) << '.' << std::endl;
}
@@ -5968,7 +5970,8 @@ void bolt::determine_affected_cells(explosion_map& m, const coord_def& delta,
for (unsigned int i = 0; i < aoe_funcs.size(); ++i)
hits = (*aoe_funcs[i])(*this, loc) && hits;
- if (hits) {
+ if (hits)
+ {
// Hmm, I think we're OK.
m(delta + centre) = std::min(count, m(delta + centre));
}
diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc
index 69a4e185fa..9678edc16c 100644
--- a/crawl-ref/source/cloud.cc
+++ b/crawl-ref/source/cloud.cc
@@ -771,14 +771,13 @@ void in_a_cloud()
case CLOUD_MUTAGENIC:
mpr("You are engulfed in a mutagenic fog!");
- if (coinflip()) {
+ if (coinflip())
+ {
mpr("Strange energies course through your body.");
if (one_chance_in(3))
you.mutate();
else
- {
give_bad_mutation();
- }
}
break;
diff --git a/crawl-ref/source/crash-u.cc b/crawl-ref/source/crash-u.cc
index 5b6614ad9d..b1309b385e 100644
--- a/crawl-ref/source/crash-u.cc
+++ b/crawl-ref/source/crash-u.cc
@@ -215,7 +215,8 @@ void write_stack_trace(FILE* file, int ignore_count)
// Now we prettify the printout to even show demangled C++ function names.
std::string bt = "";
- for (int i = 0; i < num_frames; i++) {
+ for (int i = 0; i < num_frames; i++)
+ {
#if defined (TARGET_OS_MACOSX)
char *addr = ::strstr(symbols[i], "0x");
char *mangled = ::strchr(addr, ' ') + 1;
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 1da42f3958..aab2d4e0e4 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -2997,7 +2997,9 @@ static builder_rc_type _builder_basic(int level_number)
#ifdef DEBUG_DIAGNOSTICS
mprf(MSGCH_DIAGNOSTICS, "Trail ends in shaft.");
#endif
- } else {
+ }
+ else
+ {
grd[xend][yend] = DNGN_FLOOR;
#ifdef DEBUG_DIAGNOSTICS
mprf(MSGCH_DIAGNOSTICS, "Trail does not end in shaft..");
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index ce7f664cea..7573ca6313 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -4092,14 +4092,18 @@ static void _catchup_monster_moves(monsters *mon, int turns)
}
bool changed = 0;
- for (int i = 0; i < range/x; i++) {
+ for (int i = 0; i < range/x; i++)
+ {
if (mon->behaviour == BEH_SLEEP)
break;
- if (coinflip()) {
+
+ if (coinflip())
+ {
changed = 1;
- if (coinflip()) {
+ if (coinflip())
mon->behaviour = BEH_SLEEP;
- } else {
+ else
+ {
mon->behaviour = BEH_WANDER;
mon->foe = MHITNOT;
mon->target = random_in_bounds();
diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc
index 80da72274b..81bf6479e8 100644
--- a/crawl-ref/source/hiscores.cc
+++ b/crawl-ref/source/hiscores.cc
@@ -1084,8 +1084,10 @@ void scorefile_entry::init()
best_skill_lvl = you.skills[ best_skill ];
// Note all skills at level 27.
- for (int sk = 0; sk < NUM_SKILLS; ++sk) {
- if (you.skills[sk] == 27) {
+ for (int sk = 0; sk < NUM_SKILLS; ++sk)
+ {
+ if (you.skills[sk] == 27)
+ {
if (!maxed_skills.empty())
maxed_skills += ",";
maxed_skills += skill_name(sk);
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 158112a087..9fdbf2a886 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -907,7 +907,8 @@ void game_options::reset_options()
// Otherwise, do a check to see if we're using Apple_Terminal.
#ifndef USE_8_COLOUR_TERM_MAP
const char *term_program = getenv("TERM_PROGRAM");
- if (term_program && strcmp(term_program, "Apple_Terminal") == 0) {
+ if (term_program && strcmp(term_program, "Apple_Terminal") == 0)
+ {
#endif
for (int i = 0; i < 16; ++i)
colour[i] = i % 8;
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 91eea53903..abb21d0fc2 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -2096,7 +2096,8 @@ bool setup_missile_beam(const actor *agent, bolt &beam, item_def &item,
beam.damage_funcs.push_back(_silver_damages_victim);
if (poisoned)
beam.hit_funcs.push_back(_poison_hit_victim);
- if (penetrating) {
+ if (penetrating)
+ {
beam.range_funcs.push_back(_item_penetrates_victim);
beam.hit_verb = "passes through";
}
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index ad2d189658..a167165398 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -2313,9 +2313,8 @@ bool item_needs_autopickup(const item_def &item)
if ((item.flags & ISFLAG_THROWN) && Options.pickup_thrown)
return (true);
- if ((item.flags & ISFLAG_DROPPED) && !Options.pickup_dropped) {
+ if ((item.flags & ISFLAG_DROPPED) && !Options.pickup_dropped)
return (false);
- }
std::string itemname;
return _is_option_autopickup(item, itemname);
diff --git a/crawl-ref/source/l_mons.cc b/crawl-ref/source/l_mons.cc
index 0f7a4b75b8..9071039a65 100644
--- a/crawl-ref/source/l_mons.cc
+++ b/crawl-ref/source/l_mons.cc
@@ -125,8 +125,8 @@ static int l_mons_do_dismiss(lua_State *ls)
// dismiss is only callable from dlua, not from managed VMs (i.e.
// end-user scripts cannot dismiss monsters).
ASSERT_DLUA;
- monsters *mons =
- util_get_userdata<monsters>(ls, lua_upvalueindex(1));
+ monsters *mons = util_get_userdata<monsters>(ls, lua_upvalueindex(1));
+
if (mons->alive())
{
mons->flags |= MF_HARD_RESET;
@@ -142,12 +142,11 @@ static int l_mons_do_random_teleport(lua_State *ls)
// We should only be able to teleport monsters from dlua.
ASSERT_DLUA;
- monsters *mons =
- util_get_userdata<monsters>(ls, lua_upvalueindex(1));
+ monsters *mons = util_get_userdata<monsters>(ls, lua_upvalueindex(1));
+
if (mons->alive())
- {
mons->teleport(true);
- }
+
return (0);
}
@@ -241,10 +240,8 @@ static int monster_get(lua_State *ls)
return (0);
for (unsigned i = 0; i < sizeof(mons_attrs) / sizeof(mons_attrs[0]); ++i)
- {
if (!strcmp(attr, mons_attrs[i].attribute))
return (mons_attrs[i].accessor(ls, mw->mons, attr));
- }
return (0);
}
@@ -259,11 +256,14 @@ static const char *_monster_behaviour_names[] = {
"lurk"
};
-static beh_type behaviour_by_name(const std::string &name) {
+static beh_type behaviour_by_name(const std::string &name)
+{
ASSERT(ARRAYSZ(_monster_behaviour_names) == NUM_BEHAVIOURS);
+
for (unsigned i = 0; i < ARRAYSZ(_monster_behaviour_names); ++i)
if (name == _monster_behaviour_names[i])
return static_cast<beh_type>(i);
+
return NUM_BEHAVIOURS;
}
@@ -281,12 +281,13 @@ static int monster_set(lua_State *ls)
if (!attr)
return (0);
- if (!strcmp(attr, "beh")) {
+ if (!strcmp(attr, "beh"))
+ {
const beh_type beh =
- lua_isnumber(ls, 3) ?
- static_cast<beh_type>(luaL_checkint(ls, 3)) :
- lua_isstring(ls, 3) ? behaviour_by_name(lua_tostring(ls, 3)) :
- NUM_BEHAVIOURS;
+ lua_isnumber(ls, 3) ? static_cast<beh_type>(luaL_checkint(ls, 3)) :
+ lua_isstring(ls, 3) ? behaviour_by_name(lua_tostring(ls, 3))
+ : NUM_BEHAVIOURS;
+
if (beh != NUM_BEHAVIOURS)
mw->mons->behaviour = beh;
}
@@ -294,17 +295,21 @@ static int monster_set(lua_State *ls)
return (0);
}
-static int mons_behaviour(lua_State *ls) {
+static int mons_behaviour(lua_State *ls)
+{
if (lua_gettop(ls) < 1)
return (0);
- if (lua_isnumber(ls, 1)) {
+ if (lua_isnumber(ls, 1))
+ {
lua_pushvalue(ls, 1);
return (1);
}
- else if (lua_isstring(ls, 1)) {
+ else if (lua_isstring(ls, 1))
+ {
const beh_type beh = behaviour_by_name(lua_tostring(ls, 1));
- if (beh != NUM_BEHAVIOURS) {
+ if (beh != NUM_BEHAVIOURS)
+ {
lua_pushnumber(ls, beh);
return (1);
}
diff --git a/crawl-ref/source/mon-stuff.cc b/crawl-ref/source/mon-stuff.cc
index fc109c5aee..afe17384ac 100644
--- a/crawl-ref/source/mon-stuff.cc
+++ b/crawl-ref/source/mon-stuff.cc
@@ -1115,7 +1115,7 @@ static void _elven_twin_died(monsters* twin, bool in_transit)
found_duvessa = true;
break;
}
- else if (mi->type == MONS_DOWAN
+ else if (mi->type == MONS_DOWAN
|| (mi->props.exists("original_name")
&& mi->props["original_name"].get_string() == "Dowan"))
{
@@ -2095,8 +2095,8 @@ int monster_die(monsters *monster, killer_type killer,
// And his vault can be placed again.
you.uniq_map_names.erase("uniq_boris");
}
- else if (monster->type == MONS_KIRKE
- || (monster->props.exists("original_name")
+ else if (monster->type == MONS_KIRKE
+ || (monster->props.exists("original_name")
&& monster->props["original_name"].get_string() == "Kirke")
&& !in_transit)
{
@@ -3708,7 +3708,6 @@ void monster_teleport(monsters *monster, bool instan, bool silent)
monster->add_ench( mon_enchant(ENCH_TP, 0, KC_OTHER,
random_range(20, 30)) );
}
-
return;
}
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 1c25a5ee72..480730e6f9 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -1447,7 +1447,7 @@ bool _cell_vetoes_teleport (const coord_def cell, bool check_monsters = true)
}
}
-void _handle_teleport_update (bool large_change, bool check_ring_TC,
+void _handle_teleport_update (bool large_change, bool check_ring_TC,
const coord_def old_pos)
{
if (large_change)
@@ -1566,9 +1566,13 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area, bool wizar
if (pos == you.pos() || pos == coord_def(-1,-1))
{
if (!wizard_tele)
+ {
if (!yesno("Are you sure you want to cancel this teleport?",
true, 'n'))
+ {
continue;
+ }
+ }
you.turn_is_over = false;
return (false);
}
@@ -1582,7 +1586,6 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area, bool wizar
more();
continue;
}
-
break;
}
@@ -1598,8 +1601,8 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area, bool wizar
pos.y += random2(3) - 1;
}
#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
- "Scattered target square (%d, %d)", pos.x, pos.y);
+ mprf(MSGCH_DIAGNOSTICS,
+ "Scattered target square (%d, %d)", pos.x, pos.y);
#endif
}
@@ -1729,7 +1732,8 @@ bool you_teleport_to (const coord_def where_to, bool move_monsters)
monsters *mons = monster_at(where);
mons->teleport(true);
}
- else {
+ else
+ {
for (adjacent_iterator ai(where); ai; ++ai)
{
if (!_cell_vetoes_teleport(*ai))
@@ -1739,7 +1743,7 @@ bool you_teleport_to (const coord_def where_to, bool move_monsters)
}
else
{
- if (monster_at(*ai) && move_monsters
+ if (monster_at(*ai) && move_monsters
&& !_cell_vetoes_teleport(*ai, false))
{
monsters *mons = monster_at(*ai);
@@ -1769,7 +1773,7 @@ bool you_teleport_to (const coord_def where_to, bool move_monsters)
void you_teleport_now(bool allow_control, bool new_abyss_area, bool wizard_tele)
{
- const bool randtele = _teleport_player(allow_control, new_abyss_area,
+ const bool randtele = _teleport_player(allow_control, new_abyss_area,
wizard_tele);
// Xom is amused by uncontrolled teleports that land you in a
diff --git a/crawl-ref/source/teleport.cc b/crawl-ref/source/teleport.cc
index c3b553552f..375c9f96bf 100644
--- a/crawl-ref/source/teleport.cc
+++ b/crawl-ref/source/teleport.cc
@@ -269,9 +269,11 @@ bool random_near_space(const coord_def& origin, coord_def& target,
int walls_between = 0;
if (!crawl_state.arena)
+ {
walls_between = num_feats_between(target, you.pos(),
DNGN_CLEAR_ROCK_WALL,
DNGN_CLEAR_PERMAROCK_WALL);
+ }
if (walls_between >= min_walls_between)
return (true);
@@ -279,5 +281,3 @@ bool random_near_space(const coord_def& origin, coord_def& target,
return (false);
}
-
-