本文整理汇总了C++中MagicField::isReplacable方法的典型用法代码示例。如果您正苦于以下问题:C++ MagicField::isReplacable方法的具体用法?C++ MagicField::isReplacable怎么用?C++ MagicField::isReplacable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MagicField
的用法示例。
在下文中一共展示了MagicField::isReplacable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: __addThing
//.........这里部分代码省略.........
++thingCount;
onAddTileItem(item);
}
}
else if(item->isAlwaysOnTop())
{
if(item->isSplash())
{
//remove old splash if exists
if(items)
{
for(ItemVector::iterator it = items->getBeginTopItem(); it != items->getEndTopItem(); ++it)
{
if(!(*it)->isSplash())
continue;
int32_t oldSplashIndex = __getIndexOfThing(*it);
Item* oldSplash = *it;
__removeThing(oldSplash, 1);
oldSplash->setParent(NULL);
g_game.freeThing(oldSplash);
postRemoveNotification(actor, oldSplash, NULL, oldSplashIndex, true);
break;
}
}
}
bool isInserted = false;
if(items)
{
for(ItemVector::iterator it = items->getBeginTopItem(); it != items->getEndTopItem(); ++it)
{
//Note: this is different from internalAddThing
if(Item::items[item->getID()].alwaysOnTopOrder > Item::items[(*it)->getID()].alwaysOnTopOrder)
continue;
items->insert(it, item);
++thingCount;
isInserted = true;
break;
}
}
else
items = makeItemList();
if(!isInserted)
{
items->push_back(item);
++thingCount;
}
onAddTileItem(item);
}
else
{
if(item->isMagicField())
{
//remove old field item if exists
if(items)
{
MagicField* oldField = NULL;
for(ItemVector::iterator it = items->getBeginDownItem(); it != items->getEndDownItem(); ++it)
{
if(!(oldField = (*it)->getMagicField()))
continue;
if(oldField->isReplacable())
{
int32_t oldFieldIndex = __getIndexOfThing(*it);
__removeThing(oldField, 1);
oldField->setParent(NULL);
g_game.freeThing(oldField);
postRemoveNotification(actor, oldField, NULL, oldFieldIndex, true);
break;
}
//This magic field cannot be replaced.
item->setParent(NULL);
g_game.freeThing(item);
return;
}
}
}
if(item->getID() == ITEM_WATERBALL_SPLASH && !hasFlag(TILESTATE_TRASHHOLDER))
item->setID(ITEM_WATERBALL);
items = makeItemList();
items->insert(items->getBeginDownItem(), item);
++items->downItemCount;
++thingCount;
onAddTileItem(item);
}
}