1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 14:37:16 +00:00

Merge pull request #60 from Quuxplusone/polarb50

polara50 and polarb50 now consistently return bool, not int
This commit is contained in:
Zeno Rogue 2018-09-24 00:24:50 +02:00 committed by GitHub
commit 7058ccf747
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 13 deletions

View File

@ -199,7 +199,7 @@ heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special) {
cell *c = bf.at; cell *c = bf.at;
if(cdist50(c) != 0) return NULL; if(cdist50(c) != 0) return NULL;
if(polarb50(c) != 1) return NULL; if(!polarb50(c)) return NULL;
} }
heptagon *alt = tailored_alloc<heptagon> (S7); heptagon *alt = tailored_alloc<heptagon> (S7);

View File

@ -2778,7 +2778,7 @@ cell *createMovR(cell *c, int d);
bool ishept(cell *c); bool ishept(cell *c);
int cdist50(cell *c); int cdist50(cell *c);
int polarb50(cell *c); bool polarb50(cell *c);
bool isGravityLand(eLand l); bool isGravityLand(eLand l);
bool isWarped(eLand l); bool isWarped(eLand l);
@ -2996,7 +2996,7 @@ void sdltogl(SDL_Surface *txt, struct glfont_t& f, int ch);
void showStartMenu(); void showStartMenu();
bool polara50(int x); bool polara50(int x);
int polara50(cell *c); bool polara50(cell *c);
int fiftyval049(cell *c); int fiftyval049(cell *c);
namespace fieldpattern { namespace fieldpattern {

View File

@ -211,7 +211,7 @@ void giantLandSwitch(cell *c, int d, cell *from) {
if(d == 9) { if(d == 9) {
cell *c2 = NONSTDVAR ? c->master->c7 : c; cell *c2 = NONSTDVAR ? c->master->c7 : c;
if(cdist50(c2) == 3 && polarb50(c2) == 1) if(cdist50(c2) == 3 && polarb50(c2))
c->wall = waPalace; c->wall = waPalace;
} }
@ -272,12 +272,12 @@ void giantLandSwitch(cell *c, int d, cell *from) {
break; break;
} }
} }
else if(cdist50(c) == 3 && polarb50(c) == 1 && !ishept(c)) { else if(cdist50(c) == 3 && polarb50(c) && !ishept(c)) {
if(GOLDBERG) ; if(GOLDBERG) ;
else { else {
int q = 0, s = 0; int q = 0, s = 0;
if(!ishept(c)) for(int i=0; i<c->type; i++) if(!ishept(c)) for(int i=0; i<c->type; i++)
if(cdist50(c->move(i)) == 3 && polarb50(c->move(i)) == 1 && !ishept(c->move(i))) if(cdist50(c->move(i)) == 3 && polarb50(c->move(i)) && !ishept(c->move(i)))
q++, s += i; q++, s += i;
if(q == 1 && c->move(s)->land == laPalace) { if(q == 1 && c->move(s)->land == laPalace) {
switch(princess::generating ? 0 : hrand(2)) { switch(princess::generating ? 0 : hrand(2)) {

View File

@ -138,19 +138,19 @@ int land50(cell *c) {
} }
} }
int polara50(cell *c) { bool polara50(cell *c) {
if(sphere || euclid || S7>7 || S6>6) return 0; if(sphere || euclid || S7>7 || S6>6) return false;
else if(NONSTDVAR) return polara50(fiftyval(c->master->c7)); else if(NONSTDVAR) return polara50(fiftyval(c->master->c7));
else if(ctof(c)) return polara50(fiftyval(c)); else if(ctof(c)) return polara50(fiftyval(c));
else { else {
auto ar = gp::get_masters(c); auto ar = gp::get_masters(c);
for(int i=0; i<3; i++) for(int i=0; i<3; i++)
if(cdist50(ar[i]->fiftyval) < 3) return polara50(ar[i]->fiftyval); if(cdist50(ar[i]->fiftyval) < 3) return polara50(ar[i]->fiftyval);
return 0; return false;
} }
} }
int polarb50(cell *c) { bool polarb50(cell *c) {
if(euclid) return true; if(euclid) return true;
if(sphere || euclid || S7>7 || S6>6) return true; if(sphere || euclid || S7>7 || S6>6) return true;
else if(NONSTDVAR) return polarb50(fiftyval(c->master->c7)); else if(NONSTDVAR) return polarb50(fiftyval(c->master->c7));
@ -159,7 +159,7 @@ int polarb50(cell *c) {
auto ar = gp::get_masters(c); auto ar = gp::get_masters(c);
for(int i=0; i<3; i++) for(int i=0; i<3; i++)
if(cdist50(ar[i]->fiftyval) < 3) return polarb50(ar[i]->fiftyval); if(cdist50(ar[i]->fiftyval) < 3) return polarb50(ar[i]->fiftyval);
return 0; return false;
} }
} }
@ -189,7 +189,8 @@ int fiftyval049(cell *c) {
else if(sphere) return 0; else if(sphere) return 0;
else { else {
int a[3], qa=0; int a[3], qa=0;
int pa = polara50(c), pb = polarb50(c); bool pa = polara50(c);
bool pb = polarb50(c);
auto ar = gp::get_masters(c); auto ar = gp::get_masters(c);
for(int i=0; i<3; i++) for(int i=0; i<3; i++)
if(polara50(ar[i]->fiftyval) == pa && polarb50(ar[i]->fiftyval) == pb) if(polara50(ar[i]->fiftyval) == pa && polarb50(ar[i]->fiftyval) == pb)
@ -2105,7 +2106,7 @@ namespace linepatterns {
break; break;
case patPalace: { case patPalace: {
int a = polarb50(c); bool a = polarb50(c);
if(pseudohept(c)) for(int i=0; i<7; i++) { if(pseudohept(c)) for(int i=0; i<7; i++) {
cell *c1 = createMov(c, (i+3) % 7); cell *c1 = createMov(c, (i+3) % 7);
cell *c2 = createMov(c, (i+4) % 7); cell *c2 = createMov(c, (i+4) % 7);