summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/acr.cc498
-rw-r--r--crawl-ref/source/externs.h4
-rw-r--r--crawl-ref/source/initfile.cc260
-rw-r--r--crawl-ref/source/items.cc152
-rw-r--r--crawl-ref/source/items.h11
-rw-r--r--crawl-ref/source/libgui.cc96
-rw-r--r--crawl-ref/source/newgame.cc2
-rw-r--r--crawl-ref/source/tile1.cc65
-rw-r--r--crawl-ref/source/tile2.cc23
-rw-r--r--crawl-ref/source/tiles.h2
10 files changed, 546 insertions, 567 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index e032f33393..a08c5aeb77 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -169,35 +169,34 @@ const struct coord_def Compass[8] =
};
// Functions in main module
-static void do_berserk_no_combat_penalty(void);
-static bool initialise(void);
-static void input(void);
-static void move_player(int move_x, int move_y);
-static void open_door(int move_x, int move_y, bool check_confused = true);
-static void close_door(int move_x, int move_y);
-static void start_running( int dir, int mode );
-
-static void prep_input();
-static void input();
-static void world_reacts();
-static command_type get_next_cmd();
-static keycode_type get_next_keycode();
-static command_type keycode_to_command( keycode_type key );
-static void setup_cmd_repeat();
-static void do_prev_cmd_again();
-static void update_replay_state();
-
-static void show_commandline_options_help();
-static void wanderer_startup_message();
-static void god_greeting_message( bool game_start );
-static void take_starting_note();
-static void startup_tutorial();
+static void _do_berserk_no_combat_penalty(void);
+static bool _initialise(void);
+static void _input(void);
+static void _move_player(int move_x, int move_y);
+static void _open_door(int move_x, int move_y, bool check_confused = true);
+static void _close_door(int move_x, int move_y);
+static void _start_running( int dir, int mode );
+
+static void _prep_input();
+static void _world_reacts();
+static command_type _get_next_cmd();
+static keycode_type _get_next_keycode();
+static command_type _keycode_to_command( keycode_type key );
+static void _setup_cmd_repeat();
+static void _do_prev_cmd_again();
+static void _update_replay_state();
+
+static void _show_commandline_options_help();
+static void _wanderer_startup_message();
+static void _god_greeting_message( bool game_start );
+static void _take_starting_note();
+static void _startup_tutorial();
#ifdef DGL_SIMPLE_MESSAGING
-static void read_messages();
+static void _read_messages();
#endif
-static void compile_time_asserts();
+static void _compile_time_asserts();
/*
It all starts here. Some initialisations are run first, then straight to
@@ -209,14 +208,14 @@ int old_main( int argc, char *argv[] )
int main( int argc, char *argv[] )
#endif
{
- compile_time_asserts(); // just to quiet "unused static function" warning
+ _compile_time_asserts(); // just to quiet "unused static function" warning
// Load in the system environment variables
get_system_environment();
// parse command line args -- look only for initfile & crawl_dir entries
if (!parse_args(argc, argv, true))
{
- show_commandline_options_help();
+ _show_commandline_options_help();
return 1;
}
@@ -241,7 +240,7 @@ int main( int argc, char *argv[] )
SysEnv.scorefile.clear();
}
- const bool game_start = initialise();
+ const bool game_start = _initialise();
// override some options for tutorial
init_tutorial_options();
@@ -256,9 +255,9 @@ int main( int argc, char *argv[] )
env.markers.activate_all();
if (game_start && you.char_class == JOB_WANDERER)
- wanderer_startup_message();
+ _wanderer_startup_message();
- god_greeting_message( game_start );
+ _god_greeting_message( game_start );
// warn player about their weapon, if unsuitable
wield_warning(false);
@@ -266,12 +265,12 @@ int main( int argc, char *argv[] )
if ( game_start )
{
if (Options.tutorial_left)
- startup_tutorial();
- take_starting_note();
+ _startup_tutorial();
+ _take_starting_note();
}
while (true)
- input();
+ _input();
// Should never reach this stage, right?
#if defined(USE_TILE)
@@ -283,7 +282,7 @@ int main( int argc, char *argv[] )
return 0;
} // end main()
-static void show_commandline_options_help()
+static void _show_commandline_options_help()
{
puts("Command line options:");
puts(" -name <string> character name");
@@ -306,7 +305,7 @@ static void show_commandline_options_help()
puts(" -scorefile <filename> scorefile to report on");
}
-static void wanderer_startup_message()
+static void _wanderer_startup_message()
{
int skill_levels = 0;
for (int i = 0; i < NUM_SKILLS; i++)
@@ -323,7 +322,7 @@ static void wanderer_startup_message()
}
}
-static void god_greeting_message( bool game_start )
+static void _god_greeting_message( bool game_start )
{
switch (you.religion)
{
@@ -374,7 +373,7 @@ static void god_greeting_message( bool game_start )
}
}
-static void take_starting_note()
+static void _take_starting_note()
{
std::ostringstream notestr;
notestr << you.your_name << ", the "
@@ -392,23 +391,25 @@ static void take_starting_note()
notestr.str().c_str()));
}
-static void startup_tutorial()
+static void _startup_tutorial()
{
// don't allow triggering at game start
Options.tut_just_triggered = true;
+
// print stats and everything
- prep_input();
+ _prep_input();
+
msg::streams(MSGCH_TUTORIAL)
<< "Press any key to start the tutorial intro, or Escape to skip it."
<< std::endl;
+
const int ch = c_getch();
-
if (ch != ESCAPE)
tut_starting_screen();
}
#ifdef WIZARD
-static void handle_wizard_command( void )
+static void _handle_wizard_command( void )
{
int wiz_command, i, j, tmp;
char specs[256];
@@ -1098,7 +1099,7 @@ static void handle_wizard_command( void )
#endif
// Set up the running variables for the current run.
-static void start_running( int dir, int mode )
+static void _start_running( int dir, int mode )
{
if (Options.tutorial_events[TUT_SHIFT_RUN] && mode == RMODE_START)
Options.tutorial_events[TUT_SHIFT_RUN] = 0;
@@ -1106,7 +1107,7 @@ static void start_running( int dir, int mode )
you.running.initialise(dir, mode);
}
-static bool recharge_rod( item_def &rod, bool wielded )
+static bool _recharge_rod( item_def &rod, bool wielded )
{
if (!item_is_rod(rod) || rod.plus >= rod.plus2 || !enough_mp(1, true))
return (false);
@@ -1151,25 +1152,27 @@ static bool recharge_rod( item_def &rod, bool wielded )
return (true);
}
-static void recharge_rods()
+static void _recharge_rods()
{
const int wielded = you.equip[EQ_WEAPON];
if (wielded != -1)
{
- if (recharge_rod( you.inv[wielded], true ))
+ if (_recharge_rod( you.inv[wielded], true ))
return ;
}
for (int i = 0; i < ENDOFPACK; ++i)
{
if (i != wielded && is_valid_item(you.inv[i])
- && one_chance_in(3)
- && recharge_rod( you.inv[i], false ))
+ && one_chance_in(3)
+ && _recharge_rod( you.inv[i], false ))
+ {
return;
+ }
}
}
-static bool cmd_is_repeatable(command_type cmd, bool is_again = false)
+static bool _cmd_is_repeatable(command_type cmd, bool is_again = false)
{
switch(cmd)
{
@@ -1269,7 +1272,7 @@ static bool cmd_is_repeatable(command_type cmd, bool is_again = false)
return false;
}
- return cmd_is_repeatable(crawl_state.prev_cmd, true);
+ return _cmd_is_repeatable(crawl_state.prev_cmd, true);
case CMD_MOVE_NOWHERE:
case CMD_REST:
@@ -1309,7 +1312,7 @@ bool apply_berserk_penalty = false;
* This function handles the player's input. It's called from main(),
* from inside an endless loop.
*/
-static void input()
+static void _input()
{
crawl_state.clear_god_acting();
check_beholders();
@@ -1325,7 +1328,7 @@ static void input()
}
you.turn_is_over = false;
- prep_input();
+ _prep_input();
fire_monster_alerts();
@@ -1372,7 +1375,7 @@ static void input()
crawl_state.cancel_cmd_repeat("Cannot move, cancelling command "
"repetition.");
- world_reacts();
+ _world_reacts();
return;
}
@@ -1389,7 +1392,7 @@ static void input()
if ( you_are_delayed() )
{
- world_reacts();
+ _world_reacts();
return;
}
@@ -1397,7 +1400,7 @@ static void input()
if ( you.turn_is_over )
{
- world_reacts();
+ _world_reacts();
return;
}
@@ -1423,7 +1426,7 @@ static void input()
crawl_state.waiting_for_command = true;
c_input_reset(true);
- const command_type cmd = get_next_cmd();
+ const command_type cmd = _get_next_cmd();
crawl_state.waiting_for_command = false;
@@ -1462,14 +1465,14 @@ static void input()
if (you.turn_is_over)
{
if ( apply_berserk_penalty )
- do_berserk_no_combat_penalty();
+ _do_berserk_no_combat_penalty();
- world_reacts();
+ _world_reacts();
}
else
viewwindow(true, false);
- update_replay_state();
+ _update_replay_state();
if (you.num_turns != -1)
{
@@ -1536,14 +1539,14 @@ static void input()
crawl_state.clear_god_acting();
}
-static bool toggle_flag( bool* flag, const char* flagname )
+static bool _toggle_flag( bool* flag, const char* flagname )
{
*flag = !(*flag);
mprf( "%s is now %s.", flagname, (*flag) ? "on" : "off" );
return *flag;
}
-static bool stairs_check_beheld()
+static bool _stairs_check_beheld()
{
if (you.duration[DUR_BEHELD] && !you.duration[DUR_CONF])
{
@@ -1555,12 +1558,12 @@ static bool stairs_check_beheld()
return false;
}
-static void go_downstairs();
-static void go_upstairs()
+static void _go_downstairs();
+static void _go_upstairs()
{
const dungeon_feature_type ygrd = grd(you.pos());
- if (stairs_check_beheld())
+ if (_stairs_check_beheld())
return;
if (you.attribute[ATTR_HELD])
@@ -1591,13 +1594,13 @@ static void go_upstairs()
1 + (you.burden_state > BS_UNENCUMBERED) );
}
-static void go_downstairs()
+static void _go_downstairs()
{
bool shaft = (trap_type_at_xy(you.x_pos, you.y_pos) == TRAP_SHAFT
&& grd[you.x_pos][you.y_pos] != DNGN_UNDISCOVERED_TRAP);
- if (stairs_check_beheld())
+ if (_stairs_check_beheld())
return;
if (shaft && you.flight_mode() == FL_LEVITATE)
@@ -1635,7 +1638,7 @@ static void go_downstairs()
}
}
-static void experience_check()
+static void _experience_check()
{
mprf("You are a level %d %s %s.",
you.experience_level,
@@ -1859,59 +1862,61 @@ void process_command( command_type cmd )
break;
#endif // USE_TILE
- case CMD_OPEN_DOOR_UP_RIGHT: open_door(-1, -1); break;
- case CMD_OPEN_DOOR_UP: open_door( 0, -1); break;
- case CMD_OPEN_DOOR_UP_LEFT: open_door( 1, -1); break;
- case CMD_OPEN_DOOR_RIGHT: open_door( 1, 0); break;
- case CMD_OPEN_DOOR_DOWN_RIGHT: open_door( 1, 1); break;
- case CMD_OPEN_DOOR_DOWN: open_door( 0, 1); break;
- case CMD_OPEN_DOOR_DOWN_LEFT: open_door(-1, 1); break;
- case CMD_OPEN_DOOR_LEFT: open_door(-1, 0); break;
-
- case CMD_MOVE_DOWN_LEFT: move_player(-1, 1); break;
- case CMD_MOVE_DOWN: move_player( 0, 1); break;
- case CMD_MOVE_UP_RIGHT: move_player( 1, -1); break;
- case CMD_MOVE_UP: move_player( 0, -1); break;
- case CMD_MOVE_UP_LEFT: move_player(-1, -1); break;
- case CMD_MOVE_LEFT: move_player(-1, 0); break;
- case CMD_MOVE_DOWN_RIGHT: move_player( 1, 1); break;
- case CMD_MOVE_RIGHT: move_player( 1, 0); break;
+ case CMD_OPEN_DOOR_UP_RIGHT: _open_door(-1, -1); break;
+ case CMD_OPEN_DOOR_UP: _open_door( 0, -1); break;
+ case CMD_OPEN_DOOR_UP_LEFT: _open_door( 1, -1); break;
+ case CMD_OPEN_DOOR_RIGHT: _open_door( 1, 0); break;
+ case CMD_OPEN_DOOR_DOWN_RIGHT: _open_door( 1, 1); break;
+ case CMD_OPEN_DOOR_DOWN: _open_door( 0, 1); break;
+ case CMD_OPEN_DOOR_DOWN_LEFT: _open_door(-1, 1); break;
+ case CMD_OPEN_DOOR_LEFT: _open_door(-1, 0); break;
+
+ case CMD_MOVE_DOWN_LEFT: _move_player(-1, 1); break;
+ case CMD_MOVE_DOWN: _move_player( 0, 1); break;
+ case CMD_MOVE_UP_RIGHT: _move_player( 1, -1); break;
+ case CMD_MOVE_UP: _move_player( 0, -1); break;
+ case CMD_MOVE_UP_LEFT: _move_player(-1, -1); break;
+ case CMD_MOVE_LEFT: _move_player(-1, 0); break;
+ case CMD_MOVE_DOWN_RIGHT: _move_player( 1, 1); break;
+ case CMD_MOVE_RIGHT: _move_player( 1, 0); break;
case CMD_REST:
if (i_feel_safe())
{
- if ( you.hp == you.hp_max &&
- you.magic_points == you.max_magic_points )
+ if ( you.hp == you.hp_max
+ && you.magic_points == you.max_magic_points )
+ {
mpr("You start searching.");
+ }
else
mpr("You start resting.");
}
- start_running( RDIR_REST, RMODE_REST_DURATION );
+ _start_running( RDIR_REST, RMODE_REST_DURATION );
break;
case CMD_RUN_DOWN_LEFT:
- start_running( RDIR_DOWN_LEFT, RMODE_START );
+ _start_running( RDIR_DOWN_LEFT, RMODE_START );
break;
case CMD_RUN_DOWN:
- start_running( RDIR_DOWN, RMODE_START );
+ _start_running( RDIR_DOWN, RMODE_START );
break;
case CMD_RUN_UP_RIGHT:
- start_running( RDIR_UP_RIGHT, RMODE_START );
+ _start_running( RDIR_UP_RIGHT, RMODE_START );
break;
case CMD_RUN_UP:
- start_running( RDIR_UP, RMODE_START );
+ _start_running( RDIR_UP, RMODE_START );
break;
case CMD_RUN_UP_LEFT:
- start_running( RDIR_UP_LEFT, RMODE_START );
+ _start_running( RDIR_UP_LEFT, RMODE_START );
break;
case CMD_RUN_LEFT:
- start_running( RDIR_LEFT, RMODE_START );
+ _start_running( RDIR_LEFT, RMODE_START );
break;
case CMD_RUN_DOWN_RIGHT:
- start_running( RDIR_DOWN_RIGHT, RMODE_START );
+ _start_running( RDIR_DOWN_RIGHT, RMODE_START );
break;
case CMD_RUN_RIGHT:
- start_running( RDIR_RIGHT, RMODE_START );
+ _start_running( RDIR_RIGHT, RMODE_START );
break;
case CMD_DISABLE_MORE:
@@ -1968,7 +1973,7 @@ void process_command( command_type cmd )
break;
case CMD_TOGGLE_AUTOPICKUP:
- toggle_flag( &Options.autopickup_on, "Autopickup");
+ _toggle_flag( &Options.autopickup_on, "Autopickup");
break;
case CMD_TOGGLE_AUTOPRAYER:
@@ -1978,7 +1983,7 @@ void process_command( command_type cmd )
Options.autoprayer_on = false;
}
else
- toggle_flag( &Options.autoprayer_on, "Autoprayer" );
+ _toggle_flag( &Options.autoprayer_on, "Autoprayer" );
break;
case CMD_MAKE_NOTE:
@@ -1988,7 +1993,7 @@ void process_command( command_type cmd )
case CMD_READ_MESSAGES:
#ifdef DGL_SIMPLE_MESSAGING
if (SysEnv.have_messages)
- read_messages();
+ _read_messages();
#endif
break;
@@ -2002,11 +2007,11 @@ void process_command( command_type cmd )
}
break;
- case CMD_GO_UPSTAIRS: go_upstairs(); break;
- case CMD_GO_DOWNSTAIRS: go_downstairs(); break;
+ case CMD_GO_UPSTAIRS: _go_upstairs(); break;
+ case CMD_GO_DOWNSTAIRS: _go_downstairs(); break;
case CMD_DISPLAY_OVERMAP: display_overmap(); break;
- case CMD_OPEN_DOOR: open_door(0, 0); break;
- case CMD_CLOSE_DOOR: close_door(0, 0); break;
+ case CMD_OPEN_DOOR: _open_door(0, 0); break;
+ case CMD_CLOSE_DOOR: _close_door(0, 0); break;
case CMD_DROP:
drop();
@@ -2302,7 +2307,7 @@ void process_command( command_type cmd )
break;
case CMD_EXPERIENCE_CHECK:
- experience_check();
+ _experience_check();
break;
case CMD_SHOUT:
@@ -2404,7 +2409,7 @@ void process_command( command_type cmd )
#ifdef WIZARD
case CMD_WIZARD:
- handle_wizard_command();
+ _handle_wizard_command();
break;
#endif
@@ -2425,11 +2430,11 @@ void process_command( command_type cmd )
break;
case CMD_REPEAT_CMD:
- setup_cmd_repeat();
+ _setup_cmd_repeat();
break;
case CMD_PREV_CMD_AGAIN:
- do_prev_cmd_again();
+ _do_prev_cmd_again();
break;
case CMD_NO_CMD:
@@ -2446,7 +2451,7 @@ void process_command( command_type cmd )
}
}
-static void prep_input()
+static void _prep_input()
{
you.time_taken = player_speed();
you.shield_blocks = 0; // no blocks this round
@@ -2459,10 +2464,10 @@ static void prep_input()
}
// Decrement a single duration. Print the message if the duration runs out.
-static bool decrement_a_duration(duration_type dur, const char* endmsg = NULL,
- int midpoint = -1, int midloss = 0,
- const char* midmsg = NULL,
- msg_channel_type chan = MSGCH_DURATION )
+static bool _decrement_a_duration(duration_type dur, const char* endmsg = NULL,
+ int midpoint = -1, int midloss = 0,
+ const char* midmsg = NULL,
+ msg_channel_type chan = MSGCH_DURATION )
{
bool rc = false;
@@ -2488,7 +2493,7 @@ static bool decrement_a_duration(duration_type dur, const char* endmsg = NULL,
return rc;
}
-static void decrement_durations()
+static void _decrement_durations()
{
if (wearing_amulet(AMU_THE_GOURMAND))
{
@@ -2499,10 +2504,10 @@ static void decrement_durations()
you.duration[DUR_GOURMAND] = 0;
// must come before might/haste/berserk
- if (decrement_a_duration(DUR_BUILDING_RAGE))
+ if (_decrement_a_duration(DUR_BUILDING_RAGE))
go_berserk(false);
- if (decrement_a_duration(DUR_SLEEP))
+ if (_decrement_a_duration(DUR_SLEEP))
you.awake();
// paradox: it both lasts longer & does more damage overall if you're
@@ -2545,26 +2550,26 @@ static void decrement_durations()
}
}
- if (decrement_a_duration(DUR_ICY_ARMOUR, "Your icy armour evaporates."))
+ if (_decrement_a_duration(DUR_ICY_ARMOUR, "Your icy armour evaporates."))
you.redraw_armour_class = true;
- if (decrement_a_duration(DUR_SILENCE, "Your hearing returns."))
+ if (_decrement_a_duration(DUR_SILENCE, "Your hearing returns."))
you.attribute[ATTR_WAS_SILENCED] = 0;
- decrement_a_duration(DUR_REPEL_MISSILES,
- "You feel less protected from missiles.",
- 6, coinflip(),
- "Your repel missiles spell is about to expire...");
+ _decrement_a_duration(DUR_REPEL_MISSILES,
+ "You feel less protected from missiles.",
+ 6, coinflip(),
+ "Your repel missiles spell is about to expire...");
- decrement_a_duration(DUR_DEFLECT_MISSILES,
- "You feel less protected from missiles.",
- 6, coinflip(),
- "Your deflect missiles spell is about to expire...");
+ _decrement_a_duration(DUR_DEFLECT_MISSILES,
+ "You feel less protected from missiles.",
+ 6, coinflip(),
+ "Your deflect missiles spell is about to expire...");
- decrement_a_duration(DUR_REGENERATION,
- "Your skin stops crawling.",
- 6, coinflip(),
- "Your skin is crawling a little less now.");
+ _decrement_a_duration(DUR_REGENERATION,
+ "Your skin stops crawling.",
+ 6, coinflip(),
+ "Your skin is crawling a little less now.");
if (you.duration[DUR_PRAYER] > 1)
you.duration[DUR_PRAYER]--;
@@ -2647,9 +2652,9 @@ static void decrement_durations()
|| you.attribute[ATTR_TRANSFORMATION] != TRAN_BAT
|| you.duration[DUR_TRANSFORMATION] <= 2)
{
- if ( decrement_a_duration(DUR_TRANSFORMATION,
- NULL, 10, random2(3),
- "Your transformation is almost over.") )
+ if ( _decrement_a_duration(DUR_TRANSFORMATION,
+ NULL, 10, random2(3),
+ "Your transformation is almost over.") )
{
untransform();
you.duration[DUR_BREATH_WEAPON] = 0;
@@ -2657,44 +2662,44 @@ static void decrement_durations()
}
// must come after transformation duration
- decrement_a_duration(DUR_BREATH_WEAPON, "You have got your breath back.",
- -1, 0, NULL, MSGCH_RECOVERY);
-
- decrement_a_duration(DUR_REPEL_UNDEAD,
- "Your holy aura fades away.",
- 4, random2(3),
- "Your holy aura is starting to fade.");
- decrement_a_duration(DUR_SWIFTNESS,
- "You feel sluggish.",
- 6, coinflip(),
- "You start to feel a little slower.");
- decrement_a_duration(DUR_INSULATION,
- "You feel conductive.",
- 6, coinflip(),
- "You start to feel a little less insulated.");
-
- if ( decrement_a_duration(DUR_STONEMAIL,
- "Your scaly stone armour disappears.",
- 6, coinflip(),
- "Your scaly stone armour is starting "
- "to flake away.") )
+ _decrement_a_duration(DUR_BREATH_WEAPON, "You have got your breath back.",
+ -1, 0, NULL, MSGCH_RECOVERY);
+
+ _decrement_a_duration(DUR_REPEL_UNDEAD,
+ "Your holy aura fades away.",
+ 4, random2(3),
+ "Your holy aura is starting to fade.");
+ _decrement_a_duration(DUR_SWIFTNESS,
+ "You feel sluggish.",
+ 6, coinflip(),
+ "You start to feel a little slower.");
+ _decrement_a_duration(DUR_INSULATION,
+ "You feel conductive.",
+ 6, coinflip(),
+ "You start to feel a little less insulated.");
+
+ if ( _decrement_a_duration(DUR_STONEMAIL,
+ "Your scaly stone armour disappears.",
+ 6, coinflip(),
+ "Your scaly stone armour is starting "
+ "to flake away.") )
{
you.redraw_armour_class = true;
burden_change();
}
- if ( decrement_a_duration(DUR_FORESCRY,
- "You feel firmly rooted in the present.") )
+ if ( _decrement_a_duration(DUR_FORESCRY,
+ "You feel firmly rooted in the present.") )
you.redraw_evasion = true;
- if ( decrement_a_duration(DUR_SEE_INVISIBLE) && !player_see_invis() )
+ if ( _decrement_a_duration(DUR_SEE_INVISIBLE) && !player_see_invis() )
mpr("Your eyesight blurs momentarily.", MSGCH_DURATION);
- decrement_a_duration(DUR_SEE_INVISIBLE); // jmf: cute message
- // handled elsewhere
+ _decrement_a_duration(DUR_SEE_INVISIBLE); // jmf: cute message
+ // handled elsewhere
- if ( decrement_a_duration(DUR_CONDENSATION_SHIELD,
- "Your icy shield evaporates.") )
+ if ( _decrement_a_duration(DUR_CONDENSATION_SHIELD,
+ "Your icy shield evaporates.") )
you.redraw_armour_class = true;
if (you.duration[DUR_CONDENSATION_SHIELD] > 0 && player_res_cold() < 0)
@@ -2703,57 +2708,57 @@ static void decrement_durations()
ouch( 2 + random2avg(13, 2), 0, KILLED_BY_FREEZING );
}
- if ( decrement_a_duration(DUR_MAGIC_SHIELD,
- "Your magical shield disappears.") )
+ if ( _decrement_a_duration(DUR_MAGIC_SHIELD,
+ "Your magical shield disappears.") )
you.redraw_armour_class = true;
- if ( decrement_a_duration(DUR_STONESKIN, "Your skin feels tender.") )
+ if ( _decrement_a_duration(DUR_STONESKIN, "Your skin feels tender.") )
you.redraw_armour_class = true;
- if ( decrement_a_duration(DUR_TELEPORT) )
+ if ( _decrement_a_duration(DUR_TELEPORT) )
{
// only to a new area of the abyss sometimes (for abyss teleports)
you_teleport_now( true, one_chance_in(5) );
untag_followers();
}
- decrement_a_duration(DUR_CONTROL_TELEPORT,
- "You feel uncertain.",
- 6, coinflip(),
- "You start to feel a little uncertain.");
+ _decrement_a_duration(DUR_CONTROL_TELEPORT,
+ "You feel uncertain.",
+ 6, coinflip(),
+ "You start to feel a little uncertain.");
- decrement_a_duration(DUR_DEATH_CHANNEL,
- "Your unholy channel expires.",
- 6, coinflip(),
- "Your unholy channel is weakening.");
+ _decrement_a_duration(DUR_DEATH_CHANNEL,
+ "Your unholy channel expires.",
+ 6, coinflip(),
+ "Your unholy channel is weakening.");
- decrement_a_duration(DUR_SAGE, "You feel less studious.");
- decrement_a_duration(DUR_STEALTH, "You feel less stealthy.");
- decrement_a_duration(DUR_RESIST_FIRE, "Your fire resistance expires.");
- decrement_a_duration(DUR_RESIST_COLD, "Your cold resistance expires.");
- decrement_a_duration(DUR_RESIST_POISON, "Your poison resistance expires.");
- decrement_a_duration(DUR_SLAYING, "You feel less lethal.");
+ _decrement_a_duration(DUR_SAGE, "You feel less studious.");
+ _decrement_a_duration(DUR_STEALTH, "You feel less stealthy.");
+ _decrement_a_duration(DUR_RESIST_FIRE, "Your fire resistance expires.");
+ _decrement_a_duration(DUR_RESIST_COLD, "Your cold resistance expires.");
+ _decrement_a_duration(DUR_RESIST_POISON, "Your poison resistance expires.");
+ _decrement_a_duration(DUR_SLAYING, "You feel less lethal.");
- decrement_a_duration(DUR_INVIS, "You flicker back into view.",
- 6, coinflip(), "You flicker for a moment.");
+ _decrement_a_duration(DUR_INVIS, "You flicker back into view.",
+ 6, coinflip(), "You flicker for a moment.");
- decrement_a_duration(DUR_BARGAIN, "You feel less charismatic.");
- decrement_a_duration(DUR_CONF, "You feel less confused.");
+ _decrement_a_duration(DUR_BARGAIN, "You feel less charismatic.");
+ _decrement_a_duration(DUR_CONF, "You feel less confused.");
- if (decrement_a_duration(DUR_PARALYSIS, "You can move again."))
+ if (_decrement_a_duration(DUR_PARALYSIS, "You can move again."))
you.redraw_evasion = true;
- decrement_a_duration(DUR_EXHAUSTED, "You feel less fatigued.");
+ _decrement_a_duration(DUR_EXHAUSTED, "You feel less fatigued.");
- decrement_a_duration( DUR_CONFUSING_TOUCH,
+ _decrement_a_duration( DUR_CONFUSING_TOUCH,
((std::string("Your ") + your_hand(true)) +
" stop glowing.").c_str() );
- decrement_a_duration( DUR_SURE_BLADE,
+ _decrement_a_duration( DUR_SURE_BLADE,
"The bond with your blade fades away." );
- if ( decrement_a_duration( DUR_BEHELD, "You break out of your daze.",
- -1, 0, NULL, MSGCH_RECOVERY ))
+ if ( _decrement_a_duration( DUR_BEHELD, "You break out of your daze.",
+ -1, 0, NULL, MSGCH_RECOVERY ))
{
you.beheld_by.clear();
}
@@ -2761,10 +2766,10 @@ static void decrement_durations()
dec_slow_player();
dec_haste_player();
- if (decrement_a_duration(DUR_MIGHT, "You feel a little less mighty now."))
+ if (_decrement_a_duration(DUR_MIGHT, "You feel a little less mighty now."))
modify_stat(STAT_STRENGTH, -5, true, "might running out");
- if (decrement_a_duration(DUR_BERSERKER, "You are no longer berserk."))
+ if (_decrement_a_duration(DUR_BERSERKER, "You are no longer berserk."))
{
//jmf: guilty for berserking /after/ berserk
did_god_conduct( DID_STIMULANTS, 6 + random2(6) );
@@ -2861,10 +2866,10 @@ static void decrement_durations()
if (!you.permanent_levitation())
{
- if ( decrement_a_duration(DUR_LEVITATION,
- "You float gracefully downwards.",
- 10, random2(6),
- "You are starting to lose your buoyancy!") )
+ if ( _decrement_a_duration(DUR_LEVITATION,
+ "You float gracefully downwards.",
+ 10, random2(6),
+ "You are starting to lose your buoyancy!") )
{
burden_change();
// Landing kills controlled flight.
@@ -2875,7 +2880,7 @@ static void decrement_durations()
}
if (!you.permanent_flight())
- if ( decrement_a_duration(DUR_CONTROLLED_FLIGHT) && you.airborne() )
+ if ( _decrement_a_duration(DUR_CONTROLLED_FLIGHT) && you.airborne() )
mpr("You lose control over your flight.", MSGCH_DURATION);
if (you.rotting > 0)
@@ -2967,7 +2972,7 @@ static void decrement_durations()
}
}
-static void check_banished()
+static void _check_banished()
{
if (you.banished)
{
@@ -2987,7 +2992,7 @@ static void check_banished()
at some point.
*/
-static void check_shafts()
+static void _check_shafts()
{
for (int i = 0; i < MAX_TRAPS; i++)
{
@@ -3002,7 +3007,7 @@ static void check_shafts()
}
}
-static void check_sanctuary()
+static void _check_sanctuary()
{
if (env.sanctuary_time <= 0)
return;
@@ -3010,7 +3015,7 @@ static void check_sanctuary()
decrease_sanctuary_radius();
}
-static void world_reacts()
+static void _world_reacts()
{
crawl_state.clear_god_acting();
@@ -3022,11 +3027,11 @@ static void world_reacts()
env.turns_on_level++;
update_turn_count();
}
- check_banished();
+ _check_banished();
- check_shafts();
+ _check_shafts();
- check_sanctuary();
+ _check_sanctuary();
manage_halo();
@@ -3060,7 +3065,7 @@ static void world_reacts()
if (env.cgrid[you.x_pos][you.y_pos] != EMPTY_CLOUD)
in_a_cloud();
- decrement_durations();
+ _decrement_durations();
const int food_use = player_hunger_rate();
@@ -3104,18 +3109,19 @@ static void world_reacts()
you.magic_points_regeneration = static_cast< unsigned char >( tmp );
// If you're wielding a rod, it'll gradually recharge.
- recharge_rods();
+ _recharge_rods();
viewwindow(true, true);
if (Options.stash_tracking)
+ {
StashTrack.update_visible_stashes(
- Options.stash_tracking == STM_ALL?
- StashTracker::ST_AGGRESSIVE :
- StashTracker::ST_PASSIVE);
+ Options.stash_tracking == STM_ALL ? StashTracker::ST_AGGRESSIVE
+ : StashTracker::ST_PASSIVE);
+ }
handle_monsters();
- check_banished();
+ _check_banished();
ASSERT(you.time_taken >= 0);
// make sure we don't overflow
@@ -3127,7 +3133,7 @@ static void world_reacts()
{
handle_time(200 + (you.time_taken - you.synch_time));
you.synch_time = 200;
- check_banished();
+ _check_banished();
}
else
{
@@ -3172,7 +3178,7 @@ static void world_reacts()
static struct stat mfilestat;
-static void show_message_line(std::string line)
+static void _show_message_line(std::string line)
{
const std::string::size_type sender_pos = line.find(":");
if (sender_pos == std::string::npos)
@@ -3193,7 +3199,7 @@ static void show_message_line(std::string line)
}
}
-static void read_each_message()
+static void _read_each_message()
{
bool say_got_msg = true;
FILE *mf = fopen(SysEnv.messagefile.c_str(), "r+");
@@ -3230,7 +3236,7 @@ static void read_each_message()
say_got_msg = false;
}
- show_message_line(line);
+ _show_message_line(line);
}
if (!lock_file_handle(mf, F_RDLCK))
@@ -3262,19 +3268,19 @@ kill_messaging:
Options.messaging = false;
}
-static void read_messages()
+static void _read_messages()
{
- read_each_message();
+ _read_each_message();
update_message_status();
}
-static void announce_messages()
+static void _announce_messages()
{
// XXX: We could do a NetHack-like mail daemon here at some point.
mprf("Beep! Your pager goes off! Use _ to check your messages.");
}
-static void check_messages()
+static void _check_messages()
{
if (!Options.messaging
|| SysEnv.have_messages
@@ -3302,16 +3308,16 @@ static void check_messages()
if (SysEnv.have_messages && !had_messages)
{
- announce_messages();
+ _announce_messages();
update_message_status();
}
}
#endif
-static command_type get_next_cmd()
+static command_type _get_next_cmd()
{
#ifdef DGL_SIMPLE_MESSAGING
- check_messages();
+ _check_messages();
#endif
#if DEBUG_DIAGNOSTICS
@@ -3325,7 +3331,7 @@ static command_type get_next_cmd()
#endif
const time_t before = time(NULL);
- keycode_type keyin = get_next_keycode();
+ keycode_type keyin = _get_next_keycode();
const time_t after = time(NULL);
@@ -3342,17 +3348,17 @@ static command_type get_next_cmd()
return (CMD_NEXT_CMD);
}
- return keycode_to_command(keyin);
+ return _keycode_to_command(keyin);
}
/* for now, this is an extremely yucky hack */
-command_type keycode_to_command( keycode_type key )
+static command_type _keycode_to_command( keycode_type key )
{
switch ( key )
{
#ifdef USE_TILE
- case '-': return CMD_EDIT_PLAYER_TILE;
- case CK_MOUSE_DONE: return CMD_NEXT_CMD;
+ case '-': return CMD_EDIT_PLAYER_TILE;
+ case CK_MOUSE_DONE: return CMD_NEXT_CMD;
case CK_MOUSE_B1ITEM: return CMD_USE_ITEM;
case CK_MOUSE_B2ITEM: return CMD_VIEW_ITEM;
#endif // USE_TILE
@@ -3483,14 +3489,14 @@ command_type keycode_to_command( keycode_type key )
}
}
-keycode_type get_next_keycode()
+static keycode_type _get_next_keycode()
{
keycode_type keyin;
flush_input_buffer( FLUSH_BEFORE_COMMAND );
#ifdef USE_TILE
- tile_draw_inv(-1, REGION_INV1);
+ tile_draw_inv(REGION_INV1);
#ifdef USE_X11
update_screen();
#endif
@@ -3509,10 +3515,10 @@ keycode_type get_next_keycode()
/*
Opens doors and handles some aspects of untrapping. If either move_x or
- move_y are non-zero, the pair carries a specific direction for the door
+ move_y are non-zero, the pair carries a specific direction for the door
to be opened (eg if you type ctrl - dir).
*/
-static void open_door(int move_x, int move_y, bool check_confused)
+static void _open_door(int move_x, int move_y, bool check_confused)
{
struct dist door_move;
int dx, dy; // door x, door y
@@ -3660,7 +3666,7 @@ static void open_door(int move_x, int move_y, bool check_confused)
you.turn_is_over = true;
}
else if (grd[dx][dy] == DNGN_OPEN_DOOR)
- close_door(move_x, move_y); // for convenience
+ _close_door(move_x, move_y); // for convenience
else
{
mpr("You swing at nothing.");
@@ -3673,7 +3679,7 @@ static void open_door(int move_x, int move_y, bool check_confused)
* Similar to open_door. Can you spot the difference?
* FIX ME: closing a gate should update all tiles involved!
*/
-static void close_door(int door_x, int door_y)
+static void _close_door(int door_x, int door_y)
{
struct dist door_move;
int dx, dy; // door x, door y
@@ -3803,7 +3809,7 @@ static void close_door(int door_x, int door_y)
// initialise whole lot of stuff...
// returns true if a new character
-static bool initialise(void)
+static bool _initialise(void)
{
Options.fixup_options();
@@ -3972,7 +3978,7 @@ static bool initialise(void)
// Total penalty (including the standard one during upkeep is:
// 2 5 9 14 20 27 35 44
//
-static void do_berserk_no_combat_penalty(void)
+static void _do_berserk_no_combat_penalty(void)
{
// Butchering/eating a corpse will maintain a blood rage.
const int delay = current_delay_action();
@@ -4019,7 +4025,7 @@ static void do_berserk_no_combat_penalty(void)
// Called when the player moves by walking/running. Also calls attack
// function etc when necessary.
-static void move_player(int move_x, int move_y)
+static void _move_player(int move_x, int move_y)
{
bool attacking = false;
bool moving = true; // used to prevent eventual movement (swap)
@@ -4161,7 +4167,7 @@ static void move_player(int move_x, int move_y)
// BCR - Easy doors single move
if (targ_grid == DNGN_CLOSED_DOOR && Options.easy_open && !attacking)
{
- open_door(move_x, move_y, false);
+ _open_door(move_x, move_y, false);
you.prev_move_x = move_x;
you.prev_move_y = move_y;
}
@@ -4224,7 +4230,7 @@ static void move_player(int move_x, int move_y)
} // end move_player()
-static int get_num_and_char_keyfun(int &ch)
+static int _get_num_and_char_keyfun(int &ch)
{
if (ch == CK_BKSP || isdigit(ch) || ch >= 128)
return 1;
@@ -4232,19 +4238,19 @@ static int get_num_and_char_keyfun(int &ch)
return -1;
}
-static int get_num_and_char(const char* prompt, char* buf, int buf_len)
+static int _get_num_and_char(const char* prompt, char* buf, int buf_len)
{
if (prompt != NULL)
mpr(prompt);
line_reader reader(buf, buf_len);
- reader.set_keyproc(get_num_and_char_keyfun);
+ reader.set_keyproc(_get_num_and_char_keyfun);
return reader.read_line(true);
}
-static void setup_cmd_repeat()
+static void _setup_cmd_repeat()
{
if (is_processing_macro())
{
@@ -4259,8 +4265,8 @@ static void setup_cmd_repeat()
char buf[80];
// Function ensures that the buffer contains only digits.
- int ch = get_num_and_char("Number of times to repeat, then command key: ",
- buf, 80);
+ int ch = _get_num_and_char("Number of times to repeat, then command key: ",
+ buf, 80);
if (ch == ESCAPE)
{
@@ -4360,17 +4366,17 @@ static void setup_cmd_repeat()
crawl_state.waiting_for_command = true;
- ch = get_next_keycode();
+ ch = _get_next_keycode();
crawl_state.waiting_for_command = false;
}
- command_type cmd = keycode_to_command( (keycode_type) ch);
+ command_type cmd = _keycode_to_command( (keycode_type) ch);
if (cmd != CMD_MOUSE_MOVE)
c_input_reset(false);
- if (!is_processing_macro() && !cmd_is_repeatable(cmd))
+ if (!is_processing_macro() && !_cmd_is_repeatable(cmd))
{
crawl_state.cancel_cmd_again();
crawl_state.cancel_cmd_repeat();
@@ -4426,7 +4432,7 @@ static void setup_cmd_repeat()
crawl_state.input_line_strs.clear();
}
-static void do_prev_cmd_again()
+static void _do_prev_cmd_again()
{
if (is_processing_macro())
{
@@ -4471,7 +4477,7 @@ static void do_prev_cmd_again()
bool was_doing_repeats = crawl_state.is_repeating_cmd();
- input();
+ _input();
// crawl_state.doing_prev_cmd_again can be set to false
// while input() does its stuff if something causes
@@ -4479,7 +4485,7 @@ static void do_prev_cmd_again()
while (!was_doing_repeats && crawl_state.is_repeating_cmd()
&& crawl_state.doing_prev_cmd_again)
{
- input();
+ _input();
}
if (!was_doing_repeats && crawl_state.is_repeating_cmd()
@@ -4491,7 +4497,7 @@ static void do_prev_cmd_again()
crawl_state.doing_prev_cmd_again = false;
}
-static void update_replay_state()
+static void _update_replay_state()
{
if (crawl_state.is_repeating_cmd())
{
@@ -4547,7 +4553,7 @@ static void update_replay_state()
}
-void compile_time_asserts()
+static void _compile_time_asserts()
{
// Check that the numbering comments in enum.h haven't been
// disturbed accidentally.
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 315a12f01f..1b3d2b8cf1 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1761,8 +1761,8 @@ public:
#endif // WIZARD
#ifdef USE_TILE
- char show_items[20]; // show which item types in tile inventory
- bool title_screen; // display title screen?
+ char tile_show_items[20]; // show which item types in tile inventory
+ bool tile_title_screen; // display title screen?
// minimap colours
char tile_player_col;
char tile_monster_col;
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 7a9273d079..b191ce76ae 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -88,7 +88,7 @@ const std::string tile_cols[24] =
"yellow", "lightyellow", "darkyellow", "brown"
};
-static unsigned int str_to_tile_colour(std::string colour)
+static unsigned int _str_to_tile_colour(std::string colour)
{
if (colour.empty())
return (0);
@@ -102,7 +102,7 @@ static unsigned int str_to_tile_colour(std::string colour)
else if (colour == "lightgray")
colour = "lightgrey";
- for (unsigned int i=0; i<24; i++)
+ for (unsigned int i = 0; i < 24; i++)
{
if (tile_cols[i] == colour)
return (i);
@@ -189,7 +189,7 @@ int str_to_colour( const std::string &str, int default_colour,
}
// returns -1 if unmatched else returns 0-15
-static int str_to_channel_colour( const std::string &str )
+static int _str_to_channel_colour( const std::string &str )
{
int ret = str_to_colour( str );
@@ -239,7 +239,7 @@ std::string channel_to_str( int channel )
return message_channel_names[channel];
}
-static int str_to_book( const std::string& str )
+static int _str_to_book( const std::string& str )
{
if ( str == "fire" || str == "flame" )
return SBT_FIRE;
@@ -252,7 +252,7 @@ static int str_to_book( const std::string& str )
return SBT_NO_SELECTION;
}
-static int str_to_weapon( const std::string &str )
+static int _str_to_weapon( const std::string &str )
{
if (str == "shortsword" || str == "short sword")
return (WPN_SHORT_SWORD);
@@ -291,7 +291,7 @@ std::string weapon_to_str( int weapon )
}
}
-static fire_type str_to_fire_types( const std::string &str )
+static fire_type _str_to_fire_types( const std::string &str )
{
if (str == "launcher")
return (FIRE_LAUNCHER);
@@ -321,7 +321,7 @@ static fire_type str_to_fire_types( const std::string &str )
return (FIRE_NONE);
}
-static char str_to_race( const std::string &str )
+static char _str_to_race( const std::string &str )
{
if (str == "random")
return '*';
@@ -343,7 +343,7 @@ static char str_to_race( const std::string &str )
return ((index != -1) ? index_to_letter( index ) : 0);
}
-static int str_to_class( const std::string &str )
+static int _str_to_class( const std::string &str )
{
if (str == "random")
return '*';
@@ -365,7 +365,7 @@ static int str_to_class( const std::string &str )
return ((index != -1) ? index_to_letter( index ) : 0);
}
-static bool read_bool( const std::string &field, bool def_value )
+static bool _read_bool( const std::string &field, bool def_value )
{
bool ret = def_value;
@@ -381,8 +381,8 @@ static bool read_bool( const std::string &field, bool def_value )
// read a value which can be either a boolean (in which case return
// 0 for true, -1 for false), or a string of the form PREFIX:NUMBER
// (e.g., auto:7), in which case return NUMBER as an int.
-static int read_bool_or_number( const std::string &field, int def_value,
- const std::string& num_prefix)
+static int _read_bool_or_number( const std::string &field, int def_value,
+ const std::string& num_prefix)
{
int ret = def_value;
@@ -802,8 +802,8 @@ void game_options::reset_options()
#endif
#ifdef USE_TILE
- show_items[0] = '0';
- title_screen = true;
+ tile_show_items[0] = '0';
+ tile_title_screen = true;
// minimap colours
tile_player_col = MAP_WHITE;
tile_monster_col = MAP_RED;
@@ -934,7 +934,7 @@ void game_options::add_fire_order_slot(const std::string &s)
unsigned flags = 0;
std::vector<std::string> alts = split_string("/", s);
for (int i = 0, size = alts.size(); i < size; ++i)
- flags |= str_to_fire_types(alts[i]);
+ flags |= _str_to_fire_types(alts[i]);
if (flags)
fire_order.push_back(flags);
@@ -1097,9 +1097,11 @@ std::string read_init_file(bool runscript)
FILE* f = NULL;
char name_buff[kPathLen];
// Check all possibilities for init.txt
- for ( int i = 0; f == NULL && locations_data[i][1] != NULL; ++i ) {
+ for ( int i = 0; f == NULL && locations_data[i][1] != NULL; ++i )
+ {
// Don't look at unset options
- if ( locations_data[i][0] != NULL ) {
+ if ( locations_data[i][0] != NULL )
+ {
snprintf( name_buff, sizeof name_buff, "%s%s",
locations_data[i][0], locations_data[i][1] );
f = fopen( name_buff, "r" );
@@ -1416,7 +1418,7 @@ void game_options::fixup_options()
end(1);
}
-static int str_to_killcategory(const std::string &s)
+static int _str_to_killcategory(const std::string &s)
{
static const char *kc[] = {
"you",
@@ -1424,7 +1426,8 @@ static int str_to_killcategory(const std::string &s)
"other",
};
- for (unsigned i = 0; i < sizeof(kc) / sizeof(*kc); ++i) {
+ for (unsigned i = 0; i < sizeof(kc) / sizeof(*kc); ++i)
+ {
if (s == kc[i])
return i;
}
@@ -1433,8 +1436,8 @@ static int str_to_killcategory(const std::string &s)
void game_options::do_kill_map(const std::string &from, const std::string &to)
{
- int ifrom = str_to_killcategory(from),
- ito = str_to_killcategory(to);
+ int ifrom = _str_to_killcategory(from),
+ ito = _str_to_killcategory(to);
if (ifrom != -1 && ito != -1)
kill_map[ifrom] = ito;
}
@@ -1507,7 +1510,8 @@ void game_options::add_message_colour_mapping(const std::string &field)
if (cmap.size() != 2)
return;
- const int col = (cmap[0]=="mute") ? MSGCOL_MUTED : str_to_colour(cmap[0]);
+ const int col = (cmap[0] == "mute") ? MSGCOL_MUTED
+ : str_to_colour(cmap[0]);
if (col == -1)
return;
@@ -1707,7 +1711,7 @@ void game_options::read_option_line(const std::string &str, bool runscript)
if (key == "ascii_display")
{
char_set =
- read_bool(field, char_set == CSET_ASCII)?
+ _read_bool(field, char_set == CSET_ASCII)?
CSET_ASCII
: CSET_IBM;
valid = true;
@@ -1733,36 +1737,36 @@ void game_options::read_option_line(const std::string &str, bool runscript)
else if (key == "use_old_selection_order")
{
// use old order of species/classes on selection screen?
- use_old_selection_order = read_bool( field, use_old_selection_order );
+ use_old_selection_order = _read_bool( field, use_old_selection_order );
}
else if (key == "default_autopickup")
{
// should autopickup default to on or off?
- autopickup_on = read_bool( field, autopickup_on );
+ autopickup_on = _read_bool( field, autopickup_on );
}
else if (key == "default_autoprayer")
{
// should autoprayer default to on or off?
- autoprayer_on = read_bool( field, autoprayer_on );
+ autoprayer_on = _read_bool( field, autoprayer_on );
}
else if (key == "show_inventory_weights")
{
// should weights be shown on inventory items?
- show_inventory_weights = read_bool( field, show_inventory_weights );
+ show_inventory_weights = _read_bool( field, show_inventory_weights );
}
else if (key == "suppress_startup_errors")
{
- suppress_startup_errors = read_bool( field, suppress_startup_errors );
+ suppress_startup_errors = _read_bool( field, suppress_startup_errors );
}
else if (key == "clean_map")
{
// removes monsters/clouds from map
- clean_map = read_bool( field, clean_map );
+ clean_map = _read_bool( field, clean_map );
}
else if (key == "colour_map" || key == "color_map")
{
// colour-codes play-screen map
- colour_map = read_bool( field, colour_map );
+ colour_map = _read_bool( field, colour_map );
}
else if (key == "easy_confirm")
{
@@ -1776,33 +1780,33 @@ void game_options::read_option_line(const std::string &str, bool runscript)
|| key == "easy_quit_item_prompts")
{
// allow aborting of item lists with space
- easy_quit_item_prompts = read_bool( field,
+ easy_quit_item_prompts = _read_bool( field,
easy_quit_item_prompts );
}
else if (key == "easy_open")
{
// automatic door opening with movement
- easy_open = read_bool( field, easy_open );
+ easy_open = _read_bool( field, easy_open );
}
else if (key == "easy_armor"
- || key == "easy_armour"
- || key == "easy_unequip")
+ || key == "easy_armour"
+ || key == "easy_unequip")
{
// automatic removal of armour when dropping
- easy_unequip = read_bool( field, easy_unequip );
+ easy_unequip = _read_bool( field, easy_unequip );
}
else if (key == "easy_butcher")
{
// automatic knife switching
- easy_butcher = read_bool( field, easy_butcher );
+ easy_butcher = _read_bool( field, easy_butcher );
}
else if (key == "always_confirm_butcher")
{
- always_confirm_butcher = read_bool( field, always_confirm_butcher );
+ always_confirm_butcher = _read_bool( field, always_confirm_butcher );
}
else if (key == "list_rotten")
{
- list_rotten = read_bool( field, list_rotten );
+ list_rotten = _read_bool( field, list_rotten );
}
else if (key == "lua_file" && runscript)
{
@@ -1828,7 +1832,7 @@ void game_options::read_option_line(const std::string &str, bool runscript)
else if (key == "channel")
{
const int chnl = str_to_channel( subkey );
- const int col = str_to_channel_colour( field );
+ const int col = _str_to_channel_colour( field );
if (chnl != -1 && col != -1)
channels[chnl] = col;
@@ -1932,7 +1936,7 @@ void game_options::read_option_line(const std::string &str, bool runscript)
// This is useful for terms where dark grey does
// not have standout modes (since it's black on black).
// This option will use light-grey instead in these cases.
- no_dark_brand = read_bool( field, no_dark_brand );
+ no_dark_brand = _read_bool( field, no_dark_brand );
}
else if (key == "heap_brand")
{
@@ -1952,12 +1956,12 @@ void game_options::read_option_line(const std::string &str, bool runscript)
else if (key == "weapon")
{
// choose this weapon for classes that get choice
- weapon = str_to_weapon( field );
+ weapon = _str_to_weapon( field );
}
else if (key == "book")
{
// choose this book for classes that get choice
- book = str_to_book( field );
+ book = _str_to_book( field );
}
else if (key == "chaos_knight")
{
@@ -2009,11 +2013,11 @@ void game_options::read_option_line(const std::string &str, bool runscript)
else if (key == "random_pick")
{
// randomly generate character
- random_pick = read_bool( field, random_pick );
+ random_pick = _read_bool( field, random_pick );
}
else if (key == "remember_name")
{
- remember_name = read_bool( field, remember_name );
+ remember_name = _read_bool( field, remember_name );
}
#ifndef SAVE_DIR_PATH
else if (key == "save_dir")
@@ -2025,11 +2029,11 @@ void game_options::read_option_line(const std::string &str, bool runscript)
#endif
else if (key == "show_turns")
{
- show_turns = read_bool( field, show_turns );
+ show_turns = _read_bool( field, show_turns );
}
else if (key == "show_beam")
{
- show_beam = read_bool( field, show_beam );
+ show_beam = _read_bool( field, show_beam );
}
#ifndef SAVE_DIR_PATH
else if (key == "morgue_dir")
@@ -2087,35 +2091,35 @@ void game_options::read_option_line(const std::string &str, bool runscript)
}
else if (key == "race")
{
- race = str_to_race( field );
+ race = _str_to_race( field );
}
else if (key == "class")
{
- cls = str_to_class( field );
+ cls = _str_to_class( field );
}
else if (key == "auto_list")
{
- auto_list = read_bool( field, auto_list );
+ auto_list = _read_bool( field, auto_list );
}
else if (key == "default_target")
{
- default_target = read_bool( field, default_target );
+ default_target = _read_bool( field, default_target );
if (default_target)
target_unshifted_dirs = false;
}
else if (key == "autopickup_no_burden")
{
- autopickup_no_burden = read_bool( field, autopickup_no_burden );
+ autopickup_no_burden = _read_bool( field, autopickup_no_burden );
}
#ifdef DGL_SIMPLE_MESSAGING
else if (key == "messaging")
{
- messaging = read_bool(field, messaging);
+ messaging = _read_bool(field, messaging);
}
#endif
else if (key == "mouse_input")
{
- mouse_input = read_bool(field, mouse_input);
+ mouse_input = _read_bool(field, mouse_input);
}
else if (key == "view_max_width")
{
@@ -2138,24 +2142,24 @@ void game_options::read_option_line(const std::string &str, bool runscript)
}
else if (key == "view_lock_x")
{
- view_lock_x = read_bool(field, view_lock_x);
+ view_lock_x = _read_bool(field, view_lock_x);
}
else if (key == "view_lock_y")
{
- view_lock_y = read_bool(field, view_lock_y);
+ view_lock_y = _read_bool(field, view_lock_y);
}
else if (key == "view_lock")
{
- const bool lock = read_bool(field, true);
+ const bool lock = _read_bool(field, true);
view_lock_x = view_lock_y = lock;
}
else if (key == "center_on_scroll")
{
- center_on_scroll = read_bool(field, center_on_scroll);
+ center_on_scroll = _read_bool(field, center_on_scroll);
}
else if (key == "symmetric_scroll")
{
- symmetric_scroll = read_bool(field, symmetric_scroll);
+ symmetric_scroll = _read_bool(field, symmetric_scroll);
}
else if (key == "scroll_margin_x")
{
@@ -2183,37 +2187,37 @@ void game_options::read_option_line(const std::string &str, bool runscript)
}
else if (key == "note_skill_max")
{
- note_skill_max = read_bool( field, note_skill_max );
+ note_skill_max = _read_bool( field, note_skill_max );
}
else if (key == "note_all_spells")
{
- note_all_spells = read_bool( field, note_all_spells );
+ note_all_spells = _read_bool( field, note_all_spells );
}
else if (key == "delay_message_clear")
{
- delay_message_clear = read_bool( field, delay_message_clear );
+ delay_message_clear = _read_bool( field, delay_message_clear );
}
else if (key == "flush")
{
if (subkey == "failure")
{
flush_input[FLUSH_ON_FAILURE]
- = read_bool(field, flush_input[FLUSH_ON_FAILURE]);
+ = _read_bool(field, flush_input[FLUSH_ON_FAILURE]);
}
else if (subkey == "command")
{
flush_input[FLUSH_BEFORE_COMMAND]
- = read_bool(field, flush_input[FLUSH_BEFORE_COMMAND]);
+ = _read_bool(field, flush_input[FLUSH_BEFORE_COMMAND]);
}
else if (subkey == "message")
{
flush_input[FLUSH_ON_MESSAGE]
- = read_bool(field, flush_input[FLUSH_ON_MESSAGE]);
+ = _read_bool(field, flush_input[FLUSH_ON_MESSAGE]);
}
else if (subkey == "lua")
{
flush_input[FLUSH_LUA]
- = read_bool(field, flush_input[FLUSH_LUA]);
+ = _read_bool(field, flush_input[FLUSH_LUA]);
}
}
else if (key == "wiz_mode")
@@ -2227,8 +2231,10 @@ void game_options::read_option_line(const std::string &str, bool runscript)
else if (field == "yes")
wiz_mode = WIZ_YES;
else
+ {
crawl_state.add_startup_error(
make_stringf("Unknown wiz_mode option: %s\n", field.c_str()));
+ }
#endif
}
else if (key == "ban_pickup")
@@ -2260,8 +2266,7 @@ void game_options::read_option_line(const std::string &str, bool runscript)
{
std::vector<std::string> thesplit = split_string(":", field);
autoinscriptions.push_back(
- std::pair<text_pattern,std::string>(thesplit[0],
- thesplit[1]));
+ std::pair<text_pattern,std::string>(thesplit[0], thesplit[1]));
}
else if (key == "map_file_name")
{
@@ -2276,8 +2281,8 @@ void game_options::read_option_line(const std::string &str, bool runscript)
std::vector<std::string> insplit = split_string(":", thesplit[i]);
int hp_percent = 100;
- if ( insplit.size() == 0 || insplit.size() > 2 ||
- (insplit.size() == 1 && i != 0) )
+ if ( insplit.size() == 0 || insplit.size() > 2
+ || insplit.size() == 1 && i != 0 )
{
crawl_state.add_startup_error(
make_stringf("Bad hp_colour string: %s\n", field.c_str()));
@@ -2287,7 +2292,7 @@ void game_options::read_option_line(const std::string &str, bool runscript)
if ( insplit.size() == 2 )
hp_percent = atoi(insplit[0].c_str());
- int scolour = str_to_colour(insplit[(insplit.size()==1) ? 0 : 1]);
+ int scolour = str_to_colour(insplit[(insplit.size() == 1) ? 0 : 1]);
hp_colour.push_back(std::pair<int, int>(hp_percent, scolour));
}
}
@@ -2300,8 +2305,8 @@ void game_options::read_option_line(const std::string &str, bool runscript)
std::vector<std::string> insplit = split_string(":", thesplit[i]);
int mp_percent = 100;
- if ( insplit.size() == 0 || insplit.size() > 2 ||
- (insplit.size() == 1 && i != 0) )
+ if ( insplit.size() == 0 || insplit.size() > 2
+ || insplit.size() == 1 && i != 0 )
{
crawl_state.add_startup_error(
make_stringf("Bad mp_colour string: %s\n", field.c_str()));
@@ -2311,7 +2316,7 @@ void game_options::read_option_line(const std::string &str, bool runscript)
if ( insplit.size() == 2 )
mp_percent = atoi(insplit[0].c_str());
- int scolour = str_to_colour(insplit[(insplit.size()==1) ? 0 : 1]);
+ int scolour = str_to_colour(insplit[(insplit.size() == 1) ? 0 : 1]);
mp_colour.push_back(std::pair<int, int>(mp_percent, scolour));
}
}
@@ -2334,11 +2339,11 @@ void game_options::read_option_line(const std::string &str, bool runscript)
}
else if (key == "pickup_thrown")
{
- pickup_thrown = read_bool(field, pickup_thrown);
+ pickup_thrown = _read_bool(field, pickup_thrown);
}
else if (key == "pickup_dropped")
{
- pickup_dropped = read_bool(field, pickup_dropped);
+ pickup_dropped = _read_bool(field, pickup_dropped);
}
#ifdef WIZARD
else if (key == "fsim_kit")
@@ -2403,11 +2408,11 @@ void game_options::read_option_line(const std::string &str, bool runscript)
}
else if (key == "use_fake_cursor")
{
- use_fake_cursor = read_bool(field, use_fake_cursor);
+ use_fake_cursor = _read_bool(field, use_fake_cursor);
}
else if (key == "macro_meta_entry")
{
- macro_meta_entry = read_bool(field, macro_meta_entry);
+ macro_meta_entry = _read_bool(field, macro_meta_entry);
}
else if (key == "stop_travel" || key == "travel_stop_message")
{
@@ -2469,20 +2474,20 @@ void game_options::read_option_line(const std::string &str, bool runscript)
}
else if (key == "classic_item_colours")
{
- classic_item_colours = read_bool(field, classic_item_colours);
+ classic_item_colours = _read_bool(field, classic_item_colours);
}
else if (key == "item_colour" || key == "item_color")
{
- item_colour = read_bool(field, item_colour);
+ item_colour = _read_bool(field, item_colour);
}
else if (key == "easy_exit_menu")
{
- easy_exit_menu = read_bool(field, easy_exit_menu);
+ easy_exit_menu = _read_bool(field, easy_exit_menu);
}
else if (key == "dos_use_background_intensity")
{
dos_use_background_intensity =
- read_bool(field, dos_use_background_intensity);
+ _read_bool(field, dos_use_background_intensity);
}
else if (key == "item_stack_summary_minimum")
{
@@ -2519,15 +2524,15 @@ void game_options::read_option_line(const std::string &str, bool runscript)
}
else if (key == "explore_greedy")
{
- explore_greedy = read_bool(field, explore_greedy);
+ explore_greedy = _read_bool(field, explore_greedy);
}
else if (key == "explore_improved")
{
- explore_improved = read_bool(field, explore_improved);
+ explore_improved = _read_bool(field, explore_improved);
}
else if (key == "trap_prompt")
{
- trap_prompt = read_bool(field, trap_prompt);
+ trap_prompt = _read_bool(field, trap_prompt);
}
else if (key == "stash_tracking")
{
@@ -2545,10 +2550,12 @@ void game_options::read_option_line(const std::string &str, bool runscript)
else if (key == "sound")
{
std::vector<std::string> seg = split_string(",", field);
- for (int i = 0, count = seg.size(); i < count; ++i) {
+ for (int i = 0, count = seg.size(); i < count; ++i)
+ {
const std::string &sub = seg[i];
std::string::size_type cpos = sub.find(":", 0);
- if (cpos != std::string::npos) {
+ if (cpos != std::string::npos)
+ {
sound_mapping mapping;
mapping.pattern = sub.substr(0, cpos);
mapping.soundfile = sub.substr(cpos + 1);
@@ -2592,12 +2599,12 @@ void game_options::read_option_line(const std::string &str, bool runscript)
else if (key == "menu_colour_prefix_class" ||
key == "menu_color_prefix_class")
{
- menu_colour_prefix_class = read_bool(field, menu_colour_prefix_class);
+ menu_colour_prefix_class = _read_bool(field, menu_colour_prefix_class);
}
else if (key == "menu_colour_prefix_id" ||
key == "menu_color_prefix_id")
{
- menu_colour_prefix_id = read_bool(field, menu_colour_prefix_id);
+ menu_colour_prefix_id = _read_bool(field, menu_colour_prefix_id);
}
else if (key == "message_colour" || key == "message_color")
{
@@ -2624,7 +2631,8 @@ void game_options::read_option_line(const std::string &str, bool runscript)
{
const std::string &s = seg[i];
std::string::size_type cpos = s.find(":", 0);
- if (cpos != std::string::npos) {
+ if (cpos != std::string::npos)
+ {
std::string from = s.substr(0, cpos);
std::string to = s.substr(cpos + 1);
do_kill_map(from, to);
@@ -2675,23 +2683,23 @@ void game_options::read_option_line(const std::string &str, bool runscript)
}
else if (key == "level_map_title")
{
- level_map_title = read_bool(field, level_map_title);
+ level_map_title = _read_bool(field, level_map_title);
}
else if (key == "target_zero_exp")
{
- target_zero_exp = read_bool(field, target_zero_exp);
+ target_zero_exp = _read_bool(field, target_zero_exp);
}
else if (key == "target_oos")
{
- target_oos = read_bool(field, target_oos);
+ target_oos = _read_bool(field, target_oos);
}
else if (key == "target_los_first")
{
- target_los_first = read_bool(field, target_los_first);
+ target_los_first = _read_bool(field, target_los_first);
}
else if (key == "target_unshifted_dirs")
{
- target_unshifted_dirs = read_bool(field, target_unshifted_dirs);
+ target_unshifted_dirs = _read_bool(field, target_unshifted_dirs);
if (target_unshifted_dirs)
default_target = false;
}
@@ -2709,112 +2717,112 @@ void game_options::read_option_line(const std::string &str, bool runscript)
else if (field.find("single") != std::string::npos)
pickup_mode = -1;
else
- pickup_mode = read_bool_or_number(field, pickup_mode, "auto:");
+ pickup_mode = _read_bool_or_number(field, pickup_mode, "auto:");
}
else if (key == "additional_macro_file")
{
additional_macro_files.push_back(orig_field);
}
#ifdef USE_TILE
- else if (key == "show_items")
+ else if (key == "tile_show_items")
{
- strncpy(show_items, field.c_str(), 18);
+ strncpy(tile_show_items, field.c_str(), 18);
}
- else if (key == "title_screen")
+ else if (key == "tile_title_screen")
{
- title_screen = read_bool(field, title_screen);
+ tile_title_screen = _read_bool(field, title_screen);
}
else if (key == "tile_player_col")
{
tile_player_col =
- str_to_tile_colour(field);
+ _str_to_tile_colour(field);
}
else if (key == "tile_monster_col")
{
tile_monster_col =
- str_to_tile_colour(field);
+ _str_to_tile_colour(field);
}
else if (key == "tile_neutral_col")
{
tile_neutral_col =
- str_to_tile_colour(field);
+ _str_to_tile_colour(field);
}
else if (key == "tile_friendly_col")
{
tile_friendly_col =
- str_to_tile_colour(field);
+ _str_to_tile_colour(field);
}
else if (key == "tile_item_col")
{
tile_item_col =
- str_to_tile_colour(field);
+ _str_to_tile_colour(field);
}
else if (key == "tile_unseen_col")
{
tile_unseen_col =
- str_to_tile_colour(field);
+ _str_to_tile_colour(field);
}
else if (key == "tile_floor_col")
{
tile_floor_col =
- str_to_tile_colour(field);
+ _str_to_tile_colour(field);
}
else if (key == "tile_wall_col")
{
tile_wall_col =
- str_to_tile_colour(field);
+ _str_to_tile_colour(field);
}
else if (key == "tile_mapped_wall_col")
{
tile_mapped_wall_col =
- str_to_tile_colour(field);
+ _str_to_tile_colour(field);
}
else if (key == "tile_door_col")
{
tile_door_col =
- str_to_tile_colour(field);
+ _str_to_tile_colour(field);
}
else if (key == "tile_downstairs_col")
{
tile_downstairs_col =
- str_to_tile_colour(field);
+ _str_to_tile_colour(field);
}
else if (key == "tile_upstairs_col")
{
tile_upstairs_col =
- str_to_tile_colour(field);
+ _str_to_tile_colour(field);
}
else if (key == "tile_feature_col")
{
tile_feature_col =
- str_to_tile_colour(field);
+ _str_to_tile_colour(field);
}
else if (key == "tile_trap_col")
{
tile_trap_col =
- str_to_tile_colour(field);
+ _str_to_tile_colour(field);
}
else if (key == "tile_water_col")
{
tile_water_col =
- str_to_tile_colour(field);
+ _str_to_tile_colour(field);
}
else if (key == "tile_lava_col")
{
tile_lava_col =
- str_to_tile_colour(field);
+ _str_to_tile_colour(field);
}
else if (key == "tile_excluded_col")
{
tile_excluded_col =
- str_to_tile_colour(field);
+ _str_to_tile_colour(field);
}
#endif
#ifdef WIN32TILES
else if (key == "use_dos_char")
{
- use_dos_char = read_bool( field, use_dos_char );
+ use_dos_char = _read_bool( field, use_dos_char );
}
#endif
@@ -2926,14 +2934,14 @@ bool parse_args( int argc, char **argv, bool rc_only )
int ecount;
// initialize
- for(int i=0; i<num_cmd_ops; i++)
- arg_seen[i] = false;
+ for (int i = 0; i < num_cmd_ops; i++)
+ 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)
+ while (current < argc)
{
// get argument
arg = argv[current];
@@ -2963,10 +2971,10 @@ bool parse_args( int argc, char **argv, bool rc_only )
arg = &arg[1];
int o;
- for(o = 0; o < num_cmd_ops; o++)
+ for (o = 0; o < num_cmd_ops; o++)
{
- if (stricmp(cmd_ops[o], arg) == 0)
- break;
+ if (stricmp(cmd_ops[o], arg) == 0)
+ break;
}
if (o == num_cmd_ops)
@@ -3079,10 +3087,10 @@ bool parse_args( int argc, char **argv, bool rc_only )
if (!rc_only)
{
if (o == 2)
- Options.race = str_to_race( std::string( next_arg ) );
+ Options.race = _str_to_race( std::string( next_arg ) );
if (o == 3)
- Options.cls = str_to_class( std::string( next_arg ) );
+ Options.cls = _str_to_class( std::string( next_arg ) );
}
nextUsed = true;
break;
@@ -3170,7 +3178,7 @@ bool game_options::o_bool(const char *name, bool def) const
bool val = def;
opt_map::const_iterator i = named_options.find(name);
if (i != named_options.end())
- val = read_bool(i->second, val);
+ val = _read_bool(i->second, val);
return (val);
}
@@ -3253,7 +3261,7 @@ void menu_sort_condition::set_sort(std::string &s)
trail_pos == std::string::npos? s : s.substr(0, trail_pos);
trim_string(sort_cond);
- sort = read_bool_or_number(sort_cond, sort, "auto:");
+ sort = _read_bool_or_number(sort_cond, sort, "auto:");
if (trail_pos != std::string::npos)
s = s.substr(trail_pos + 1);
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 5202aaa865..a62a5cf589 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -78,12 +78,12 @@
#include "view.h"
#include "xom.h"
-static bool invisible_to_player( const item_def& item );
-static void item_list_on_square( std::vector<const item_def*>& items,
- int obj, bool force_squelch = false );
-static void autoinscribe_item( item_def& item );
-static void autoinscribe_floor_items();
-static void autoinscribe_inventory();
+static bool _invisible_to_player( const item_def& item );
+static void _item_list_on_square( std::vector<const item_def*>& items,
+ int obj, bool force_squelch = false );
+static void _autoinscribe_item( item_def& item );
+static void _autoinscribe_floor_items();
+static void _autoinscribe_inventory();
static bool will_autopickup = false;
static bool will_autoinscribe = false;
@@ -133,7 +133,7 @@ void link_items(void)
}
} // end link_items()
-static bool item_ok_to_clean(int item)
+static bool _item_ok_to_clean(int item)
{
// never clean food or Orbs
if (mitm[item].base_type == OBJ_FOOD || mitm[item].base_type == OBJ_ORBS)
@@ -151,7 +151,7 @@ static bool item_ok_to_clean(int item)
// returns index number of first available space, or NON_ITEM for
// unsuccessful cleanup (should be exceedingly rare!)
-int cull_items(void)
+static int _cull_items(void)
{
crawl_state.cancel_cmd_repeat();
@@ -192,7 +192,7 @@ int cull_items(void)
{
next = mitm[item].link; // in case we can't get it later.
- if (item_ok_to_clean(item) && random2(100) < 15)
+ if (_item_ok_to_clean(item) && random2(100) < 15)
{
const item_def& obj(mitm[item]);
if (is_fixed_artefact(obj))
@@ -355,7 +355,7 @@ int get_item_slot( int reserve )
if (item >= MAX_ITEMS - reserve)
{
- item = (reserve <= 10) ? cull_items() : NON_ITEM;
+ item = (reserve <= 10) ? _cull_items() : NON_ITEM;
if (item == NON_ITEM)
return (NON_ITEM);
@@ -544,18 +544,22 @@ void destroy_item( int dest, bool never_created )
destroy_item( mitm[dest], never_created );
}
-static void handle_gone_item(const item_def &item)
+static void _handle_gone_item(const item_def &item)
{
if (you.level_type == LEVEL_ABYSS
&& place_type(item.orig_place) == LEVEL_ABYSS
&& !(item.flags & ISFLAG_BEEN_IN_INV))
{
if (item.base_type == OBJ_ORBS)
+ {
set_unique_item_status(OBJ_ORBS, item.sub_type,
UNIQ_LOST_IN_ABYSS);
+ }
else if (is_fixed_artefact(item))
+ {
set_unique_item_status(OBJ_WEAPONS, item.special,
UNIQ_LOST_IN_ABYSS);
+ }
}
if (is_rune(item))
@@ -580,13 +584,13 @@ static void handle_gone_item(const item_def &item)
void item_was_lost(const item_def &item)
{
- handle_gone_item( item );
+ _handle_gone_item( item );
xom_check_lost_item( item );
}
void item_was_destroyed(const item_def &item, int cause)
{
- handle_gone_item( item );
+ _handle_gone_item( item );
xom_check_destroyed_item( item, cause );
}
@@ -636,15 +640,17 @@ void destroy_item_stack( int x, int y, int cause )
}
}
-static bool invisible_to_player( const item_def& item ) {
+static bool _invisible_to_player( const item_def& item )
+{
return strstr(item.inscription.c_str(), "=k") != 0;
}
-static int count_nonsquelched_items( int obj ) {
+static int count_nonsquelched_items( int obj )
+{
int result = 0;
while ( obj != NON_ITEM )
{
- if ( !invisible_to_player(mitm[obj]) )
+ if ( !_invisible_to_player(mitm[obj]) )
++result;
obj = mitm[obj].link;
}
@@ -657,16 +663,18 @@ static int count_nonsquelched_items( int obj ) {
are included. If force_squelch is true, squelched items are
never displayed.
*/
-static void item_list_on_square( std::vector<const item_def*>& items,
- int obj, bool force_squelch ) {
+static void _item_list_on_square( std::vector<const item_def*>& items,
+ int obj, bool force_squelch )
+{
const bool have_nonsquelched = (force_squelch ||
count_nonsquelched_items(obj));
/* loop through the items */
- while ( obj != NON_ITEM ) {
+ while ( obj != NON_ITEM )
+ {
/* add them to the items list if they qualify */
- if ( !have_nonsquelched || !invisible_to_player(mitm[obj]) )
+ if ( !have_nonsquelched || !_invisible_to_player(mitm[obj]) )
{
items.push_back( &mitm[obj] );
}
@@ -755,7 +763,7 @@ void item_check(bool verbose)
std::vector<const item_def*> items;
- item_list_on_square( items, igrd[you.x_pos][you.y_pos], true );
+ _item_list_on_square( items, igrd[you.x_pos][you.y_pos], true );
if (items.size() == 0)
{
@@ -826,33 +834,21 @@ void item_check(bool verbose)
learned_something_new(TUT_MULTI_PICKUP);
}
-void show_items()
+static void _pickup_menu(int item_link)
{
std::vector<const item_def*> items;
- item_list_on_square( items, igrd[you.x_pos][you.y_pos], true );
-
- if ( items.empty() )
- mpr("There are no items here.");
- else {
- select_items( items, "Things that are here:", true );
- redraw_screen();
- }
-
- describe_floor();
-}
-
-void pickup_menu(int item_link)
-{
- std::vector<const item_def*> items;
- item_list_on_square( items, item_link, false );
+ _item_list_on_square( items, item_link, false );
std::vector<SelItem> selected =
select_items( items, "Select items to pick up" );
redraw_screen();
- for (int i = 0, count = selected.size(); i < count; ++i) {
- for (int j = item_link; j != NON_ITEM; j = mitm[j].link) {
- if (&mitm[j] == selected[i].item) {
+ for (int i = 0, count = selected.size(); i < count; ++i)
+ {
+ for (int j = item_link; j != NON_ITEM; j = mitm[j].link)
+ {
+ if (&mitm[j] == selected[i].item)
+ {
if (j == item_link)
item_link = mitm[j].link;
@@ -1010,12 +1006,13 @@ void origin_set_monstercorpse(item_def &item, int x, int y)
item.orig_monnum = first_corpse_monnum(x, y);
}
-void origin_freeze(item_def &item, int x, int y)
+static void _origin_freeze(item_def &item, int x, int y)
{
if (!origin_known(item))
{
if (!item.orig_monnum && x != -1 && y != -1)
origin_set_monstercorpse(item, x, y);
+
item.orig_place = get_packed_place();
check_note_item(item);
#ifdef DGL_MILESTONES
@@ -1024,7 +1021,7 @@ void origin_freeze(item_def &item, int x, int y)
}
}
-static std::string origin_monster_name(const item_def &item)
+static std::string _origin_monster_name(const item_def &item)
{
const int monnum = item.orig_monnum - 1;
if (monnum == MONS_PLAYER_GHOST)
@@ -1034,12 +1031,12 @@ static std::string origin_monster_name(const item_def &item)
return mons_type_name(monnum, DESC_NOCAP_A);
}
-static std::string origin_monster_desc(const item_def &item)
+static std::string _origin_monster_desc(const item_def &item)
{
- return (origin_monster_name(item));
+ return (_origin_monster_name(item));
}
-static std::string origin_place_desc(const item_def &item)
+static std::string _origin_place_desc(const item_def &item)
{
return prep_branch_level_name(item.orig_place);
}
@@ -1068,13 +1065,13 @@ bool origin_describable(const item_def &item)
&& (item.base_type != OBJ_FOOD || item.sub_type != FOOD_CHUNK));
}
-std::string article_it(const item_def &item)
+static std::string _article_it(const item_def &item)
{
// "it" is always correct, since gloves and boots also come in pairs.
return "it";
}
-bool origin_is_original_equip(const item_def &item)
+static bool _origin_is_original_equip(const item_def &item)
{
return (item.orig_place == 0xFFFFU && item.orig_monnum == -1);
}
@@ -1084,7 +1081,7 @@ std::string origin_desc(const item_def &item)
if (!origin_describable(item))
return ("");
- if (origin_is_original_equip(item))
+ if (_origin_is_original_equip(item))
return "Original Equipment";
std::string desc;
@@ -1096,36 +1093,37 @@ std::string origin_desc(const item_def &item)
switch (iorig)
{
case -1:
- desc += "You bought " + article_it(item) + " in a shop ";
+ desc += "You bought " + _article_it(item) + " in a shop ";
break;
case AQ_SCROLL:
- desc += "You acquired " + article_it(item) + " ";
+ desc += "You acquired " + _article_it(item) + " ";
break;
case AQ_CARD_GENIE:
desc += "You drew the Genie ";
break;
case AQ_WIZMODE:
- desc += "Your wizardly powers created "+article_it(item)+" ";
+ desc += "Your wizardly powers created "+ _article_it(item)+ " ";
break;
default:
if (iorig > GOD_NO_GOD && iorig < NUM_GODS)
desc += god_name(static_cast<god_type>(iorig))
- + " gifted " + article_it(item) + " to you ";
+ + " gifted " + _article_it(item) + " to you ";
else
// Bug really.
- desc += "You stumbled upon " + article_it(item) + " ";
+ desc += "You stumbled upon " + _article_it(item) + " ";
break;
}
}
else if (item.orig_monnum - 1 == MONS_DANCING_WEAPON)
desc += "You subdued it ";
else
- desc += "You took " + article_it(item) + " off "
- + origin_monster_desc(item) + " ";
+ desc += "You took " + _article_it(item) + " off "
+ + _origin_monster_desc(item) + " ";
}
else
- desc += "You found " + article_it(item) + " ";
- desc += origin_place_desc(item);
+ desc += "You found " + _article_it(item) + " ";
+
+ desc += _origin_place_desc(item);
return (desc);
}
@@ -1199,10 +1197,10 @@ void pickup()
// a killed item here
pickup_single_item(o, mitm[o].quantity);
}
- else if (Options.pickup_mode != -1 &&
- num_nonsquelched >= Options.pickup_mode)
+ else if (Options.pickup_mode != -1
+ && num_nonsquelched >= Options.pickup_mode)
{
- pickup_menu(o);
+ _pickup_menu(o);
}
else
{
@@ -1213,7 +1211,7 @@ void pickup()
// must save this because pickup can destroy the item
next = mitm[o].link;
- if ( num_nonsquelched && invisible_to_player(mitm[o]) )
+ if ( num_nonsquelched && _invisible_to_player(mitm[o]) )
{
o = next;
continue;
@@ -1236,7 +1234,7 @@ void pickup()
#endif
)
{
- pickup_menu(o);
+ _pickup_menu(o);
break;
}
@@ -1446,7 +1444,7 @@ int find_free_slot(const item_def &i)
#undef slotisfree
}
-static void got_item(item_def& item, int quant)
+static void _got_item(item_def& item, int quant)
{
if (!is_rune(item))
return;
@@ -1549,7 +1547,7 @@ int move_item_to_player( int obj, int quant_got, bool quiet )
dec_mitm_item_quantity( obj, quant_got );
burden_change();
- got_item(mitm[obj], quant_got);
+ _got_item(mitm[obj], quant_got);
if (!quiet)
mpr( you.inv[m].name(DESC_INVENTORY).c_str() );
@@ -1590,9 +1588,9 @@ int move_item_to_player( int obj, int quant_got, bool quiet )
if (!item.slot)
item.slot = index_to_letter(item.link);
- autoinscribe_item( item );
+ _autoinscribe_item( item );
- origin_freeze(item, you.x_pos, you.y_pos);
+ _origin_freeze(item, you.x_pos, you.y_pos);
check_note_item(item);
item.quantity = quant_got;
@@ -1622,7 +1620,7 @@ int move_item_to_player( int obj, int quant_got, bool quiet )
if (item.base_type == OBJ_ORBS && you.level_type == LEVEL_DUNGEON)
unset_branch_flags(BFLAG_HAS_ORB);
- got_item(item, item.quantity);
+ _got_item(item, item.quantity);
you.turn_is_over = true;
@@ -2074,7 +2072,7 @@ void drop(void)
start_delay( DELAY_MULTIDROP, items_for_multidrop.size() );
}
-static void autoinscribe_item( item_def& item )
+static void _autoinscribe_item( item_def& item )
{
std::string iname = item.name(DESC_INVENTORY);
@@ -2105,7 +2103,7 @@ static void autoinscribe_item( item_def& item )
}
}
-static void autoinscribe_floor_items()
+static void _autoinscribe_floor_items()
{
int o, next;
o = igrd[you.x_pos][you.y_pos];
@@ -2113,17 +2111,17 @@ static void autoinscribe_floor_items()
while (o != NON_ITEM)
{
next = mitm[o].link;
- autoinscribe_item( mitm[o] );
+ _autoinscribe_item( mitm[o] );
o = next;
}
}
-static void autoinscribe_inventory()
+static void _autoinscribe_inventory()
{
for (int i = 0; i < ENDOFPACK; i++)
{
if (is_valid_item(you.inv[i]))
- autoinscribe_item( you.inv[i] );
+ _autoinscribe_item( you.inv[i] );
}
}
@@ -2139,8 +2137,8 @@ void request_autoinscribe(bool do_inscribe)
void autoinscribe()
{
- autoinscribe_floor_items();
- autoinscribe_inventory();
+ _autoinscribe_floor_items();
+ _autoinscribe_inventory();
will_autoinscribe = false;
}
@@ -2297,7 +2295,7 @@ static void do_autopickup()
void autopickup()
{
- autoinscribe_floor_items();
+ _autoinscribe_floor_items();
do_autopickup();
}
@@ -2305,7 +2303,7 @@ int inv_count(void)
{
int count=0;
- for(int i=0; i< ENDOFPACK; i++)
+ for(int i = 0; i < ENDOFPACK; i++)
{
if (is_valid_item( you.inv[i] ))
count++;
diff --git a/crawl-ref/source/items.h b/crawl-ref/source/items.h
index 8b64cd43d7..14bdb971a4 100644
--- a/crawl-ref/source/items.h
+++ b/crawl-ref/source/items.h
@@ -61,12 +61,6 @@ void link_items(void);
* *********************************************************************** */
void fix_item_coordinates(void);
-// last updated: 19apr2001 {gdl}
-/* ***********************************************************************
- * called from: dungeon
- * *********************************************************************** */
-int cull_items(void);
-
// last updated: 16oct2001 -- bwr
int get_item_slot( int reserve = 50 );
@@ -121,10 +115,6 @@ void drop(void);
* *********************************************************************** */
int inv_count(void);
-void show_items();
-
-void cmd_destroy_item( void );
-
bool pickup_single_item(int link, int qty);
bool drop_item( int item_dropped, int quant_drop, bool try_offer = false );
@@ -133,7 +123,6 @@ int get_equip_slot(const item_def *item);
void origin_set(int x, int y);
void origin_set_monster(item_def &item, const monsters *monster);
-void origin_freeze(item_def &item, int x, int y);
bool origin_known(const item_def &item);
bool origin_describable(const item_def &item);
std::string origin_desc(const item_def &item);
diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc
index e17f9bfad3..7bb0cfa5d4 100644
--- a/crawl-ref/source/libgui.cc
+++ b/crawl-ref/source/libgui.cc
@@ -391,11 +391,11 @@ void GmapUpdate(int x, int y, int what, bool upd_tile)
// since that might be cheating in some cases. This could be rewritten.
int t = tile_idx_unseen_terrain(x, y, what);
- if (c!=0 && c!= oldc && upd_tile)
+ if (c != 0 && c!= oldc && upd_tile)
{
if (c == PX_I || c == PX_M)
{
- env.tile_bk_bg[x][y]= t;
+ env.tile_bk_bg[x][y] = t;
if (env.tile_bk_bg[x][y] == 0)
env.tile_bk_bg[x][y] = tileidx_feature(DNGN_UNSEEN, x, y);
}
@@ -404,11 +404,11 @@ void GmapUpdate(int x, int y, int what, bool upd_tile)
env.tile_bk_bg[x][y] = t;
}
}
- else if (c==0)
+ else if (c == 0)
{
// forget map
- env.tile_bk_fg[x][y]=0;
- env.tile_bk_bg[x][y]=t;
+ env.tile_bk_fg[x][y] = 0;
+ env.tile_bk_bg[x][y] = t;
return;
}
@@ -459,7 +459,7 @@ void GmapDisplay(int linex, int liney)
{
for (int x = gmap_min_x; x <= gmap_max_x; x++, count++)
{
- if ( (count>=0) && (count<GXM*GYM) )
+ if (count >= 0 && count < GXM*GYM)
buf2[count] = gmap_data[x][y];
}
count += GXM - (gmap_max_x - gmap_min_x + 1);
@@ -531,7 +531,7 @@ static void _do_layout()
win_main->placeRegion(region_item2, LAYER_CRT, region_crt, PLACE_BOTTOM,
tm, tm, tm, tm);
- if (Options.show_items[0] != 0)
+ if (Options.tile_show_items[0] != 0)
{
item_x = (win_main->wx - lowest->sx) / TILE_X;
item_y = (win_main->wy - lowest->ey) / TILE_Y;
@@ -564,17 +564,17 @@ void libgui_init()
libgui_init_sys();
- for(i=0;i<NUM_REGIONS;i++)
- region_lock[i] = false;
+ for (i = 0; i < NUM_REGIONS; i++)
+ region_lock[i] = false;
pref_mode = PREF_MODE_TILE;
_libgui_load_prefs();
// Adjust sizes
- if (dngn_x & 1 ==0) dngn_x++;
- if (dngn_y & 1 ==0) dngn_y++;
- if (font_size &1 == 1) font_size--;
+ if (dngn_x & 1 == 0) dngn_x++;
+ if (dngn_y & 1 == 0) dngn_y++;
+ if (font_size & 1 == 1) font_size--;
tile_dngn_x = dngn_x;
tile_dngn_y = dngn_y;
@@ -605,7 +605,7 @@ void libgui_init()
TileInitWin();
#endif
- if (Options.show_items[0] != 0)
+ if (Options.tile_show_items[0] != 0)
{
// temporal size
region_item = new TileRegionClass(1, 1, TILE_X, TILE_Y);
@@ -734,8 +734,8 @@ static void _libgui_load_prefs()
{
fgets(buf, 250, fp);
i = 0;
- while(buf[i] >= 32 && i< 120)
- i++;
+ while (buf[i] >= 32 && i < 120)
+ i++;
buf[i] = 0;
for (i = 0; i < MAX_PREFS; i++)
@@ -1057,7 +1057,7 @@ void edit_prefs()
region_item2->resize_backbuf();
tile_set_force_redraw_inv(true);
- tile_draw_inv(-1, REGION_INV1);
+ tile_draw_inv(REGION_INV1);
region_map->force_redraw = true;
viewwindow(true, true);
@@ -1084,7 +1084,7 @@ typedef struct tip_info
static int old_tip_idx = -1;
-void tip_grid(int gx, int gy, bool do_null = true, int minimap=0)
+static void _tip_grid(int gx, int gy, bool do_null = true, int minimap = 0)
{
mesclr();
const coord_def gc(gx,gy);
@@ -1209,10 +1209,6 @@ static bool _can_use_item(item_def item, bool equipped)
&& mons_has_blood(item.plus));
}
- // mummies can't do anything with food or potions
- if (you.species == SP_MUMMY)
- return (item.base_type != OBJ_POTIONS && item.base_type != OBJ_FOOD);
-
if (equipped && item_cursed(item))
{
// misc. items/rods can always be evoked, cursed or not
@@ -1224,6 +1220,10 @@ static bool _can_use_item(item_def item, bool equipped)
return (!_is_true_equipped_item(item));
}
+ // mummies can't do anything with food or potions
+ if (you.species == SP_MUMMY)
+ return (item.base_type != OBJ_POTIONS && item.base_type != OBJ_FOOD);
+
// in all other cases you can use the item in some way
return true;
}
@@ -1308,7 +1308,7 @@ static int _handle_mouse_motion(int mouse_x, int mouse_y, bool init)
oldmode = mode;
oldcx = cx;
oldcy = cy;
- tip_grid(cx-1, cy-1, 1);
+ _tip_grid(cx-1, cy-1, 1);
TileDrawFarDungeon(cx-1, cy-1);
return 0;
}
@@ -1503,18 +1503,15 @@ static int _handle_mouse_motion(int mouse_x, int mouse_y, bool init)
oldcy = cy;
oldmode = mode;
- if(mode==REGION_DNGN)
+ if (mode == REGION_DNGN)
tile_place_cursor(cx, cy, true);
-
- if(mode==REGION_TDNGN)
- {
+ else if (mode == REGION_TDNGN)
cgotoxy(cx+2, cy+1, GOTO_DNGN);
- }
const int gx = view2gridX(cx) + 1;
const int gy = view2gridY(cy) + 1;
- tip_grid(gx, gy);
+ _tip_grid(gx, gy);
// mouse-over info on player
if (cx == DCX && cy == DCY)
@@ -1552,7 +1549,7 @@ static int _handle_mouse_motion(int mouse_x, int mouse_y, bool init)
}
else
{
- tip_grid(cx - 1, cy - 1, false, 1);
+ _tip_grid(cx - 1, cy - 1, false, 1);
}
oldmode = mode;
@@ -1589,17 +1586,17 @@ static int _handle_mouse_button(int mx, int my, int button,
bool shift, bool ctrl)
{
int dir;
- const int dx[9]={-1,0,1, -1,0,1, -1,0,1};
- const int dy[9]={1,1,1,0,0,0,-1,-1,-1};
+ const int dx[9] = {-1,0,1, -1,0,1, -1,0,1};
+ const int dy[9] = {1,1,1,0,0,0,-1,-1,-1};
- const int cmd_n[9]={'b', 'j', 'n', 'h', '.', 'l', 'y', 'k', 'u'};
- const int cmd_s[9]={'B', 'J', 'N', 'H', '5', 'L', 'Y', 'K', 'U'};
+ const int cmd_n[9] = {'b', 'j', 'n', 'h', '.', 'l', 'y', 'k', 'u'};
+ const int cmd_s[9] = {'B', 'J', 'N', 'H', '5', 'L', 'Y', 'K', 'U'};
- const int cmd_c[9]={
+ const int cmd_c[9] = {
CONTROL('B'), CONTROL('J'), CONTROL('N'), CONTROL('H'),
'X', CONTROL('L'), CONTROL('Y'), CONTROL('K'), CONTROL('U'),
};
- const int cmd_dir[9]={'1','2','3','4','5','6','7','8','9'};
+ const int cmd_dir[9] = {'1','2','3','4','5','6','7','8','9'};
int trig = CK_MOUSE_B1;
if (button == 2)
@@ -1725,8 +1722,8 @@ static int _handle_mouse_button(int mx, int my, int button,
return '5';
}
- if((mouse_mode==MOUSE_MODE_COMMAND || mouse_mode == MOUSE_MODE_MACRO) &&
- (mode == REGION_DNGN || mode == REGION_TDNGN))
+ if ((mouse_mode == MOUSE_MODE_COMMAND || mouse_mode == MOUSE_MODE_MACRO)
+ && (mode == REGION_DNGN || mode == REGION_TDNGN))
{
if (button == 1 && cx == DCX && cy == DCY)
{
@@ -2135,7 +2132,7 @@ void get_input_line_gui(char *const buff, int len)
if (k < len
&& (isprint(kin)
|| (kin >= CONTROL('A') && kin <= CONTROL('Z'))
- || (kin >= 0x80 && kin <=0xff)))
+ || (kin >= 0x80 && kin <= 0xff)))
{
buff[k++] = kin;
}
@@ -2297,12 +2294,13 @@ void puttext(int sx, int sy, int ex, int ey, unsigned char *buf, bool mono,
{
TextRegionClass *r = (where == 1) ?region_crt:region_dngn;
- if (where==1 && UseDosChar) r=region_xmap;
+ if (where == 1 && UseDosChar)
+ r = region_xmap;
int xx, yy;
unsigned char *ptr = buf;
//cgotoxy(1, 1, GOTO_CRT);
- for(yy = sy-1; yy <= ey-1; yy++)
+ for (yy = sy-1; yy <= ey-1; yy++)
{
unsigned char *c = &(r->cbuf[yy*(r->mx)+sx-1]);
unsigned char *a = &(r->abuf[yy*(r->mx)+sx-1]);
@@ -2310,8 +2308,8 @@ void puttext(int sx, int sy, int ex, int ey, unsigned char *buf, bool mono,
{
*c = *ptr;
- if (*c==0)
- *c=32;
+ if (*c == 0)
+ *c = 32;
ptr++;
if (mono)
@@ -2350,14 +2348,20 @@ void ViewTextFile(const char *name)
return;
}
- for (i=0; i<80*MAXTEXTLINES; i++) buf[i] = ' ';
+ for (i = 0; i < 80*MAXTEXTLINES; i++)
+ buf[i] = ' ';
- while(nlines<MAXTEXTLINES)
+ while (nlines < MAXTEXTLINES)
{
fgets((char *)buf2, 82, fp);
- if (feof(fp)) break;
+
+ if (feof(fp))
+ break;
+
i = 0;
- while(i<79 && buf2[i] !=13 && buf2[i] != 10) i++;
+ while (i < 79 && buf2[i] != 13 && buf2[i] != 10)
+ i++;
+
memcpy(&buf[nlines*80], buf2, i);
nlines++;
}
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index c60b57ee67..7e4ee7bb53 100644
--- a/crawl-ref/source/newgame.cc
+++ b/crawl-ref/source/newgame.cc
@@ -2427,7 +2427,7 @@ static void give_basic_spells(job_type which_job)
static void openingScreen(void)
{
#ifdef USE_TILE
- if (Options.title_screen)
+ if (Options.tile_title_screen)
TileDrawTitle();
#endif
diff --git a/crawl-ref/source/tile1.cc b/crawl-ref/source/tile1.cc
index af9127eee5..fff4b55c03 100644
--- a/crawl-ref/source/tile1.cc
+++ b/crawl-ref/source/tile1.cc
@@ -1650,7 +1650,9 @@ int tileidx_item(const item_def &item)
return TILE_RING_RANDOM_OFFSET + color - 1;
else
return TILE_RING_NORMAL_OFFSET + special % 13;
- } else {
+ }
+ else
+ {
if (is_unrandom_artefact( item ))
return _tileidx_unrand_artefact(find_unrandart_index(item));
else if(is_random_artefact( item ))
@@ -2300,9 +2302,9 @@ void tilep_race_default(int race, int gender, int level, int *parts)
{
int result;
int hair;
- int beard=0;
+ int beard = 0;
- if(gender==TILEP_GENDER_MALE)
+ if (gender == TILEP_GENDER_MALE)
hair = TILEP_HAIR_SHORT_BLACK;
else
hair = TILEP_HAIR_LONG_BLACK;
@@ -2441,7 +2443,7 @@ void tilep_job_default(int job, int gender, int *parts)
parts[TILEP_PART_LEG] = 0;
parts[TILEP_PART_BODY] = 0;
parts[TILEP_PART_ARM] = 0;
- parts[TILEP_PART_HAND1] =0;
+ parts[TILEP_PART_HAND1] = 0;
parts[TILEP_PART_HAND2] = 0;
parts[TILEP_PART_HELM] = 0;
@@ -2715,7 +2717,9 @@ void tilep_part_to_str(int number, char *buf)
int tilep_str_to_part(char *str)
{
//special
- if (str[0]=='*') return TILEP_SHOW_EQUIP;
+ if (str[0] == '*')
+ return TILEP_SHOW_EQUIP;
+
//normal 2 digits
return atoi(str);
}
@@ -3741,7 +3745,7 @@ void tile_clear_buf()
{
for (int x = 0; x < GXM; x++)
{
- tile_dngn[x][y]=TILE_DNGN_UNSEEN;
+ tile_dngn[x][y] = TILE_DNGN_UNSEEN;
}
}
}
@@ -3786,7 +3790,8 @@ void tile_place_item(int x, int y, int idx)
int t = tileidx_item(mitm[idx]);
if (mitm[idx].link != NON_ITEM)
t |= TILE_FLAG_S_UNDER;
- env.tile_fg[x-1][y-1]=t;
+
+ env.tile_fg[x-1][y-1] = t;
if (item_needs_autopickup(mitm[idx]))
env.tile_bg[x-1][y-1] |= TILE_FLAG_CURSOR3;
@@ -4182,11 +4187,11 @@ static int _pack_floor_item(int *idx, int *flag, int *isort, int max)
ARM_HELMET, ARM_GLOVES, ARM_BOOTS
};
- int i;
- for (i=0;i<NUM_WEAPONS;i++)
- isort_weapon2[isort_weapon[i]] = i;
- for (i=0;i<NUM_ARMOURS;i++)
- isort_armour2[isort_armour[i]] = i;
+ for (int i = 0; i < NUM_WEAPONS; i++)
+ isort_weapon2[isort_weapon[i]] = i;
+
+ for (int i = 0; i < NUM_ARMOURS; i++)
+ isort_armour2[isort_armour[i]] = i;
int o = igrd[you.x_pos][you.y_pos];
if (o == NON_ITEM) return 0;
@@ -4292,7 +4297,7 @@ extern TileRegionClass *region_item;
extern TileRegionClass *region_item2;
extern WinClass *win_main;
-void tile_draw_inv(int item_type, int flag)
+void tile_draw_inv(int flag)
{
// "inventory" including items on floor
#define MAXINV 200
@@ -4314,40 +4319,8 @@ void tile_draw_inv(int item_type, int flag)
if (numInvTiles > MAXINV)
numInvTiles = MAXINV;
- // item.base_type <-> char conversion table
- const static char *obj_syms = ")([/%#?=!#+\\0}x";
-
- const static char *syms_table[] =
- {
- ")\\", // weapons and staves
- "(", // missile
- "[", // armour
- "/", // wands
- "%", // foods
- "#", // none
- "?+", // scrolls and books
- "=", // rings/amulets
- "!", // potions
- "#", // none
- "?+", // books/scrolls
- ")\\", // weapons and staves
- "0",
- "}",
- "x"
- };
-
// which items to show in inventory
- const char *item_chars = Options.show_items;
-
- // XXX: What does this do?
- // tile_draw_inv is only ever called with item_type = -1, flag = REGION_INV1
- // (in acr.cc and libgui.cc) --jpeg
- if (item_type >= 0)
- item_chars = syms_table[item_type];
- else if (item_type == -2)
- item_chars = obj_syms;
- else if (item_type == -3)
- item_chars = "."; // floor
+ const char *item_chars = Options.tile_show_items;
// show no items, please
if (item_chars[0] == 0)
diff --git a/crawl-ref/source/tile2.cc b/crawl-ref/source/tile2.cc
index 40aef67d96..3d466581ec 100644
--- a/crawl-ref/source/tile2.cc
+++ b/crawl-ref/source/tile2.cc
@@ -172,10 +172,10 @@ const int tcache_oy_normal[TCACHE_KIND_NORMAL] = {0};
const int tcache_nlayer_normal[TCACHE_KIND_NORMAL] = {1};
#define TREGION_0_NORMAL 0
-const int region_sx_normal[1]={0};
-const int region_sy_normal[1]={0};
-const int region_wx_normal[1]={TILE_X};
-const int region_wy_normal[1]={TILE_Y};
+const int region_sx_normal[1] = {0};
+const int region_sy_normal[1] = {0};
+const int region_wx_normal[1] = {TILE_X};
+const int region_wy_normal[1] = {TILE_Y};
// ISO mode sink mask
static char *sink_mask;
@@ -307,7 +307,7 @@ void TileInit()
for (k = 0; k < tcache_kind; k++)
{
- screen_tcach_idx[k]= (int *)malloc(sizeof(int)* tile_xmax * tile_ymax);
+ screen_tcach_idx[k] = (int *)malloc(sizeof(int)* tile_xmax * tile_ymax);
tcache[k] = (tile_cache *)malloc(sizeof(tile_cache)*max_tcache);
for (x = 0; x < tile_xmax * tile_ymax; x++)
screen_tcach_idx[k][x] = -1;
@@ -346,7 +346,7 @@ void TileResizeScreen(int x0, int y0)
for (k = 0; k < tcache_kind; k++)
{
free(screen_tcach_idx[k]);
- screen_tcach_idx[k]= (int *)malloc(sizeof(int)* tile_xmax * tile_ymax);
+ screen_tcach_idx[k] = (int *)malloc(sizeof(int)* tile_xmax * tile_ymax);
free(tcache[k]);
tcache[k] = (tile_cache *)malloc(sizeof(tile_cache)*max_tcache);
@@ -835,9 +835,10 @@ int TileDrawCursor(int x, int y, int cflag)
return oldc;
}
-void TileDrawBolt(int x, int y, int fg){
+void TileDrawBolt(int x, int y, int fg)
+{
- t1buf[x+1][y+1]=fg | TILE_FLAG_FLYING;
+ t1buf[x+1][y+1] = fg | TILE_FLAG_FLYING;
_update_single_grid(x, y);
}
@@ -1459,7 +1460,7 @@ static bool _draw_doll(img_type img, dolls_data *doll, bool force_redraw = false
// Hack: change overlay order of boots/skirts
for (i = 0; i < TILEP_PARTS_TOTAL; i++)
- p_order2[i]=p_order[i];
+ p_order2[i] = p_order[i];
// swap boot and leg-armor
if (parts2[TILEP_PART_LEG] < TILEP_LEG_SKIRT_OFS)
@@ -1583,7 +1584,7 @@ static void _load_doll_data(const char *fn, dolls_data *dolls, int max,
void TilePlayerEdit()
{
- const int p_lines[PARTS_ITEMS]=
+ const int p_lines[PARTS_ITEMS] =
{
TILEP_SELECT_DOLL,
TILEP_PART_BASE,
@@ -1599,7 +1600,7 @@ void TilePlayerEdit()
TILEP_PART_CLOAK
};
- const char *p_names[PARTS_ITEMS]=
+ const char *p_names[PARTS_ITEMS] =
{
" Index:",
" Gendr:",
diff --git a/crawl-ref/source/tiles.h b/crawl-ref/source/tiles.h
index b1db1c39d6..fa1e808c6c 100644
--- a/crawl-ref/source/tiles.h
+++ b/crawl-ref/source/tiles.h
@@ -60,7 +60,7 @@ void tile_finish_dngn(unsigned int *tileb, int cx, int cy);
void tile_draw_dungeon(unsigned int *tileb);
// Tile Inventry display
-void tile_draw_inv(int item_type = -1, int flag = -1);
+void tile_draw_inv(int flag = -1);
// Multiple pickup
void tile_pick_menu();