mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
refactor
This commit is contained in:
parent
b1740bf7eb
commit
4306573320
7 changed files with 26 additions and 24 deletions
|
|
@ -3,9 +3,6 @@
|
|||
#include "content/Content.hpp"
|
||||
#include "ItemDef.hpp"
|
||||
|
||||
ItemStack::ItemStack() : item(ITEM_EMPTY), count(0) {
|
||||
}
|
||||
|
||||
ItemStack::ItemStack(itemid_t item, itemcount_t count)
|
||||
: item(item), count(count) {
|
||||
}
|
||||
|
|
@ -28,9 +25,9 @@ bool ItemStack::accepts(const ItemStack& other) const {
|
|||
return item == other.getItemId();
|
||||
}
|
||||
|
||||
void ItemStack::move(ItemStack& item, const ContentIndices* indices) {
|
||||
auto& def = indices->items.require(item.getItemId());
|
||||
int count = std::min(item.count, def.stackSize - this->count);
|
||||
void ItemStack::move(ItemStack& item, const ContentIndices& indices) {
|
||||
auto& def = indices.items.require(item.getItemId());
|
||||
itemcount_t count = std::min(item.count, def.stackSize - this->count);
|
||||
if (isEmpty()) {
|
||||
set(ItemStack(item.getItemId(), count));
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue