diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-08-22 17:58:31 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-08-25 22:09:32 +0200 |
commit | 221d67c4774bf41e6f2f0f73fb6914030e33bdde (patch) | |
tree | 6fbb4de64d172c196ed617176d5346dd4d774c49 /src/equipment.h | |
parent | 9e313b385bae45a88338a2dbfb008af7a9e38e7a (diff) | |
download | mana-221d67c4774bf41e6f2f0f73fb6914030e33bdde.tar.gz mana-221d67c4774bf41e6f2f0f73fb6914030e33bdde.tar.bz2 mana-221d67c4774bf41e6f2f0f73fb6914030e33bdde.tar.xz mana-221d67c4774bf41e6f2f0f73fb6914030e33bdde.zip |
Fixed initialization of equipment backend
For new characters (and in general, when logging in with a character
that had nothing equipped), the equipment backend wasn't being
initialized. This resulted in the equipment not being visible in the
Equipment window.
Fixes #83
Diffstat (limited to 'src/equipment.h')
-rw-r--r-- | src/equipment.h | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/equipment.h b/src/equipment.h index 726f7f5e..d40ca55d 100644 --- a/src/equipment.h +++ b/src/equipment.h @@ -29,8 +29,6 @@ class Item; class Equipment { public: - Equipment() = default; - class Backend { public: virtual Item *getEquipment(int slotIndex) const = 0; @@ -46,13 +44,17 @@ class Equipment {} }; + Equipment(Backend *backend) + : mBackend(backend) + {} + /** * Get equipment at the given slot. */ Item *getEquipment(int slotIndex) const { return mBackend ? mBackend->getEquipment(slotIndex) : nullptr; } - const std::string getSlotName(int slotIndex) const + std::string getSlotName(int slotIndex) const { return mBackend ? mBackend->getSlotName(slotIndex) : std::string(); } int getSlotNumber() const @@ -67,16 +69,8 @@ class Equipment void clear() { if (mBackend) mBackend->clear(); } - /** - * Set equipment at the given slot. - */ - void setEquipment(int index, int id, int quantity = 0); - - void setBackend(Backend *backend) - { mBackend = backend; } - private: - Backend *mBackend = nullptr; + Backend *mBackend; }; #endif |