| 141 | } |
| 142 | |
| 143 | auto Sorcery::Application::load_state_from_binary(const std::string &filename) |
| 144 | -> bool { |
| 145 | |
| 146 | std::ifstream is(filename, std::ios::binary); |
| 147 | if (!is.is_open()) { |
| 148 | std::cerr << "Error: could not open " << filename << " for reading.\n"; |
| 149 | return false; |
| 150 | } |
| 151 | |
| 152 | // Note we serialize INTO existing objects thus no need to reinject |
| 153 | cereal::BinaryInputArchive archive(is); |
| 154 | archive(*_game, *_controller); |
| 155 | |
| 156 | DEBUG_LOGF("Quicksave successfully loaded from {}!", filename); |
| 157 | |
| 158 | return true; |
| 159 | } |
| 160 | |
| 161 | // Default Destructor |
| 162 | Sorcery::Application::~Application() {} |