summaryrefslogtreecommitdiff
path: root/src/craftdef.h
diff options
context:
space:
mode:
authorHybridDog <ovvv@web.de>2019-04-03 13:59:42 +0200
committerSmallJoker <mk939@ymail.com>2019-05-20 20:59:36 +0200
commit1604b949fde0fcb075709f5b451dde5ba06a27d0 (patch)
treeeff68506331bbba03803b2b056244558362abfde /src/craftdef.h
parentb1b40fef16a17f4a6da7d4268af8f0921dbe829c (diff)
downloadminetest-1604b949fde0fcb075709f5b451dde5ba06a27d0.tar.gz
minetest-1604b949fde0fcb075709f5b451dde5ba06a27d0.tar.bz2
minetest-1604b949fde0fcb075709f5b451dde5ba06a27d0.zip
Test crafting hash type only once for a recipe
Diffstat (limited to 'src/craftdef.h')
-rw-r--r--src/craftdef.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/craftdef.h b/src/craftdef.h
index 46ee2164e..140321f0f 100644
--- a/src/craftdef.h
+++ b/src/craftdef.h
@@ -149,13 +149,19 @@ public:
virtual void decrementInput(CraftInput &input,
std::vector<ItemStack> &output_replacements, IGameDef *gamedef) const=0;
- virtual CraftHashType getHashType() const = 0;
+ CraftHashType getHashType() const
+ {
+ return hash_type;
+ }
virtual u64 getHash(CraftHashType type) const = 0;
// to be called after all mods are loaded, so that we catch all aliases
virtual void initHash(IGameDef *gamedef) = 0;
virtual std::string dump() const=0;
+
+protected:
+ CraftHashType hash_type;
};
/*
@@ -186,7 +192,6 @@ public:
virtual void decrementInput(CraftInput &input,
std::vector<ItemStack> &output_replacements, IGameDef *gamedef) const;
- virtual CraftHashType getHashType() const;
virtual u64 getHash(CraftHashType type) const;
virtual void initHash(IGameDef *gamedef);
@@ -232,7 +237,6 @@ public:
virtual void decrementInput(CraftInput &input,
std::vector<ItemStack> &output_replacements, IGameDef *gamedef) const;
- virtual CraftHashType getHashType() const;
virtual u64 getHash(CraftHashType type) const;
virtual void initHash(IGameDef *gamedef);
@@ -274,10 +278,12 @@ public:
virtual void decrementInput(CraftInput &input,
std::vector<ItemStack> &output_replacements, IGameDef *gamedef) const;
- virtual CraftHashType getHashType() const { return CRAFT_HASH_TYPE_COUNT; }
virtual u64 getHash(CraftHashType type) const { return 2; }
- virtual void initHash(IGameDef *gamedef) {}
+ virtual void initHash(IGameDef *gamedef)
+ {
+ hash_type = CRAFT_HASH_TYPE_COUNT;
+ }
virtual std::string dump() const;
@@ -314,7 +320,6 @@ public:
virtual void decrementInput(CraftInput &input,
std::vector<ItemStack> &output_replacements, IGameDef *gamedef) const;
- virtual CraftHashType getHashType() const;
virtual u64 getHash(CraftHashType type) const;
virtual void initHash(IGameDef *gamedef);
@@ -358,7 +363,6 @@ public:
virtual void decrementInput(CraftInput &input,
std::vector<ItemStack> &output_replacements, IGameDef *gamedef) const;
- virtual CraftHashType getHashType() const;
virtual u64 getHash(CraftHashType type) const;
virtual void initHash(IGameDef *gamedef);