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
11
crystal.cpp
11
crystal.cpp
@ -553,7 +553,7 @@ int dist_relative(cell *c) {
|
||||
int r = roundTableRadius(NULL);
|
||||
cell *start = m->gamestart();
|
||||
if(!cc) {
|
||||
printf("Finding Camelot center...");
|
||||
println(hlog, "Finding Camelot center...");
|
||||
cc = start;
|
||||
while(precise_distance(cc, start) < r + 5)
|
||||
cc = cc->cmove(hrand(cc->type));
|
||||
@ -944,7 +944,6 @@ shift_data shift_data_zero;
|
||||
string get_table_volume() {
|
||||
if(!pure()) {
|
||||
auto m = crystal_map();
|
||||
m->prepare_east();
|
||||
bignum res;
|
||||
manual_celllister cl;
|
||||
cl.add(m->gamestart());
|
||||
@ -959,9 +958,14 @@ string get_table_volume() {
|
||||
}
|
||||
static const ld eps = 1e-4;
|
||||
if(mincoord >= 0-eps && maxcoord < 4-eps) {
|
||||
ld my_rad2 = rad2;
|
||||
auto cshift = (co - m->camelot_coord) / 4;
|
||||
auto sd = &shift_data_zero;
|
||||
for(int i=0; i<m->cs.dim; i++) {
|
||||
if(i == m->cs.dim-1 && (m->cs.dir&1)) {
|
||||
my_rad2 -= pow(cshift[i] / m->camelot_mul, 2);
|
||||
}
|
||||
else {
|
||||
ld val = cshift[i] - floor(cshift[i]);
|
||||
if(!sd->children.count(val)) {
|
||||
sd->children[val].parent = sd;
|
||||
@ -969,7 +973,8 @@ string get_table_volume() {
|
||||
}
|
||||
sd = &sd->children[val];
|
||||
}
|
||||
res.addmul(sd->compute(rad2), 1);
|
||||
}
|
||||
res.addmul(sd->compute(my_rad2), 1);
|
||||
}
|
||||
if(mincoord < -2 || maxcoord > 6) continue;
|
||||
forCellCM(c2, c) cl.add(c2);
|
||||
|
Loading…
Reference in New Issue
Block a user