1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2026-04-15 06:21:23 +00:00

ru:: print doubles exactly to prevent fallthroughs possible due to numerical errors

This commit is contained in:
Zeno Rogue
2026-03-29 14:44:14 +02:00
parent e031d0ae4b
commit 9346567ab0

View File

@@ -23,7 +23,7 @@ struct saver : stater {
fhstream& f;
saver(fhstream &_f) : f(_f) {}
stater& act(const string& s, int& i, int _i) override { if(i != _i) println(f, s, "=", i); return self; }
stater& act(const string& s, ld& d, ld _d) override { if(d != _d) println(f, s, "=", d); return self; }
stater& act(const string& s, ld& d, ld _d) override { if(d != _d) println(f, s, "=", format("%.17g", d)); return self; }
stater& act(const string& s, bool& b, bool _b) override { if(b != _b) println(f, s, "=", b); return self; }
stater& act(const string& s, string& w, const string& _w) override { if(w != _w) println(f, s, "=", w); return self; }
stater& act(const string& s, color_t& c, color_t _c) override { if(c != _c) println(f, s, "=", format("%08X", c)); return self; }