mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
feat: saving entities (WIP)
This commit is contained in:
parent
019a88ef84
commit
f0270d3391
24 changed files with 290 additions and 101 deletions
|
|
@ -83,6 +83,13 @@ std::vector<ubyte> json::to_binary(const Map* obj, bool compress) {
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
std::vector<ubyte> json::to_binary(const Value& value, bool compress) {
|
||||
if (auto map = std::get_if<Map_sptr>(&value)) {
|
||||
return to_binary(map->get(), compress);
|
||||
}
|
||||
throw std::runtime_error("map is only supported as the root element");
|
||||
}
|
||||
|
||||
static Value value_from_binary(ByteReader& reader) {
|
||||
ubyte typecode = reader.get();
|
||||
switch (typecode) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue