mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Create framework for getting rid of global definitions of node/tool/item/whatever types
This commit is contained in:
parent
5fc791ac9a
commit
abceeee92f
60 changed files with 1017 additions and 743 deletions
27
src/tool.h
27
src/tool.h
|
@ -51,9 +51,32 @@ struct ToolDiggingProperties
|
|||
{}
|
||||
};
|
||||
|
||||
std::string tool_get_imagename(const std::string &toolname);
|
||||
struct ToolDefinition
|
||||
{
|
||||
std::string imagename;
|
||||
ToolDiggingProperties properties;
|
||||
|
||||
ToolDiggingProperties tool_get_digging_properties(const std::string &toolname);
|
||||
ToolDefinition(){}
|
||||
ToolDefinition(const std::string &imagename_,
|
||||
ToolDiggingProperties properties_):
|
||||
imagename(imagename_),
|
||||
properties(properties_)
|
||||
{}
|
||||
};
|
||||
|
||||
class IToolDefManager
|
||||
{
|
||||
public:
|
||||
IToolDefManager(){}
|
||||
virtual ~IToolDefManager(){}
|
||||
virtual bool registerTool(std::string toolname, const ToolDefinition &def)=0;
|
||||
virtual ToolDefinition* getToolDefinition(const std::string &toolname)=0;
|
||||
virtual std::string getImagename(const std::string &toolname)=0;
|
||||
virtual ToolDiggingProperties getDiggingProperties(
|
||||
const std::string &toolname)=0;
|
||||
};
|
||||
|
||||
IToolDefManager* createToolDefManager();
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue