本文整理汇总了C++中dynamicdataloader::deferred_json::size方法的典型用法代码示例。如果您正苦于以下问题:C++ deferred_json::size方法的具体用法?C++ deferred_json::size怎么用?C++ deferred_json::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dynamicdataloader::deferred_json
的用法示例。
在下文中一共展示了deferred_json::size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: finalize
void recipe_dictionary::finalize()
{
if( !DynamicDataLoader::get_instance().load_deferred( deferred ) ) {
debugmsg( "JSON contains circular dependency: discarded %i recipes", deferred.size() );
}
finalize_internal( recipe_dict.recipes );
finalize_internal( recipe_dict.uncraft );
for( auto &e : recipe_dict.recipes ) {
auto &r = e.second;
for( const auto &bk : r.booksets ) {
islot_book::recipe_with_description_t desc{ &r, bk.second, item::nname( r.result ), false };
item::find_type( bk.first )->book->recipes.insert( desc );
}
if( r.contained && r.container == "null" ) {
r.container = item::find_type( r.result )->default_container;
}
if( r.autolearn ) {
r.autolearn_requirements = r.required_skills;
if( r.skill_used ) {
r.autolearn_requirements[ r.skill_used ] = r.difficulty;
}
}
// add recipe to category and component caches
recipe_dict.category[r.category].insert( &r );
for( const auto &opts : r.requirements().get_components() ) {
for( const item_comp &comp : opts ) {
recipe_dict.component[comp.type].insert( &r );
}
}
// if reversible and no specific uncraft recipe exists use this recipe
if( r.reversible && !recipe_dict.uncraft.count( r.result ) ) {
recipe_dict.uncraft[ r.result ] = r;
}
}
// add pseudo uncrafting recipes
for( const auto &e : item_controller->get_all_itypes() ) {
// books that don't alreay have an uncrafting recipe
if( e.second->book && !recipe_dict.uncraft.count( e.first ) && e.second->volume > 0 ) {
int pages = e.second->volume / units::from_milliliter( 12.5 );
auto &bk = recipe_dict.uncraft[ e.first ];
bk.ident_ = e.first;
bk.result = e.first;
bk.reversible = true;
bk.requirements_ = *requirement_id( "uncraft_book" ) * pages;
bk.time = pages * 10; // @todo allow specifying time in requirement_data
}
}
}
示例2: finalize
void vpart_info::finalize()
{
if( !DynamicDataLoader::get_instance().load_deferred( deferred ) ) {
debugmsg( "JSON contains circular dependency: discarded %i vehicle parts", deferred.size() );
}
for( auto& e : vpart_info_all ) {
// if part name specified ensure it is translated
// otherwise the name of the base item will be used
if( !e.second.name_.empty() ) {
e.second.name_ = _( e.second.name_.c_str() );
}
if( e.second.folded_volume > 0 ) {
e.second.set_flag( "FOLDABLE" );
}
for( const auto& f : e.second.flags ) {
auto b = vpart_bitflag_map.find( f );
if( b != vpart_bitflag_map.end() ) {
e.second.bitflags.set( b->second );
}
}
e.second.power = hp_to_watt( e.second.power );
// Calculate and cache z-ordering based off of location
// list_order is used when inspecting the vehicle
if( e.second.location == "on_roof" ) {
e.second.z_order = 9;
e.second.list_order = 3;
} else if( e.second.location == "on_cargo" ) {
e.second.z_order = 8;
e.second.list_order = 6;
} else if( e.second.location == "center" ) {
e.second.z_order = 7;
e.second.list_order = 7;
} else if( e.second.location == "under" ) {
// Have wheels show up over frames
e.second.z_order = 6;
e.second.list_order = 10;
} else if( e.second.location == "structure" ) {
e.second.z_order = 5;
e.second.list_order = 1;
} else if( e.second.location == "engine_block" ) {
// Should be hidden by frames
e.second.z_order = 4;
e.second.list_order = 8 ;
} else if( e.second.location == "on_battery_mount" ){
// Should be hidden by frames
e.second.z_order = 3;
e.second.list_order = 10;
} else if( e.second.location == "fuel_source" ) {
// Should be hidden by frames
e.second.z_order = 3;
e.second.list_order = 9;
} else if( e.second.location == "roof" ) {
// Shouldn't be displayed
e.second.z_order = -1;
e.second.list_order = 4;
} else if( e.second.location == "armor" ) {
// Shouldn't be displayed (the color is used, but not the symbol)
e.second.z_order = -2;
e.second.list_order = 2;
} else {
// Everything else
e.second.z_order = 0;
e.second.list_order = 5;
}
}
}