item_factory.cpp
if( relative.has_int( "vitamins" ) ) {
// allows easy specification of 'fortified' comestibles
for( const auto &v : vitamin::all() ) {
slot.default_nutrition.vitamins[ v.first ] += relative.get_int( "vitamins" );
So far only read the code.
From perspective of implementing a new deserializer on Python: vitamins defined explicitly, support for this removed. But I guess JSON authors and author(s) of this CPP code will want to just limit vitamins list in this block.
I don't see "vitamins": "?[0-9] used anywhere. Can we please just remove it?
Yep, I don't see it anywhere either, I think it can be removed.
Hi, I'm looking to improve my C++ by contributing to a few projects on github and I thought I might take a look at this issue if that's OK?
Yep! Feel free to ask questions if you need any help.
To be clear, it's only specifying an integer that you want to remove, an array should still be allowed? i.e. only this code:
if( relative.has_int( "vitamins" ) ) {
// allows easy specification of 'fortified' comestibles
for( const auto &v : vitamin::all() ) {
slot.default_nutrition.vitamins[ v.first ] += relative.get_int( "vitamins" );
}
}
and not the block below:
else if( relative.has_array( "vitamins" ) ) {
for( JsonArray pair : relative.get_array( "vitamins" ) ) {
vitamin_id vit( pair.get_string( 0 ) );
slot.default_nutrition.vitamins[ vit ] += pair.get_int( 1 );
}
}
Yes