Skip to content

Commit

Permalink
Use average NPC's stats to calculate faction camp calories (CleverRav…
Browse files Browse the repository at this point in the history
  • Loading branch information
RenechCDDA authored and katemonster33 committed May 17, 2023
1 parent 179098e commit e143d57
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/faction_camp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4940,6 +4940,12 @@ int time_to_food( time_duration work )
return 2500 * to_hours<int>( work ) / 24;
}

static const npc &getAverageJoe()
{
static npc averageJoe;
return averageJoe;
}

// mission support
bool basecamp::distribute_food()
{
Expand Down Expand Up @@ -4999,8 +5005,9 @@ bool basecamp::distribute_food()
if( it.rotten() ) {
return false;
}
const int kcal = it.get_comestible()->default_nutrition.kcal() * it.count() * rot_multip( it,
container );
const int kcal = getAverageJoe().compute_effective_nutrients( it ).kcal() * it.count() * rot_multip(
it,
container );
if( kcal <= 0 ) {
// can happen if calories is low and rot is high.
return false;
Expand Down

0 comments on commit e143d57

Please sign in to comment.