You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
561 B
32 lines
561 B
6 days ago
|
#pragma once
|
||
|
#include "lights.hpp"
|
||
|
#include <nlohmann/json.hpp>
|
||
|
#include <fmt/core.h>
|
||
|
|
||
|
|
||
|
namespace components {
|
||
|
using namespace nlohmann;
|
||
|
using lighting::LightSource;
|
||
|
|
||
|
struct InventoryItem {
|
||
|
int count;
|
||
|
json data;
|
||
|
};
|
||
|
|
||
|
struct Inventory {
|
||
|
int gold;
|
||
|
LightSource light;
|
||
|
std::unordered_map<std::string, InventoryItem> items;
|
||
|
|
||
|
size_t count() { return items.size(); }
|
||
|
|
||
|
void add(InventoryItem item);
|
||
|
|
||
|
bool decrease(std::string id, int count);
|
||
|
|
||
|
InventoryItem& get(std::string id);
|
||
|
|
||
|
void remove_all(std::string id);
|
||
|
};
|
||
|
}
|