Skip to content

Commit

Permalink
Migrated can_run into Character per reviewer advice
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramza13 committed Oct 13, 2019
1 parent 048b567 commit 5dd9f78
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" );
Expand Down Expand Up @@ -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 ) ) {
Expand Down
2 changes: 2 additions & 0 deletions src/character.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,8 @@ class Character : public Creature, public visitable<Character>
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.
Expand Down
5 changes: 0 additions & 5 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
1 change: 0 additions & 1 deletion src/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5dd9f78

Please sign in to comment.