land improvements in Sol/Penrose/B4

This commit is contained in:
Zeno Rogue 2019-07-25 23:07:36 +02:00
parent b2e8a869cb
commit fff0cd1d3e
7 changed files with 68 additions and 22 deletions

View File

@ -884,6 +884,11 @@ void clear_euland(eLand first) {
euland3[0] = laCrossroads;
}
bool valid_wall_at(int c) {
if(sol) return true;
return short(c) % 3 == 0;
}
eLand switchable(eLand nearland, eLand farland, int c) {
if(chaosmode) {
if(hrand(6) == 0)
@ -893,10 +898,12 @@ eLand switchable(eLand nearland, eLand farland, int c) {
else if(specialland == laCrossroads4) {
if((dual::state && nearland == laCrossroads4) || hrand(15) == 0)
return getNewLand(nearland);
if(nearland == laCrossroads4 && sol && hrand(5) == 0)
return getNewLand(nearland);
return nearland;
}
else if(nearland == laCrossroads) {
if(hrand(4) == 0 && (short(c)%3==0))
if(hrand(4) == 0 && valid_wall_at(c))
return laBarrier;
return laCrossroads;
}
@ -904,7 +911,7 @@ eLand switchable(eLand nearland, eLand farland, int c) {
return getNewLand(farland);
}
else {
if(hrand(20) == 0 && (short(c)%3==0))
if(hrand(20) == 0 && valid_wall_at(c))
return laBarrier;
return nearland;
}
@ -923,6 +930,27 @@ eLand getEuclidLand(int c) {
return la = laCrossroads;
}
void setLandSol(cell *c) {
setland(c, specialland);
switch(specialland) {
case laCrossroads4: case laCrossroads: case laCrossroads2:
setland(c, getEuclidLand(c->master->distance));
if(c->land == laBarrier && c->master->emeraldval % 3) c->wall = waBarrier;
break;
case laTerracotta:
if((c->master->distance & 15) == 1) {
setland(c, laMercuryRiver);
if(c->master->emeraldval % 3) c->wall = waMercury;
}
break;
case laOcean: case laIvoryTower: case laEndorian: case laDungeon:
if(c->master->distance <= 0) setland(c, laRlyeh);
else c->landparam = c->master->distance;
break;
default: ;
}
}
void setLandEuclid(cell *c) {
#if CAP_RACING
if(racing::track_ready) {
@ -1209,7 +1237,7 @@ bool good_for_wall(cell *c) {
}
void buildBigStuff(cell *c, cell *from) {
if(sphere || quotient || sol || penrose) return;
if(sphere || quotient || sol || (penrose && !binarytiling)) return;
if(chaosmode > 1) return;
bool deepOcean = deep_ocean_at(c, from);
@ -1535,6 +1563,10 @@ void moreBigStuff(cell *c) {
forCellCM(c2, c) if(celldistAlt(c2) < celldistAlt(c)) i++;
if(i > 1) c->wall = waColumn;
}
else if(sol) {
if(c->master->emeraldval % 3 || c->master->zebraval % 3)
c->wall = waColumn;
}
else if(geometry == gHoroTris || geometry == gHoroRec) {
if(c->c.spin(binary::updir()) != 0) c->wall = waColumn;
}

View File

@ -89,6 +89,23 @@ namespace binary {
ld hororec_scale = 0.25;
ld horohex_scale = 0.6;
void make_binary_lands(heptagon *parent, heptagon *h) {
if(!parent->emeraldval) parent->emeraldval = currentmap->gamestart()->land;
eLand z = eLand(parent->emeraldval);
int chance = 0;
if(specialland == laCrossroads4 || parent->emeraldval == laCrossroads4) {
eLand x = parent->c7->land;
parent->c7->land = z;
chance = wallchance(parent->c7, deep_ocean_at(parent->c7, parent->c7));
parent->c7->land = x;
}
if(chaosmode) chance = 1000;
if(chance && hrand(40000) < chance)
h->emeraldval = getNewLand(z);
else
h->emeraldval = z;
}
heptagon *build(heptagon *parent, int d, int d1, int t, int side, int delta) {
auto h = buildHeptagon1(tailored_alloc<heptagon> (t), parent, d, hsA, d1);
h->distance = parent->distance + delta;
@ -98,22 +115,13 @@ namespace binary {
h->cdata = NULL;
h->zebraval = side;
h->emeraldval = 0;
if(WDIM == 3 && h->c7) {
if(!parent->emeraldval) parent->emeraldval = currentmap->gamestart()->land;
eLand z = eLand(parent->emeraldval);
int chance = 0;
if(specialland == laCrossroads4 || parent->emeraldval == laCrossroads4) {
eLand x = parent->c7->land;
parent->c7->land = z;
chance = wallchance(parent->c7, deep_ocean_at(parent->c7, parent->c7));
parent->c7->land = x;
}
if(chaosmode) chance = 1000;
if(chance && hrand(40000) < chance)
h->emeraldval = getNewLand(z);
if(geometry == gBinary4) {
if(d < 2)
h->emeraldval = (parent->emeraldval * 2 + d) % 15015;
else
h->emeraldval = z;
h->emeraldval = ((parent->emeraldval - d1) * 7508) % 15015;
}
if(WDIM == 3 && h->c7) make_binary_lands(parent, h);
#if DEBUG_BINARY_TILING
xcode[h] = expected_xcode(parent, d);
if(rxcode.count(xcode[h])) {
@ -901,10 +909,10 @@ namespace solv {
h = tailored_alloc<heptagon> (S7);
h->c7 = newCell(S7, h);
coords[h] = make_pair(x, y);
h->distance = 0;
h->distance = x->distance;
h->dm4 = 0;
h->zebraval = 0;
h->emeraldval = 0;
h->zebraval = x->emeraldval;
h->emeraldval = y->emeraldval;
h->fieldval = 0;
h->cdata = NULL;
return h;
@ -922,6 +930,8 @@ namespace solv {
alt->cdata = NULL;
alt->c7 = NULL;
alt->zebraval = 0;
alt->distance = 0;
alt->emeraldval = 0;
binary_map = binary::new_alt_map(alt);
}

View File

@ -436,7 +436,7 @@ int celldistAlt(cell *c) {
return euclidAlt(x, y);
}
#if CAP_BT
if(binarytiling) return c->master->distance + (specialland == laCamelot && !tactic::on? 30 : 0);
if(binarytiling || sol) return c->master->distance + (specialland == laCamelot && !tactic::on? 30 : 0);
#endif
#if CAP_CRYSTAL
if(geometry == gCrystal)

View File

@ -393,6 +393,7 @@ bool sizes_known() {
if(binarytiling) return false;
// not implemented
if(archimedean) return false;
if(penrose) return false;
return true;
}

View File

@ -1610,7 +1610,7 @@ bool bearsCamelot(eLand l);
extern bool safety;
#define SAGEMELT .1
#define TEMPLE_EACH (among(geometry, gHoroRec, gHoroHex, gKiteDart3) ? 3 : (WDIM == 3 && binarytiling) ? 2 : geometry == gSpace435 ? 4 : (WDIM == 3 && hyperbolic) ? 3 : 6)
#define TEMPLE_EACH (among(geometry, gHoroRec, gHoroHex, gKiteDart3) ? 3 : (sol && binarytiling) ? 6 : (WDIM == 3 && binarytiling) ? 2 : geometry == gSpace435 ? 4 : (WDIM == 3 && hyperbolic) ? 3 : 6)
#define PT(x, y) ((tactic::on || quotient == 2 || daily::on) ? (y) : inv::on ? min(2*(y),x) : (x))
#define ROCKSNAKELENGTH 50
#define WORMLENGTH 15
@ -3060,6 +3060,7 @@ void setLandSphere(cell *c);
void setLandWeird(cell *c);
void moreBigStuff(cell *c);
void setLandEuclid(cell *c);
void setLandSol(cell *c);
bool checkInTree(cell *c, int maxv);
cell *findcompass(cell *c);
int edgeDepth(cell *c);

View File

@ -2573,6 +2573,7 @@ void setdist(cell *c, int d, cell *from) {
else if(sphere || fulltorus) setLandSphere(c);
else if(euclid) setLandEuclid(c);
else if(quotient) { setland(c, specialland); setLandQuotient(c); }
else if(sol) setLandSol(c);
else if(weirdhyperbolic) setLandWeird(c);
}

View File

@ -152,6 +152,7 @@ struct hrmap_kite : hrmap {
heptagon *hspawn(heptagon *of, int our, int their, pshape s) {
auto h = newtile(s, of->distance + (our ? 1 : -1));
if(binarytiling) binary::make_binary_lands(of, h);
of->c.connect(our, h, their, false);
return h;
}