#ifndef COMMON_INVENTORY_H_
#define COMMON_INVENTORY_H_
+#include "fwd.h"
+
#include <SDL.h>
namespace common {
-class Item;
-
class Inventory {
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; }
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: