1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-18 23:10:26 +00:00

fixed some bugs with modecode and save format

This commit is contained in:
Zeno Rogue 2018-12-14 21:35:46 +01:00
parent a18570f77a
commit 4b89d1dfd7
2 changed files with 23 additions and 6 deletions

View File

@ -105,6 +105,8 @@ namespace mapstream {
f.write(torusconfig::qty);
f.write(torusconfig::dx);
f.write(torusconfig::dy);
f.write(torusconfig::sdx);
f.write(torusconfig::sdy);
f.write(torusconfig::torus_mode);
}
if(geometry == gFieldQuotient) {
@ -207,9 +209,12 @@ namespace mapstream {
f.read(torusconfig::qty);
f.read(torusconfig::dx);
f.read(torusconfig::dy);
if(vernum >= 10504)
if(vernum >= 10504) {
f.read(torusconfig::sdx);
f.read(torusconfig::sdy);
f.read(torusconfig::torus_mode);
}
torusconfig::activate();
}
if(geometry == gCrystal && vernum >= 10504) {
int sides;

View File

@ -955,12 +955,24 @@ int modecode() {
mct += irr::density_code() << 21; // 8 bits
}
if(DUAL) {
mct += (1 << 19);
mct += (1 << 20);
}
// 32 bits [29..61) for geometry specifics
if(torus) {
mct += ll(torusconfig::dx) << 29;
mct += ll(torusconfig::dy) << 37;
mct += ll(torusconfig::qty) << 45;
mct += ll(torusconfig::torusmode) << 53;
mct += ll(torusconfig::torusmode) << 29;
auto& mode = torusconfig::tmodes[torusconfig::torusmode];
bool single = (mode.flags & torusconfig::TF_SINGLE);
if(single) {
mct += ll(torusconfig::qty) << 37;
mct += ll(torusconfig::dy) << 45;
}
else {
mct += ll(torusconfig::sdx) << 37;
mct += ll(torusconfig::sdy) << 45;
}
}
if(geometry == gQuotient) {