2020-07-10 17:49:16 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-07-25 14:29:05 +00:00
|
|
|
#include <map>
|
|
|
|
|
2020-07-25 16:45:03 +00:00
|
|
|
namespace world {
|
|
|
|
/// Universe unit
|
|
|
|
struct Voxel {
|
|
|
|
/// Quantity of material
|
2020-07-30 16:35:13 +00:00
|
|
|
/// FIXME: low density area are cheatty
|
|
|
|
/// @note v < iso * UCHAR_MAX are useless
|
2020-07-25 16:45:03 +00:00
|
|
|
unsigned char Density;
|
|
|
|
/// Material type
|
|
|
|
/// @see world::materials
|
|
|
|
unsigned short Material;
|
|
|
|
};
|
|
|
|
/// Stock of material
|
|
|
|
struct Item {
|
|
|
|
/// Quantity of material
|
|
|
|
unsigned long long Count;
|
|
|
|
/// Material type
|
|
|
|
/// @see world::materials
|
|
|
|
unsigned short Material;
|
|
|
|
};
|
|
|
|
/// List of materials
|
|
|
|
struct ItemList: std::map<unsigned short, unsigned long long> {
|
|
|
|
void add(const std::optional<Item>& item) {
|
|
|
|
if(item) {
|
|
|
|
(*this)[item.value().Material] += item.value().Count;
|
|
|
|
}
|
2020-07-25 14:29:05 +00:00
|
|
|
}
|
2020-07-25 16:45:03 +00:00
|
|
|
};
|
|
|
|
}
|