本文整理汇总了C++中item::get_category方法的典型用法代码示例。如果您正苦于以下问题:C++ item::get_category方法的具体用法?C++ item::get_category怎么用?C++ item::get_category使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类item
的用法示例。
在下文中一共展示了item::get_category方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: it
itemstack_or_category(const item *a, int b)
: it(a), slice(NULL), category(&it->get_category()), item_pos(b)
{
}
示例2: it
inventory_entry( const item *it, int pos, const item_category *cat = nullptr )
: it( it ),
slice( nullptr ),
category( ( cat != nullptr ) ? cat : &it->get_category() ),
item_pos( pos ) {}
示例3: get_near_zone_type_for_item
zone_type_id zone_manager::get_near_zone_type_for_item( const item &it,
const tripoint &where ) const
{
auto cat = it.get_category();
if( it.has_flag( "FIREWOOD" ) ) {
if( has_near( zone_type_id( "LOOT_WOOD" ), where ) ) {
return zone_type_id( "LOOT_WOOD" );
}
}
if( cat.id() == "food" ) {
const bool preserves = it.is_food_container() && it.type->container->preserves;
const auto &it_food = it.is_food_container() ? it.contents.front() : it;
if( it_food.is_food() ) { // skip food without comestible, like MREs
if( it_food.get_comestible()->comesttype == "DRINK" ) {
if( !preserves && it_food.goes_bad() && has_near( zone_type_id( "LOOT_PDRINK" ), where ) ) {
return zone_type_id( "LOOT_PDRINK" );
} else if( has_near( zone_type_id( "LOOT_DRINK" ), where ) ) {
return zone_type_id( "LOOT_DRINK" );
}
}
if( !preserves && it_food.goes_bad() && has_near( zone_type_id( "LOOT_PFOOD" ), where ) ) {
return zone_type_id( "LOOT_PFOOD" );
}
}
return zone_type_id( "LOOT_FOOD" );
}
if( cat.id() == "guns" ) {
return zone_type_id( "LOOT_GUNS" );
}
if( cat.id() == "magazines" ) {
return zone_type_id( "LOOT_MAGAZINES" );
}
if( cat.id() == "ammo" ) {
return zone_type_id( "LOOT_AMMO" );
}
if( cat.id() == "weapons" ) {
return zone_type_id( "LOOT_WEAPONS" );
}
if( cat.id() == "tools" ) {
return zone_type_id( "LOOT_TOOLS" );
}
if( cat.id() == "clothing" ) {
if( it.is_filthy() && has_near( zone_type_id( "LOOT_FCLOTHING" ), where ) ) {
return zone_type_id( "LOOT_FCLOTHING" );
}
return zone_type_id( "LOOT_CLOTHING" );
}
if( cat.id() == "drugs" ) {
return zone_type_id( "LOOT_DRUGS" );
}
if( cat.id() == "books" ) {
return zone_type_id( "LOOT_BOOKS" );
}
if( cat.id() == "mods" ) {
return zone_type_id( "LOOT_MODS" );
}
if( cat.id() == "mutagen" ) {
return zone_type_id( "LOOT_MUTAGENS" );
}
if( cat.id() == "bionics" ) {
return zone_type_id( "LOOT_BIONICS" );
}
if( cat.id() == "veh_parts" ) {
return zone_type_id( "LOOT_VEHICLE_PARTS" );
}
if( cat.id() == "other" ) {
return zone_type_id( "LOOT_OTHER" );
}
if( cat.id() == "fuel" ) {
return zone_type_id( "LOOT_FUEL" );
}
if( cat.id() == "seeds" ) {
return zone_type_id( "LOOT_SEEDS" );
}
if( cat.id() == "chems" ) {
return zone_type_id( "LOOT_CHEMICAL" );
}
if( cat.id() == "spare_parts" ) {
return zone_type_id( "LOOT_SPARE_PARTS" );
}
if( cat.id() == "artifacts" ) {
return zone_type_id( "LOOT_ARTIFACTS" );
}
if( cat.id() == "armor" ) {
if( it.is_filthy() && has_near( zone_type_id( "LOOT_FARMOR" ), where ) ) {
return zone_type_id( "LOOT_FARMOR" );
}
return zone_type_id( "LOOT_ARMOR" );
}
return zone_type_id();
}