fixed a weird crash in guided tour

This commit is contained in:
Zeno Rogue 2020-07-13 00:07:39 +02:00
parent 7deb98154f
commit b87f051b3f
1 changed files with 13 additions and 1 deletions

View File

@ -36,6 +36,18 @@ struct gamedata {
}
index += ssize;
}
template<class T> void store_ptr(T& x) {
T* copy;
if(mode == 0) {
copy = new T;
*copy = move(x);
}
store(copy);
if(mode != 0) {
x = move(*copy);
delete copy;
}
}
};
#endif
@ -49,7 +61,7 @@ void gamedata_all(gamedata& gd) {
gd.store(chaosmode);
gd.store(*current_display);
gd.store(cgip);
gd.store(vid);
gd.store_ptr(vid);
gd.store(sightrange_bonus);
gd.store(genrange_bonus);
gd.store(gamerange_bonus);