mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Make getStackMax return the correct maximal stack size
This commit is contained in:
parent
aa33166386
commit
2de8c22a99
3 changed files with 5 additions and 7 deletions
|
@ -80,15 +80,14 @@ struct ItemStack
|
|||
// Maximum size of a stack
|
||||
u16 getStackMax(IItemDefManager *itemdef) const
|
||||
{
|
||||
s16 max = itemdef->get(name).stack_max;
|
||||
return (max >= 0) ? max : 0;
|
||||
return itemdef->get(name).stack_max;
|
||||
}
|
||||
|
||||
// Number of items that can be added to this stack
|
||||
u16 freeSpace(IItemDefManager *itemdef) const
|
||||
{
|
||||
u16 max = getStackMax(itemdef);
|
||||
if(count > max)
|
||||
if (count >= max)
|
||||
return 0;
|
||||
return max - count;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue