Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use average NPC's stats to calculate faction camp gained calories #65168

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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