summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/dungeon.cc18
-rw-r--r--crawl-ref/source/enum.h10
-rw-r--r--crawl-ref/source/item_use.cc35
-rw-r--r--crawl-ref/source/items.cc4
-rw-r--r--crawl-ref/source/libgui.cc5
-rw-r--r--crawl-ref/source/output.cc7
-rw-r--r--crawl-ref/source/religion.cc3
-rw-r--r--crawl-ref/source/tile1.cc6
-rw-r--r--crawl-ref/source/tile2.cc23
-rw-r--r--crawl-ref/source/traps.cc18
-rw-r--r--crawl-ref/source/view.cc52
11 files changed, 101 insertions, 80 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 4f75b55a7a..83e412f529 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -2354,8 +2354,8 @@ static bool _shaft_is_in_corridor(int x, int y)
return (true);
}
- // No corridor (found).
- return false;
+ // No corridor found.
+ return (false);
}
static void _place_traps(int level_number)
@@ -2437,8 +2437,8 @@ static void _place_fog_machines(int level_number)
break;
place_fog_machine(data, x, y);
- } // end "for i"
-} // end place_traps()
+ }
+}
static void _place_specific_feature(dungeon_feature_type feat)
{
@@ -7233,13 +7233,13 @@ bool place_specific_trap(int spec_x, int spec_y, trap_type spec_type)
if (env.trap[tcount].type == TRAP_UNASSIGNED)
{
env.trap[tcount].type = spec_type;
- env.trap[tcount].x = spec_x;
- env.trap[tcount].y = spec_y;
- grd[spec_x][spec_y] = DNGN_UNDISCOVERED_TRAP;
- return true;
+ env.trap[tcount].x = spec_x;
+ env.trap[tcount].y = spec_y;
+ grd[spec_x][spec_y] = DNGN_UNDISCOVERED_TRAP;
+ return (true);
}
- return false;
+ return (false);
}
static void _build_river( dungeon_feature_type river_type ) //mv
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index d9fb425c16..abd9e474ee 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -2641,11 +2641,11 @@ enum targeting_type
enum torment_source_type
{
TORMENT_GENERIC = -1,
- TORMENT_CARDS = -2, // Symbol of torment
- TORMENT_SPWLD = -3, // Special wield torment
- TORMENT_SCROLL = -4,
- TORMENT_SPELL = -5, // SPELL_SYMBOL_OF_TORMENT
- TORMENT_XOM = -6 // Xom effect
+ TORMENT_CARDS = -2, // Symbol of torment
+ TORMENT_SPWLD = -3, // Special wield torment
+ TORMENT_SCROLL = -4,
+ TORMENT_SPELL = -5, // SPELL_SYMBOL_OF_TORMENT
+ TORMENT_XOM = -6 // Xom effect
};
enum trap_type // env.trap_type[]
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index d48cfe2fb4..96d5f3f4d3 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -1311,6 +1311,10 @@ void fire_target_behaviour::message_ammo_prompt(const std::string* pre_text)
const int next_item = get_next_fire_item(m_slot, +1);
bool no_other_items = (next_item == -1 || next_item == m_slot);
+ // How many letters are only needed for formatting, but won't ever
+ // be printed.
+ int colour_length = 0;
+
mesclr();
if (pre_text)
@@ -1322,7 +1326,8 @@ void fire_target_behaviour::message_ammo_prompt(const std::string* pre_text)
else
{
const item_def& item_def = you.inv[m_slot];
- const launch_retval projected = is_launched(&you, you.weapon(), item_def);
+ const launch_retval projected = is_launched(&you, you.weapon(),
+ item_def);
if (projected == LRET_FUMBLED)
msg << "Awkwardly throwing ";
@@ -1334,22 +1339,32 @@ void fire_target_behaviour::message_ammo_prompt(const std::string* pre_text)
msg << "Buggy ";
}
- msg << (no_other_items ? "(i - inventory)" : "(i - inventory. (,) - cycle)")
+ msg << (no_other_items ? "(i - inventory)"
+ : "(i - inventory. (,) - cycle)")
<< ": ";
if (m_slot == -1)
{
msg << "<red>" << m_noitem_reason << "</red>";
+ colour_length = 5;
}
else
{
- const char* color = (selected_from_inventory ? "grey" : "w");
- msg << "<" << color << ">"
+ const char* colour = (selected_from_inventory ? "lightgrey" : "w");
+ msg << "<" << colour << ">"
<< you.inv[m_slot].name(DESC_INVENTORY_EQUIP)
- << "</" << color << ">";
+ << "</" << colour << ">";
+ colour_length = (selected_from_inventory ? 11 : 3);
}
- formatted_message_history(msg.str(), MSGCH_PROMPT);
+#ifdef USE_TILE
+ if (selected_from_inventory)
+ tile_draw_inv(REGION_INV1);
+#endif
+
+ formatted_message_history(msg.str()
+ .substr(0, crawl_view.msgsz.x + colour_length),
+ MSGCH_PROMPT);
}
bool fire_target_behaviour::should_redraw()
@@ -1381,7 +1396,7 @@ command_type fire_target_behaviour::get_command(int key)
m_slot = next;
selected_from_inventory = false;
}
- // Do this stuff unconditionally to make the prompt redraw
+ // Do this stuff unconditionally to make the prompt redraw.
message_ammo_prompt();
need_prompt = true;
break;
@@ -1397,7 +1412,7 @@ command_type fire_target_behaviour::get_command(int key)
}
message_ammo_prompt( err.length() ? &err : NULL );
need_prompt = true;
- return CMD_NO_CMD;
+ return (CMD_NO_CMD);
}
case '?':
show_targeting_help();
@@ -1446,7 +1461,7 @@ static bool _fire_choose_item_and_target(int& slot, dist& target,
// If ammo was chosen via 'fi', it's not supposed to get quivered.
// Otherwise, if the user chose different ammo, quiver it.
// Same for items selected in tile mode.
- if (was_chosen || ! beh.selected_from_inventory)
+ if (was_chosen || !beh.selected_from_inventory)
{
you.m_quiver->on_item_fired(you.inv[beh.m_slot]);
}
@@ -3977,7 +3992,7 @@ bool enchant_armour( int &ac_change, bool quiet, item_def &arm )
TilePlayerRefresh();
#endif
- // no additional enchantment
+ // No additional enchantment.
return (true);
}
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 7eb738e89d..a3ffa4a1cb 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -1921,14 +1921,14 @@ bool drop_item( int item_dropped, int quant_drop, bool try_offer )
&& !copy_item_to_grid( you.inv[item_dropped],
you.x_pos, you.y_pos, quant_drop, true ))
{
- mpr( "Too many items on this level, not dropping the item." );
+ mpr("Too many items on this level, not dropping the item.");
return (false);
}
mprf("You drop %s.",
quant_name(you.inv[item_dropped], quant_drop, DESC_NOCAP_A).c_str());
- if ( grid_destroys_items(my_grid) )
+ if (grid_destroys_items(my_grid))
{
if ( !silenced(you.pos()) )
mprf(MSGCH_SOUND, grid_item_destruction_message(my_grid));
diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc
index 13c0b7e3f2..b39b8ca26b 100644
--- a/crawl-ref/source/libgui.cc
+++ b/crawl-ref/source/libgui.cc
@@ -1278,10 +1278,11 @@ static int _handle_mouse_motion(int mouse_x, int mouse_y, bool init)
else
mode = convert_cursor_pos(mouse_x, mouse_y, &cx, &cy);
- if (oldcx == cx && oldcy == cy && oldmode == mode) return 0;
+ if (oldcx == cx && oldcy == cy && oldmode == mode)
+ return 0;
// erase old cursor
- if ( oldmode == REGION_DNGN && mode != oldmode)
+ if (oldmode == REGION_DNGN && mode != oldmode)
{
oldcx = -10;
//_setcursortype(0);
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 1774818fc4..f190f6aa18 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -105,7 +105,7 @@ class colour_bar
#endif
const int width = crawl_view.hudsz.x - (ox-1);
- const int disp = width * val / max_val;
+ const int disp = width * val / max_val;
const int old_disp = (m_old_disp < 0) ? disp : m_old_disp;
m_old_disp = disp;
@@ -528,7 +528,8 @@ static void _print_stats_qv(int y)
else if (item != NULL && is_valid_item(*item))
{
textcolor(item->colour);
- cprintf("-) %s", item->name(DESC_PLAIN, true).c_str());
+ cprintf("-) %s", item->name(DESC_PLAIN, true)
+ .substr(0, crawl_view.hudsz.x - 15).c_str());
textcolor(RED);
cprintf(" (empty)");
}
@@ -1489,7 +1490,7 @@ void update_monster_pane()
}
}
#else
-// FIXME: implement this for tiles
+// FIXME: Implement this for Tiles!
void update_monster_pane() {}
#endif
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 6ab9b2cd3d..ee472d24da 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -458,7 +458,8 @@ bool god_gives_permanent_followers(god_type god)
// Only TSO, Yredelemnul, and Beogh do this, but if you switch from
// TSO to another good god, you keep your (non-daeva) permanent
// followers, so count the other good gods here as well.
- return (is_good_god(god)
+ return (god == GOD_SHINING_ONE
+ || you.worshipped[GOD_SHINING_ONE] && is_good_god(god)
|| god == GOD_YREDELEMNUL
|| god == GOD_BEOGH);
}
diff --git a/crawl-ref/source/tile1.cc b/crawl-ref/source/tile1.cc
index c540f3b3ba..2f0c3f9aae 100644
--- a/crawl-ref/source/tile1.cc
+++ b/crawl-ref/source/tile1.cc
@@ -34,8 +34,8 @@ static FixedArray < unsigned int, GXM, GYM > tile_dngn;
bool is_bazaar()
{
- return (you.level_type == LEVEL_PORTAL_VAULT &&
- you.level_type_name == "bazaar");
+ return (you.level_type == LEVEL_PORTAL_VAULT
+ && you.level_type_name == "bazaar");
}
unsigned short get_bazaar_special_colour()
@@ -391,7 +391,7 @@ static int _tileidx_monster_base(int mon_idx, bool detected)
{
// Use item tile
item_def item = mitm[menv[mon_idx].inv[MSLOT_WEAPON]];
- return tileidx_item(item) | TILE_FLAG_ANIM_WEP;
+ return tileidx_item(item) | TILE_FLAG_ANIM_WEP;
}
case MONS_TITAN:
diff --git a/crawl-ref/source/tile2.cc b/crawl-ref/source/tile2.cc
index 279e5bf378..c4ee319a0c 100644
--- a/crawl-ref/source/tile2.cc
+++ b/crawl-ref/source/tile2.cc
@@ -2853,7 +2853,8 @@ void TileDrawInvData(int n, int flag, int *tiles, int *num, int *idx,
int *iflags)
{
int i;
- TileRegionClass *r = (flag == REGION_INV1) ? region_item:region_item2;
+ TileRegionClass *r = (flag == REGION_INV1 ? region_item
+ : region_item2);
r->flag = true;
@@ -2869,19 +2870,19 @@ void TileDrawInvData(int n, int flag, int *tiles, int *num, int *idx,
if (i == MAX_ITEMLIST)
break;
- int tile0 = (i>=n) ? -1 : tiles[i];
- int idx0 = (i>=n) ? -1 : idx[i];
+ int tile0 = (i >= n) ? -1 : tiles[i];
+ int idx0 = (i >= n) ? -1 : idx[i];
char key = (iflags[i] & TILEI_FLAG_FLOOR) ? 0
: index_to_letter(idx[i]);
- if ( flag == itemlist_flag
- && tile0 == itemlist[i]
- && num[i] == itemlist_num[i]
- && key == itemlist_key[i]
- && idx0 == itemlist_idx[i]
- && iflags[i] == itemlist_iflag[i]
- && !force_redraw_inv
- && i < old_itemlist_n)
+ if (flag == itemlist_flag
+ && tile0 == itemlist[i]
+ && num[i] == itemlist_num[i]
+ && key == itemlist_key[i]
+ && idx0 == itemlist_idx[i]
+ && iflags[i] == itemlist_iflag[i]
+ && !force_redraw_inv
+ && i < old_itemlist_n)
{
continue;
}
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc
index d6646e9dba..1434640c19 100644
--- a/crawl-ref/source/traps.cc
+++ b/crawl-ref/source/traps.cc
@@ -472,10 +472,10 @@ void handle_traps(trap_type trt, int i, bool trap_known)
void destroy_trap( const coord_def& pos )
{
- for ( int i = 0; i < MAX_TRAPS; ++i )
+ for (int i = 0; i < MAX_TRAPS; ++i)
{
- if ( env.trap[i].x == pos.x && env.trap[i].y == pos.y &&
- env.trap[i].type != TRAP_UNASSIGNED )
+ if (env.trap[i].x == pos.x && env.trap[i].y == pos.y
+ && env.trap[i].type != TRAP_UNASSIGNED)
{
grd(pos) = DNGN_FLOOR;
env.trap[i].type = TRAP_UNASSIGNED;
@@ -954,7 +954,7 @@ bool is_valid_shaft_level(const level_id &place)
if (place.level_type != LEVEL_DUNGEON)
return (false);
- // disallow shafts on the first two levels
+ // Disallow shafts on the first two levels.
if (place.branch == BRANCH_MAIN_DUNGEON
&& you.your_level < 2)
{
@@ -1147,9 +1147,9 @@ static trap_type random_trap_default(int level_number, const level_id &place)
if (random2(1 + level_number) > 11)
type = TRAP_BLADE;
- if ((random2(1 + level_number) > 14 && one_chance_in(3))
- || (place.branch == BRANCH_HALL_OF_ZOT &&
- place.level_type == LEVEL_DUNGEON && coinflip()))
+ if (random2(1 + level_number) > 14 && one_chance_in(3)
+ || (place.branch == BRANCH_HALL_OF_ZOT
+ && place.level_type == LEVEL_DUNGEON && coinflip()))
{
type = TRAP_ZOT;
}
@@ -1168,7 +1168,7 @@ trap_type random_trap_for_place(int level_number, const level_id &place)
{
if (level_number == -1)
{
- switch(place.level_type)
+ switch (place.level_type)
{
case LEVEL_DUNGEON:
level_number = absdungeon_depth(place.branch, place.depth);
@@ -1184,7 +1184,7 @@ trap_type random_trap_for_place(int level_number, const level_id &place)
}
}
- switch(place.level_type)
+ switch (place.level_type)
{
case LEVEL_DUNGEON:
if (branches[place.branch].rand_trap_function != NULL)
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index e0ca6d1eea..ca754b3d44 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -2670,7 +2670,7 @@ void losight(env_show_grid &sh,
bool is_feature(int feature, int x, int y)
{
if (!env.map[x][y].object)
- return false;
+ return (false);
// 'grid' can fit in an unsigned char, but making this a short shuts up
// warnings about out-of-range case values.
@@ -2702,9 +2702,9 @@ bool is_feature(int feature, int x, int y)
case DNGN_ALTAR_ELYVILON:
case DNGN_ALTAR_LUGONU:
case DNGN_ALTAR_BEOGH:
- return true;
+ return (true);
default:
- return false;
+ return (false);
}
case '\t':
case '\\':
@@ -2727,9 +2727,9 @@ bool is_feature(int feature, int x, int y)
case DNGN_TRANSIT_PANDEMONIUM:
case DNGN_ENTER_ZOT:
case DNGN_RETURN_FROM_ZOT:
- return true;
+ return (true);
default:
- return false;
+ return (false);
}
case '<':
switch (grid)
@@ -2752,9 +2752,9 @@ bool is_feature(int feature, int x, int y)
case DNGN_RETURN_FROM_SWAMP:
case DNGN_RETURN_FROM_SHOALS:
case DNGN_EXIT_PORTAL_VAULT:
- return true;
+ return (true);
default:
- return false;
+ return (false);
}
case '>':
switch (grid)
@@ -2776,9 +2776,9 @@ bool is_feature(int feature, int x, int y)
case DNGN_ENTER_TOMB:
case DNGN_ENTER_SWAMP:
case DNGN_ENTER_SHOALS:
- return true;
+ return (true);
default:
- return false;
+ return (false);
}
case '^':
switch (grid)
@@ -2786,9 +2786,9 @@ bool is_feature(int feature, int x, int y)
case DNGN_TRAP_MECHANICAL:
case DNGN_TRAP_MAGICAL:
case DNGN_TRAP_NATURAL:
- return true;
+ return (true);
default:
- return false;
+ return (false);
}
default:
return get_envmap_char(x, y) == (unsigned) feature;
@@ -3161,8 +3161,10 @@ void show_map( coord_def &spec_place, bool travel_mode )
getty = unmangle_direction_keys(getchm(KC_LEVELMAP), KC_LEVELMAP,
false, false);
#ifdef USE_TILE
- if (getty == CK_MOUSE_B4) getty = '-';
- if (getty == CK_MOUSE_B5) getty = '+';
+ if (getty == CK_MOUSE_B4)
+ getty = '-';
+ else if (getty == CK_MOUSE_B5)
+ getty = '+';
#endif
c_input_reset(false);
@@ -3613,7 +3615,7 @@ bool magic_mapping(int map_radius, int proportion, bool suppress_msg,
}
#ifdef USE_TILE
- GmapInit(true); // re-draw tile backup
+ GmapInit(true); // Re-draw tile backup.
tile_clear_buf();
#endif
@@ -5303,24 +5305,24 @@ void crawl_view_geometry::init_geometry()
}
const _layout* winner = &lay_inline;
- if ( Options.mlist_allow_alternate_layout
- && !Options.classic_hud
- && lay_mlist.valid)
+ if (Options.mlist_allow_alternate_layout
+ && !Options.classic_hud
+ && lay_mlist.valid)
{
winner = &lay_mlist;
}
- msgp = winner->msgp;
- msgsz = winner->msgsz;
- viewp = winner->viewp;
- viewsz = winner->viewsz;
- hudp = winner->hudp;
- hudsz = winner->hudsz;
- mlistp = winner->mlistp;
+ msgp = winner->msgp;
+ msgsz = winner->msgsz;
+ viewp = winner->viewp;
+ viewsz = winner->viewsz;
+ hudp = winner->hudp;
+ hudsz = winner->hudsz;
+ mlistp = winner->mlistp;
mlistsz = winner->mlistsz;
#ifdef USE_TILE
- // libgui may redefine these based on its own settings
+ // libgui may redefine these based on its own settings.
gui_init_view_params(*this);
#endif