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
45
save.hpp
Normal file
45
save.hpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
#pragma once
|
||||
|
||||
#include "components.hpp"
|
||||
#include "map.hpp"
|
||||
#include "dinkyecs.hpp"
|
||||
#include "tser.hpp"
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
namespace save {
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
struct MapData {
|
||||
size_t width;
|
||||
size_t height;
|
||||
std::vector<Room> rooms;
|
||||
Matrix walls;
|
||||
|
||||
DEFINE_SERIALIZABLE(MapData, width, height, rooms, walls);
|
||||
};
|
||||
|
||||
struct Facts {
|
||||
components::Player player;
|
||||
|
||||
DEFINE_SERIALIZABLE(Facts, player);
|
||||
};
|
||||
|
||||
struct SaveData {
|
||||
Facts facts;
|
||||
MapData map;
|
||||
|
||||
std::map<DinkyECS::Entity, components::Position> position;
|
||||
std::map<DinkyECS::Entity, components::Motion> motion;
|
||||
std::map<DinkyECS::Entity, components::Combat> combat;
|
||||
std::map<DinkyECS::Entity, components::Tile> tile;
|
||||
// std::map<DinkyECS::Entity, components::Inventory> inventory;
|
||||
|
||||
DEFINE_SERIALIZABLE(SaveData, facts, map, position, motion, combat, tile);
|
||||
};
|
||||
|
||||
void to_file(fs::path path, DinkyECS::World &world, Map &map);
|
||||
void from_file(fs::path path, DinkyECS::World &world_out, Map &map);
|
||||
void load_configs(DinkyECS::World &world);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue