Skip to content

Commit

Permalink
Reset age and height in clear_character
Browse files Browse the repository at this point in the history
Variation in age and height was leading to a test failure in
starve_test.
  • Loading branch information
jbytheway committed Apr 12, 2020
1 parent 333959c commit 55b78e4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6888,6 +6888,12 @@ units::mass Character::bionics_weight() const
return bio_weight;
}

void Character::reset_chargen_attributes()
{
init_age = 25;
init_height = 175;
}

int Character::base_age() const
{
return init_age;
Expand Down
2 changes: 2 additions & 0 deletions src/character.h
Original file line number Diff line number Diff line change
Expand Up @@ -1579,6 +1579,8 @@ class Character : public Creature, public visitable<Character>
float get_bmi() const;
// returns amount of calories burned in a day given various metabolic factors
int get_bmr() const;
// Reset age and height to defaults for consistent test results
void reset_chargen_attributes();
// age in years, determined at character creation
int base_age() const;
void mod_base_age( int mod );
Expand Down
1 change: 1 addition & 0 deletions tests/player_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ void clear_character( player &dummy, bool debug_storage )
dummy.clear_morale();
dummy.clear_bionics();
dummy.activity.set_to_null();
dummy.reset_chargen_attributes();
dummy.set_pain( 0 );

// Restore all stamina and go to walk mode
Expand Down

0 comments on commit 55b78e4

Please sign in to comment.