Skip to content

Commit

Permalink
Evaluate fac_food_supply vitamins?
Browse files Browse the repository at this point in the history
  • Loading branch information
RenechCDDA committed Nov 17, 2024
1 parent e0bc6da commit 6d9ae77
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/math_parser_diag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,15 @@ diag_assign_dbl_f faction_trust_ass( char /* scope */, std::vector<diag_value> c
diag_eval_dbl_f faction_food_supply_eval( char /* scope */,
std::vector<diag_value> const &params, 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<double>( fac->food_supply.get_vitamin( vit_to_check ) );
}
return static_cast<double>( fac->food_supply.calories );
};
}
Expand Down

0 comments on commit 6d9ae77

Please sign in to comment.