Skip to content

Commit

Permalink
Use dialogue scoping for variable resolution
Browse files Browse the repository at this point in the history
Co-authored-by: andrei <[email protected]>
  • Loading branch information
RenechCDDA and andrei8l committed Nov 19, 2024
1 parent 86325b6 commit 774ce38
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/math_parser_diag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ diag_eval_dbl_f faction_food_supply_eval( char /* scope */,
return [fac_val = params[0], vit_val]( const_dialogue const & d ) {
faction *fac = g->faction_manager_ptr->get( faction_id( fac_val.str( d ) ) );
if( !vit_val.is_empty() ) {
return static_cast<double>( fac->food_supply.get_vitamin( vitamin_id( vit_val.str() ) ) );
return static_cast<double>( fac->food_supply.get_vitamin( vitamin_id( vit_val.str( d ) ) ) );
}
return static_cast<double>( fac->food_supply.calories );
};
Expand All @@ -287,7 +287,7 @@ diag_assign_dbl_f faction_food_supply_ass( char /* scope */,
return [fac_val = params[0], vit_val]( dialogue const & d, double val ) {
faction *fac = g->faction_manager_ptr->get( faction_id( fac_val.str( d ) ) );
if( !vit_val.is_empty() ) {
fac->food_supply.add_vitamin( vitamin_id( vit_val.str() ), val );
fac->food_supply.add_vitamin( vitamin_id( vit_val.str( d ) ), val );
return;
}
fac->food_supply.calories = val;
Expand Down

0 comments on commit 774ce38

Please sign in to comment.