mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 17:10:36 +00:00
fixed the Camelot volume computation for bitruncated half-dimension
This commit is contained in:
parent
69ca24889a
commit
d4684503cd
21
crystal.cpp
21
crystal.cpp
@ -553,7 +553,7 @@ int dist_relative(cell *c) {
|
|||||||
int r = roundTableRadius(NULL);
|
int r = roundTableRadius(NULL);
|
||||||
cell *start = m->gamestart();
|
cell *start = m->gamestart();
|
||||||
if(!cc) {
|
if(!cc) {
|
||||||
printf("Finding Camelot center...");
|
println(hlog, "Finding Camelot center...");
|
||||||
cc = start;
|
cc = start;
|
||||||
while(precise_distance(cc, start) < r + 5)
|
while(precise_distance(cc, start) < r + 5)
|
||||||
cc = cc->cmove(hrand(cc->type));
|
cc = cc->cmove(hrand(cc->type));
|
||||||
@ -944,7 +944,6 @@ shift_data shift_data_zero;
|
|||||||
string get_table_volume() {
|
string get_table_volume() {
|
||||||
if(!pure()) {
|
if(!pure()) {
|
||||||
auto m = crystal_map();
|
auto m = crystal_map();
|
||||||
m->prepare_east();
|
|
||||||
bignum res;
|
bignum res;
|
||||||
manual_celllister cl;
|
manual_celllister cl;
|
||||||
cl.add(m->gamestart());
|
cl.add(m->gamestart());
|
||||||
@ -959,17 +958,23 @@ string get_table_volume() {
|
|||||||
}
|
}
|
||||||
static const ld eps = 1e-4;
|
static const ld eps = 1e-4;
|
||||||
if(mincoord >= 0-eps && maxcoord < 4-eps) {
|
if(mincoord >= 0-eps && maxcoord < 4-eps) {
|
||||||
|
ld my_rad2 = rad2;
|
||||||
auto cshift = (co - m->camelot_coord) / 4;
|
auto cshift = (co - m->camelot_coord) / 4;
|
||||||
auto sd = &shift_data_zero;
|
auto sd = &shift_data_zero;
|
||||||
for(int i=0; i<m->cs.dim; i++) {
|
for(int i=0; i<m->cs.dim; i++) {
|
||||||
ld val = cshift[i] - floor(cshift[i]);
|
if(i == m->cs.dim-1 && (m->cs.dir&1)) {
|
||||||
if(!sd->children.count(val)) {
|
my_rad2 -= pow(cshift[i] / m->camelot_mul, 2);
|
||||||
sd->children[val].parent = sd;
|
}
|
||||||
sd->children[val].shift = val;
|
else {
|
||||||
|
ld val = cshift[i] - floor(cshift[i]);
|
||||||
|
if(!sd->children.count(val)) {
|
||||||
|
sd->children[val].parent = sd;
|
||||||
|
sd->children[val].shift = val;
|
||||||
|
}
|
||||||
|
sd = &sd->children[val];
|
||||||
}
|
}
|
||||||
sd = &sd->children[val];
|
|
||||||
}
|
}
|
||||||
res.addmul(sd->compute(rad2), 1);
|
res.addmul(sd->compute(my_rad2), 1);
|
||||||
}
|
}
|
||||||
if(mincoord < -2 || maxcoord > 6) continue;
|
if(mincoord < -2 || maxcoord > 6) continue;
|
||||||
forCellCM(c2, c) cl.add(c2);
|
forCellCM(c2, c) cl.add(c2);
|
||||||
|
Loading…
Reference in New Issue
Block a user