From 6418bd9226a58f6c85ce272a194752d488f52ee6 Mon Sep 17 00:00:00 2001 From: RenechCDDA <84619419+RenechCDDA@users.noreply.github.com> Date: Tue, 18 Apr 2023 13:59:44 -0400 Subject: [PATCH] Use average NPC's stats to calculate faction camp calories --- src/faction_camp.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/faction_camp.cpp b/src/faction_camp.cpp index cab8be0c8bc46..37467ae095f27 100644 --- a/src/faction_camp.cpp +++ b/src/faction_camp.cpp @@ -4940,6 +4940,12 @@ int time_to_food( time_duration work ) return 2500 * to_hours( work ) / 24; } +const npc &getAverageJoe() +{ + static npc averageJoe; + return averageJoe; +} + // mission support bool basecamp::distribute_food() { @@ -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;