aboutsummaryrefslogtreecommitdiff
path: root/src/itemdef.h
diff options
context:
space:
mode:
authorElias Fleckenstein <54945686+EliasFleckenstein03@users.noreply.github.com>2020-11-04 16:44:42 +0100
committerGitHub <noreply@github.com>2020-11-04 16:44:42 +0100
commit5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc (patch)
treec980d614fec4a5495798be3e79e033229062c3cd /src/itemdef.h
parent28f6a79706b088c37268a59d90878220dc4ef9c7 (diff)
parent3af10766fd2b58b068e970266724d7eb10e9316b (diff)
downloaddragonfireclient-5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc.tar.xz
Merge branch 'master' into master
Diffstat (limited to 'src/itemdef.h')
-rw-r--r--src/itemdef.h70
1 files changed, 35 insertions, 35 deletions
diff --git a/src/itemdef.h b/src/itemdef.h
index f47e6cbe7..e6170d150 100644
--- a/src/itemdef.h
+++ b/src/itemdef.h
@@ -54,7 +54,7 @@ struct ItemDefinition
Basic item properties
*/
ItemType type;
- std::string name; // "" = hand
+ std::string name; // "" = hand
std::string description; // Shown in tooltip.
/*
@@ -64,8 +64,9 @@ struct ItemDefinition
std::string inventory_overlay; // Overlay of inventory_image.
std::string wield_image; // If empty, inventory_image or mesh (only nodes) is used
std::string wield_overlay; // Overlay of wield_image.
- std::string palette_image; // If specified, the item will be colorized based on this
- video::SColor color; // The fallback color of the node.
+ std::string palette_image; // If specified, the item will be colorized based on
+ // this
+ video::SColor color; // The fallback color of the node.
v3f wield_scale;
/*
@@ -91,11 +92,12 @@ struct ItemDefinition
*/
ItemDefinition();
ItemDefinition(const ItemDefinition &def);
- ItemDefinition& operator=(const ItemDefinition &def);
+ ItemDefinition &operator=(const ItemDefinition &def);
~ItemDefinition();
void reset();
void serialize(std::ostream &os, u16 protocol_version) const;
void deSerialize(std::istream &is);
+
private:
void resetInitial();
};
@@ -108,30 +110,28 @@ public:
virtual ~IItemDefManager() = default;
// Get item definition
- virtual const ItemDefinition& get(const std::string &name) const=0;
+ virtual const ItemDefinition &get(const std::string &name) const = 0;
// Get alias definition
- virtual const std::string &getAlias(const std::string &name) const=0;
+ virtual const std::string &getAlias(const std::string &name) const = 0;
// Get set of all defined item names and aliases
- virtual void getAll(std::set<std::string> &result) const=0;
+ virtual void getAll(std::set<std::string> &result) const = 0;
// Check if item is known
- virtual bool isKnown(const std::string &name) const=0;
+ virtual bool isKnown(const std::string &name) const = 0;
#ifndef SERVER
// Get item inventory texture
- virtual video::ITexture* getInventoryTexture(const std::string &name,
- Client *client) const=0;
+ virtual video::ITexture *getInventoryTexture(
+ const std::string &name, Client *client) const = 0;
// Get item wield mesh
- virtual ItemMesh* getWieldMesh(const std::string &name,
- Client *client) const=0;
+ virtual ItemMesh *getWieldMesh(const std::string &name, Client *client) const = 0;
// Get item palette
- virtual Palette* getPalette(const std::string &name,
- Client *client) const = 0;
+ virtual Palette *getPalette(const std::string &name, Client *client) const = 0;
// Returns the base color of an item stack: the color of all
// tiles that do not define their own color.
- virtual video::SColor getItemstackColor(const ItemStack &stack,
- Client *client) const = 0;
+ virtual video::SColor getItemstackColor(
+ const ItemStack &stack, Client *client) const = 0;
#endif
- virtual void serialize(std::ostream &os, u16 protocol_version)=0;
+ virtual void serialize(std::ostream &os, u16 protocol_version) = 0;
};
class IWritableItemDefManager : public IItemDefManager
@@ -142,43 +142,43 @@ public:
virtual ~IWritableItemDefManager() = default;
// Get item definition
- virtual const ItemDefinition& get(const std::string &name) const=0;
+ virtual const ItemDefinition &get(const std::string &name) const = 0;
// Get alias definition
- virtual const std::string &getAlias(const std::string &name) const=0;
+ virtual const std::string &getAlias(const std::string &name) const = 0;
// Get set of all defined item names and aliases
- virtual void getAll(std::set<std::string> &result) const=0;
+ virtual void getAll(std::set<std::string> &result) const = 0;
// Check if item is known
- virtual bool isKnown(const std::string &name) const=0;
+ virtual bool isKnown(const std::string &name) const = 0;
#ifndef SERVER
// Get item inventory texture
- virtual video::ITexture* getInventoryTexture(const std::string &name,
- Client *client) const=0;
+ virtual video::ITexture *getInventoryTexture(
+ const std::string &name, Client *client) const = 0;
// Get item wield mesh
- virtual ItemMesh* getWieldMesh(const std::string &name,
- Client *client) const=0;
+ virtual ItemMesh *getWieldMesh(const std::string &name, Client *client) const = 0;
#endif
// Replace the textures of registered nodes with the ones specified in
// the texture pack's override.txt files
- virtual void applyTextureOverrides(const std::vector<TextureOverride> &overrides)=0;
+ virtual void applyTextureOverrides(
+ const std::vector<TextureOverride> &overrides) = 0;
// Remove all registered item and node definitions and aliases
// Then re-add the builtin item definitions
- virtual void clear()=0;
+ virtual void clear() = 0;
// Register item definition
- virtual void registerItem(const ItemDefinition &def)=0;
- virtual void unregisterItem(const std::string &name)=0;
+ virtual void registerItem(const ItemDefinition &def) = 0;
+ virtual void unregisterItem(const std::string &name) = 0;
// Set an alias so that items named <name> will load as <convert_to>.
// Alias is not set if <name> has already been defined.
// Alias will be removed if <name> is defined at a later point of time.
- virtual void registerAlias(const std::string &name,
- const std::string &convert_to)=0;
+ virtual void registerAlias(
+ const std::string &name, const std::string &convert_to) = 0;
- virtual void serialize(std::ostream &os, u16 protocol_version)=0;
- virtual void deSerialize(std::istream &is)=0;
+ virtual void serialize(std::ostream &os, u16 protocol_version) = 0;
+ virtual void deSerialize(std::istream &is) = 0;
// Do stuff asked by threads that can only be done in the main thread
- virtual void processQueue(IGameDef *gamedef)=0;
+ virtual void processQueue(IGameDef *gamedef) = 0;
};
-IWritableItemDefManager* createItemDefManager();
+IWritableItemDefManager *createItemDefManager();