Brought over a bunch of code from the roguelike and now will use it to generate a random map.
This commit is contained in:
parent
8d3d3b4ec3
commit
2daa1c9bd5
59 changed files with 4303 additions and 411 deletions
33
inventory.hpp
Normal file
33
inventory.hpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
#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=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);
|
||||
|
||||
InventoryItem& get(size_t at);
|
||||
|
||||
int item_index(std::string id);
|
||||
|
||||
void erase_item(size_t at);
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue