aboutsummaryrefslogtreecommitdiff
path: root/src/inventory.h
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2022-04-26 20:40:52 +0200
committersfan5 <sfan5@live.de>2022-09-30 14:02:14 +0200
commitbbdb1929c61a7cf851b498f34154ac0f9528fbb4 (patch)
treeb9ddfc4fc727dc944bbf88d6f4e3bce9eb584dc9 /src/inventory.h
parent13a8948edd24a593bde4ae328392e680966877f5 (diff)
downloadminetest-bbdb1929c61a7cf851b498f34154ac0f9528fbb4.tar.xz
Clean up Game::handleDigging() and some related parts
Diffstat (limited to 'src/inventory.h')
-rw-r--r--src/inventory.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/inventory.h b/src/inventory.h
index 8b31de3a8..0f024792a 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -48,8 +48,8 @@ struct ItemStack
// Returns the string used for inventory
std::string getItemString(bool include_meta = true) const;
// Returns the tooltip
- std::string getDescription(IItemDefManager *itemdef) const;
- std::string getShortDescription(IItemDefManager *itemdef) const;
+ std::string getDescription(const IItemDefManager *itemdef) const;
+ std::string getShortDescription(const IItemDefManager *itemdef) const;
/*
Quantity methods
@@ -82,13 +82,13 @@ struct ItemStack
}
// Maximum size of a stack
- u16 getStackMax(IItemDefManager *itemdef) const
+ u16 getStackMax(const IItemDefManager *itemdef) const
{
return itemdef->get(name).stack_max;
}
// Number of items that can be added to this stack
- u16 freeSpace(IItemDefManager *itemdef) const
+ u16 freeSpace(const IItemDefManager *itemdef) const
{
u16 max = getStackMax(itemdef);
if (count >= max)
@@ -97,7 +97,7 @@ struct ItemStack
}
// Returns false if item is not known and cannot be used
- bool isKnown(IItemDefManager *itemdef) const
+ bool isKnown(const IItemDefManager *itemdef) const
{
return itemdef->isKnown(name);
}
@@ -105,14 +105,14 @@ struct ItemStack
// Returns a pointer to the item definition struct,
// or a fallback one (name="unknown") if the item is unknown.
const ItemDefinition& getDefinition(
- IItemDefManager *itemdef) const
+ const IItemDefManager *itemdef) const
{
return itemdef->get(name);
}
// Get tool digging properties, or those of the hand if not a tool
const ToolCapabilities& getToolCapabilities(
- IItemDefManager *itemdef) const
+ const IItemDefManager *itemdef) const
{
const ToolCapabilities *item_cap =
itemdef->get(name).tool_capabilities;
@@ -127,7 +127,7 @@ struct ItemStack
// Wear out (only tools)
// Returns true if the item is (was) a tool
- bool addWear(s32 amount, IItemDefManager *itemdef)
+ bool addWear(s32 amount, const IItemDefManager *itemdef)
{
if(getDefinition(itemdef).type == ITEM_TOOL)
{