|
@@ -339,12 +339,12 @@ void Inventory::saveInventory( Framework::StreamWriter* zWriter )
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void Inventory::localTransaction( Array< ItemSlot* >* zSourceSlots, Array< ItemSlot* >* zTargetSlots, ItemFilter* zFilter, int count )
|
|
|
+void Inventory::localTransaction( Array< ItemSlot* >* zSourceSlots, Array< ItemSlot* >* zTargetSlots, ItemFilter* zFilter, int count, Direction outDir, Direction inDir )
|
|
|
{
|
|
|
if( itemCache )
|
|
|
{
|
|
|
cs.lock();
|
|
|
- auto sourceSlot = zSourceSlots->begin();
|
|
|
+ auto sourceSlot = zSourceSlots ? zSourceSlots->begin() : pullSlotsOrder->begin();
|
|
|
for( auto targetSlot = zTargetSlots->begin(); targetSlot; )
|
|
|
{
|
|
|
int amount = count;
|
|
@@ -359,19 +359,19 @@ void Inventory::localTransaction( Array< ItemSlot* >* zSourceSlots, Array< ItemS
|
|
|
int index = 0;
|
|
|
for( auto sourceSlot = zSurceListe->begin(); sourceSlot; sourceSlot++, index++ )
|
|
|
{
|
|
|
- if( zSourceSlots->getWertIndex( sourceSlot ) < 0 )
|
|
|
+ if( zSourceSlots && zSourceSlots->getWertIndex( sourceSlot ) < 0 )
|
|
|
continue;
|
|
|
if( zFilter && !zFilter->matchItem( sourceSlot->zStack()->zItem() ) )
|
|
|
continue;
|
|
|
- int number = MIN( targetSlot->numberOfAddableItems( sourceSlot->zStack(), NO_DIRECTION ), count );
|
|
|
+ int number = MIN( targetSlot->numberOfAddableItems( sourceSlot->zStack(), inDir ), count );
|
|
|
if( number > 0 )
|
|
|
{
|
|
|
- ItemStack* stack = sourceSlot->takeItemsOut( number, NO_DIRECTION );
|
|
|
+ ItemStack* stack = sourceSlot->takeItemsOut( number, outDir );
|
|
|
if( stack )
|
|
|
{
|
|
|
if( !sourceSlot->zStack() )
|
|
|
toDelete.add( index, 0 );
|
|
|
- targetSlot->addItems( stack, NO_DIRECTION );
|
|
|
+ targetSlot->addItems( stack, inDir );
|
|
|
updateCache( sourceSlot, targetSlot->zStack()->zItem()->zItemType()->getId() );
|
|
|
if( stack->getSize() )
|
|
|
{
|
|
@@ -403,13 +403,13 @@ void Inventory::localTransaction( Array< ItemSlot* >* zSourceSlots, Array< ItemS
|
|
|
cs.unlock();
|
|
|
return;
|
|
|
}
|
|
|
- int number = MIN( targetSlot->numberOfAddableItems( sourceSlot->zStack(), NO_DIRECTION ), count );
|
|
|
+ int number = MIN( targetSlot->numberOfAddableItems( sourceSlot->zStack(), inDir ), count );
|
|
|
if( number > 0 )
|
|
|
{
|
|
|
- ItemStack* stack = sourceSlot->takeItemsOut( number, NO_DIRECTION );
|
|
|
+ ItemStack* stack = sourceSlot->takeItemsOut( number, outDir );
|
|
|
if( stack )
|
|
|
{
|
|
|
- targetSlot->addItems( stack, NO_DIRECTION );
|
|
|
+ targetSlot->addItems( stack, inDir );
|
|
|
updateCache( sourceSlot, targetSlot->zStack()->zItem()->zItemType()->getId() );
|
|
|
updateCache( targetSlot, -1 );
|
|
|
if( stack->getSize() )
|