X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcommon%2FInventory.h;h=5e21721d5d1a0804bd5186ef1d2952d2668a80d7;hb=092a2dd175a4001a495c84ee85211734fb928c83;hp=f60b9abecb49e71817e5c3fe7a4b74fe3d011f3d;hpb=2a1d9169e1f6c2dfe0f93ed40d5fb68d3da342af;p=l2e.git diff --git a/src/common/Inventory.h b/src/common/Inventory.h index f60b9ab..5e21721 100644 --- a/src/common/Inventory.h +++ b/src/common/Inventory.h @@ -1,14 +1,9 @@ -/* - * Inventory.h - * - * Created on: Aug 9, 2012 - * Author: holy - */ - #ifndef COMMON_INVENTORY_H_ #define COMMON_INVENTORY_H_ -#include "fwd.h" +namespace common { + class Item; +} #include @@ -22,17 +17,27 @@ public: public: bool Add(const Item *, int count = 1); void Remove(const Item *, int count = 1); + void RemoveAll(const Item *); int MaxItems() const { return 96; } + bool AddScenarioItem(const Item *); + const Item *ScenarioItemAt(int offset) const { return scenario[offset]; } + int NumScenarioItems() const { return scenarioEnd; } + int MaxScenarioItems() const { return 64; } + const Item *ItemAt(int offset) const { return entries[offset].item; } int ItemCountAt(int offset) const { return entries[offset].count; } + void Sort(); + void SwapEntriesAt(int lhs, int rhs); + private: struct Entry { Entry() : item(0), count(0) { } const Item *item; Uint8 count; + static bool Less(const Entry &, const Entry &); }; private: @@ -42,6 +47,8 @@ private: private: Entry entries[96]; + const Item *scenario[64]; + int scenarioEnd; };