本文整理汇总了C++中InventoryItemRef::Delete方法的典型用法代码示例。如果您正苦于以下问题:C++ InventoryItemRef::Delete方法的具体用法?C++ InventoryItemRef::Delete怎么用?C++ InventoryItemRef::Delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InventoryItemRef
的用法示例。
在下文中一共展示了InventoryItemRef::Delete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Merge
bool InventoryItem::Merge(InventoryItemRef to_merge, int32 qty, bool notify) {
if(typeID() != to_merge->typeID()) {
_log(ITEM__ERROR, "%s (%u): Asked to merge with %s (%u).", itemName().c_str(), itemID(), to_merge->itemName().c_str(), to_merge->itemID());
return false;
}
if(locationID() != to_merge->locationID() || flag() != to_merge->flag()) {
_log(ITEM__ERROR, "%s (%u) in location %u, flag %u: Asked to merge with item %u in location %u, flag %u.", itemName().c_str(), itemID(), locationID(), flag(), to_merge->itemID(), to_merge->locationID(), to_merge->flag());
return false;
}
if(qty == 0)
qty = to_merge->quantity();
if(qty <= 0) {
_log(ITEM__ERROR, "%s (%u): Asked to merge with %d units of item %u.", itemName().c_str(), itemID(), qty, to_merge->itemID());
return false;
}
if(!AlterQuantity(qty, notify)) {
_log(ITEM__ERROR, "%s (%u): Failed to add quantity %d.", itemName().c_str(), itemID(), qty);
return false;
}
if(qty == to_merge->quantity()) {
to_merge->Delete();
} else if(!to_merge->AlterQuantity(-qty, notify)) {
_log(ITEM__ERROR, "%s (%u): Failed to remove quantity %d.", to_merge->itemName().c_str(), to_merge->itemID(), qty);
return false;
}
return true;
}
示例2: RemoveRig
void Ship::RemoveRig( InventoryItemRef item, uint32 inventoryID )
{
m_ModuleManager->UnfitModule(item->itemID());
//delete the item
item->Delete();
}
示例3: RemoveRig
void Ship::RemoveRig( InventoryItemRef item, uint32 inventoryID )
{
m_ModuleManager->UninstallRig(item->itemID());
//move the item to the void or w/e
m_pOperator->MoveItem(item->itemID(), inventoryID, flagAutoFit);
//delete the item
item->Delete();
}
示例4: DeleteContents
void Inventory::DeleteContents(ItemFactory &factory)
{
LoadContents( factory );
std::map<uint32, InventoryItemRef>::iterator cur, end;
cur = mContents.begin();
end = mContents.end();
for(; cur != end; )
{
// Our "cur" iterator becomes invalid once RemoveItem
// for its item is called, so we need to increment it
// before calling Delete().
InventoryItemRef i = cur->second;
cur++;
i->Delete();
}
mContents.clear();
}
示例5: Command_unspawn
PyResult Command_unspawn( Client* who, CommandDB* db, PyServiceMgr* services, const Seperator& args )
{
uint32 entityID = 0;
uint32 itemID = 0;
if( (args.argCount() < 3) || (args.argCount() > 3) )
throw PyException( MakeCustomError("Correct Usage: /unspawn (entityID) (itemID), and for now (entityID) is unused, so just type 0, and use the itemID from the entity table for (itemID)") );
if( !(args.isNumber( 1 )) )
throw PyException( MakeCustomError( "Argument 1 should be an item entity ID" ) );
if( !(args.isNumber( 2 )) )
throw PyException( MakeCustomError( "Argument 2 should be an item item ID" ) );
entityID = atoi( args.arg( 1 ).c_str() );
itemID = atoi( args.arg( 2 ).c_str() );
if( !who->IsInSpace() )
throw PyException( MakeCustomError( "You must be in space to unspawn things." ) );
// Search for the itemRef for itemID:
InventoryItemRef itemRef = who->services().item_factory.GetItem( itemID );
SystemEntity * entityRef = who->System()->get( itemID );
// Actually do the unspawn using SystemManager's RemoveEntity:
if( entityRef == NULL )
{
return new PyString( "Un-Spawn Failed: itemID not found." );
}
else
{
who->System()->RemoveEntity( entityRef );
itemRef->Delete();
}
sLog.Log( "Command", "%s: Un-Spawned %u.", who->GetName(), itemID );
return new PyString( "Un-Spawn successful." );
}
示例6: UnplugImplant
void Character::UnplugImplant( uint32 itemID )
{
InventoryItemRef item = m_factory.GetItem( itemID );
item->Delete();
m_factory.db().LoadImplantsAndBoosters( itemID, m_implants, m_boosters );
}