From abceeee92f99b84ebb79968269835a4f509bfb90 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 14 Nov 2011 00:19:48 +0200 Subject: Create framework for getting rid of global definitions of node/tool/item/whatever types --- src/tool.h | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'src/tool.h') diff --git a/src/tool.h b/src/tool.h index 49d069aac..a2a94f7fc 100644 --- a/src/tool.h +++ b/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; + + 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; +}; -ToolDiggingProperties tool_get_digging_properties(const std::string &toolname); +IToolDefManager* createToolDefManager(); #endif -- cgit v1.2.3