fixed switching to 2d field quotient after 3d field quotient, and refactored

This commit is contained in:
Zeno Rogue 2021-04-23 20:10:06 +02:00
parent 056419288c
commit 4da935a4e2
2 changed files with 18 additions and 9 deletions

View File

@ -1366,10 +1366,13 @@ EX void enableFieldChange() {
fieldpattern::quotient_field_changed = true;
nextPrimes(gxcur);
dynamicval<eGeometry> g(geometry, gFieldQuotient);
ginf[geometry].g = ginf[gxcur.base].g;
ginf[geometry].sides = ginf[gxcur.base].sides;
ginf[geometry].vertex = ginf[gxcur.base].vertex;
ginf[geometry].distlimit = ginf[gxcur.base].distlimit;
ginf[geometry].tiling_name = ginf[gxcur.base].tiling_name;
ginf[geometry].default_variation = ginf[gxcur.base].default_variation;
ginf[geometry].flags = qFIELD | qANYQ | qBOUNDED;
fieldpattern::current_quotient_field.init(gxcur.primes[gxcur.current_prime_id].p);
}

View File

@ -1138,6 +1138,20 @@ EX void field_quotient_3d(int p, unsigned hash) {
println(hlog, "set prime = ", currfp.Prime);
}
EX void field_quotient_2d(int group, int id, int triplet) {
using namespace fieldpattern;
current_extra = group;
auto& gxcur = fgeomextras[current_extra];
while(id >= isize(gxcur.primes)) nextPrime(gxcur);
fgeomextras[current_extra].current_prime_id = id;
if(triplet != -1)
triplet_id = triplet;
enableFieldChange();
set_geometry(gFieldQuotient);
}
int read_geom_args() {
using namespace arg;
if(0) ;
@ -1154,15 +1168,7 @@ int read_geom_args() {
stop_game_and_switch_mode(rg::nothing);
int a, b;
shift(); sscanf(argcs(), "%d,%d", &a, &b);
using namespace fieldpattern;
current_extra = a;
auto& gxcur = fgeomextras[current_extra];
while(b >= isize(gxcur.primes)) nextPrime(gxcur);
fgeomextras[current_extra].current_prime_id = b;
enableFieldChange();
set_geometry(gFieldQuotient);
field_quotient_2d(a, b, -1);
}
else if(argis("-triplet")) {
stop_game();