本文整理汇总了C++中P_ITEM::onDropOnGround方法的典型用法代码示例。如果您正苦于以下问题:C++ P_ITEM::onDropOnGround方法的具体用法?C++ P_ITEM::onDropOnGround怎么用?C++ P_ITEM::onDropOnGround使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_ITEM
的用法示例。
在下文中一共展示了P_ITEM::onDropOnGround方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dropOnGround
void DragAndDrop::dropOnGround( cUOSocket* socket, P_ITEM pItem, const Coord_cl& pos )
{
P_PLAYER pChar = socket->player();
// Check if the destination is in line of sight
if ( !pChar->lineOfSight( pos.losItemPoint(pItem->id()) ) )
{
socket->bounceItem( pItem, BR_OUT_OF_SIGHT );
return;
}
if ( !pChar->canPickUp( pItem ) )
{
socket->bounceItem( pItem, BR_CANNOT_PICK_THAT_UP );
return;
}
if ( pItem->onDropOnGround( pos ) )
{
// We're still dragging something
if ( socket->dragging() )
socket->bounceItem( socket->dragging(), BR_NO_REASON );
return;
}
pItem->removeFromCont();
pItem->moveTo( pos );
pItem->update();
// Play Sounds for non gold items
if (pItem->id() != 0xEED) {
pItem->soundEffect(0x42);
}
}
示例2: dropOnGround
void cDragItems::dropOnGround( cUOSocket *socket, P_ITEM pItem, const Coord_cl &pos )
{
P_PLAYER pChar = socket->player();
// Check if the destination is in line of sight
if( !lineOfSight( pChar->pos(), pos, WALLS_CHIMNEYS|DOORS|LAVA_WATER ) )
{
socket->bounceItem( pItem, BR_OUT_OF_SIGHT );
return;
}
if( !pChar->canPickUp( pItem ) )
{
socket->bounceItem( pItem, BR_CANNOT_PICK_THAT_UP );
return;
}
if( pItem->onDropOnGround( pos ) )
{
// We're still dragging something
if( socket->dragging() )
socket->bounceItem( socket->dragging(), BR_NO_REASON );
return;
}
pItem->removeFromCont();
pItem->moveTo( pos );
pItem->update();
if( pItem->priv() & 0x01 )
pItem->startDecay();
// Multi handling
// Has it been dropped into a multi
cMulti* pMulti = cMulti::findMulti( pos );
if( pMulti )
{
pMulti->addItem( pItem );
}
}