本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例10:
ItemList<BodyItem> WorldItem::coldetBodyItems() const
{
ItemList<BodyItem> bodyItems;
for(auto& info : impl->coldetBodyInfos){
bodyItems.push_back(info.bodyItem);
}
return bodyItems;
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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;
}