ItemSlot.cpp 977 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include "ItemSlot.h"
  2. ItemSlot::ItemSlot(Framework::Text name, 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. name(name)
  12. {}
  13. ItemSlot::~ItemSlot()
  14. {
  15. if( items )
  16. items->release();
  17. }
  18. void ItemSlot::setItems( ItemStack* items )
  19. {
  20. if( this->items )
  21. this->items->release();
  22. this->items = items;
  23. }
  24. int ItemSlot::getPullPriority() const
  25. {
  26. return pullPriority;
  27. }
  28. int ItemSlot::getPushPriority() const
  29. {
  30. return pushPriority;
  31. }
  32. ItemStack* ItemSlot::zStack() const
  33. {
  34. return items;
  35. }
  36. const Framework::Text& ItemSlot::getName() const
  37. {
  38. return name;
  39. }