本文整理汇总了C++中Item_spawn_data::create方法的典型用法代码示例。如果您正苦于以下问题:C++ Item_spawn_data::create方法的具体用法?C++ Item_spawn_data::create怎么用?C++ Item_spawn_data::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Item_spawn_data
的用法示例。
在下文中一共展示了Item_spawn_data::create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
Item_spawn_data::ItemList Single_item_creator::create(int birthday, RecursionList &rec) const
{
ItemList result;
int cnt = 1;
if (modifier.get() != NULL) {
cnt = (modifier->count.first == modifier->count.second) ? modifier->count.first : rng(
modifier->count.first, modifier->count.second);
}
for( ; cnt > 0; cnt--) {
if (type == S_ITEM) {
result.push_back(create_single(birthday, rec));
} else {
if (std::find(rec.begin(), rec.end(), id) != rec.end()) {
debugmsg("recursion in item spawn list %s", id.c_str());
return result;
}
rec.push_back(id);
Item_spawn_data *isd = item_controller->get_group(id);
if (isd == NULL) {
debugmsg("unknown item spawn list %s", id.c_str());
return result;
}
ItemList tmplist = isd->create(birthday, rec);
if (modifier.get() != NULL) {
for(ItemList::iterator a = tmplist.begin(); a != tmplist.end(); ++a) {
modifier->modify(*a);
}
}
result.insert(result.end(), tmplist.begin(), tmplist.end());
}
}
return result;
}
示例2: create
Item_spawn_data::ItemList Single_item_creator::create( const time_point &birthday,
RecursionList &rec ) const
{
ItemList result;
int cnt = 1;
if( modifier ) {
auto modifier_count = modifier->count;
cnt = ( modifier_count.first == modifier_count.second ) ? modifier_count.first : rng(
modifier_count.first, modifier_count.second );
}
for( ; cnt > 0; cnt-- ) {
if( type == S_ITEM ) {
const auto itm = create_single( birthday, rec );
if( !itm.is_null() ) {
result.push_back( itm );
}
} else {
if( std::find( rec.begin(), rec.end(), id ) != rec.end() ) {
debugmsg( "recursion in item spawn list %s", id.c_str() );
return result;
}
rec.push_back( id );
Item_spawn_data *isd = item_controller->get_group( id );
if( isd == nullptr ) {
debugmsg( "unknown item spawn list %s", id.c_str() );
return result;
}
ItemList tmplist = isd->create( birthday, rec );
rec.erase( rec.end() - 1 );
if( modifier ) {
for( auto &elem : tmplist ) {
modifier->modify( elem );
}
}
result.insert( result.end(), tmplist.begin(), tmplist.end() );
}
}
return result;
}