当前位置: 首页>>代码示例>>C++>>正文


C++ ItemList::push_back方法代码示例

本文整理汇总了C++中ItemList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemList::push_back方法的具体用法?C++ ItemList::push_back怎么用?C++ ItemList::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ItemList的用法示例。


在下文中一共展示了ItemList::push_back方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: transferToDepot

bool House::transferToDepot(Player* player) const
{
	if (townid == 0 || owner == 0) {
		return false;
	}

	ItemList moveItemList;
	for (HouseTile* tile : houseTiles) {
		if (const TileItemVector* items = tile->getItemList()) {
			for (Item* item : *items) {
				if (item->isPickupable()) {
					moveItemList.push_back(item);
				} else {
					Container* container = item->getContainer();
					if (container) {
						for (Item* containerItem : container->getItemList()) {
							moveItemList.push_back(containerItem);
						}
					}
				}
			}
		}
	}

	for (Item* item : moveItemList) {
		g_game.internalMoveItem(item->getParent(), player->getInbox(), INDEX_WHEREEVER, item, item->getItemCount(), nullptr, FLAG_NOLIMIT);
	}
	return true;
}
开发者ID:HeavenIsLost,项目名称:ChronusServer,代码行数:29,代码来源:house.cpp

示例2:

// LinkItems - This function is the main entry point into linking. It takes a
// list of LinkItem which indicates the order the files should be linked and
// how each file should be treated (plain file or with library search). The
// function only links bitcode and produces a result list of items that are
// native objects. 
bool
Linker::LinkInItems(const ItemList& Items, ItemList& NativeItems) {
  // Clear the NativeItems just in case
  NativeItems.clear();

  // For each linkage item ...
  for (ItemList::const_iterator I = Items.begin(), E = Items.end();
       I != E; ++I) {
    if (I->second) {
      // Link in the library suggested.
      bool is_native = false;
      if (LinkInLibrary(I->first, is_native))
        return true;
      if (is_native)
        NativeItems.push_back(*I);
    } else {
      // Link in the file suggested
      bool is_native = false;
      if (LinkInFile(sys::Path(I->first), is_native))
        return true;
      if (is_native)
        NativeItems.push_back(*I);
    }
  }

  return false;
}
开发者ID:32bitmicro,项目名称:llvm,代码行数:32,代码来源:LinkItems.cpp

示例3: transferToDepot

bool House::transferToDepot(Player* player)
{
	if (townid == 0 || houseOwner == 0) {
		return false;
	}

	ItemList moveItemList;
	for (HouseTileList::iterator it = houseTiles.begin(); it != houseTiles.end(); ++it) {
		if (const TileItemVector* items = (*it)->getItemList()) {
			for (ItemVector::const_iterator iit = items->begin(), iend = items->end(); iit != iend; ++iit) {
				Item* item = *iit;
				if (item->isPickupable()) {
					moveItemList.push_back(item);
				} else {
					Container* container = item->getContainer();
					if (container) {
						for (ItemDeque::const_iterator cit = container->getItems(); cit != container->getEnd(); ++cit) {
							moveItemList.push_back(*cit);
						}
					}
				}
			}
		}
	}

	for (ItemList::iterator it = moveItemList.begin(); it != moveItemList.end(); ++it) {
		Item* item = *it;
		g_game.internalMoveItem(item->getParent(), player->getInbox(), INDEX_WHEREEVER,
		                        item, item->getItemCount(), NULL, FLAG_NOLIMIT);
	}

	return true;
}
开发者ID:nclx,项目名称:forgottenserver,代码行数:33,代码来源:house.cpp

示例4: transferToDepot

bool House::transferToDepot()
{
	if(!townId)
		return false;

	Player* player = NULL;
	if(owner)
	{
		uint32_t tmp = owner;
		if(isGuild() && !IOGuild::getInstance()->swapGuildIdToOwner(tmp))
			tmp = 0;

		if(tmp)
			player = g_game.getPlayerByGuidEx(tmp);
	}

	Item* item = NULL;
	Container* tmpContainer = NULL;

	ItemList moveList;
	for(HouseTileList::iterator it = houseTiles.begin(); it != houseTiles.end(); ++it)
	{
		for(uint32_t i = 0; i < (*it)->getThingCount(); ++i)
		{
			if(!(item = (*it)->__getThing(i)->getItem()))
				continue;

			if(item->isPickupable())
				moveList.push_back(item);
			else if((tmpContainer = item->getContainer()))
			{
				for(ItemList::const_iterator it = tmpContainer->getItems(); it != tmpContainer->getEnd(); ++it)
					moveList.push_back(*it);
			}
		}
	}

	if(player)
	{
		Depot* depot = player->getDepot(townId, true);
		for(ItemList::iterator it = moveList.begin(); it != moveList.end(); ++it)
			g_game.internalMoveItem(NULL, (*it)->getParent(), depot, INDEX_WHEREEVER, (*it), (*it)->getItemCount(), NULL, FLAG_NOLIMIT);

		if(player->isVirtual())
		{
			IOLoginData::getInstance()->savePlayer(player);
			delete player;
		}
	}
	else
	{
		for(ItemList::iterator it = moveList.begin(); it != moveList.end(); ++it)
			g_game.internalRemoveItem(NULL, (*it), (*it)->getItemCount(), false, FLAG_NOLIMIT);
	}

	return true;
}
开发者ID:alexisjojo,项目名称:darkkonia,代码行数:57,代码来源:house.cpp

示例5: transferToDepot

bool House::transferToDepot()
{
	if(!townId)
		return false;

	Player* player = NULL;
	if(owner)
	{
		uint32_t tmp = owner;
		if(isGuild() && !IOGuild::getInstance()->swapGuildIdToOwner(tmp))
			tmp = 0;

		if(tmp)
			player = g_game.getPlayerByGuidEx(tmp);
	}

	Container* tmpContainer = NULL;
	TileItemVector* items = NULL;

	ItemList moveList;
	for(HouseTileList::iterator it = houseTiles.begin(); it != houseTiles.end(); ++it)
	{
		if(!(items = (*it)->getItemList()))
			continue;

		for(ItemVector::iterator iit = items->begin(); iit != items->end(); ++iit)
		{
			if((*iit)->isPickupable())
				moveList.push_back(*iit);
			else if((tmpContainer = (*iit)->getContainer()))
			{
				for(ItemList::const_iterator cit = tmpContainer->getItems(); cit != tmpContainer->getEnd(); ++cit)
					moveList.push_back(*cit);
			}
		}
	}

	if(player)
	{
		for(ItemList::iterator it = moveList.begin(); it != moveList.end(); ++it)
			g_game.internalMoveItem(NULL, (*it)->getParent(), player->getInbox(), INDEX_WHEREEVER, (*it), (*it)->getItemCount(), NULL, FLAG_NOLIMIT);

		if(player->isVirtual())
		{
			IOLoginData::getInstance()->savePlayer(player);
			delete player;
		}
	}
	else
	{
		for(ItemList::iterator it = moveList.begin(); it != moveList.end(); ++it)
			g_game.internalRemoveItem(NULL, (*it), (*it)->getItemCount(), false, FLAG_NOLIMIT);
	}

	return true;
}
开发者ID:081421,项目名称:otxserver,代码行数:56,代码来源:house.cpp

示例6:

bool qmimap4::CopyOfflineJob::merge(OfflineJob* pOfflineJob)
{
	assert(pOfflineJob);
	
	if (pOfflineJob->getType() == TYPE_COPY &&
		wcscmp(getFolder(), pOfflineJob->getFolder()) == 0) {
		CopyOfflineJob* p = static_cast<CopyOfflineJob*>(pOfflineJob);
		if (wcscmp(wstrFolderTo_.get(), p->wstrFolderTo_.get()) == 0 && bMove_ == p->bMove_) {
			UidList listUidFrom;
			listUidFrom.reserve(listUidFrom_.size() + p->listUidFrom_.size());
			ItemList listItemTo;
			listItemTo.reserve(listItemTo_.size() + p->listItemTo_.size());
			
			UidList::const_iterator itUS = listUidFrom_.begin();
			UidList::const_iterator itUO = p->listUidFrom_.begin();
			ItemList::const_iterator itIS = listItemTo_.begin();
			ItemList::const_iterator itIO = p->listItemTo_.begin();
			while (true) {
				if (itUS != listUidFrom_.end()) {
					if (itUO != p->listUidFrom_.end()) {
						if (*itUS < *itUO) {
							listUidFrom.push_back(*itUS++);
							listItemTo.push_back(*itIS++);
						}
						else {
							listUidFrom.push_back(*itUO++);
							listItemTo.push_back(*itIO++);
						}
					}
					else {
						listUidFrom.push_back(*itUS++);
						listItemTo.push_back(*itIS++);
					}
				}
				else {
					if (itUO != p->listUidFrom_.end()) {
						listUidFrom.push_back(*itUO++);
						listItemTo.push_back(*itIO++);
					}
					else {
						break;
					}
				}
			}
			
			listUidFrom_.swap(listUidFrom);
			listItemTo_.swap(listItemTo);
			
			return true;
		}
	}
	
	return false;
}
开发者ID:snakamura,项目名称:q3,代码行数:54,代码来源:offlinejob.cpp

示例7: 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;
}
开发者ID:3721assistant,项目名称:Cataclysm-DDA,代码行数:33,代码来源:item_group.cpp

示例8: updatePartList

void GraphViewBaseImpl::updatePartList()
{
    treeWidget.clear();

    int numParts = 0;
    if(!itemInfos.empty()){
        ItemList<Item> items;
        for(list<ItemInfo>::iterator p = itemInfos.begin(); p != itemInfos.end(); ++p){
            items.push_back(p->item.get());
        }
        numParts = self->currentNumParts(items);
    }
    
    for(int i=0; i < numParts; ++i){
        PartItem* partItem = new PartItem();
        partItem->setText(0, QString::number(i));
        partItem->setTextAlignment(0, Qt::AlignHCenter);
        partItem->index = i;
        treeWidget.addTopLevelItem(partItem);
    }

    treeWidget.header()->updateGeometry();
    treeWidget.updateGeometry();

    updateSelections();
}
开发者ID:arntanguy,项目名称:choreonoid,代码行数:26,代码来源:GraphViewBase.cpp

示例9: create

Item_spawn_data::ItemList Item_group::create(int birthday, RecursionList &rec) const
{
    ItemList result;
    if (type == G_COLLECTION) {
        for(prop_list::const_iterator a = items.begin(); a != items.end(); ++a) {
            if(rng(0, 99) >= (*a)->probability) {
                continue;
            }
            ItemList tmp = (*a)->create(birthday, rec);
            result.insert(result.end(), tmp.begin(), tmp.end());
        }
    } else if (type == G_DISTRIBUTION) {
        int p = rng(0, sum_prob - 1);
        for(prop_list::const_iterator a = items.begin(); a != items.end(); ++a) {
            p -= (*a)->probability;
            if (p >= 0) {
                continue;
            }
            ItemList tmp = (*a)->create(birthday, rec);
            result.insert(result.end(), tmp.begin(), tmp.end());
            break;
        }
    }
    if (with_ammo && !result.empty()) {
        it_gun *maybe_gun = dynamic_cast<it_gun *>(result.front().type);
        if (maybe_gun != NULL) {
            item ammo(default_ammo(maybe_gun->ammo), birthday);
            // TODO: change the spawn lists to contain proper references to containers
            ammo = ammo.in_its_container();
            result.push_back(ammo);
        }
    }
    return result;
}
开发者ID:HolyHemperor,项目名称:Cataclysm-DDA,代码行数:34,代码来源:item_group.cpp

示例10:

ItemList<BodyItem> WorldItem::coldetBodyItems() const
{
    ItemList<BodyItem> bodyItems;
    for(auto& info : impl->coldetBodyInfos){
        bodyItems.push_back(info.bodyItem);
    }
    return bodyItems;
}
开发者ID:s-nakaoka,项目名称:choreonoid,代码行数:8,代码来源:WorldItem.cpp

示例11: fillItems

 virtual void fillItems(ItemList& items, IItemCreator const& creator)
 {
     while (this->hasData())
     {
         db::IItem* item = creator.create();
         this->fetchone().fillItem(*item);
         items.push_back(*item);
     }
 }
开发者ID:hotgloupi,项目名称:zhttpd,代码行数:9,代码来源:ICursor.hpp

示例12:

// LinkItems - This function is the main entry point into linking. It takes a
// list of LinkItem which indicates the order the files should be linked and
// how each file should be treated (plain file or with library search). The
// function only links bitcode and produces a result list of items that are
// native objects. 
bool
Linker::LinkInItems(const ItemList& Items, ItemList& NativeItems) {
  // Clear the NativeItems just in case
  NativeItems.clear();

  // For each linkage item ...
  for (ItemList::const_iterator I = Items.begin(), E = Items.end();
       I != E; ++I) {
    if (I->second) {
      // Link in the library suggested.
      bool is_native = false;
      if (LinkInLibrary(I->first, is_native))
        return true;
      if (is_native)
        NativeItems.push_back(*I);
    } else {
      // Link in the file suggested
      bool is_native = false;
      if (LinkInFile(sys::Path(I->first), is_native))
        return true;
      if (is_native)
        NativeItems.push_back(*I);
    }
  }

  // At this point we have processed all the link items provided to us. Since
  // we have an aggregated module at this point, the dependent libraries in
  // that module should also be aggregated with duplicates eliminated. This is
  // now the time to process the dependent libraries to resolve any remaining
  // symbols.
  bool is_native;
  for (Module::lib_iterator I = Composite->lib_begin(),
         E = Composite->lib_end(); I != E; ++I) {
    if(LinkInLibrary(*I, is_native))
      return true;
    if (is_native)
      NativeItems.push_back(std::make_pair(*I, true));
  }

  return false;
}
开发者ID:Killfrra,项目名称:llvm-kernel,代码行数:46,代码来源:LinkItems.cpp

示例13: extractCheckedItems

void ItemTreeViewImpl::extractCheckedItems(QTreeWidgetItem* twItem, int column, ItemList<>& checkedItemList)
{
    ItvItem* itvItem = dynamic_cast<ItvItem*>(twItem);
    if(itvItem){
        if(itvItem->checkState(column) == Qt::Checked){
            checkedItemList.push_back(itvItem->item.get());
        }
    }
    int n = twItem->childCount();
    for(int i=0; i < n; ++i){
        extractCheckedItems(twItem->child(i), column, checkedItemList);
    }
}
开发者ID:haraisao,项目名称:choreonoid,代码行数:13,代码来源:ItemTreeView.cpp

示例14: while

        void
CLxItemSelection::GetList (
        ItemList		&list)
{
        CLxUser_Item		 item;
        LXtScanInfoID		 scan;
        void			*pkt;

        list.clear ();

        scan = 0;
        while (scan = srv_sel.ScanLoop (scan, sel_ID, &pkt)) {
                pkt_trans.GetItem (pkt, item);
                if (Include (item))
                        list.push_back (item);
        }
}
开发者ID:kioku-systemk,项目名称:mrzExporter,代码行数:17,代码来源:lxu_select.cpp

示例15: 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;
}
开发者ID:Barhandar,项目名称:Cataclysm-DDA,代码行数:39,代码来源:item_group.cpp


注:本文中的ItemList::push_back方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。