|
|
|
@ -17,12 +17,11 @@ inline void extract(DinkyECS::World &world, std::map<DinkyECS::Entity, CompT> &i |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void save::to_file(fs::path path, DinkyECS::World &world, Map &map) { |
|
|
|
|
/*
|
|
|
|
|
SaveData save_data; |
|
|
|
|
tser::BinaryArchive archive; |
|
|
|
|
|
|
|
|
|
save_data.facts.player = world.get_the<Player>(); |
|
|
|
|
save_data.map = MapData{map.$rooms, map.$input_map, map.$walls, map.$limit}; |
|
|
|
|
save_data.map = MapData{map.$rooms, map.$walls, map.$limit}; |
|
|
|
|
|
|
|
|
|
extract<Position>(world, save_data.position); |
|
|
|
|
extract<Combat>(world, save_data.combat); |
|
|
|
@ -36,7 +35,6 @@ void save::to_file(fs::path path, DinkyECS::World &world, Map &map) { |
|
|
|
|
std::ofstream out(path, std::ios::binary); |
|
|
|
|
out << archive_view; |
|
|
|
|
out.flush(); |
|
|
|
|
*/ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<typename CompT> |
|
|
|
@ -73,10 +71,12 @@ void save::from_file(fs::path path, DinkyECS::World &world_out, Map &map_out) { |
|
|
|
|
inject<Tile>(world_out, save_data.tile); |
|
|
|
|
inject<Inventory>(world_out, save_data.inventory); |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
map_out = Map(save_data.map.input_map, |
|
|
|
|
save_data.map.walls, save_data.map.limit); |
|
|
|
|
*/ |
|
|
|
|
size_t width = save_data.map.walls[0].size(); |
|
|
|
|
size_t height = save_data.map.walls.size(); |
|
|
|
|
int limit = save_data.map.limit; |
|
|
|
|
|
|
|
|
|
Pathing paths(width, height, limit); |
|
|
|
|
map_out = Map(save_data.map.walls, paths, limit); |
|
|
|
|
|
|
|
|
|
save::load_configs(world_out); |
|
|
|
|
} |
|
|
|
|