mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-30 15:39:54 +00:00
replaced macro VALENCE with function valence()
This commit is contained in:
parent
769982040d
commit
7f09bb6259
12
barriers.cpp
12
barriers.cpp
@ -68,7 +68,7 @@ EX bool checkBarriersBack(cellwalker bb, int q IS(5), bool cross IS(false)) {
|
||||
|
||||
/** warp coasts use a different algorithm for nowall barriers when has_nice_dual() is on. Check whether we should use this different algorithm when the lands are l1 and l2 */
|
||||
EX bool warped_version(eLand l1, eLand l2) {
|
||||
return (has_nice_dual() && (l1 == laWarpCoast || l1 == laWarpSea || l2 == laWarpSea || l2 == laWarpCoast)) || (VALENCE == 3);
|
||||
return (has_nice_dual() && (l1 == laWarpCoast || l1 == laWarpSea || l2 == laWarpSea || l2 == laWarpCoast)) || (valence() == 3);
|
||||
}
|
||||
|
||||
EX bool checkBarriersNowall(cellwalker bb, int q, int dir, eLand l1 IS(laNone), eLand l2 IS(laNone)) {
|
||||
@ -101,7 +101,7 @@ EX bool checkBarriersNowall(cellwalker bb, int q, int dir, eLand l1 IS(laNone),
|
||||
if(warped_version(l1, l2)) {
|
||||
bb = bb + wstep + (2*dir) + wstep + dir;
|
||||
}
|
||||
else if(VALENCE > 3) {
|
||||
else if(valence() > 3) {
|
||||
bb = bb + dir + wstep + dir;
|
||||
dir = -dir;
|
||||
swap(l1, l2);
|
||||
@ -264,7 +264,7 @@ EX void extendNowall(cell *c) {
|
||||
cw += wstep;
|
||||
setland(cw.at, c->barright);
|
||||
}
|
||||
else if(VALENCE > 3) {
|
||||
else if(valence() > 3) {
|
||||
auto cw2 = cw + wstep;
|
||||
setland(cw2.at, c->barright);
|
||||
cw2.at->barleft = NOWALLSEP_USED;
|
||||
@ -277,7 +277,7 @@ EX void extendNowall(cell *c) {
|
||||
if(warpv) {
|
||||
cw0 = cw + (2*i) + wstep;
|
||||
}
|
||||
else if(VALENCE > 3) {
|
||||
else if(valence() > 3) {
|
||||
cw0 = cw + i + wstep + i;
|
||||
}
|
||||
else {
|
||||
@ -286,7 +286,7 @@ EX void extendNowall(cell *c) {
|
||||
}
|
||||
if(cw0.at->barleft != NOWALLSEP_USED) {
|
||||
cw0.at->barleft = NOWALLSEP;
|
||||
if(VALENCE > 3) {
|
||||
if(valence() > 3) {
|
||||
cw0.at->barright = c->barright;
|
||||
cw0.at->bardir = cw0.spin;
|
||||
setland(cw0.at, c->land);
|
||||
@ -846,7 +846,7 @@ EX bool buildBarrierNowall(cell *c, eLand l2, int forced_dir IS(NODIR)) {
|
||||
for(int j=0; j<c->type; j++) swap(ds[j], ds[hrand(j+1)]);
|
||||
|
||||
for(int i=0; i<c->type; i++) {
|
||||
int d = forced_dir != NODIR ? forced_dir : (VALENCE>3) ? (2+(i&1)) : ds[i];
|
||||
int d = forced_dir != NODIR ? forced_dir : (valence()>3) ? (2+(i&1)) : ds[i];
|
||||
/* if(warpv && GOLDBERG) {
|
||||
d = hrand(c->type); */
|
||||
if(warpv && c->move(d) && c->move(d)->mpdist < c->mpdist) continue;
|
||||
|
@ -1581,7 +1581,7 @@ EX bool no_barriers_in_radius(cell *c, int rad) {
|
||||
EX eMonster camelot_monster() {
|
||||
eMonster ms[3] = { moHedge, moLancer, moFlailer };
|
||||
eMonster m = ms[hrand(3)];
|
||||
if(m == moHedge && VALENCE > 3)
|
||||
if(m == moHedge && valence() > 3)
|
||||
m = moPyroCultist;
|
||||
if(getDistLimit() <= 2 && m == moLancer) m = moGoblin;
|
||||
if(getDistLimit() <= 3 && m == moPyroCultist) m = moCultist;
|
||||
|
10
cell.cpp
10
cell.cpp
@ -1141,7 +1141,7 @@ EX int mine_adjacency_rule = 0;
|
||||
EX map<cell*, vector<cell*>> adj_memo;
|
||||
|
||||
EX bool geometry_has_alt_mine_rule() {
|
||||
if(WDIM == 2) return VALENCE > 3;
|
||||
if(WDIM == 2) return valence() > 3;
|
||||
if(WDIM == 3) return !among(geometry, gHoroHex, gCell5, gBitrunc3, gCell8, gECell8, gCell120, gECell120);
|
||||
return true;
|
||||
}
|
||||
@ -1241,4 +1241,12 @@ EX bool standard_tiling() {
|
||||
return !arcm::in() && !kite::in() && !bt::in();
|
||||
}
|
||||
|
||||
EX int valence() {
|
||||
if(BITRUNCATED) return 3;
|
||||
#if CAP_ARCM
|
||||
if(arcm::in()) return arcm::valence();
|
||||
#endif
|
||||
return S3;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ array<feature, 21> features {{
|
||||
{0x181418, 5, moSkeleton, VF { if(c->wall == waNone && !c->monst && hrand_monster(80000) < 25 + items[itVarTreasure]) c->monst = moSkeleton, c->hitpoints = 3; } },
|
||||
{0x180000, 5, moPyroCultist, VF { if(c->wall == waNone && !c->monst && hrand_monster(80000) < 25 + items[itVarTreasure]) c->monst = moPyroCultist; } },
|
||||
{0x00000C, 2, moFlailer, VF { if(c->wall == waNone && !c->monst && hrand_monster(80000) < 25 + items[itVarTreasure]) c->monst = moFlailer; } },
|
||||
{0x1C0700, 1, moHedge, VF { if(c->wall == waNone && !c->monst && hrand_monster(80000) < 25 + items[itVarTreasure] && VALENCE == 3) c->monst = moHedge; } },
|
||||
{0x1C0700, 1, moHedge, VF { if(c->wall == waNone && !c->monst && hrand_monster(80000) < 25 + items[itVarTreasure] && valence() == 3) c->monst = moHedge; } },
|
||||
{0x000c00,-1, moNone, VF { if(hrand(1500) < 30) createArrowTrapAt(c, laVariant); } },
|
||||
{0x001200,-1, moNone, VF { if(hrand(1500) < 50 && c->wall == waNone) c->wall = waTrapdoor; } },
|
||||
{0x000c18,-1, moNone, VF { if(hrand(1500) < 30) build_pool(c, true); } },
|
||||
@ -779,7 +779,7 @@ EX int ambush(cell *c, eItem what) {
|
||||
vector<cell*> around;
|
||||
cell *clast = NULL;
|
||||
cell *ccur = c0;
|
||||
int v = VALENCE;
|
||||
int v = valence();
|
||||
if(v > 4) {
|
||||
for(cell *c: cl.lst) if(cl.getdist(c) == d) around.push_back(c);
|
||||
hrandom_shuffle(&around[0], isize(around));
|
||||
|
@ -1147,7 +1147,7 @@ EX void build_rugdata() {
|
||||
ldcoord vcoord[MAX_EDGE];
|
||||
|
||||
for(int i=0; i<c->type; i++)
|
||||
if(VALENCE == 4)
|
||||
if(valence() == 4)
|
||||
vcoord[i] = ((m->get_coord(c->cmove(i)) + m->get_coord(c->cmodmove(i-1))) / 2);
|
||||
else
|
||||
vcoord[i] = ((m->get_coord(c->cmove(i)) + m->get_coord(c->cmodmove(i-1)) + co) / 3);
|
||||
|
@ -599,21 +599,21 @@ EX namespace ts {
|
||||
EX cell *left_of(cell *c, const cellfunction& cf) {
|
||||
int pid = parent_id(c, 1, cf);
|
||||
if(pid == -1) return c;
|
||||
if(VALENCE == 3) return c->cmodmove(pid+1);
|
||||
if(valence() == 3) return c->cmodmove(pid+1);
|
||||
else return (cellwalker(c, pid) + wstep - 1).cpeek();
|
||||
}
|
||||
|
||||
EX cell *right_of(cell *c, const cellfunction& cf) {
|
||||
int pid = parent_id(c, -1, cf);
|
||||
if(pid == -1) return c;
|
||||
if(VALENCE == 3) return c->cmodmove(pid-1);
|
||||
if(valence() == 3) return c->cmodmove(pid-1);
|
||||
else return (cellwalker(c, pid) + wstep + 1).cpeek();
|
||||
}
|
||||
|
||||
EX cell *child_number(cell *c, int id, const cellfunction& cf) {
|
||||
int pid = parent_id(c, 1, cf);
|
||||
if(pid == -1) return c->cmove(id);
|
||||
return c->cmodmove(pid + (VALENCE == 3 ? 2 : 1) + id);
|
||||
return c->cmodmove(pid + (valence() == 3 ? 2 : 1) + id);
|
||||
}
|
||||
|
||||
#if HDR
|
||||
@ -1047,7 +1047,7 @@ EX int hyperbolic_celldistance(cell *c1, cell *c2) {
|
||||
if(d1 == d2) {
|
||||
if(cl1 == c1 && in_segment(cl2, c1, cr2)) return d;
|
||||
if(cl2 == c2 && in_segment(cl1, c2, cr1)) return d;
|
||||
if(VALENCE == 3) {
|
||||
if(valence() == 3) {
|
||||
int dx = min(sibling_distance(cr1, cl2, sibling_limit), sibling_distance(cr2, cl1, sibling_limit));
|
||||
if(d + dx <= found_distance) {
|
||||
found_distance = d + dx;
|
||||
|
@ -1984,7 +1984,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
|
||||
if(t == 50) { c->item = itNone; break; }
|
||||
cell *dog1 = dogcells[hrand(isize(dogcells))];
|
||||
cell *dog2 = dogcells[hrand(isize(dogcells))];
|
||||
if(VALENCE != 3 || isNeighbor(dog1, dog2)) {
|
||||
if(valence() != 3 || isNeighbor(dog1, dog2)) {
|
||||
dog1->monst = moHunterGuard;
|
||||
dog1->landparam = 0;
|
||||
dog2->monst = moHunterGuard;
|
||||
|
@ -1041,7 +1041,7 @@ EX land_validity_t& land_validity(eLand l) {
|
||||
if(l == laWarpCoast && quotient && geometry != gZebraQuotient && !randomPatternsMode)
|
||||
return pattern_incompatibility;
|
||||
|
||||
if(among(l, laEmerald, laCamelot, laDryForest) && VALENCE != 3 && old_daily_id >= 65)
|
||||
if(among(l, laEmerald, laCamelot, laDryForest) && valence() != 3 && old_daily_id >= 65)
|
||||
return hedgehogs;
|
||||
|
||||
// laPower and laEmerald and laPalace -> [partial] in quotients and hyperbolic_non37
|
||||
@ -1052,7 +1052,7 @@ EX land_validity_t& land_validity(eLand l) {
|
||||
else if(quotient) return pattern_incompatibility;
|
||||
}
|
||||
|
||||
if(among(l, laEmerald, laCamelot, laDryForest) && VALENCE != 3)
|
||||
if(among(l, laEmerald, laCamelot, laDryForest) && valence() != 3)
|
||||
return hedgehogs;
|
||||
|
||||
if(l == laWineyard && sol)
|
||||
|
@ -1204,7 +1204,7 @@ EX bool geosupport_chessboard() {
|
||||
#endif
|
||||
(bt::in() || kite::in()) ? 0 :
|
||||
(S3 >= OINF) ? true :
|
||||
(VALENCE % 2 == 0);
|
||||
(valence() % 2 == 0);
|
||||
}
|
||||
|
||||
EX int geosupport_threecolor() {
|
||||
|
@ -325,7 +325,7 @@ EX namespace yendor {
|
||||
if(i == 1)
|
||||
onlychild = true;
|
||||
if(!onlychild) ycw++;
|
||||
if(VALENCE == 3) ycw++;
|
||||
if(valence() == 3) ycw++;
|
||||
|
||||
onlychild = false;
|
||||
|
||||
@ -451,7 +451,7 @@ EX namespace yendor {
|
||||
|
||||
if(i == 1) onlychild = true;
|
||||
if(!onlychild) ycw++;
|
||||
if(VALENCE == 3) ycw++;
|
||||
if(valence() == 3) ycw++;
|
||||
|
||||
onlychild = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user