From 48f785a271089f4f85bdfb5624b56b433e0ebd13 Mon Sep 17 00:00:00 2001 From: Vsevolod Kozlov Date: Thu, 5 Nov 2009 19:28:56 +0300 Subject: Replace uses of player_is_airborne with you.airborne. Signed-off-by: Robert Vollmert --- crawl-ref/source/abl-show.cc | 2 +- crawl-ref/source/acr.cc | 4 ++-- crawl-ref/source/it_use2.cc | 6 +++--- crawl-ref/source/item_use.cc | 4 ++-- crawl-ref/source/misc.cc | 12 ++++++------ crawl-ref/source/output.cc | 6 +++--- crawl-ref/source/player.cc | 17 ++++++----------- crawl-ref/source/player.h | 1 - crawl-ref/source/religion.cc | 2 +- crawl-ref/source/spells1.cc | 2 +- crawl-ref/source/spells4.cc | 2 +- crawl-ref/source/tilepick.cc | 2 +- 12 files changed, 27 insertions(+), 33 deletions(-) diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index 3c3a1f6a85..218bd0d648 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -2301,7 +2301,7 @@ std::vector your_talents(bool check_confused) _add_talent(talents, ABIL_TRAN_BAT, check_confused); } - if (!player_is_airborne() && !transform_changed_physiology()) + if (!you.airborne() && !transform_changed_physiology()) { // Kenku can fly, but only from the ground // (until level 15, when it becomes permanent until revoked). diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 7b7a6a5c89..f7c244e801 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -3300,7 +3300,7 @@ static void _open_door(coord_def move, bool check_confused) } else { - const char* verb = (player_is_airborne() ? "reach down and open" + const char* verb = (you.airborne() ? "reach down and open" : "open"); mprf("You %s the %s%s.", verb, adj, noun); } @@ -3463,7 +3463,7 @@ static void _close_door(coord_def move) } else { - const char* verb = player_is_airborne() ? "reach down and close" + const char* verb = you.airborne() ? "reach down and close" : "close"; mprf("You %s the %s%s.", verb, adj, noun); diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc index bc50fa4f89..96350a9bc6 100644 --- a/crawl-ref/source/it_use2.cc +++ b/crawl-ref/source/it_use2.cc @@ -224,10 +224,10 @@ bool potion_effect(potion_type pot_eff, int pow, bool drank_it, bool was_known) case POT_LEVITATION: mprf(MSGCH_DURATION, - "You feel %s buoyant.", !player_is_airborne() ? "very" + "You feel %s buoyant.", !you.airborne() ? "very" : "more"); - if (!player_is_airborne()) + if (!you.airborne()) mpr("You gently float upwards from the floor."); // Amulet of Controlled Flight can auto-ID. @@ -246,7 +246,7 @@ bool potion_effect(potion_type pot_eff, int pow, bool drank_it, bool was_known) } // Merfolk boots unmeld if levitation takes us out of water. - if (!player_is_airborne() && you.species == SP_MERFOLK + if (!you.airborne() && you.species == SP_MERFOLK && feat_is_water(grd(you.pos()))) { unmeld_one_equip(EQ_BOOTS); diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 2bab2ccfce..371e407330 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -3200,7 +3200,7 @@ void jewellery_wear_effects(item_def &item) case RING_LEVITATION: if (!scan_artefacts(ARTP_LEVITATE)) { - if (player_is_airborne()) + if (you.airborne()) mpr("You feel vaguely more buoyant than before."); else mpr("You feel buoyant."); @@ -5469,7 +5469,7 @@ void use_artefact(item_def &item, bool *show_msgs, bool unmeld) if (unknown_proprt(ARTP_LEVITATE) && !items_give_ability(item.link, ARTP_LEVITATE)) { - if (player_is_airborne()) + if (you.airborne()) mpr("You feel vaguely more buoyant than before."); else mpr("You feel buoyant."); diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 4e4e1cc76f..55650b1041 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -1303,7 +1303,7 @@ void search_around(bool only_adjacent) bool merfolk_change_is_safe(bool quiet) { // If already transformed, no subsequent transformation necessary. - if (!player_is_airborne() && feat_is_water(grd(you.pos()))) + if (!you.airborne() && feat_is_water(grd(you.pos()))) return (true); std::set r; @@ -1346,21 +1346,21 @@ static void climb_message(dungeon_feature_type stair, bool going_up, { mprf("You %s downwards.", you.flight_mode() == FL_FLY ? "fly" : - (player_is_airborne() ? "float" : "slide")); + (you.airborne() ? "float" : "slide")); } } else if (feat_is_gate(stair)) { mprf("You %s %s through the gate.", you.flight_mode() == FL_FLY ? "fly" : - (player_is_airborne() ? "float" : "go"), + (you.airborne() ? "float" : "go"), going_up ? "up" : "down"); } else { mprf("You %s %swards.", you.flight_mode() == FL_FLY ? "fly" : - (player_is_airborne() ? "float" : "climb"), + (you.airborne() ? "float" : "climb"), going_up ? "up" : "down"); } } @@ -1802,7 +1802,7 @@ void up_stairs(dungeon_feature_type force_stair, // Since the overloaded message set turn_is_over, I'm assuming that // the overloaded character makes an attempt... so we're doing this // check before that one. -- bwr - if (!player_is_airborne() + if (!you.airborne() && you.confused() && old_level_type == LEVEL_DUNGEON && !feat_is_escape_hatch(stair_find) @@ -2345,7 +2345,7 @@ void down_stairs( int old_level, dungeon_feature_type force_stair, if (old_level_type != you.level_type && you.level_type == LEVEL_DUNGEON) mprf("Welcome back to %s!", branches[you.where_are_you].longname); - if (!player_is_airborne() + if (!you.airborne() && you.confused() && !feat_is_escape_hatch(stair_find) && force_stair != DNGN_ENTER_ABYSS diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index a940e5e870..d5505d48ac 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -668,7 +668,7 @@ static void _get_status_lights(std::vector& out) out.push_back(status_light(color, "Ins")); } - if (player_is_airborne()) + if (you.airborne()) { const bool perm = you.permanent_flight(); const bool expiring = (!perm && dur_expiring(DUR_LEVITATION)); @@ -1907,7 +1907,7 @@ static std::vector _get_overview_resistances( cols.add_formatted(1, buf, false); const int rctel = player_control_teleport(calc_unid); - const int rlevi = player_is_airborne(); + const int rlevi = you.airborne(); const int rcfli = wearing_amulet(AMU_CONTROLLED_FLIGHT, calc_unid); snprintf(buf, sizeof buf, "%sCtrl.Telep.: %s\n" @@ -2160,7 +2160,7 @@ std::string _status_mut_abilities() if (you.duration[DUR_BERSERKER]) status.push_back("berserking"); - if (player_is_airborne()) + if (you.airborne()) { std::string help; if (wearing_amulet( AMU_CONTROLLED_FLIGHT )) diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 905843576b..43c6fedeae 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -235,7 +235,7 @@ bool move_player_to_grid( const coord_def& p, bool stepped, bool allow_shift, bool need_doll_update = false; #endif // Only consider terrain if player is not levitating. - if (!player_is_airborne()) + if (!you.airborne()) { bool merfolk_check = false; if (you.species == SP_MERFOLK) @@ -389,7 +389,7 @@ bool player_can_swim() bool is_feat_dangerous(dungeon_feature_type grid) { - return (!player_is_airborne() + return (!you.airborne() && (grid == DNGN_LAVA || (grid == DNGN_DEEP_WATER && !player_likes_water()))); } @@ -2697,7 +2697,7 @@ int player_sust_abil(bool calc_unid) int carrying_capacity(burden_state_type bs) { int cap = (2 * you.body_weight()) + (you.strength * 200) - + (player_is_airborne() ? 1000 : 0); + + (you.airborne() ? 1000 : 0); // We are nice to the lighter species in that strength adds absolutely // instead of relatively to body weight. --dpeg @@ -3531,7 +3531,7 @@ int check_stealth(void) stealth += scan_artefacts( ARTP_STEALTH ); - if (player_is_airborne()) + if (you.airborne()) stealth += 10; else if (player_in_water()) { @@ -3996,7 +3996,7 @@ void display_char_status() if (you.duration[DUR_BERSERKER]) mpr("You are possessed by a berserker rage."); - if (player_is_airborne()) + if (you.airborne()) { const bool expires = dur_expiring(DUR_LEVITATION) && !you.permanent_flight(); @@ -4053,7 +4053,7 @@ void display_char_status() const bool water = player_in_water(); const bool swim = player_is_swimming(); - const bool lev = player_is_airborne(); + const bool lev = you.airborne(); const bool fly = (you.flight_mode() == FL_FLY); const bool swift = (you.duration[DUR_SWIFTNESS] > 0); @@ -4196,11 +4196,6 @@ bool wearing_amulet(jewellery_type amulet, bool calc_unid) return (amu.sub_type == amulet && (calc_unid || item_type_known(amu))); } -bool player_is_airborne(void) -{ - return you.airborne(); -} - static int _species_exp_mod(species_type species) { if (player_genus(GENPC_DRACONIAN, species)) diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index 56770a7212..827d8788de 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -539,7 +539,6 @@ bool player_light_armour(bool with_skill = false); bool player_in_water(void); bool player_is_swimming(void); -bool player_is_airborne(void); bool player_under_penance(void); diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 4247dbbae3..9b971986f2 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -991,7 +991,7 @@ bool zin_remove_all_mutations() static bool _need_water_walking() { - return (!player_is_airborne() && you.species != SP_MERFOLK + return (!you.airborne() && you.species != SP_MERFOLK && grd(you.pos()) == DNGN_DEEP_WATER); } diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index fa95cae514..df0bcebb33 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -1481,7 +1481,7 @@ void cast_swiftness(int power) void cast_fly(int power) { const int dur_change = 25 + random2(power) + random2(power); - const bool was_levitating = player_is_airborne(); + const bool was_levitating = you.airborne(); you.duration[DUR_LEVITATION] += dur_change; if (you.duration[DUR_LEVITATION] > 100) diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 84af39d6f3..7faa22b550 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -788,7 +788,7 @@ static int _discharge_monsters(coord_def where, int pow, int, actor *) mpr("You are struck by lightning."); damage = 3 + random2(5 + pow / 10); damage = check_your_resists( damage, BEAM_ELECTRICITY ); - if (player_is_airborne()) + if (you.airborne()) damage /= 2; ouch(damage, NON_MONSTER, KILLED_BY_WILD_MAGIC); } diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc index d356481fa7..e119ae6b78 100644 --- a/crawl-ref/source/tilepick.cc +++ b/crawl-ref/source/tilepick.cc @@ -2623,7 +2623,7 @@ int tileidx_player(int job) case TRAN_LICH: ch = TILEP_TRAN_LICH; break; } - if (player_is_airborne()) + if (you.airborne()) ch |= TILE_FLAG_FLYING; if (you.attribute[ATTR_HELD]) -- cgit v1.2.3-54-g00ecf