From f84975d1d15dad6f3bb0eda1e95f487e63d018fd Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Wed, 5 Sep 2018 06:37:07 -0700 Subject: [PATCH] polara50 and polarb50 now consistently return bool, not int. MSVC complains about constructions such as bool polara50(int); int polara50(cell *c) { // ... return polara50(someint); } --- bigstuff.cpp | 2 +- hyper.h | 4 ++-- landgen.cpp | 6 +++--- pattern2.cpp | 15 ++++++++------- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/bigstuff.cpp b/bigstuff.cpp index 21e4d358..662209d2 100644 --- a/bigstuff.cpp +++ b/bigstuff.cpp @@ -199,7 +199,7 @@ heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special) { cell *c = bf.at; if(cdist50(c) != 0) return NULL; - if(polarb50(c) != 1) return NULL; + if(!polarb50(c)) return NULL; } heptagon *alt = tailored_alloc (S7); diff --git a/hyper.h b/hyper.h index 84f7f676..7e2320fe 100644 --- a/hyper.h +++ b/hyper.h @@ -2734,7 +2734,7 @@ cell *createMovR(cell *c, int d); bool ishept(cell *c); int cdist50(cell *c); -int polarb50(cell *c); +bool polarb50(cell *c); bool isGravityLand(eLand l); bool isWarped(eLand l); @@ -2952,7 +2952,7 @@ void sdltogl(SDL_Surface *txt, struct glfont_t& f, int ch); void showStartMenu(); bool polara50(int x); -int polara50(cell *c); +bool polara50(cell *c); int fiftyval049(cell *c); namespace fieldpattern { diff --git a/landgen.cpp b/landgen.cpp index 271ae915..b6cfa3e4 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -211,7 +211,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { if(d == 9) { cell *c2 = NONSTDVAR ? c->master->c7 : c; - if(cdist50(c2) == 3 && polarb50(c2) == 1) + if(cdist50(c2) == 3 && polarb50(c2)) c->wall = waPalace; } @@ -272,12 +272,12 @@ void giantLandSwitch(cell *c, int d, cell *from) { break; } } - else if(cdist50(c) == 3 && polarb50(c) == 1 && !ishept(c)) { + else if(cdist50(c) == 3 && polarb50(c) && !ishept(c)) { if(GOLDBERG) ; else { int q = 0, s = 0; if(!ishept(c)) for(int i=0; itype; 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; if(q == 1 && c->move(s)->land == laPalace) { switch(princess::generating ? 0 : hrand(2)) { diff --git a/pattern2.cpp b/pattern2.cpp index bb93d71b..d1fdda6c 100644 --- a/pattern2.cpp +++ b/pattern2.cpp @@ -138,19 +138,19 @@ int land50(cell *c) { } } -int polara50(cell *c) { - if(sphere || euclid || S7>7 || S6>6) return 0; +bool polara50(cell *c) { + if(sphere || euclid || S7>7 || S6>6) return false; else if(NONSTDVAR) return polara50(fiftyval(c->master->c7)); else if(ctof(c)) return polara50(fiftyval(c)); else { auto ar = gp::get_masters(c); for(int i=0; i<3; i++) 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(sphere || euclid || S7>7 || S6>6) return true; else if(NONSTDVAR) return polarb50(fiftyval(c->master->c7)); @@ -159,7 +159,7 @@ int polarb50(cell *c) { auto ar = gp::get_masters(c); for(int i=0; i<3; i++) 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 { 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); for(int i=0; i<3; i++) if(polara50(ar[i]->fiftyval) == pa && polarb50(ar[i]->fiftyval) == pb) @@ -2089,7 +2090,7 @@ namespace linepatterns { break; case patPalace: { - int a = polarb50(c); + bool a = polarb50(c); if(pseudohept(c)) for(int i=0; i<7; i++) { cell *c1 = createMov(c, (i+3) % 7); cell *c2 = createMov(c, (i+4) % 7);