Skip to content

Commit

Permalink
Fix message about rot when eating with saprophage (#65068)
Browse files Browse the repository at this point in the history
* fix rot check

* fix test
  • Loading branch information
Hirmuolio authored Apr 14, 2023
1 parent 9af6e19 commit 440b313
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/consumption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ ret_val<edible_rating> Character::will_eat( const item &food, bool interactive )
add_consequence( _( "Your stomach won't be happy (allergy)." ), ALLERGY );
}

if( saprophage && edible && food.rotten() && !food.has_flag( flag_FERTILIZER ) ) {
if( saprophage && edible && !food.rotten() && !food.has_flag( flag_FERTILIZER ) ) {
// Note: We're allowing all non-solid "food". This includes drugs
// Hard-coding fertilizer for now - should be a separate flag later
//~ No, we don't eat "rotten" food. We eat properly aged food, like a normal person.
Expand Down
6 changes: 3 additions & 3 deletions tests/char_edible_rating_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,12 +486,12 @@ TEST_CASE( "who will eat rotten food", "[will_eat][edible_rating][rotten]" )
dummy.toggle_trait( trait_SAPROPHAGE );
REQUIRE( dummy.has_trait( trait_SAPROPHAGE ) );

THEN( "they can eat it, but would prefer it to be more rotten" ) {
THEN( "they can eat it, and like that it is rotten" ) {
expect_can_eat( dummy, toastem_rotten );

auto conseq = dummy.will_eat( toastem_rotten, false );
CHECK( conseq.value() == ALLERGY_WEAK );
CHECK( conseq.str() == "Your stomach won't be happy (not rotten enough)." );
CHECK( conseq.value() == EDIBLE );
CHECK( conseq.str().empty() );
}
}
}
Expand Down

0 comments on commit 440b313

Please sign in to comment.