Exploring raycasters and possibly make a little "doom like" game based on it.
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.
 
 
 
 
 
 
raycaster/inventory.hpp

35 lines
650 B

#pragma once
#include "components.hpp"
#include <nlohmann/json.hpp>
#include "levelmanager.hpp"
namespace components {
using namespace nlohmann;
struct InventoryItem {
int count;
json data;
};
struct Inventory {
int gold=0;
LightSource light{0, 0};
std::vector<InventoryItem> items{};
size_t count() { return items.size(); }
void add(InventoryItem item);
bool decrease(size_t at, int count);
bool has_item(size_t at);
InventoryItem& get(size_t at);
int item_index(std::string id);
void erase_item(size_t at);
std::pair<bool, std::string> use(GameLevel &level, size_t at);
};
}