mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-25 17:40:36 +00:00
fixed saving floats on Windows, key conflict on 's'
This commit is contained in:
parent
1440419dab
commit
ab6334974e
13
config.cpp
13
config.cpp
@ -127,7 +127,10 @@ template<> struct saver<unsigned> : dsaver<unsigned> {
|
|||||||
template<> struct saver<ld> : dsaver<ld> {
|
template<> struct saver<ld> : dsaver<ld> {
|
||||||
saver<ld>(ld& val) : dsaver<ld>(val) { }
|
saver<ld>(ld& val) : dsaver<ld>(val) { }
|
||||||
string save() { return ftssmart(val); }
|
string save() { return ftssmart(val); }
|
||||||
void load(const string& s) { val = atof(s.c_str()); }
|
void load(const string& s) {
|
||||||
|
if(s == "0.0000000000e+000") ; // ignore!
|
||||||
|
else val = atof(s.c_str());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -632,9 +635,11 @@ void showGraphConfig() {
|
|||||||
if(xuni == 'u') vid.particles = !vid.particles;
|
if(xuni == 'u') vid.particles = !vid.particles;
|
||||||
if(xuni == 'd') vid.graphglyph = (1+vid.graphglyph)%3;
|
if(xuni == 'd') vid.graphglyph = (1+vid.graphglyph)%3;
|
||||||
|
|
||||||
if(xuni == 'j')
|
if(xuni == 'j') {
|
||||||
dialog::editNumber(whatever, -10, 10, 1, 0, XLAT("whatever"),
|
dialog::editNumber(whatever, -10, 10, 1, 0, XLAT("whatever"),
|
||||||
XLAT("Whatever."));
|
XLAT("Whatever."));
|
||||||
|
dialog::reaction = resetGeometry;
|
||||||
|
}
|
||||||
|
|
||||||
if(xuni == 'a') dialog::editNumber(vid.sspeed, -5, 5, 1, 0,
|
if(xuni == 'a') dialog::editNumber(vid.sspeed, -5, 5, 1, 0,
|
||||||
XLAT("scrolling speed"),
|
XLAT("scrolling speed"),
|
||||||
@ -774,7 +779,7 @@ void showBasicConfig() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ISSTEAM
|
#if ISSTEAM
|
||||||
dialog::addBoolItem(XLAT("send scores to Steam leaderboards"), (vid.steamscore&1), 's');
|
dialog::addBoolItem(XLAT("send scores to Steam leaderboards"), (vid.steamscore&1), 'x');
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dialog::addBoolItem(XLAT("skip the start menu"), vid.skipstart, 'm');
|
dialog::addBoolItem(XLAT("skip the start menu"), vid.skipstart, 'm');
|
||||||
@ -830,7 +835,7 @@ void showBasicConfig() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ISSTEAM
|
#if ISSTEAM
|
||||||
if(xuni == 's') vid.steamscore = vid.steamscore^1;
|
if(xuni == 'x') vid.steamscore = vid.steamscore^1;
|
||||||
#endif
|
#endif
|
||||||
if(xuni == 't')
|
if(xuni == 't')
|
||||||
dialog::editNumber(vid.flashtime, 0, 64, 1, 8, XLAT("message flash time"),
|
dialog::editNumber(vid.flashtime, 0, 64, 1, 8, XLAT("message flash time"),
|
||||||
|
3
util.cpp
3
util.cpp
@ -25,7 +25,8 @@ string fts4(float x) { char buf[64]; sprintf(buf, "%6.4f", x); return buf; }
|
|||||||
string ftssmart(ld x) {
|
string ftssmart(ld x) {
|
||||||
if(x == int(x)) return its(int(x));
|
if(x == int(x)) return its(int(x));
|
||||||
if(abs(x) > 1) return fts4(x);
|
if(abs(x) > 1) return fts4(x);
|
||||||
char buf[64]; sprintf(buf, "%.10le", (double) x); return buf;
|
char buf[64]; sprintf(buf, "%.10e", (float) x);
|
||||||
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
string cts(char c) { char buf[8]; buf[0] = c; buf[1] = 0; return buf; }
|
string cts(char c) { char buf[8]; buf[0] = c; buf[1] = 0; return buf; }
|
||||||
|
Loading…
Reference in New Issue
Block a user