Open WatermelonsEverywhere opened 5 days ago
Okay that's confirmed, and weird as hell. Let's see where the problem lays.
Okay I'm just stupid and used std::map::count. I knew vitamins was a std::map, but for some reason my brain was thinking of it as a different type of container. Easy enough fix.
Absolute bare minimum patch:
index 3dca58c371..ab19237744 100644
--- a/src/math_parser_diag.cpp
+++ b/src/math_parser_diag.cpp
@@ -1655,7 +1655,8 @@ diag_eval_dbl_f vitamin_eval( char scope, std::vector<diag_value> const ¶ms,
}
if( item_location const *const itm = actor->get_const_item(); itm != nullptr ) {
const nutrients &nutrient_data = default_character_compute_effective_nutrients( *itm->get_item() );
- return static_cast<int>( nutrient_data.vitamins().count( vitamin_id( id.str( d ) ) ) );
+ const auto &v = nutrient_data.vitamins().find( vitamin_id( id.str( d ) ) );
+ return v != nutrient_data.vitamins().end() ? v->second : 0;
}
debugmsg( "Tried to access vitamins of a non-Character/non-item talker" );
return 0;
I'm looking into this. I tried @RenechCDDA 's patch and it doesn't seem to have fixed it... but the bug is inconsistent and doesn't always trigger. I'll try toying with it some more.
Describe the bug
Giving a Refugee Center beggar a can of sealed peach sparkling water as a food offer triggers the "They know what you've done." hostile cannibalism response.
Attach save file
Coletown-trimmed.tar.gz
Steps to reproduce
Expected behavior
For the beggars to recieve the peach sparkling water as any other donated food or drink item.
Screenshots
No response
Versions and configuration
Additional context
No response