Save system should work better now, just needed to switch to basic map. This would probably a lot better if tser.hpp supported std::any.

This commit is contained in:
Zed A. Shaw 2024-11-05 06:11:50 -05:00
parent d113dba42f
commit 71bc97a016
3 changed files with 38 additions and 24 deletions

View file

@ -4,16 +4,24 @@
#include "dinkyecs.hpp"
#include "tser.hpp"
#include <string>
#include <vector>
#include <map>
namespace save {
struct SaveData {
components::Player player;
std::vector<components::Position> position;
std::vector<components::Motion> motion;
std::vector<components::Combat> combat;
DEFINE_SERIALIZABLE(SaveData, player, position, motion, combat);
struct Facts {
components::Player player;
DEFINE_SERIALIZABLE(Facts, player);
};
struct SaveData {
Facts facts;
std::map<DinkyECS::Entity, components::Position> position;
std::map<DinkyECS::Entity, components::Motion> motion;
std::map<DinkyECS::Entity, components::Combat> combat;
DEFINE_SERIALIZABLE(SaveData, facts, position, motion, combat);
};
void to_file(std::string path, DinkyECS::World &world);