diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-03-22 19:31:43 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-03-22 19:31:43 +0000 |
commit | 67eb0dfe831f2a90dccdff0f611d09a2214eae1e (patch) | |
tree | 29f67e3e83f6abce34bb72b6765481b454ea10f6 /crawl-ref | |
parent | b432e59457a38ff3f885e6da7afd2570c5dd0098 (diff) | |
download | crawl-ref-67eb0dfe831f2a90dccdff0f611d09a2214eae1e.tar.gz crawl-ref-67eb0dfe831f2a90dccdff0f611d09a2214eae1e.zip |
Applying the new convention to static methods.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3813 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/beam.cc | 326 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 308 | ||||
-rw-r--r-- | crawl-ref/source/spells1.cc | 22 |
3 files changed, 331 insertions, 325 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 7c44cdf1df..d2c8c10293 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -80,34 +80,34 @@ static int opdir[] = { 2, 1, 4, 3 }; static FixedArray < bool, 19, 19 > explode_map; // helper functions (some of these should probably be public): -static void sticky_flame_monster( int mn, kill_category who, int hurt_final ); -static bool affects_wall(const bolt &beam, int wall_feature); -static bool isBouncy(bolt &beam, unsigned char gridtype); -static int beam_source(const bolt &beam); -static std::string beam_zapper(const bolt &beam); -static bool beam_term_on_target(bolt &beam, int x, int y); -static void beam_explodes(bolt &beam, int x, int y); -static int affect_wall(bolt &beam, int x, int y); -static int affect_place_clouds(bolt &beam, int x, int y); -static void affect_place_explosion_clouds(bolt &beam, int x, int y); -static int affect_player(bolt &beam); -static void affect_items(bolt &beam, int x, int y); -static int affect_monster(bolt &beam, monsters *mon); -static int affect_monster_enchantment(bolt &beam, monsters *mon); -static void beam_paralyses_monster( bolt &pbolt, monsters *monster ); -static int range_used_on_hit(bolt &beam); -static void explosion1(bolt &pbolt); -static void explosion_map(bolt &beam, int x, int y, - int count, int dir, int r); -static void explosion_cell(bolt &beam, int x, int y, bool drawOnly); - -static void ench_animation( int flavour, const monsters *mon = NULL, bool force = false); -static void zappy(zap_type z_type, int power, bolt &pbolt); -static void monster_die(monsters *mons, const bolt &beam); +static void _sticky_flame_monster( int mn, kill_category who, int hurt_final ); +static bool _affects_wall(const bolt &beam, int wall_feature); +static bool _isBouncy(bolt &beam, unsigned char gridtype); +static int _beam_source(const bolt &beam); +static std::string _beam_zapper(const bolt &beam); +static bool _beam_term_on_target(bolt &beam, int x, int y); +static void _beam_explodes(bolt &beam, int x, int y); +static int _affect_wall(bolt &beam, int x, int y); +static int _affect_place_clouds(bolt &beam, int x, int y); +static void _affect_place_explosion_clouds(bolt &beam, int x, int y); +static int _affect_player(bolt &beam); +static void _affect_items(bolt &beam, int x, int y); +static int _affect_monster(bolt &beam, monsters *mon); +static int _affect_monster_enchantment(bolt &beam, monsters *mon); +static void _beam_paralyses_monster( bolt &pbolt, monsters *monster ); +static int _range_used_on_hit(bolt &beam); +static void _explosion1(bolt &pbolt); +static void _explosion_map(bolt &beam, int x, int y, + int count, int dir, int r); +static void _explosion_cell(bolt &beam, int x, int y, bool drawOnly); + +static void _ench_animation( int flavour, const monsters *mon = NULL, bool force = false); +static void _zappy(zap_type z_type, int power, bolt &pbolt); +static void _monster_die(monsters *mons, const bolt &beam); static std::set<std::string> beam_message_cache; -static bool beam_is_blockable( bolt &pbolt ) +static bool _beam_is_blockable( bolt &pbolt ) { // BEAM_ELECTRICITY is added here because chain lighting is not // a true beam (stops at the first target it gets to and redirects @@ -117,7 +117,7 @@ static bool beam_is_blockable( bolt &pbolt ) } // Kludge to suppress multiple redundant messages for a single beam. -static void beam_mpr(msg_channel_type channel, const char *s, ...) +static void _beam_mpr(msg_channel_type channel, const char *s, ...) { va_list args; va_start(args, s); @@ -134,12 +134,12 @@ static void beam_mpr(msg_channel_type channel, const char *s, ...) beam_message_cache.insert( message ); } -static void monster_die(monsters *mons, const bolt &beam) +static void _monster_die(monsters *mons, const bolt &beam) { monster_die(mons, beam.killer(), beam.beam_source); } -static kill_category whose_kill(const bolt &beam) +static kill_category _whose_kill(const bolt &beam) { if (YOU_KILL(beam.thrower)) return (KC_YOU); @@ -197,7 +197,7 @@ void zap_animation( int colour, const monsters *mon, bool force ) } // special front function for zap_animation to interpret enchantment flavours -static void ench_animation( int flavour, const monsters *mon, bool force ) +static void _ench_animation( int flavour, const monsters *mon, bool force ) { const int elem = (flavour == BEAM_HEALING) ? EC_HEAL : (flavour == BEAM_PAIN) ? EC_UNHOLY : @@ -236,7 +236,7 @@ void zapping(zap_type ztype, int power, bolt &pbolt) pbolt.aux_source.clear(); // additional source info, unused // fill in the bolt structure - zappy( ztype, power, pbolt ); + _zappy( ztype, power, pbolt ); if (ztype == ZAP_LIGHTNING && !silenced(you.x_pos, you.y_pos)) // needs to check silenced at other location, too {dlb} @@ -277,7 +277,7 @@ dice_def calc_dice( int num_dice, int max_damage ) // *do not* call this function directly (duh - it's static), need to // see zapping() for default values not set within this function {dlb} -static void zappy( zap_type z_type, int power, bolt &pbolt ) +static void _zappy( zap_type z_type, int power, bolt &pbolt ) { int temp_rand = 0; // probability determination {dlb} @@ -1256,7 +1256,7 @@ static void zappy( zap_type z_type, int power, bolt &pbolt ) // The wall will always shield the monster if the beam bounces off the // wall, and a monster can't use a metal wall to shield itself from // electricity. -static bool affect_mon_in_wall(bolt &pbolt, item_def *item, int tx, int ty) +static bool _affect_mon_in_wall(bolt &pbolt, item_def *item, int tx, int ty) { UNUSED(item); @@ -1394,7 +1394,7 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item ) if (grid_is_solid(grd[tx][ty])) { // first, check to see if this beam affects walls. - if (affects_wall(pbolt, grd[tx][ty])) + if (_affects_wall(pbolt, grd[tx][ty])) { // should we ever get a tracer with a wall-affecting // beam (possible I suppose), we'll quit tracing now. @@ -1409,7 +1409,7 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item ) { // BEGIN bounce case. Bouncing protects any monster // in the wall. - if (!isBouncy(pbolt, grd[tx][ty])) + if (!_isBouncy(pbolt, grd[tx][ty])) { // Affect any monster that might be in the wall. rangeRemaining -= affect(pbolt, tx, ty); @@ -1455,7 +1455,7 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item ) // monsters have no chance to dodge or block such // a beam, and we want to avoid silly messages. if (tx == pbolt.target_x && ty == pbolt.target_y) - beamTerminate = beam_term_on_target(pbolt, tx, ty); + beamTerminate = _beam_term_on_target(pbolt, tx, ty); // affect the cell, except in the special case noted // above -- affect() will early out if something gets @@ -1560,7 +1560,7 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item ) int ox = pbolt.target_x; int oy = pbolt.target_y; - beam_explodes(pbolt, tx, ty); + _beam_explodes(pbolt, tx, ty); if (pbolt.is_tracer) { @@ -1706,7 +1706,7 @@ int mons_adjust_flavoured( monsters *monster, bolt &pbolt, } else if (res <= 0 && doFlavouredEffects && !one_chance_in(3)) { - poison_monster( monster, whose_kill(pbolt) ); + poison_monster( monster, _whose_kill(pbolt) ); } break; } @@ -1724,12 +1724,12 @@ int mons_adjust_flavoured( monsters *monster, bolt &pbolt, // Poison arrow can poison any living thing regardless of // poison resistance. -- bwr if (mons_has_lifeforce(monster)) - poison_monster( monster, whose_kill(pbolt), 2, true ); + poison_monster( monster, _whose_kill(pbolt), 2, true ); } } else if (doFlavouredEffects) { - poison_monster( monster, whose_kill(pbolt), 4 ); + poison_monster( monster, _whose_kill(pbolt), 4 ); } break; @@ -1786,7 +1786,7 @@ int mons_adjust_flavoured( monsters *monster, bolt &pbolt, return (hurted); if (mons_res_poison( monster ) <= 0) - poison_monster( monster, whose_kill(pbolt) ); + poison_monster( monster, _whose_kill(pbolt) ); if (one_chance_in( 3 + 2 * mons_res_negative_energy(monster) )) { @@ -1897,7 +1897,7 @@ int mons_adjust_flavoured( monsters *monster, bolt &pbolt, return (hurted); } // end mons_adjust_flavoured() -static bool monster_resists_mass_enchantment(monsters *monster, +static bool _monster_resists_mass_enchantment(monsters *monster, enchant_type wh_enchant, int pow) { @@ -1978,7 +1978,7 @@ bool mass_enchantment( enchant_type wh_enchant, int pow, int origin, if (m_attempted) ++*m_attempted; - if (monster_resists_mass_enchantment(monster, wh_enchant, pow)) + if (_monster_resists_mass_enchantment(monster, wh_enchant, pow)) continue; if (monster->add_ench(mon_enchant(wh_enchant, 0, kc))) @@ -2047,7 +2047,7 @@ int mons_ench_f2(monsters *monster, bolt &pbolt) // not hasted, slow it if (!monster->has_ench(ENCH_SLOW) && !mons_is_stationary(monster) - && monster->add_ench(mon_enchant(ENCH_SLOW, 0, whose_kill(pbolt)))) + && monster->add_ench(mon_enchant(ENCH_SLOW, 0, _whose_kill(pbolt)))) { if (!mons_is_paralysed(monster) && simple_monster_message(monster, " seems to slow down.")) @@ -2106,7 +2106,7 @@ int mons_ench_f2(monsters *monster, bolt &pbolt) return (MON_AFFECTED); case BEAM_PARALYSIS: /* 3 = paralysis */ - beam_paralyses_monster(pbolt, monster); + _beam_paralyses_monster(pbolt, monster); return (MON_AFFECTED); case BEAM_CONFUSION: /* 4 = confusion */ @@ -2114,7 +2114,7 @@ int mons_ench_f2(monsters *monster, bolt &pbolt) return (MON_UNAFFECTED); if (monster->add_ench( - mon_enchant(ENCH_CONFUSION, 0, whose_kill(pbolt)))) + mon_enchant(ENCH_CONFUSION, 0, _whose_kill(pbolt)))) { // put in an exception for things you won't notice becoming confused. if (simple_monster_message(monster, " appears confused.")) @@ -2171,14 +2171,14 @@ int mons_ench_f2(monsters *monster, bolt &pbolt) } // end mons_ench_f2() // degree is ignored. -static void slow_monster(monsters *mon, int /* degree */) +static void _slow_monster(monsters *mon, int /* degree */) { bolt beam; beam.flavour = BEAM_SLOW; mons_ench_f2(mon, beam); } -static void beam_paralyses_monster(bolt &pbolt, monsters *monster) +static void _beam_paralyses_monster(bolt &pbolt, monsters *monster) { if (!monster->has_ench(ENCH_PARALYSIS) && monster->add_ench(ENCH_PARALYSIS)) @@ -2214,13 +2214,13 @@ bool curare_hits_monster( const bolt &beam, simple_monster_message(monster, " convulses."); if ((monster->hit_points -= hurted) < 1) { - monster_die(monster, beam); + _monster_die(monster, beam); mondied = true; } } if (!mondied) - slow_monster(monster, levels); + _slow_monster(monster, levels); } // Deities take notice. @@ -2264,7 +2264,7 @@ bool poison_monster( monsters *monster, } // actually napalms a monster (w/ message) -void sticky_flame_monster( int mn, kill_category who, int levels ) +void _sticky_flame_monster( int mn, kill_category who, int levels ) { monsters *monster = &menv[mn]; @@ -2355,7 +2355,7 @@ void mimic_alert(monsters *mimic) monster_teleport( mimic, !one_chance_in(3) ); } // end mimic_alert() -static bool isBouncy(bolt &beam, unsigned char gridtype) +static bool _isBouncy(bolt &beam, unsigned char gridtype) { if (beam.name[0] == '0') return false; @@ -2367,7 +2367,7 @@ static bool isBouncy(bolt &beam, unsigned char gridtype) return (false); } -static void beam_explodes(bolt &beam, int x, int y) +static void _beam_explodes(bolt &beam, int x, int y) { cloud_type cl_type; @@ -2380,7 +2380,7 @@ static void beam_explodes(bolt &beam, int x, int y) // generic explosion if (beam.is_explosion) // beam.flavour == BEAM_EXPLOSION || beam.flavour == BEAM_HOLY) { - explosion1(beam); + _explosion1(beam); return; } @@ -2429,7 +2429,7 @@ static void beam_explodes(bolt &beam, int x, int y) break; } - explosion1(beam); + _explosion1(beam); return; } @@ -2439,7 +2439,7 @@ static void beam_explodes(bolt &beam, int x, int y) // cloud producer -- POISON BLAST if (beam.name == "blast of poison") { - big_cloud( CLOUD_POISON, whose_kill(beam), x, y, 0, 7 + random2(5) ); + big_cloud( CLOUD_POISON, _whose_kill(beam), x, y, 0, 7 + random2(5) ); return; } @@ -2447,13 +2447,13 @@ static void beam_explodes(bolt &beam, int x, int y) if (beam.name == "foul vapour") { cl_type = beam.flavour == BEAM_MIASMA? CLOUD_MIASMA : CLOUD_STINK; - big_cloud( cl_type, whose_kill(beam), x, y, 0, 9 ); + big_cloud( cl_type, _whose_kill(beam), x, y, 0, 9 ); return; } if (beam.name == "freezing blast") { - big_cloud( CLOUD_COLD, whose_kill(beam), x, y, + big_cloud( CLOUD_COLD, _whose_kill(beam), x, y, random_range(10, 15), 9 ); return; } @@ -2463,19 +2463,19 @@ static void beam_explodes(bolt &beam, int x, int y) || beam.name == "metal orb" || beam.name == "great blast of cold") { - explosion1( beam ); + _explosion1( beam ); return; } // cloud producer only -- stinking cloud if (beam.name == "ball of vapour") { - explosion1( beam ); + _explosion1( beam ); return; } } -static bool beam_term_on_target(bolt &beam, int x, int y) +static bool _beam_term_on_target(bolt &beam, int x, int y) { if (beam.flavour == BEAM_LINE_OF_SIGHT) { @@ -2542,7 +2542,7 @@ void beam_drop_object( bolt &beam, item_def *item, int x, int y ) // Returns true if the beam hits the player, fuzzing the beam if necessary // for monsters without see invis firing tracers at the player. -static bool found_player(const bolt &beam, int x, int y) +static bool _found_player(const bolt &beam, int x, int y) { const bool needs_fuzz = beam.is_tracer && !beam.can_see_invis && you.invisible(); @@ -2565,9 +2565,9 @@ int affect(bolt &beam, int x, int y) if (beam.is_tracer) // tracers always stop on walls. return (BEAM_STOP); - if (affects_wall(beam, grd[x][y])) + if (_affects_wall(beam, grd[x][y])) { - rangeUsed += affect_wall(beam, x, y); + rangeUsed += _affect_wall(beam, x, y); } // if it's still a wall, quit - we can't do anything else to a // wall (but we still might be able to do something to any @@ -2579,8 +2579,8 @@ int affect(bolt &beam, int x, int y) if (mid != NON_MONSTER) { monsters *mon = &menv[mid]; - if (affect_mon_in_wall(beam, NULL, x, y)) - rangeUsed += affect_monster( beam, mon ); + if (_affect_mon_in_wall(beam, NULL, x, y)) + rangeUsed += _affect_monster( beam, mon ); else if (you.can_see(mon)) { mprf("The %s protects %s from harm.", @@ -2597,10 +2597,10 @@ int affect(bolt &beam, int x, int y) // if not a tracer, place clouds if (!beam.is_tracer) - rangeUsed += affect_place_clouds(beam, x, y); + rangeUsed += _affect_place_clouds(beam, x, y); // if player is at this location, try to affect unless term_on_target - if (found_player(beam, x, y)) + if (_found_player(beam, x, y)) { // Done this way so that poison blasts affect the target once (via // place_cloud) and explosion spells only affect the target once @@ -2609,10 +2609,10 @@ int affect(bolt &beam, int x, int y) if (!beam.is_big_cloud && (!beam.is_explosion || beam.in_explosion_phase)) { - rangeUsed += affect_player( beam ); + rangeUsed += _affect_player( beam ); } - if (beam_term_on_target(beam, x, y)) + if (_beam_term_on_target(beam, x, y)) return (BEAM_STOP); } @@ -2633,10 +2633,10 @@ int affect(bolt &beam, int x, int y) if (!beam.is_big_cloud && (!beam.is_explosion || beam.in_explosion_phase)) { - rangeUsed += affect_monster( beam, &menv[mid] ); + rangeUsed += _affect_monster( beam, &menv[mid] ); } - if (beam_term_on_target(beam, x, y)) + if (_beam_term_on_target(beam, x, y)) return (BEAM_STOP); } } @@ -2644,15 +2644,15 @@ int affect(bolt &beam, int x, int y) return (rangeUsed); } -static bool is_fiery(const bolt &beam) +static bool _is_fiery(const bolt &beam) { return (beam.flavour == BEAM_FIRE || beam.flavour == BEAM_HELLFIRE || beam.flavour == BEAM_LAVA); } -static bool is_superhot(const bolt &beam) +static bool _is_superhot(const bolt &beam) { - if (!is_fiery(beam)) + if (!_is_fiery(beam)) return (false); return beam.name == "bolt of fire" @@ -2661,7 +2661,7 @@ static bool is_superhot(const bolt &beam) && beam.in_explosion_phase); } -static bool affects_wall(const bolt &beam, int wall) +static bool _affects_wall(const bolt &beam, int wall) { // digging if (beam.flavour == BEAM_DIGGING) @@ -2672,7 +2672,7 @@ static bool affects_wall(const bolt &beam, int wall) if (beam.flavour == BEAM_DISINTEGRATION && beam.damage.num >= 3) return (true); - if (is_fiery(beam) && wall == DNGN_WAX_WALL) + if (_is_fiery(beam) && wall == DNGN_WAX_WALL) return (true); // eye of devastation? @@ -2683,7 +2683,7 @@ static bool affects_wall(const bolt &beam, int wall) } // return amount of extra range used up by affectation of this wall. -static int affect_wall(bolt &beam, int x, int y) +static int _affect_wall(bolt &beam, int x, int y) { int rangeUsed = 0; @@ -2725,21 +2725,21 @@ static int affect_wall(bolt &beam, int x, int y) // END DIGGING EFFECT // FIRE effect - if (is_fiery(beam)) + if (_is_fiery(beam)) { const int wgrd = grd[x][y]; if (wgrd != DNGN_WAX_WALL) return (0); - if (!is_superhot(beam)) + if (!_is_superhot(beam)) { if (beam.flavour != BEAM_HELLFIRE) { if (see_grid(x, y)) - beam_mpr(MSGCH_PLAIN, - "The wax appears to soften slightly."); + _beam_mpr(MSGCH_PLAIN, + "The wax appears to soften slightly."); else if (player_can_smell()) - beam_mpr(MSGCH_PLAIN, "You smell warm wax."); + _beam_mpr(MSGCH_PLAIN, "You smell warm wax."); } return (BEAM_STOP); @@ -2747,11 +2747,11 @@ static int affect_wall(bolt &beam, int x, int y) grd[x][y] = DNGN_FLOOR; if (see_grid(x, y)) - beam_mpr(MSGCH_PLAIN, "The wax bubbles and burns!"); + _beam_mpr(MSGCH_PLAIN, "The wax bubbles and burns!"); else if (player_can_smell()) - beam_mpr(MSGCH_PLAIN, "You smell burning wax."); + _beam_mpr(MSGCH_PLAIN, "You smell burning wax."); - place_cloud(CLOUD_FIRE, x, y, random2(10) + 15, whose_kill(beam)); + place_cloud(CLOUD_FIRE, x, y, random2(10) + 15, _whose_kill(beam)); beam.obvious_effect = true; @@ -2812,11 +2812,11 @@ static int affect_wall(bolt &beam, int x, int y) return (rangeUsed); } -static int affect_place_clouds(bolt &beam, int x, int y) +static int _affect_place_clouds(bolt &beam, int x, int y) { if (beam.in_explosion_phase) { - affect_place_explosion_clouds( beam, x, y ); + _affect_place_explosion_clouds( beam, x, y ); return (0); // return value irrelevant for explosions } @@ -2854,45 +2854,45 @@ static int affect_place_clouds(bolt &beam, int x, int y) // POISON BLAST if (beam.name == "blast of poison") - place_cloud( CLOUD_POISON, x, y, random2(4) + 2, whose_kill(beam) ); + place_cloud( CLOUD_POISON, x, y, random2(4) + 2, _whose_kill(beam) ); // FIRE/COLD over water/lava if ( (grd[x][y] == DNGN_LAVA && beam.flavour == BEAM_COLD) || (grid_is_watery(grd[x][y]) && beam.flavour == BEAM_FIRE) ) { - place_cloud( CLOUD_STEAM, x, y, 2 + random2(5), whose_kill(beam) ); + place_cloud( CLOUD_STEAM, x, y, 2 + random2(5), _whose_kill(beam) ); } if (beam.flavour == BEAM_COLD && grid_is_watery(grd[x][y])) { - place_cloud( CLOUD_COLD, x, y, 2 + random2(5), whose_kill(beam) ); + place_cloud( CLOUD_COLD, x, y, 2 + random2(5), _whose_kill(beam) ); } // GREAT BLAST OF COLD if (beam.name == "great blast of cold") - place_cloud( CLOUD_COLD, x, y, random2(5) + 3, whose_kill(beam) ); + place_cloud( CLOUD_COLD, x, y, random2(5) + 3, _whose_kill(beam) ); // BALL OF STEAM if (beam.name == "ball of steam") { - place_cloud( CLOUD_STEAM, x, y, random2(5) + 2, whose_kill(beam) ); + place_cloud( CLOUD_STEAM, x, y, random2(5) + 2, _whose_kill(beam) ); } if (beam.flavour == BEAM_MIASMA) { - place_cloud( CLOUD_MIASMA, x, y, random2(5) + 2, whose_kill(beam) ); + place_cloud( CLOUD_MIASMA, x, y, random2(5) + 2, _whose_kill(beam) ); } // POISON GAS if (beam.name == "poison gas") - place_cloud( CLOUD_POISON, x, y, random2(4) + 3, whose_kill(beam) ); + place_cloud( CLOUD_POISON, x, y, random2(4) + 3, _whose_kill(beam) ); return (0); } // following two functions used with explosions: -static void affect_place_explosion_clouds(bolt &beam, int x, int y) +static void _affect_place_explosion_clouds(bolt &beam, int x, int y) { cloud_type cl_type; int duration; @@ -2902,7 +2902,7 @@ static void affect_place_explosion_clouds(bolt &beam, int x, int y) || ((grd[x][y] == DNGN_DEEP_WATER || grd[x][y] == DNGN_SHALLOW_WATER) && beam.flavour == BEAM_FIRE) ) { - place_cloud( CLOUD_STEAM, x, y, 2 + random2(5), whose_kill(beam) ); + place_cloud( CLOUD_STEAM, x, y, 2 + random2(5), _whose_kill(beam) ); return; } @@ -2965,19 +2965,19 @@ static void affect_place_explosion_clouds(bolt &beam, int x, int y) break; } - place_cloud( cl_type, x, y, duration, whose_kill(beam) ); + place_cloud( cl_type, x, y, duration, _whose_kill(beam) ); } // then check for more specific explosion cloud types. if (beam.name == "ice storm") { - place_cloud( CLOUD_COLD, x, y, 2 + random2avg(5, 2), whose_kill(beam) ); + place_cloud( CLOUD_COLD, x, y, 2 + random2avg(5, 2), _whose_kill(beam) ); } if (beam.name == "stinking cloud") { duration = 1 + random2(4) + random2( (beam.ench_power / 50) + 1 ); - place_cloud( CLOUD_STINK, x, y, duration, whose_kill(beam) ); + place_cloud( CLOUD_STINK, x, y, duration, _whose_kill(beam) ); } if (beam.name == "great blast of fire") @@ -2987,7 +2987,7 @@ static void affect_place_explosion_clouds(bolt &beam, int x, int y) if (duration > 20) duration = 20 + random2(4); - place_cloud( CLOUD_FIRE, x, y, duration, whose_kill(beam) ); + place_cloud( CLOUD_FIRE, x, y, duration, _whose_kill(beam) ); if (grd[x][y] == DNGN_FLOOR && mgrd[x][y] == NON_MONSTER && one_chance_in(4)) @@ -2997,7 +2997,7 @@ static void affect_place_explosion_clouds(bolt &beam, int x, int y) } } -static void affect_items(bolt &beam, int x, int y) +static void _affect_items(bolt &beam, int x, int y) { object_class_type objs_vulnerable = OBJ_UNASSIGNED; @@ -3043,13 +3043,13 @@ static void affect_items(bolt &beam, int x, int y) } } -static int beam_ouch_agent(const bolt &beam) +static int _beam_ouch_agent(const bolt &beam) { return YOU_KILL(beam.thrower)? 0 : beam.beam_source; } // A little helper function to handle the calling of ouch()... -static void beam_ouch( int dam, bolt &beam ) +static void _beam_ouch( int dam, bolt &beam ) { // The order of this is important. if (YOU_KILL( beam.thrower ) && beam.aux_source.empty()) @@ -3073,7 +3073,7 @@ static void beam_ouch( int dam, bolt &beam ) // [ds] Apply a fuzz if the monster lacks see invisible and is trying to target // an invisible player. This makes invisibility slightly more powerful. -static bool fuzz_invis_tracer(bolt &beem) +static bool _fuzz_invis_tracer(bolt &beem) { // Did the monster have a rough idea of where you are? int dist = grid_distance(beem.target_x, beem.target_y, @@ -3083,7 +3083,7 @@ static bool fuzz_invis_tracer(bolt &beem) if (dist > 2) return (false); - const int beam_src = beam_source(beem); + const int beam_src = _beam_source(beem); if (beam_src != MHITNOT && beam_src != MHITYOU) { // Monsters that can sense invisible @@ -3122,9 +3122,9 @@ bool test_beam_hit(int attack, int defence) || random2(attack) >= random2avg(defence, 2)); } -static std::string beam_zapper(const bolt &beam) +static std::string _beam_zapper(const bolt &beam) { - const int bsrc = beam_source(beam); + const int bsrc = _beam_source(beam); if (bsrc == MHITYOU) return ("self"); else if (bsrc == MHITNOT) @@ -3134,7 +3134,7 @@ static std::string beam_zapper(const bolt &beam) } // return amount of extra range used up by affectation of the player -static int affect_player( bolt &beam ) +static int _affect_player( bolt &beam ) { // digging -- don't care. if (beam.flavour == BEAM_DIGGING) @@ -3145,7 +3145,7 @@ static int affect_player( bolt &beam ) { // check can see player if (beam.can_see_invis || !you.invisible() - || fuzz_invis_tracer(beam)) + || _fuzz_invis_tracer(beam)) { if (beam.attitude != ATT_HOSTILE) { @@ -3158,7 +3158,7 @@ static int affect_player( bolt &beam ) beam.foe_power += you.experience_level; } } - return (range_used_on_hit(beam)); + return (_range_used_on_hit(beam)); } // Trigger an interrupt, so travel will stop on misses @@ -3204,7 +3204,7 @@ static int affect_player( bolt &beam ) return (0); // no extra used by miss! } } - else if (beam_is_blockable(beam)) + else if (_beam_is_blockable(beam)) { // non-beams can be blocked or dodged if (you.equip[EQ_SHIELD] != -1 @@ -3274,10 +3274,10 @@ static int affect_player( bolt &beam ) if (beam.flavour != BEAM_TELEPORT && you.level_type == LEVEL_ABYSS) xom_is_stimulated(255); - return (range_used_on_hit(beam)); + return (_range_used_on_hit(beam)); } - ench_animation( beam.flavour ); + _ench_animation( beam.flavour ); // these colors are misapplied - see mons_ench_f2() {dlb} switch (beam.flavour) @@ -3395,7 +3395,7 @@ static int affect_player( bolt &beam ) break; } you.banished = true; - you.banished_by = beam_zapper(beam); + you.banished_by = _beam_zapper(beam); beam.obvious_effect = true; break; // banishment to the abyss @@ -3411,7 +3411,7 @@ static int affect_player( bolt &beam ) if (beam.aux_source.empty()) beam.aux_source = "by nerve-wracking pain"; - beam_ouch( roll_dice( beam.damage ), beam ); + _beam_ouch( roll_dice( beam.damage ), beam ); beam.obvious_effect = true; break; @@ -3427,7 +3427,7 @@ static int affect_player( bolt &beam ) if (beam.aux_source.empty()) beam.aux_source = "by dispel undead"; - beam_ouch( roll_dice( beam.damage ), beam ); + _beam_ouch( roll_dice( beam.damage ), beam ); beam.obvious_effect = true; break; @@ -3437,7 +3437,7 @@ static int affect_player( bolt &beam ) if (beam.aux_source.empty()) beam.aux_source = "a disintegration bolt"; - beam_ouch( roll_dice( beam.damage ), beam ); + _beam_ouch( roll_dice( beam.damage ), beam ); beam.obvious_effect = true; break; @@ -3476,7 +3476,7 @@ static int affect_player( bolt &beam ) // regardless of affect, we need to know if this is a stopper // or not - it seems all of the above are. - return (range_used_on_hit(beam)); + return (_range_used_on_hit(beam)); // END enchantment beam } @@ -3570,7 +3570,7 @@ static int affect_player( bolt &beam ) { if (random2(100) < 90 - (3 * player_AC())) { - curare_hits_player( beam_ouch_agent(beam), 1 + random2(3) ); + curare_hits_player( _beam_ouch_agent(beam), 1 + random2(3) ); was_affected = true; } } @@ -3628,19 +3628,19 @@ static int affect_player( bolt &beam ) beam.foe_hurt++; } - beam_ouch( hurted, beam ); + _beam_ouch( hurted, beam ); - return (range_used_on_hit( beam )); + return (_range_used_on_hit( beam )); } -static int beam_source(const bolt &beam) +static int _beam_source(const bolt &beam) { return MON_KILL(beam.thrower) ? beam.beam_source : beam.thrower == KILL_MISC ? MHITNOT : MHITYOU; } -static int name_to_skill_level(const std::string& name) +static int _name_to_skill_level(const std::string& name) { skill_type type = SK_THROWING; @@ -3661,7 +3661,7 @@ static int name_to_skill_level(const std::string& name) return (2 * you.skills[type]); } -static void update_hurt_or_helped(bolt &beam, monsters *mon) +static void _update_hurt_or_helped(bolt &beam, monsters *mon) { if (beam.attitude != mons_attitude(mon)) { @@ -3687,7 +3687,7 @@ static void update_hurt_or_helped(bolt &beam, monsters *mon) } // return amount of range used up by affectation of this monster -static int affect_monster(bolt &beam, monsters *mon) +static int _affect_monster(bolt &beam, monsters *mon) { const int tid = mgrd[mon->x][mon->y]; const int mons_type = menv[tid].type; @@ -3737,9 +3737,9 @@ static int affect_monster(bolt &beam, monsters *mon) "crumbles away!"); } beam.obvious_effect = true; - update_hurt_or_helped(beam, mon); + _update_hurt_or_helped(beam, mon); mon->hit_points = 0; - monster_die(mon, beam); + _monster_die(mon, beam); return (BEAM_STOP); } @@ -3760,7 +3760,7 @@ static int affect_monster(bolt &beam, monsters *mon) beam.fr_power += mons_power(mons_type); } - return (range_used_on_hit(beam)); + return (_range_used_on_hit(beam)); } // BEGIN non-tracer enchantment @@ -3796,24 +3796,24 @@ static int affect_monster(bolt &beam, monsters *mon) } - behaviour_event( mon, ME_ANNOY, beam_source(beam) ); + behaviour_event( mon, ME_ANNOY, _beam_source(beam) ); } else { - behaviour_event( mon, ME_ALERT, beam_source(beam) ); + behaviour_event( mon, ME_ALERT, _beam_source(beam) ); } // !@#*( affect_monster_enchantment() has side-effects on // the beam structure which screw up range_used_on_hit(), // so call it now and store. - int rangeUsed = range_used_on_hit(beam); + int rangeUsed = _range_used_on_hit(beam); // Doing this here so that the player gets to see monsters // "flicker and vanish" when turning invisible.... - ench_animation( beam.flavour, mon ); + _ench_animation( beam.flavour, mon ); // now do enchantment affect - int ench_result = affect_monster_enchantment(beam, mon); + int ench_result = _affect_monster_enchantment(beam, mon); if (mon->alive()) { switch (ench_result) @@ -3827,7 +3827,7 @@ static int affect_monster(bolt &beam, monsters *mon) beam.msg_generated = true; break; default: - update_hurt_or_helped(beam, mon); + _update_hurt_or_helped(beam, mon); break; } } @@ -3921,7 +3921,7 @@ static int affect_monster(bolt &beam, monsters *mon) } } // either way, we could hit this monster, so return range used - return (range_used_on_hit(beam)); + return (_range_used_on_hit(beam)); } // END non-enchantment (could still be tracer) @@ -3968,7 +3968,7 @@ static int affect_monster(bolt &beam, monsters *mon) // Don't annoy friendlies if the player's beam did no damage. // Hostiles will still take umbrage. if (hurt_final > 0 || !mons_friendly(mon) || !YOU_KILL(beam.thrower)) - behaviour_event(mon, ME_ANNOY, beam_source(beam) ); + behaviour_event(mon, ME_ANNOY, _beam_source(beam) ); } // explosions always 'hit' @@ -3993,7 +3993,7 @@ static int affect_monster(bolt &beam, monsters *mon) } // The monster may block the beam. - if (!engulfs && beam_is_blockable(beam)) + if (!engulfs && _beam_is_blockable(beam)) { const int shield_block = mon->shield_bonus(); if (shield_block > 0) @@ -4012,7 +4012,7 @@ static int affect_monster(bolt &beam, monsters *mon) } } - update_hurt_or_helped(beam, mon); + _update_hurt_or_helped(beam, mon); conduct.enabled = true; @@ -4048,7 +4048,7 @@ static int affect_monster(bolt &beam, monsters *mon) if (mon->hit_points < 1) { - monster_die(mon, beam); + _monster_die(mon, beam); } else { @@ -4065,7 +4065,7 @@ static int affect_monster(bolt &beam, monsters *mon) if (levels > 4) levels = 4; - sticky_flame_monster( tid, whose_kill(beam), levels ); + _sticky_flame_monster( tid, _whose_kill(beam), levels ); } @@ -4090,7 +4090,7 @@ static int affect_monster(bolt &beam, monsters *mon) int num_success = 0; if ( YOU_KILL(beam.thrower) ) { - const int skill_level = name_to_skill_level(beam.name); + const int skill_level = _name_to_skill_level(beam.name); if ( skill_level + 25 > random2(50) ) num_success++; if ( skill_level > random2(50) ) @@ -4103,7 +4103,7 @@ static int affect_monster(bolt &beam, monsters *mon) { if ( num_success == 2 ) num_levels++; - poison_monster( mon, whose_kill(beam), num_levels ); + poison_monster( mon, _whose_kill(beam), num_levels ); } } @@ -4111,7 +4111,7 @@ static int affect_monster(bolt &beam, monsters *mon) if (beam.name.find("curare") != std::string::npos) { if (beam.ench_power == AUTOMATIC_HIT - && curare_hits_monster( beam, mon, whose_kill(beam), 2 )) + && curare_hits_monster( beam, mon, _whose_kill(beam), 2 )) { wake_mimic = false; } @@ -4123,10 +4123,10 @@ static int affect_monster(bolt &beam, monsters *mon) beogh_follower_convert(mon, true); } - return (range_used_on_hit(beam)); + return (_range_used_on_hit(beam)); } -static int affect_monster_enchantment(bolt &beam, monsters *mon) +static int _affect_monster_enchantment(bolt &beam, monsters *mon) { bool death_check = false; @@ -4191,7 +4191,7 @@ static int affect_monster_enchantment(bolt &beam, monsters *mon) simple_monster_message(mon, " wobbles for a moment."); } else - monster_die(mon, beam); + _monster_die(mon, beam); beam.obvious_effect = true; return (MON_AFFECTED); @@ -4383,7 +4383,7 @@ static int affect_monster_enchantment(bolt &beam, monsters *mon) return (mons_ench_f2(mon, beam)); if (mon->hit_points < 1) - monster_die(mon, beam); + _monster_die(mon, beam); else { print_wounds(mon); @@ -4397,7 +4397,7 @@ static int affect_monster_enchantment(bolt &beam, monsters *mon) // extra range used on hit -static int range_used_on_hit(bolt &beam) +static int _range_used_on_hit(bolt &beam) { // non-beams can only affect one thing (player/monster) if (!beam.is_beam) @@ -4462,7 +4462,7 @@ static int range_used_on_hit(bolt &beam) from missile() and beam() in beam.cc. Explosions which do not follow from beams (eg scrolls of immolation) bypass this function. */ -static void explosion1(bolt &pbolt) +static void _explosion1(bolt &pbolt) { int ex_size = 1; // convenience @@ -4704,7 +4704,7 @@ void explosion( bolt &beam, bool hole_in_the_middle, // corners where a simple 'line of sight' isn't quite // enough. This might be slow for really big explosions, // as the recursion runs approximately as R^2 - explosion_map(beam, 0, 0, 0, 0, r); + _explosion_map(beam, 0, 0, 0, 0, r); // go through affected cells, drawing effect and // calling affect() and affect_items() for each. @@ -4726,7 +4726,7 @@ void explosion( bolt &beam, bool hole_in_the_middle, { // do center -- but only if its affected if (!hole_in_the_middle) - explosion_cell(beam, 0, 0, drawing); + _explosion_cell(beam, 0, 0, drawing); // do the rest of it for(int rad = 1; rad <= r; rad ++) @@ -4735,20 +4735,20 @@ void explosion( bolt &beam, bool hole_in_the_middle, for (int ay = 1 - rad; ay <= rad - 1; ay += 1) { if (explode_map[-rad+9][ay+9]) - explosion_cell(beam, -rad, ay, drawing); + _explosion_cell(beam, -rad, ay, drawing); if (explode_map[rad+9][ay+9]) - explosion_cell(beam, rad, ay, drawing); + _explosion_cell(beam, rad, ay, drawing); } // do top & bottom for (int ax = -rad; ax <= rad; ax += 1) { if (explode_map[ax+9][-rad+9]) - explosion_cell(beam, ax, -rad, drawing); + _explosion_cell(beam, ax, -rad, drawing); if (explode_map[ax+9][rad+9]) - explosion_cell(beam, ax, rad, drawing); + _explosion_cell(beam, ax, rad, drawing); } // new-- delay after every 'ring' {gdl} @@ -4784,7 +4784,7 @@ void explosion( bolt &beam, bool hole_in_the_middle, more(); } -static void explosion_cell(bolt &beam, int x, int y, bool drawOnly) +static void _explosion_cell(bolt &beam, int x, int y, bool drawOnly) { bool random_beam = false; int realx = beam.target_x + x; @@ -4814,9 +4814,9 @@ static void explosion_cell(bolt &beam, int x, int y, bool drawOnly) // now affect items if (!drawOnly) { - affect_items(beam, realx, realy); - if (affects_wall(beam, grd[realx][realy])) - affect_wall(beam, realx, realy); + _affect_items(beam, realx, realy); + if (_affects_wall(beam, grd[realx][realy])) + _affect_wall(beam, realx, realy); } if (drawOnly) @@ -4843,7 +4843,7 @@ static void explosion_cell(bolt &beam, int x, int y, bool drawOnly) } } -static void explosion_map( bolt &beam, int x, int y, +static void _explosion_map( bolt &beam, int x, int y, int count, int dir, int r ) { // 1. check to see out of range @@ -4864,7 +4864,7 @@ static void explosion_map( bolt &beam, int x, int y, // solid cells at the center of the explosion. if (dngn_feat <= DNGN_MAXWALL) { - if (!(x==0 && y==0) && !affects_wall(beam, dngn_feat)) + if (!(x==0 && y==0) && !_affects_wall(beam, dngn_feat)) return; } @@ -4881,8 +4881,8 @@ static void explosion_map( bolt &beam, int x, int y, if (x * spreadx[i] < 0 || y * spready[i] < 0) cadd = 17; - explosion_map( beam, x + spreadx[i], y + spready[i], - count + cadd, opdir[i], r ); + _explosion_map( beam, x + spreadx[i], y + spready[i], + count + cadd, opdir[i], r ); } } } diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index e08685c1cb..f6f2f044a4 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -70,14 +70,14 @@ #include "stash.h" #include "xom.h" -static bool handle_special_ability(monsters *monster, bolt & beem); -static bool handle_pickup(monsters *monster); -static void handle_behaviour(monsters *monster); -static void set_nearest_monster_foe(monsters *monster); -static void mons_in_cloud(monsters *monster); -static bool monster_move(monsters *monster); -static bool plant_spit(monsters *monster, bolt &pbolt); -static spell_type map_wand_to_mspell(int wand_type); +static bool _handle_special_ability(monsters *monster, bolt & beem); +static bool _handle_pickup(monsters *monster); +static void _handle_behaviour(monsters *monster); +static void _set_nearest_monster_foe(monsters *monster); +static void _mons_in_cloud(monsters *monster); +static bool _monster_move(monsters *monster); +static bool _plant_spit(monsters *monster, bolt &pbolt); +static spell_type _map_wand_to_mspell(int wand_type); // [dshaligram] Doesn't need to be extern. static int mmov_x, mmov_y; @@ -271,8 +271,8 @@ bool curse_an_item( bool decay_potions ) return (true); } -static void monster_drop_ething(monsters *monster, - bool mark_item_origins = false) +static void _monster_drop_ething(monsters *monster, + bool mark_item_origins = false) { const bool hostile_grid = grid_destroys_items(grd(monster->pos())); const int midx = (int) monster_index(monster); @@ -313,7 +313,7 @@ static void monster_drop_ething(monsters *monster, grid_item_destruction_message(grd(monster->pos()))); } -static void place_monster_corpse(const monsters *monster) +static void _place_monster_corpse(const monsters *monster) { int corpse_class = mons_species(monster->type); if (corpse_class == MONS_DRACONIAN) @@ -360,24 +360,24 @@ static void place_monster_corpse(const monsters *monster) } } // end place_monster_corpse() -static void tutorial_inspect_kill() +static void _tutorial_inspect_kill() { if (Options.tutorial_events[TUT_KILLED_MONSTER]) learned_something_new(TUT_KILLED_MONSTER); } #ifdef DGL_MILESTONES -static std::string milestone_kill_verb(killer_type killer) +static std::string _milestone_kill_verb(killer_type killer) { return (killer == KILL_RESET? "banished " : "killed "); } -static void check_kill_milestone(const monsters *mons, +static void _check_kill_milestone(const monsters *mons, killer_type killer, int i) { if (mons->type == MONS_PLAYER_GHOST) { - std::string milestone = milestone_kill_verb(killer) + "the ghost of "; + std::string milestone = _milestone_kill_verb(killer) + "the ghost of "; milestone += ghost_description(*mons, true); milestone += "."; mark_milestone("ghost", milestone); @@ -410,7 +410,7 @@ static void _give_monster_experience( monsters *victim, } } -static void give_adjusted_experience(monsters *monster, killer_type killer, +static void _give_adjusted_experience(monsters *monster, killer_type killer, bool pet_kill, int killer_index, unsigned int *exp_gain, unsigned int *avail_gain) @@ -470,7 +470,7 @@ static bool _is_pet_kill(killer_type killer, int i) && (me.who == KC_YOU || me.who == KC_FRIENDLY)); } -static bool ely_heals_monster(monsters *monster, killer_type killer, int i) +static bool _ely_heals_monster(monsters *monster, killer_type killer, int i) { god_type god = GOD_ELYVILON; ASSERT(you.religion != god); @@ -521,7 +521,7 @@ static bool ely_heals_monster(monsters *monster, killer_type killer, int i) return (true); } -static bool monster_avoided_death(monsters *monster, killer_type killer, int i) +static bool _monster_avoided_death(monsters *monster, killer_type killer, int i) { if (monster->hit_points < -25 || monster->hit_points < -monster->max_hit_points @@ -532,7 +532,7 @@ static bool monster_avoided_death(monsters *monster, killer_type killer, int i) } if (you.religion != GOD_ELYVILON && you.penance[GOD_ELYVILON] - && ely_heals_monster(monster, killer, i)) + && _ely_heals_monster(monster, killer, i)) { return (true); } @@ -580,7 +580,7 @@ static bool monster_avoided_death(monsters *monster, killer_type killer, int i) return (false); } -static bool is_mons_mutator_or_rotter(monsters *mons) +static bool _is_mons_mutator_or_rotter(monsters *mons) { if (mons->has_ench(ENCH_GLOWING_SHAPESHIFTER, ENCH_SHAPESHIFTER)) return true; @@ -597,7 +597,7 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) if (monster->type == -1) return; - if (!silent && monster_avoided_death(monster, killer, i)) + if (!silent && _monster_avoided_death(monster, killer, i)) return; if (mons_is_caught(monster)) @@ -615,7 +615,7 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) const bool gives_xp = !monster->has_ench(ENCH_ABJ); #ifdef DGL_MILESTONES - check_kill_milestone(monster, killer, i); + _check_kill_milestone(monster, killer, i); #endif // Award experience for suicide if the suicide was caused by the @@ -754,7 +754,7 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) } // killing triggers tutorial lesson - tutorial_inspect_kill(); + _tutorial_inspect_kill(); // prevent summoned creatures from being done_good kills, if (!created_friendly && gives_xp) @@ -778,7 +778,7 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) monster->hit_dice, true, monster); } - if (is_mons_mutator_or_rotter(monster)) + if (_is_mons_mutator_or_rotter(monster)) did_god_conduct(DID_KILL_MUTATOR_OR_ROTTER, monster->hit_dice, true, monster); @@ -1066,8 +1066,8 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) KC_OTHER; unsigned int exp_gain = 0, avail_gain = 0; - give_adjusted_experience(monster, killer, pet_kill, i, - &exp_gain, &avail_gain); + _give_adjusted_experience(monster, killer, pet_kill, i, + &exp_gain, &avail_gain); PlaceInfo& curr_PlaceInfo = you.get_place_info(); PlaceInfo delta; @@ -1108,7 +1108,7 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) else { // have to add case for disintegration effect here? {dlb} - place_monster_corpse(monster); + _place_monster_corpse(monster); } } @@ -1118,7 +1118,7 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) const coord_def mwhere = monster->pos(); if (drop_items) - monster_drop_ething(monster, YOU_KILL(killer) || pet_kill); + _monster_drop_ething(monster, YOU_KILL(killer) || pet_kill); monster_cleanup(monster); // Force redraw for monsters that die. @@ -1144,7 +1144,7 @@ void monster_cleanup(monsters *monster) you.pet_target = MHITNOT; } // end monster_cleanup() -static bool jelly_divide(monsters * parent) +static bool _jelly_divide(monsters * parent) { int jex = 0, jey = 0; // loop variables {dlb} bool foundSpot = false; // to rid code of hideous goto {dlb} @@ -1241,7 +1241,7 @@ void alert_nearby_monsters(void) } } // end alert_nearby_monsters() -static bool valid_morph( monsters *monster, int new_mclass ) +static bool _valid_morph( monsters *monster, int new_mclass ) { const dungeon_feature_type current_tile = grd[monster->x][monster->y]; @@ -1291,7 +1291,7 @@ static bool valid_morph( monsters *monster, int new_mclass ) return (monster_habitable_grid(new_mclass, current_tile)); } // end valid_morph() -static bool is_poly_power_unsuitable( +static bool _is_poly_power_unsuitable( poly_power_type power, int src_pow, int tgt_pow, @@ -1351,12 +1351,12 @@ bool monster_polymorph( monsters *monster, monster_type targetc, if (relax > 50) return (simple_monster_message( monster, " shudders." )); } - while (tries-- && (!valid_morph( monster, targetc ) - || is_poly_power_unsuitable(power, source_power, - target_power, relax))); + while (tries-- && (!_valid_morph( monster, targetc ) + || _is_poly_power_unsuitable(power, source_power, + target_power, relax))); } - if (!valid_morph( monster, targetc )) + if (!_valid_morph( monster, targetc )) return simple_monster_message(monster, " looks momentarily different."); // If old monster is visible to the player, and is interesting, @@ -1441,7 +1441,7 @@ bool monster_polymorph( monsters *monster, monster_type targetc, monster->speed_increment = 67 + random2(6); - monster_drop_ething(monster); + _monster_drop_ething(monster); // New monster type might be interesting mark_interesting_monst(monster); @@ -1623,7 +1623,7 @@ bool random_near_space(int ox, int oy, int &tx, int &ty, bool allow_adjacent, return (false); } // end random_near_space() -static bool habitat_okay( const monsters *monster, dungeon_feature_type targ ) +static bool _habitat_okay( const monsters *monster, dungeon_feature_type targ ) { return (monster_habitable_grid(monster, targ)); } @@ -1658,7 +1658,7 @@ bool swap_places(monsters *monster) return (false); } - const bool mon_dest_okay = habitat_okay( monster, grd[loc_x][loc_y] ); + const bool mon_dest_okay = _habitat_okay( monster, grd[loc_x][loc_y] ); const bool you_dest_okay = !is_grid_dangerous(mgrid) || yesno("Do you really want to step there?", false, 'n'); @@ -1690,7 +1690,7 @@ bool swap_places(monsters *monster) continue; if (mgrd[temp_x][temp_y] == NON_MONSTER - && habitat_okay( monster, grd[temp_x][temp_y] )) + && _habitat_okay( monster, grd[temp_x][temp_y] )) { // Found an appropiate space... check if we // switch the current choice to this one. @@ -1929,7 +1929,7 @@ void behaviour_event( monsters *mon, int event, int src, mon->del_ench(ENCH_CHARM); // do any resultant foe or state changes - handle_behaviour( mon ); + _handle_behaviour( mon ); } //--------------------------------------------------------------- @@ -1945,7 +1945,7 @@ void behaviour_event( monsters *mon, int event, int src, // the monster has a spell or special/nearby ability which isn't // affected by the wall. //--------------------------------------------------------------- -static void handle_behaviour(monsters *mon) +static void _handle_behaviour(monsters *mon) { bool changed = true; bool isFriendly = mons_friendly(mon); @@ -2020,12 +2020,12 @@ static void handle_behaviour(monsters *mon) } else { - set_nearest_monster_foe(mon); + _set_nearest_monster_foe(mon); } } if (mon->attitude == ATT_NEUTRAL && mon->foe == MHITNOT) - set_nearest_monster_foe(mon); + _set_nearest_monster_foe(mon); // monsters do not attack themselves {dlb} if (mon->foe == monster_index(mon)) @@ -2334,7 +2334,7 @@ static void handle_behaviour(monsters *mon) } } // end handle_behaviour() -static bool mons_check_set_foe(monsters *mon, int x, int y, +static bool _mons_check_set_foe(monsters *mon, int x, int y, bool friendly, bool neutral) { if (!in_bounds(x, y)) @@ -2365,7 +2365,7 @@ static bool mons_check_set_foe(monsters *mon, int x, int y, // choose nearest monster as a foe // (used for berserking monsters) -void set_nearest_monster_foe(monsters *mon) +void _set_nearest_monster_foe(monsters *mon) { const bool friendly = mons_friendly(mon); const bool neutral = mons_neutral(mon); @@ -2376,14 +2376,18 @@ void set_nearest_monster_foe(monsters *mon) for (int k = 1; k <= LOS_RADIUS; k++) { for (int x = mx - k; x <= mx + k; ++x) - if (mons_check_set_foe(mon, x, my - k, friendly, neutral) - || mons_check_set_foe(mon, x, my + k, friendly, neutral)) + if (_mons_check_set_foe(mon, x, my - k, friendly, neutral) + || _mons_check_set_foe(mon, x, my + k, friendly, neutral)) + { return; + } for (int y = my - k + 1; y < my + k; ++y) - if (mons_check_set_foe(mon, mx - k, y, friendly, neutral) - || mons_check_set_foe(mon, mx + k, y, friendly, neutral)) - return; + if (_mons_check_set_foe(mon, mx - k, y, friendly, neutral) + || _mons_check_set_foe(mon, mx + k, y, friendly, neutral)) + { + return; + } } } @@ -2455,7 +2459,7 @@ bool simple_monster_message(const monsters *monster, const char *event, // Move the monster closer to its target square. // //--------------------------------------------------------------- -static void handle_movement(monsters *monster) +static void _handle_movement(monsters *monster) { int dx, dy; @@ -2554,7 +2558,7 @@ static void handle_movement(monsters *monster) // next to the player. // //--------------------------------------------------------------- -static void handle_nearby_ability(monsters *monster) +static void _handle_nearby_ability(monsters *monster) { if (!mons_near( monster ) || monster->behaviour == BEH_SLEEP @@ -2670,7 +2674,7 @@ static void handle_nearby_ability(monsters *monster) // $$$ not sure what to say here... // //--------------------------------------------------------------- -static bool handle_special_ability(monsters *monster, bolt & beem) +static bool _handle_special_ability(monsters *monster, bolt & beem) { bool used = false; @@ -2855,7 +2859,7 @@ static bool handle_special_ability(monsters *monster, bolt & beem) } if (one_chance_in(3)) - used = plant_spit(monster, beem); + used = _plant_spit(monster, beem); break; @@ -3155,7 +3159,7 @@ static bool handle_special_ability(monsters *monster, bolt & beem) // the monster imbibed. // //--------------------------------------------------------------- -static bool handle_potion(monsters *monster, bolt & beem) +static bool _handle_potion(monsters *monster, bolt & beem) { // yes, there is a logic to this ordering {dlb}: @@ -3253,7 +3257,7 @@ static bool handle_potion(monsters *monster, bolt & beem) } } // end handle_potion() -static bool handle_reaching(monsters *monster) +static bool _handle_reaching(monsters *monster) { bool ret = false; const int wpn = monster->inv[MSLOT_WEAPON]; @@ -3317,7 +3321,7 @@ static bool handle_reaching(monsters *monster) // the monster read something. // //--------------------------------------------------------------- -static bool handle_scroll(monsters *monster) +static bool _handle_scroll(monsters *monster) { // yes, there is a logic to this ordering {dlb}: if (monster->has_ench(ENCH_CONFUSION) @@ -3404,7 +3408,7 @@ static bool handle_scroll(monsters *monster) // monster zapped. // //--------------------------------------------------------------- -static bool handle_wand(monsters *monster, bolt &beem) +static bool _handle_wand(monsters *monster, bolt &beem) { // yes, there is a logic to this ordering {dlb}: if (monster->behaviour == BEH_SLEEP) @@ -3428,7 +3432,7 @@ static bool handle_wand(monsters *monster, bolt &beem) item_def &wand(mitm[monster->inv[MSLOT_WAND]]); // map wand type to monster spell type - const spell_type mzap = map_wand_to_mspell(wand.sub_type); + const spell_type mzap = _map_wand_to_mspell(wand.sub_type); if (mzap == SPELL_NO_SPELL) return (false); @@ -3583,7 +3587,7 @@ static bool handle_wand(monsters *monster, bolt &beem) // Returns a suitable breath weapon for the draconian; does not handle all // draconians, does fire a tracer. -static spell_type get_draconian_breath_spell( const monsters *monster ) +static spell_type _get_draconian_breath_spell( const monsters *monster ) { spell_type draco_breath = SPELL_NO_SPELL; @@ -3636,7 +3640,7 @@ static spell_type get_draconian_breath_spell( const monsters *monster ) return (draco_breath); } -static bool is_emergency_spell(const monster_spells &msp, int spell) +static bool _is_emergency_spell(const monster_spells &msp, int spell) { // If the emergency spell appears early, it's probably not a dedicated // escape spell. @@ -3646,7 +3650,7 @@ static bool is_emergency_spell(const monster_spells &msp, int spell) return (msp[5] == spell); } -static const char *orb_of_fire_glow() +static const char *_orb_of_fire_glow() { static const char *orb_glows[] = { @@ -3659,9 +3663,9 @@ static const char *orb_of_fire_glow() return RANDOM_ELEMENT(orb_glows); } -static bool mons_announce_cast(monsters *monster, bool nearby, - spell_type spell_cast, - spell_type draco_breath) +static bool _mons_announce_cast(monsters *monster, bool nearby, + spell_type spell_cast, + spell_type draco_breath) { if (nearby) // handle monsters within range of player { @@ -3805,7 +3809,7 @@ static bool mons_announce_cast(monsters *monster, bool nearby, break; case MONS_ORB_OF_FIRE: - simple_monster_message(monster, orb_of_fire_glow(), + simple_monster_message(monster, _orb_of_fire_glow(), MSGCH_MONSTER_SPELL); break; } @@ -3823,7 +3827,7 @@ static bool mons_announce_cast(monsters *monster, bool nearby, return (true); } -static bool enemies_around(const monsters *monster) +static bool _enemies_around(const monsters *monster) { if (mons_friendly(monster)) return (!mons_near(monster) || !i_feel_safe()); @@ -3839,11 +3843,11 @@ static bool enemies_around(const monsters *monster) // a spell was cast. // //--------------------------------------------------------------- -static bool handle_spell( monsters *monster, bolt & beem ) +static bool _handle_spell( monsters *monster, bolt & beem ) { bool monsterNearby = mons_near(monster); bool finalAnswer = false; // as in: "Is that your...?" {dlb} - const spell_type draco_breath = get_draconian_breath_spell(monster); + const spell_type draco_breath = _get_draconian_breath_spell(monster); // yes, there is a logic to this ordering {dlb}: if (monster->behaviour == BEH_SLEEP @@ -3881,7 +3885,7 @@ static bool handle_spell( monsters *monster, bolt & beem ) spell_type spell_cast = SPELL_NO_SPELL; monster_spells hspell_pass(monster->spells); - if (!enemies_around(monster)) + if (!_enemies_around(monster)) { // forces the casting of dig when player not visible - this is EVIL! if (monster->has_spell(SPELL_DIG) @@ -3925,7 +3929,7 @@ static bool handle_spell( monsters *monster, bolt & beem ) // monsters caught in a net try to get away // this is only urgent if enemies are around - if (!finalAnswer && enemies_around(monster) && mons_is_caught(monster) + if (!finalAnswer && _enemies_around(monster) && mons_is_caught(monster) && one_chance_in(4)) { for (int i = 0; i < NUM_MONSTER_SPELL_SLOTS; i++) @@ -3973,7 +3977,7 @@ static bool handle_spell( monsters *monster, bolt & beem ) if (!finalAnswer) { // if nothing found by now, safe friendlies will rarely cast - if (mons_friendly(monster) && !enemies_around(monster) + if (mons_friendly(monster) && !_enemies_around(monster) && !one_chance_in(8)) { return (false); @@ -4095,7 +4099,7 @@ static bool handle_spell( monsters *monster, bolt & beem ) // The breath weapon is also occasionally used. if (draco_breath != SPELL_NO_SPELL && (spell_cast == SPELL_NO_SPELL - || (!is_emergency_spell(hspell_pass, spell_cast) + || (!_is_emergency_spell(hspell_pass, spell_cast) && one_chance_in(4))) && !is_sanctuary(you.x_pos, you.y_pos) && !is_sanctuary(monster->x, monster->y)) @@ -4116,8 +4120,8 @@ static bool handle_spell( monsters *monster, bolt & beem ) return (false); } - if (!mons_announce_cast(monster, monsterNearby, - spell_cast, draco_breath)) + if (!_mons_announce_cast(monster, monsterNearby, + spell_cast, draco_breath)) return (false); // FINALLY! determine primary spell effects {dlb}: @@ -4220,7 +4224,7 @@ int mons_pick_best_missile(monsters *mons, item_def **launcher, // the monster hurled. // //--------------------------------------------------------------- -static bool handle_throw(monsters *monster, bolt & beem) +static bool _handle_throw(monsters *monster, bolt & beem) { // yes, there is a logic to this ordering {dlb}: if (monster->incapacitated() @@ -4306,21 +4310,21 @@ static bool handle_throw(monsters *monster, bolt & beem) return (false); } // end handle_throw() -static bool handle_monster_spell(monsters *monster, bolt &beem) +static bool _handle_monster_spell(monsters *monster, bolt &beem) { // shapeshifters don't get spells if (!monster->has_ench( ENCH_GLOWING_SHAPESHIFTER, ENCH_SHAPESHIFTER ) || !mons_class_flag( monster->type, M_ACTUAL_SPELLS )) { - if (handle_spell(monster, beem)) + if (_handle_spell(monster, beem)) return (true); } return (false); } // Give the monster its action energy (aka speed_increment). -static void monster_add_energy(monsters *monster) +static void _monster_add_energy(monsters *monster) { int energy_gained = (monster->speed * you.time_taken) / 10; @@ -4334,7 +4338,7 @@ static void monster_add_energy(monsters *monster) } // Do natural regeneration for monster. -static void monster_regenerate(monsters *monster) +static void _monster_regenerate(monsters *monster) { if (monster->has_ench(ENCH_SICK)) return; @@ -4369,7 +4373,7 @@ static void monster_regenerate(monsters *monster) } } -static void swim_or_move_energy(monsters *mon) +static void _swim_or_move_energy(monsters *mon) { const dungeon_feature_type feat = grd[mon->x][mon->y]; // FIXME: Replace check with mons_is_swimming()? @@ -4388,7 +4392,7 @@ static void swim_or_move_energy(monsters *mon) # define DEBUG_ENERGY_USE(problem) ((void) 0) #endif -static void handle_monster_move(int i, monsters *monster) +static void _handle_monster_move(int i, monsters *monster) { bool brkk = false; bolt beem; @@ -4404,7 +4408,7 @@ static void handle_monster_move(int i, monsters *monster) return; } - monster_add_energy(monster); + _monster_add_energy(monster); // Handle clouds on nonmoving monsters: if (monster->speed == 0) @@ -4412,7 +4416,7 @@ static void handle_monster_move(int i, monsters *monster) if (env.cgrid[monster->x][monster->y] != EMPTY_CLOUD && !monster->has_ench(ENCH_SUBMERGED)) { - mons_in_cloud( monster ); + _mons_in_cloud( monster ); } } @@ -4505,7 +4509,7 @@ static void handle_monster_move(int i, monsters *monster) break; // problem with vortices } - mons_in_cloud(monster); + _mons_in_cloud(monster); if (monster->type == -1) { @@ -4521,7 +4525,7 @@ static void handle_monster_move(int i, monsters *monster) monster->colour = newcol; } - monster_regenerate(monster); + _monster_regenerate(monster); if (mons_is_paralysed(monster)) { @@ -4529,7 +4533,7 @@ static void handle_monster_move(int i, monsters *monster) continue; } - handle_behaviour(monster); + _handle_behaviour(monster); // submerging monsters will hide from clouds if (monster_can_submerge(monster, grd[monster->x][monster->y]) @@ -4559,7 +4563,7 @@ static void handle_monster_move(int i, monsters *monster) // keep permanent friendlies from picking up stuff if (monster->attitude != ATT_FRIENDLY) { - if (handle_pickup(monster)) + if (_handle_pickup(monster)) { DEBUG_ENERGY_USE("handle_pickup()"); continue; @@ -4569,11 +4573,11 @@ static void handle_monster_move(int i, monsters *monster) if (mons_is_caught(monster)) // Struggling against the net takes time. - swim_or_move_energy(monster); + _swim_or_move_energy(monster); else { // calculates mmov_x, mmov_y based on monster target. - handle_movement(monster); + _handle_movement(monster); brkk = false; @@ -4639,7 +4643,7 @@ static void handle_monster_move(int i, monsters *monster) if (brkk) continue; } - handle_nearby_ability( monster ); + _handle_nearby_ability( monster ); beem.target_x = monster->target_x; beem.target_y = monster->target_y; @@ -4660,41 +4664,41 @@ static void handle_monster_move(int i, monsters *monster) // roughly the same weight. if (coinflip()? - handle_special_ability(monster, beem) - || handle_monster_spell(monster, beem) - : handle_monster_spell(monster, beem) - || handle_special_ability(monster, beem)) + _handle_special_ability(monster, beem) + || _handle_monster_spell(monster, beem) + : _handle_monster_spell(monster, beem) + || _handle_special_ability(monster, beem)) { DEBUG_ENERGY_USE("spell or special"); continue; } - if (handle_potion(monster, beem)) + if (_handle_potion(monster, beem)) { DEBUG_ENERGY_USE("handle_potion()"); continue; } - if (handle_scroll(monster)) + if (_handle_scroll(monster)) { DEBUG_ENERGY_USE("handle_scroll()"); continue; } - if (handle_wand(monster, beem)) + if (_handle_wand(monster, beem)) { DEBUG_ENERGY_USE("handle_wand()"); continue; } - if (handle_reaching(monster)) + if (_handle_reaching(monster)) { DEBUG_ENERGY_USE("handle_reaching()"); continue; } } - if (handle_throw(monster, beem)) + if (_handle_throw(monster, beem)) { DEBUG_ENERGY_USE("handle_throw()"); continue; @@ -4779,7 +4783,7 @@ static void handle_monster_move(int i, monsters *monster) continue; } - if (!monster_move(monster)) + if (!_monster_move(monster)) monster->speed_increment -= non_move_energy; } update_beholders(monster); @@ -4789,7 +4793,7 @@ static void handle_monster_move(int i, monsters *monster) // or died for that matter. Don't bother for // dead monsters. :) if (monster->type != -1) - handle_behaviour(monster); + _handle_behaviour(monster); } // end while @@ -4835,7 +4839,7 @@ void handle_monsters(void) const int mx = monster->x, my = monster->y; - handle_monster_move(i, monster); + _handle_monster_move(i, monster); if (!invalid_monster(monster) && (monster->x != mx || monster->y != my)) @@ -4864,7 +4868,7 @@ void handle_monsters(void) } } // end handle_monster() -static bool is_item_jelly_edible(const item_def &item) +static bool _is_item_jelly_edible(const item_def &item) { // don't eat artefacts (note that unrandarts are randarts) if (is_fixed_artefact(item) || is_random_artefact(item)) @@ -4897,7 +4901,7 @@ static bool is_item_jelly_edible(const item_def &item) // Returns false if monster doesn't spend any time pickup up // //--------------------------------------------------------------- -static bool handle_pickup(monsters *monster) +static bool _handle_pickup(monsters *monster) { // single calculation permissible {dlb} bool monsterNearby = mons_near(monster); @@ -4923,7 +4927,7 @@ static bool handle_pickup(monsters *monster) { int quant = mitm[item].quantity; - if (!is_item_jelly_edible(mitm[item])) + if (!_is_item_jelly_edible(mitm[item])) continue; if (mitm[igrd[monster->x][monster->y]].base_type != OBJ_GOLD) @@ -4988,7 +4992,7 @@ static bool handle_pickup(monsters *monster) ? 50 : monster->hit_dice * 8; if (monster->hit_points >= reqd) - jelly_divide(monster); + _jelly_divide(monster); } } @@ -5009,7 +5013,7 @@ static bool handle_pickup(monsters *monster) return (false); } // end handle_pickup() -static void jelly_grows(monsters *monster) +static void _jelly_grows(monsters *monster) { if (!silenced(you.x_pos, you.y_pos) && !silenced(monster->x, monster->y)) @@ -5031,11 +5035,11 @@ static void jelly_grows(monsters *monster) : monster->hit_dice * 8; if (monster->hit_points >= reqd) - jelly_divide(monster); + _jelly_divide(monster); } } -static bool mons_can_displace(const monsters *mpusher, const monsters *mpushee) +static bool _mons_can_displace(const monsters *mpusher, const monsters *mpushee) { if (invalid_monster(mpusher) || invalid_monster(mpushee)) return (false); @@ -5072,7 +5076,7 @@ static bool mons_can_displace(const monsters *mpusher, const monsters *mpushee) return (true); } -static bool monster_swaps_places( monsters *mon, int mx, int my ) +static bool _monster_swaps_places( monsters *mon, int mx, int my ) { if (!mx && !my) return (false); @@ -5082,7 +5086,7 @@ static bool monster_swaps_places( monsters *mon, int mx, int my ) return (false); monsters *m2 = &menv[targmon]; - if (!mons_can_displace(mon, m2)) + if (!_mons_can_displace(mon, m2)) return (false); if (mons_is_sleeping(m2)) @@ -5102,12 +5106,14 @@ static bool monster_swaps_places( monsters *mon, int mx, int my ) // Check that both monsters will be happy at their proposed new locations. const int cx = mon->x, cy = mon->y, nx = mon->x + mx, ny = mon->y + my; - if (!habitat_okay(mon, grd[nx][ny]) - || !habitat_okay(m2, grd[cx][cy])) + if (!_habitat_okay(mon, grd[nx][ny]) + || !_habitat_okay(m2, grd[cx][cy])) + { return (false); + } // Okay, do the swap! - swim_or_move_energy(mon); + _swim_or_move_energy(mon); mon->x = nx; mon->y = ny; @@ -5127,7 +5133,7 @@ static bool monster_swaps_places( monsters *mon, int mx, int my ) return (false); } -static bool do_move_monster(monsters *monster, int xi, int yi) +static bool _do_move_monster(monsters *monster, int xi, int yi) { const int fx = monster->x + xi, fy = monster->y + yi; @@ -5158,7 +5164,7 @@ static bool do_move_monster(monsters *monster, int xi, int yi) return false; /* this appears to be the real one, ie where the movement occurs: */ - swim_or_move_energy(monster); + _swim_or_move_energy(monster); mgrd[monster->x][monster->y] = NON_MONSTER; @@ -5231,8 +5237,8 @@ void mons_check_pool(monsters *mons, killer_type killer, int killnum) // returns true for monsters that obviously (to the player) feel // "thematically at home" in a branch // currently used for native monsters recognizing traps -static bool is_native_in_branch(const monsters *monster, - const branch_type branch) +static bool _is_native_in_branch(const monsters *monster, + const branch_type branch) { switch (branch) { @@ -5274,7 +5280,7 @@ static bool is_native_in_branch(const monsters *monster, } // randomize potential damage -static int estimated_trap_damage(trap_type trap) +static int _estimated_trap_damage(trap_type trap) { switch (trap) { @@ -5295,14 +5301,14 @@ static int estimated_trap_damage(trap_type trap) } } -static bool mon_can_move_to_pos(const monsters *monster, const int count_x, - const int count_y, bool just_check = false); +static bool _mon_can_move_to_pos(const monsters *monster, const int count_x, + const int count_y, bool just_check = false); // Check whether a given trap (described by trap position) can be // regarded as safe. Takes in account monster intelligence and allegiance. // (just_check is used for intelligent monsters trying to avoid traps.) -static bool is_trap_safe(const monsters *monster, const int trap_x, - const int trap_y, bool just_check = false) +static bool _is_trap_safe(const monsters *monster, const int trap_x, + const int trap_y, bool just_check = false) { const int intel = mons_intel(monster->type); @@ -5334,7 +5340,7 @@ static bool is_trap_safe(const monsters *monster, const int trap_x, // * very intelligent monsters can be assumed to have a high T&D skill // (or have memorised part of the dungeon layout ;) ) if (intel >= I_NORMAL && mechanical - && (is_native_in_branch(monster, you.where_are_you) + && (_is_native_in_branch(monster, you.where_are_you) || monster->attitude == ATT_FRIENDLY && player_knows_trap || intel >= I_HIGH && one_chance_in(3))) @@ -5365,10 +5371,10 @@ static bool is_trap_safe(const monsters *monster, const int trap_x, // If a monster still gets stuck in a corridor it will usually be // because it has less than half its maximum hp - if ((mon_can_move_to_pos(monster, x-1, y, true) - || mon_can_move_to_pos(monster, x+1,y, true)) - && (mon_can_move_to_pos(monster, x,y-1, true) - || mon_can_move_to_pos(monster, x,y+1, true))) + if ((_mon_can_move_to_pos(monster, x-1, y, true) + || _mon_can_move_to_pos(monster, x+1,y, true)) + && (_mon_can_move_to_pos(monster, x,y-1, true) + || _mon_can_move_to_pos(monster, x,y+1, true))) { return (false); } @@ -5385,7 +5391,7 @@ static bool is_trap_safe(const monsters *monster, const int trap_x, // Healthy monsters don't mind a little pain. if (mechanical && monster->hit_points >= monster->max_hit_points / 2 && (intel == I_ANIMAL - || monster->hit_points > estimated_trap_damage(trap.type))) + || monster->hit_points > _estimated_trap_damage(trap.type))) { return (true); } @@ -5397,7 +5403,7 @@ static bool is_trap_safe(const monsters *monster, const int trap_x, return (!mechanical || mons_flies(monster)); } -static void mons_open_door(monsters* monster, const coord_def &pos) +static void _mons_open_door(monsters* monster, const coord_def &pos) { dungeon_feature_type grid = grd(pos); const char *adj, *noun="door"; @@ -5451,7 +5457,7 @@ static void mons_open_door(monsters* monster, const coord_def &pos) // Check whether a monster can move to given square (described by its relative // coordinates to the current monster position). just_check is true only for // calls from is_trap_safe when checking the surrounding squares of a trap. -bool mon_can_move_to_pos(const monsters *monster, const int count_x, +bool _mon_can_move_to_pos(const monsters *monster, const int count_x, const int count_y, bool just_check) { const int targ_x = monster->x + count_x; @@ -5519,7 +5525,7 @@ bool mon_can_move_to_pos(const monsters *monster, const int count_x, { return false; } - else if (!habitat_okay( monster, target_grid )) + else if (!_habitat_okay( monster, target_grid )) { return false; } @@ -5585,7 +5591,7 @@ bool mon_can_move_to_pos(const monsters *monster, const int count_x, if (mons_aligned(thismonster, targmonster) && targmonster != MHITNOT && targmonster != MHITYOU - && !mons_can_displace(monster, &menv[targmonster])) + && !_mons_can_displace(monster, &menv[targmonster])) { return false; } @@ -5594,7 +5600,7 @@ bool mon_can_move_to_pos(const monsters *monster, const int count_x, // wandering through a trap is OK if we're pretty healthy, // really stupid, or immune to the trap const int which_trap = trap_at_xy(targ_x,targ_y); - if (which_trap >= 0 && !is_trap_safe(monster, targ_x, targ_y, just_check)) + if (which_trap >= 0 && !_is_trap_safe(monster, targ_x, targ_y, just_check)) { return false; } @@ -5672,7 +5678,7 @@ bool mon_can_move_to_pos(const monsters *monster, const int count_x, return true; } -static bool monster_move(monsters *monster) +static bool _monster_move(monsters *monster) { FixedArray < bool, 3, 3 > good_move; int count_x, count_y, count; @@ -5714,7 +5720,7 @@ static bool monster_move(monsters *monster) && (habitat == HT_LAND || monster_habitable_grid(monster, grd(newpos)))) { - return do_move_monster(monster, mmov_x, mmov_y); + return _do_move_monster(monster, mmov_x, mmov_y); } } return false; @@ -5753,7 +5759,7 @@ static bool monster_move(monsters *monster) const monsters* mons = dynamic_cast<const monsters*>(monster); good_move[count_x][count_y] = - mon_can_move_to_pos(mons, count_x-1, count_y-1); + _mon_can_move_to_pos(mons, count_x-1, count_y-1); } // now we know where we _can_ move. const coord_def newpos = monster->pos() + coord_def(mmov_x, mmov_y); @@ -5769,13 +5775,13 @@ static bool monster_move(monsters *monster) // for zombies, monster type is kept in mon->number if (mons_itemuse(monster->number) >= MONUSE_OPEN_DOORS) { - mons_open_door(monster, newpos); + _mons_open_door(monster, newpos); return true; } } else if (mons_itemuse(monster->type) >= MONUSE_OPEN_DOORS) { - mons_open_door(monster, newpos); + _mons_open_door(monster, newpos); return true; } } // endif - secret/closed doors @@ -5787,7 +5793,7 @@ static bool monster_move(monsters *monster) { grd[monster->x + mmov_x][monster->y + mmov_y] = DNGN_FLOOR; - jelly_grows(monster); + _jelly_grows(monster); if (see_grid(monster->x + mmov_x, monster->y + mmov_y)) { @@ -6004,7 +6010,7 @@ forget_it: if (targmon != NON_MONSTER) { if (mons_aligned(monster_index(monster), targmon)) - ret = monster_swaps_places(monster, mmov_x, mmov_y); + ret = _monster_swaps_places(monster, mmov_x, mmov_y); else { monsters_fight(monster_index(monster), targmon); @@ -6041,12 +6047,12 @@ forget_it: } if (mmov_x || mmov_y || (monster->confused() && one_chance_in(6))) - return do_move_monster(monster, mmov_x, mmov_y); + return _do_move_monster(monster, mmov_x, mmov_y); return ret; } // end monster_move() -static void setup_plant_spit(monsters *monster, bolt &pbolt) +static void _setup_plant_spit(monsters *monster, bolt &pbolt) { pbolt.name = "acid"; pbolt.type = dchar_glyph(DCHAR_FIRED_ZAP); @@ -6061,13 +6067,13 @@ static void setup_plant_spit(monsters *monster, bolt &pbolt) pbolt.aux_source.clear(); } -static bool plant_spit(monsters *monster, bolt &pbolt) +static bool _plant_spit(monsters *monster, bolt &pbolt) { - bool didSpit = false; + bool did_spit = false; char spit_string[INFO_SIZE]; - setup_plant_spit(monster, pbolt); + _setup_plant_spit(monster, pbolt); // fire tracer fire_tracer(monster, pbolt); @@ -6082,13 +6088,13 @@ static bool plant_spit(monsters *monster, bolt &pbolt) simple_monster_message( monster, spit_string ); fire_beam( pbolt ); - didSpit = true; + did_spit = true; } - return (didSpit); + return (did_spit); } // end plant_spit() -static void mons_in_cloud(monsters *monster) +static void _mons_in_cloud(monsters *monster) { int wc = env.cgrid[monster->x][monster->y]; int hurted = 0; @@ -6379,7 +6385,7 @@ bool heal_monster(monsters * patient, int health_boost, return (true); } // end heal_monster() -static spell_type map_wand_to_mspell(int wand_type) +static spell_type _map_wand_to_mspell(int wand_type) { switch (wand_type) { diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index 354be9f688..ef903e2dec 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -54,7 +54,7 @@ #include "traps.h" #include "view.h" -static bool abyss_blocks_teleport(bool cblink) +static bool _abyss_blocks_teleport(bool cblink) { // Lugonu worshippers get their perks. if (you.religion == GOD_LUGONU) @@ -83,7 +83,7 @@ int blink(int pow, bool high_level_controlled_blink, bool wizard_blink) if (scan_randarts(RAP_PREVENT_TELEPORTATION) && !wizard_blink) mpr("You feel a weird sense of stasis."); else if (you.level_type == LEVEL_ABYSS - && abyss_blocks_teleport(high_level_controlled_blink) + && _abyss_blocks_teleport(high_level_controlled_blink) && !wizard_blink) { mpr("The power of the Abyss keeps you in your place!"); @@ -1080,7 +1080,7 @@ void missile_prot(int pow) if (you.duration[DUR_REPEL_MISSILES] > 100) you.duration[DUR_REPEL_MISSILES] = 100; -} // end missile_prot() +} void deflection(int pow) { @@ -1090,7 +1090,7 @@ void deflection(int pow) if (you.duration[DUR_DEFLECT_MISSILES] > 100) you.duration[DUR_DEFLECT_MISSILES] = 100; -} // end cast_deflection() +} void cast_regen(int pow) { @@ -1101,12 +1101,12 @@ void cast_regen(int pow) if (you.duration[DUR_REGENERATION] > 100) you.duration[DUR_REGENERATION] = 100; -} // end cast_regen() +} void cast_berserk(void) { go_berserk(true); -} // end cast_berserk() +} void cast_swiftness(int power) { @@ -1177,7 +1177,7 @@ void cast_insulation(int power) you.duration[DUR_INSULATION] = 100; else you.duration[DUR_INSULATION] += dur_incr; -} // end cast_insulation() +} void cast_resist_poison(int power) { @@ -1189,7 +1189,7 @@ void cast_resist_poison(int power) you.duration[DUR_RESIST_POISON] = 100; else you.duration[DUR_RESIST_POISON] += dur_incr; -} // end cast_resist_poison() +} void cast_teleport_control(int power) { @@ -1201,7 +1201,7 @@ void cast_teleport_control(int power) you.duration[DUR_CONTROL_TELEPORT] = 50; else you.duration[DUR_CONTROL_TELEPORT] += dur_incr; -} // end cast_teleport_control() +} void cast_ring_of_flames(int power) { @@ -1213,7 +1213,7 @@ void cast_ring_of_flames(int power) mpr("The air around you leaps into flame!"); manage_fire_shield(); -} // end cast_ring_of_flames() +} void cast_confusing_touch(int power) { @@ -1226,7 +1226,7 @@ void cast_confusing_touch(int power) if (you.duration[DUR_CONFUSING_TOUCH] > 50) you.duration[DUR_CONFUSING_TOUCH] = 50; -} // end cast_confusing_touch() +} bool cast_sure_blade(int power) { |