Esempio n. 1
0
bool InventoryItem::_Load()
{
    // load attributes
    mAttributeMap.Load();

    // update inventory
    Inventory *inventory = m_factory.GetInventory( locationID(), false );
    if( inventory != NULL )
        inventory->AddItem( InventoryItemRef( this ) );

    return true;
}
void CharacterScene::StorageToInventory( const ItemDef* itemDef )
{
	if ( itemDef ) {
		Item item;
		storage->RemoveItem( itemDef, &item );
		Item dropped;

		if ( item.IsSomething() ) {
			Inventory* inv = unit->GetInventory();
			if ( inv->AddItem( item, &dropped ) < 0 ) {
				// Couldn't add to inventory. Return to storage.
				storage->AddItem( item );
			}
			if ( dropped.IsSomething() ) {
				storage->AddItem( dropped );
			}
		}
	}
}