diff --git a/src/character_body.cpp b/src/character_body.cpp index ff934a3f1c7cb..c055b90b0d45f 100644 --- a/src/character_body.cpp +++ b/src/character_body.cpp @@ -196,6 +196,7 @@ void Character::update_body( const time_point &from, const time_point &to ) { // Early return if we already did update previously on the same turn (e.g. when loading savegame). if( to <= last_updated ) { + last_updated = to; return; } if( !is_npc() ) { diff --git a/tests/effect_test.cpp b/tests/effect_test.cpp index bfc406f71358b..f47516db7f5fe 100644 --- a/tests/effect_test.cpp +++ b/tests/effect_test.cpp @@ -717,7 +717,7 @@ TEST_CASE( "Vitamin Effects", "[effect][vitamins]" ) const int post_vitx = subject.vitamin_get( vitx ); // The effect roughly halves the absorbed vitamin x - CHECK( posteffect_vitx == 22 ); + CHECK( posteffect_vitx == Approx( 22 ).margin( 3 ) ); CHECK( post_vitx == 46 ); // Without the effect, no vitamin v is gained diff --git a/tests/player_helpers.cpp b/tests/player_helpers.cpp index a3617fbcf115e..2ca41ba32a909 100644 --- a/tests/player_helpers.cpp +++ b/tests/player_helpers.cpp @@ -82,6 +82,7 @@ void clear_character( Character &dummy, bool skip_nutrition ) dummy.stomach.empty(); dummy.guts.empty(); dummy.clear_vitamins(); + dummy.update_body( calendar::turn, calendar::turn ); // sets last_updated to current turn if( !skip_nutrition ) { item food( "debug_nutrition" ); dummy.consume( food ); diff --git a/tests/stomach_contents_test.cpp b/tests/stomach_contents_test.cpp index 5e840cd5c90c1..b79ea1d6d64a4 100644 --- a/tests/stomach_contents_test.cpp +++ b/tests/stomach_contents_test.cpp @@ -27,7 +27,6 @@ static void reset_time() { calendar::turn = calendar::start_of_cataclysm; Character &player_character = get_player_character(); - player_character.set_stored_kcal( player_character.get_healthy_kcal() ); player_character.set_hunger( 0 ); clear_avatar(); }