33 lines
		
	
	
	
		
			563 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
	
		
			563 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #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::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);
 | |
|   };
 | |
| }
 | 
