1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-11-14 04:37:10 +00:00

Goldberg dialog now warns if outside of the supported limits

This commit is contained in:
Zeno Rogue
2022-01-08 19:30:46 +01:00
parent 450aa28d67
commit 549e57b3d1

View File

@@ -736,12 +736,22 @@ EX namespace gp {
loc config; loc config;
loc internal_representation(loc v) { EX bool rotate_and_check_limits(loc& v) {
int& x = v.first, &y = v.second; int& x = v.first, &y = v.second;
while(x < 0 || y < 0 || (x == 0 && y > 0)) while(x < 0 || y < 0 || (x == 0 && y > 0))
v = v * loc(0, 1); v = v * loc(0, 1);
if(x > 8) x = 8; return 2*(x+y) < (1<<GOLDBERG_BITS);
if(y > 8) y = 8; }
EX bool check_limits(loc v) {
return rotate_and_check_limits(v);
}
loc internal_representation(loc v) {
int& x = v.first, &y = v.second;
while(!rotate_and_check_limits(v)) {
if(x > y) x--; else y--;
}
if(S3 == 3 && y > x) v = v * loc(1, -1); if(S3 == 3 && y > x) v = v * loc(1, -1);
return v; return v;
} }
@@ -863,6 +873,8 @@ EX namespace gp {
dialog::addSelItem("y", its(config.second), 'y'); dialog::addSelItem("y", its(config.second), 'y');
dialog::add_action([] { dialog::editNumber(config.second, 0, 8, 1, 1, "y", helptext()); }); dialog::add_action([] { dialog::editNumber(config.second, 0, 8, 1, 1, "y", helptext()); });
if(!check_limits(config))
dialog::addInfo(XLAT("Outside of the supported limits"));
if(config.second && config.second != config.first && nonorientable) { if(config.second && config.second != config.first && nonorientable) {
dialog::addInfo(XLAT("This does not work in non-orientable geometries")); dialog::addInfo(XLAT("This does not work in non-orientable geometries"));
} }