From 5dd9f7825d764290d75b99e253076fd56036235a Mon Sep 17 00:00:00 2001 From: Ramza13 <52087122+Ramza13@users.noreply.github.com> Date: Sat, 12 Oct 2019 22:08:02 -0400 Subject: [PATCH] Migrated can_run into Character per reviewer advice --- src/character.cpp | 6 ++++++ src/character.h | 2 ++ src/player.cpp | 5 ----- src/player.h | 1 - 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/character.cpp b/src/character.cpp index c2d9b8994d7fb..59f8405be1fe8 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -93,6 +93,7 @@ const efftype_id effect_riding( "riding" ); const efftype_id effect_sleep( "sleep" ); const efftype_id effect_slept_through_alarm( "slept_through_alarm" ); const efftype_id effect_webbed( "webbed" ); +const efftype_id effect_winded( "winded" ); const skill_id skill_dodge( "dodge" ); const skill_id skill_throw( "throw" ); @@ -484,6 +485,11 @@ bool Character::is_limb_broken( hp_part limb ) const return hp_cur[limb] == 0; } +bool Character::can_run() +{ + return stamina > 0 && !has_effect( effect_winded ) && get_working_leg_count() >= 2; +} + bool Character::move_effects( bool attacking ) { if( has_effect( effect_downed ) ) { diff --git a/src/character.h b/src/character.h index 34f07364ed085..76387a1677612 100644 --- a/src/character.h +++ b/src/character.h @@ -463,6 +463,8 @@ class Character : public Creature, public visitable bool is_limb_disabled( hp_part limb ) const; /** Returns true if the limb is broken */ bool is_limb_broken( hp_part limb ) const; + /** source of truth of whether a player can run */ + bool can_run(); /** * Displays menu with body part hp, optionally with hp estimation after healing. * Returns selected part. diff --git a/src/player.cpp b/src/player.cpp index 97af5f79b187b..edb2b81116148 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -2501,11 +2501,6 @@ void player::toggle_run_mode() } } -bool player::can_run() -{ - return stamina > 0 && !has_effect( effect_winded ) && get_working_leg_count() >= 2; -} - void player::toggle_crouch_mode() { if( move_mode == PMM_CROUCH ) { diff --git a/src/player.h b/src/player.h index f46507cd7584d..2730a135632a6 100644 --- a/src/player.h +++ b/src/player.h @@ -450,7 +450,6 @@ class player : public Character void cycle_move_mode(); // Cycles to the next move mode. void reset_move_mode(); // Resets to walking. void toggle_run_mode(); // Toggles running on/off. - bool can_run(); // source of truth of whether a player can run void toggle_crouch_mode(); // Toggles crouching on/off. // martialarts.cpp