本文整理汇总了C++中TileItemVector::at方法的典型用法代码示例。如果您正苦于以下问题:C++ TileItemVector::at方法的具体用法?C++ TileItemVector::at怎么用?C++ TileItemVector::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TileItemVector
的用法示例。
在下文中一共展示了TileItemVector::at方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pushItems
void Monster::pushItems(Tile* tile)
{
TileItemVector* items = tile->getItemList();
if(!items)
return;
//We cannot use iterators here since we can push the item to another tile
//which will invalidate the iterator.
//start from the end to minimize the amount of traffic
int32_t moveCount = 0, removeCount = 0, downItemsSize = tile->getDownItemCount();
Item* item = NULL;
for(int32_t i = downItemsSize - 1; i >= 0; --i)
{
assert(i >= 0 && i < downItemsSize);
if((item = items->at(i)) && item->hasProperty(MOVEABLE) &&
(item->hasProperty(BLOCKPATH) || item->hasProperty(BLOCKSOLID)))
{
if(moveCount < 20 && pushItem(item, 1))
moveCount++;
else if(g_game.internalRemoveItem(this, item) == RET_NOERROR)
++removeCount;
}
}
if(removeCount > 0)
g_game.addMagicEffect(tile->getPosition(), MAGIC_EFFECT_POFF);
}