diff --git a/src/math_parser_diag.cpp b/src/math_parser_diag.cpp index b4af37792b643..86ec097c1acc3 100644 --- a/src/math_parser_diag.cpp +++ b/src/math_parser_diag.cpp @@ -270,8 +270,15 @@ diag_assign_dbl_f faction_trust_ass( char /* scope */, std::vector c diag_eval_dbl_f faction_food_supply_eval( char /* scope */, std::vector const ¶ms, diag_kwargs const &/* kwargs */ ) { - return [fac_val = params[0]]( const_dialogue const & d ) { + vitamin_id vit_to_check = vitamin_id::NULL_ID(); + if( params.size() > 1 ) { + vit_to_check = vitamin_id( params[1].str() ); + } + return [fac_val = params[0], &vit_to_check]( const_dialogue const & d ) { faction *fac = g->faction_manager_ptr->get( faction_id( fac_val.str( d ) ) ); + if( !vit_to_check->is_null() ) { + return static_cast( fac->food_supply.get_vitamin( vit_to_check ) ); + } return static_cast( fac->food_supply.calories ); }; }