ItemSlot.cpp 863 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include "ItemSlot.h"
  2. ItemSlot::ItemSlot( int maxSize, int pullPriority, int pushPriority, int allowedPullSide, int allowedPushSides, bool allowHigherStackSize )
  3. : ReferenceCounter(),
  4. items( 0 ),
  5. maxSize( maxSize ),
  6. allowedPullSide( allowedPullSide ),
  7. allowedPushSides( allowedPushSides ),
  8. pullPriority( pullPriority ),
  9. pushPriority( pushPriority ),
  10. allowHigherStackSize( allowHigherStackSize )
  11. {}
  12. ItemSlot::~ItemSlot()
  13. {
  14. if( items )
  15. items->release();
  16. }
  17. void ItemSlot::setItems( ItemStack* items )
  18. {
  19. if( this->items )
  20. this->items->release();
  21. this->items = items;
  22. }
  23. int ItemSlot::getPullPriority() const
  24. {
  25. return pullPriority;
  26. }
  27. int ItemSlot::getPushPriority() const
  28. {
  29. return pushPriority;
  30. }
  31. ItemStack* ItemSlot::zStack() const
  32. {
  33. return items;
  34. }