1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-07 22:49:54 +00:00

protect save_map_bin and load_map_bin from possible lacking base

This commit is contained in:
Zeno Rogue 2024-03-24 00:30:04 +01:00
parent 61720cec5e
commit be27fc0fce

View File

@ -808,6 +808,7 @@ bool save_map(const string& fname) {
}
EX void save_map_bin(hstream& f) {
if(!base) { f.write<short>(-1); return; }
auto& all = base->allcells();
int origcells = 0;
for(cellinfo& ci: cells)
@ -867,6 +868,7 @@ bool load_map(const string &fname) {
EX void load_map_bin(hstream& f) {
auto& all = base->allcells();
eGeometry g = (eGeometry) f.get<short>();
if(int(g) == -1) return;
int sa = f.get<short>();
cellcount = f.get<short>();