1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-09-07 04:47:56 +00:00

more header shifting

This commit is contained in:
Zeno Rogue
2019-08-09 21:18:13 +02:00
parent 1c6b8ad3f0
commit cb666fb24a
11 changed files with 278 additions and 309 deletions

View File

@@ -7,6 +7,36 @@
namespace hr {
#if HDR
struct gamedata {
// important parameters should be visible
eGeometry geo;
eVariation var;
eLand specland;
bool active;
// other properties are recorded
vector<char> record;
int index, mode;
void storegame();
void restoregame();
template<class T> void store(T& x) {
int ssize = sizeof(x);
if(ssize & 7) ssize = (ssize | 7) + 1;
if(mode == 0) {
record.resize(index+ssize);
T& at = *(new (&record[index]) T());
at = move(x);
}
else {
T& at = (T&) record[index];
x = move(at);
at.~T();
}
index += ssize;
}
};
#endif
void gamedata_all(gamedata& gd) {
gd.index = 0;
gd.store(firstland);