diff --git a/achievement.cpp b/achievement.cpp index 2b6afbbc..377e2beb 100644 --- a/achievement.cpp +++ b/achievement.cpp @@ -264,9 +264,9 @@ EX void achievement_collection(eItem it, int prevgold, int newgold) { if(PURE && geometry == gNormal) achievement_gain("GRAILH", rg::special_geometry); #if CAP_CRYSTAL - if(PURE && geometry == gCrystal && ginf[gCrystal].sides == 8 && ginf[gCrystal].vertex == 4 && !crystal::used_compass_inside) + if(PURE && cryst && ginf[gCrystal].sides == 8 && ginf[gCrystal].vertex == 4 && !crystal::used_compass_inside) achievement_gain("GRAIL4D", rg::special_geometry); - if(BITRUNCATED && geometry == gCrystal && ginf[gCrystal].sides == 8 && ginf[gCrystal].vertex == 3 && !crystal::used_compass_inside) + if(BITRUNCATED && cryst && ginf[gCrystal].sides == 8 && ginf[gCrystal].vertex == 3 && !crystal::used_compass_inside) achievement_gain("GRAIL4D2", rg::special_geometry); #endif if(q == 3) achievement_gain("GRAIL3"); diff --git a/archimedean.cpp b/archimedean.cpp index 699163d4..77314e71 100644 --- a/archimedean.cpp +++ b/archimedean.cpp @@ -69,7 +69,8 @@ struct archimedean_tiling { void regroup(); string world_size(); - eGeometryClass get_class(); + geometryinfo1& get_geometry(); + eGeometryClass get_class() { return get_geometry().kind; } ld scale(); }; @@ -311,14 +312,14 @@ void archimedean_tiling::regroup() { } } -eGeometryClass archimedean_tiling::get_class() { - if(euclidean_angle_sum < 1.999999) return gcSphere; - else if(euclidean_angle_sum > 2.000001) return gcHyperbolic; - else return gcEuclid; +geometryinfo1& archimedean_tiling::get_geometry() { + if(euclidean_angle_sum < 1.999999) return ginf[gSphere].g; + else if(euclidean_angle_sum > 2.000001) return ginf[gNormal].g; + else return ginf[gEuclid].g; } void archimedean_tiling::compute_geometry() { - ginf[gArchimedean].cclass = get_class(); + ginf[gArchimedean].g = get_geometry(); set_flag(ginf[gArchimedean].flags, qBOUNDED, get_class() == gcSphere); DEBB(DF_GEOM, (format("euclidean_angle_sum = %f\n", float(euclidean_angle_sum)))); diff --git a/bigstuff.cpp b/bigstuff.cpp index 7b37cec3..d275c613 100644 --- a/bigstuff.cpp +++ b/bigstuff.cpp @@ -45,7 +45,7 @@ EX int roundTableRadius(cell *c) { EX int celldistAltRelative(cell *c) { #if CAP_CRYSTAL - if(geometry == gCrystal) return crystal::dist_relative(c); + if(cryst) return crystal::dist_relative(c); #endif #if MAXMDIM >= 4 if(euclid && WDIM == 3) return euclid3::dist_relative(c); diff --git a/cell.cpp b/cell.cpp index 75e5e1d3..f0693e6a 100644 --- a/cell.cpp +++ b/cell.cpp @@ -265,7 +265,7 @@ EX void initcells() { if(res) currentmap = res; else if(nonisotropic || prod) currentmap = nisot::new_map(); #if CAP_CRYSTAL - else if(geometry == gCrystal) currentmap = crystal::new_map(); + else if(cryst) currentmap = crystal::new_map(); #endif #if CAP_ARCM else if(archimedean) currentmap = arcm::new_map(); @@ -466,7 +466,7 @@ EX int celldist(cell *c) { if(masterless) return eudist(decodeId(c->master)); if(euclid && (penrose || archimedean)) return celldistance(currentmap->gamestart(), c); - if(sphere || binarytiling || WDIM == 3 || geometry == gCrystal || sol || penrose) return celldistance(currentmap->gamestart(), c); + if(sphere || binarytiling || WDIM == 3 || cryst || sol || penrose) return celldistance(currentmap->gamestart(), c); #if CAP_IRR if(IRREGULAR) return irr::celldist(c, false); #endif @@ -506,7 +506,7 @@ EX int celldistAlt(cell *c) { #endif if(nil) return c->master->zebraval + abs(c->master->emeraldval) + (specialland == laCamelot && !tactic::on? 30 : 0);; #if CAP_CRYSTAL - if(geometry == gCrystal) + if(cryst) return crystal::dist_alt(c); #endif if(sphere || quotient) { @@ -935,7 +935,7 @@ EX int heptdistance(heptagon *h1, heptagon *h2) { // very rough distance int d = 0; #if CAP_CRYSTAL - if(geometry == gCrystal) return crystal::space_distance(h1->c7, h2->c7); + if(cryst) return crystal::space_distance(h1->c7, h2->c7); #endif if(sol) return solv::approx_distance(h1, h2); while(true) { @@ -949,7 +949,7 @@ EX int heptdistance(heptagon *h1, heptagon *h2) { EX int heptdistance(cell *c1, cell *c2) { #if CAP_CRYSTAL - if(geometry == gCrystal) return crystal::space_distance(c1, c2); + if(cryst) return crystal::space_distance(c1, c2); #endif if(!hyperbolic || quotient || WDIM == 3) return celldistance(c1, c2); else return heptdistance(c1->master, c2->master); @@ -1034,7 +1034,7 @@ EX int celldistance(cell *c1, cell *c2) { } #if CAP_CRYSTAL - if(geometry == gCrystal) return crystal::precise_distance(c1, c2); + if(cryst) return crystal::precise_distance(c1, c2); #endif if(masterless || archimedean || quotient || sol || (penrose && euclid) || experimental) { @@ -1072,7 +1072,7 @@ EX int celldistance(cell *c1, cell *c2) { EX vector build_shortest_path(cell *c1, cell *c2) { #if CAP_CRYSTAL - if(geometry == gCrystal) return crystal::build_shortest_path(c1, c2); + if(cryst) return crystal::build_shortest_path(c1, c2); #endif vector p; if(euclid) { diff --git a/config.cpp b/config.cpp index 1c14f137..90ac70a0 100644 --- a/config.cpp +++ b/config.cpp @@ -1885,7 +1885,7 @@ EX void show_color_dialog() { } #if CAP_CRYSTAL - if(geometry == gCrystal && cheater) { + if(cryst && cheater) { dialog::addItem(XLAT("crystal coordinate colors"), 'C'); dialog::add_action([] () { crystal::view_coordinates = true; pushScreen([] () { edit_color_table(crystal::coordcolors); });}); } diff --git a/crystal.cpp b/crystal.cpp index 0774d0ad..8614bcc6 100644 --- a/crystal.cpp +++ b/crystal.cpp @@ -515,7 +515,7 @@ EX ld compass_angle() { EX bool crystal_cell(cell *c, transmatrix V) { - if(geometry != gCrystal) return false; + if(!cryst) return false; if(view_east && cheater) { int d = dist_alt(c); @@ -1140,7 +1140,7 @@ EX void show() { string s; if(i % 2) s = its(i/2) + ".5D"; else s = its(i/2) + "D"; - dialog::addBoolItem(s, geometry == gCrystal && ginf[gCrystal].sides == i && ginf[gCrystal].vertex == 4, 'a' + i - 5); + dialog::addBoolItem(s, cryst && ginf[gCrystal].sides == i && ginf[gCrystal].vertex == 4, 'a' + i - 5); dialog::add_action(dialog::add_confirmation([i]() { set_crystal(i); start_game(); })); } dialog::addBoolItem(XLAT("4D double bitruncated"), ginf[gCrystal].vertex == 3, 'D'); @@ -1152,13 +1152,13 @@ EX void show() { dialog::editNumber(compass_probability, 0, 1, 0.1, 1, XLAT("compass probability"), compass_help()); dialog::bound_low(0); }); - if(geometry == gCrystal) { + if(cryst) { dialog::addBoolItem(XLAT("3D display"), rug::rugged, 'r'); dialog::add_action_push(rug::show); } else dialog::addBreak(100); - if(rug::rugged && geometry == gCrystal && ginf[gCrystal].sides == 8) { + if(rug::rugged && cryst && ginf[gCrystal].sides == 8) { dialog::addBoolItem(XLAT("render a cut"), draw_cut, 'x'); dialog::add_action([]() { draw_cut = true; @@ -1451,7 +1451,7 @@ void transform_euclid_to_crystal () { void add_crystal_transform(char c) { if(shmup::on) return; - if(geometry == gCrystal && ginf[gCrystal].sides == 6) { + if(cryst && ginf[gCrystal].sides == 6) { dialog::addItem("convert Crystal to 3D", c); dialog::add_action(transform_crystal_to_euclid); } diff --git a/game.cpp b/game.cpp index 2f75736d..332f0b19 100644 --- a/game.cpp +++ b/game.cpp @@ -2420,7 +2420,7 @@ EX void killMonster(cell *c, eMonster who, flagtype deathflags IS(0)) { if(m == moPirate && isOnCIsland(c) && c->item == itNone && ( eubinary || (c->master->alt && celldistAlt(c) <= 2-getDistLimit()) || - isHaunted(c->land)) && geometry != gCrystal) { + isHaunted(c->land)) && !cryst) { bool toomany = false; for(int i=0; itype; i++) { cell *c2 = c->move(i); @@ -7459,7 +7459,7 @@ EX bool in_full_game() { if(chaosmode) return true; if(euclid && isCrossroads(specialland)) return true; if(weirdhyperbolic && specialland == laCrossroads4) return true; - if(geometry == gCrystal && isCrossroads(specialland)) return true; + if(cryst && isCrossroads(specialland)) return true; if(geometry == gNormal && !NONSTDVAR) return true; return false; } @@ -7495,7 +7495,7 @@ EX void knightFlavorMessage(cell *c2) { addMessage(XLAT("\"The Holy Grail is in the center of the Round Table.\"")); } #if CAP_CRYSTAL - else if(msgid == 3 && geometry == gCrystal) { + else if(msgid == 3 && cryst) { if(crystal::pure()) addMessage(XLAT("\"Each piece of the Round Table is exactly %1 steps away from the Holy Grail.\"", its(roundTableRadius(c2)))); else @@ -7521,7 +7521,7 @@ EX void knightFlavorMessage(cell *c2) { string s = ""; if(0) ; #if CAP_CRYSTAL - else if(geometry == gCrystal) + else if(cryst) s = crystal::get_table_boundary(); #endif else if(!quotient) @@ -7533,7 +7533,7 @@ EX void knightFlavorMessage(cell *c2) { string s = ""; if(0); #if CAP_CRYSTAL - else if(geometry == gCrystal) + else if(cryst) s = crystal::get_table_volume(); #endif else if(!quotient) diff --git a/geom-exp.cpp b/geom-exp.cpp index af10a7ec..7e28b2d6 100644 --- a/geom-exp.cpp +++ b/geom-exp.cpp @@ -415,7 +415,7 @@ void ge_select_tiling(const vector& lst) { bool on = geometry == i; dynamicval cg(geometry, eGeometry(i)); if(archimedean && !CAP_ARCM) continue; - if(geometry == gCrystal && !CAP_CRYSTAL) continue; + if(cryst && !CAP_CRYSTAL) continue; if(geometry == gFieldQuotient && !CAP_FIELD) continue; dialog::addBoolItem(XLAT((geometry == gProduct && !on) ? XLAT("current geometry x E") : ginf[i].menu_displayed_name), on, letter++); dialog::lastItem().value += validclasses[land_validity(specialland).quality_level]; @@ -670,7 +670,7 @@ EX void showEuclideanMenu() { - if(euwrap || geometry == gFieldQuotient || geometry == gCrystal || archimedean || (euclid && WDIM == 3)) { + if(euwrap || geometry == gFieldQuotient || cryst || archimedean || (euclid && WDIM == 3)) { dialog::addItem(XLAT("advanced parameters"), '4'); dialog::add_action([] { if(0); @@ -679,7 +679,7 @@ EX void showEuclideanMenu() { pushScreen(arcm::show); #endif #if CAP_CRYSTAL - else if(geometry == gCrystal) + else if(cryst) pushScreen(crystal::show); #endif #if MAXMDIM == 4 @@ -774,7 +774,7 @@ EX void showEuclideanMenu() { (archimedean && sphere) ? its(isize(currentmap->allcells())) : #endif #if CAP_CRYSTAL - geometry == gCrystal ? "∞^" + its(ts/2) : + cryst ? "∞^" + its(ts/2) : #endif WDIM == 3 && bounded ? its(isize(currentmap->allcells())) : WDIM == 3 && euclid ? "∞" : diff --git a/geometry.cpp b/geometry.cpp index e7422ac6..0e0f8ece 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -885,7 +885,7 @@ EX void check_cgi() { if(geometry == gArchimedean) V("ARCM", arcm::current.symbol); - if(geometry == gCrystal) V("CRYSTAL", its(ginf[gCrystal].sides) + its(ginf[gCrystal].vertex)); + if(cryst) V("CRYSTAL", its(ginf[gCrystal].sides) + its(ginf[gCrystal].vertex)); if(binarytiling || GDIM == 3) V("WQ", its(vid.texture_step)); diff --git a/geometry2.cpp b/geometry2.cpp index 0bbbae26..128337fd 100644 --- a/geometry2.cpp +++ b/geometry2.cpp @@ -123,7 +123,7 @@ transmatrix hrmap_standard::relative_matrix(cell *c2, cell *c1, const hyperpoint h2 = h2->move(bestd); } #if CAP_CRYSTAL - else if(geometry == gCrystal) { + else if(cryst) { for(int d3=0; d3cmove(d3); if(visited.count(h3)) continue; diff --git a/graph.cpp b/graph.cpp index 1eb5031c..86a3be3c 100644 --- a/graph.cpp +++ b/graph.cpp @@ -901,7 +901,7 @@ EX bool drawItemType(eItem it, cell *c, const transmatrix& V, color_t icol, int else if(it == itCompass) { transmatrix V2; #if CAP_CRYSTAL - if(geometry == gCrystal) { + if(cryst) { if(crystal::compass_probability <= 0) return true; if(cwt.at->land == laCamelot && celldistAltRelative(cwt.at) < 0) crystal::used_compass_inside = true; V2 = V * spin(crystal::compass_angle() + M_PI); diff --git a/help.cpp b/help.cpp index 4c42fbd0..8e6a078d 100644 --- a/help.cpp +++ b/help.cpp @@ -289,7 +289,7 @@ EX string generateHelpForItem(eItem it) { string help = helptitle(XLATN(iinf[it].name), iinf[it].color); #if CAP_CRYSTAL - if(it == itCompass && geometry == gCrystal) + if(it == itCompass && cryst) help += crystal::compass_help(); else #endif @@ -680,7 +680,7 @@ string generateHelpForLand(eLand l) { } #if CAP_CRYSTAL - if(l == laCamelot && geometry == gCrystal) { + if(l == laCamelot && cryst) { if(!crystal::used_compass_inside) s += XLAT("\nSpecial conduct (still valid)\n"); else s += XLAT("\nSpecial conduct failed:\n"); diff --git a/heptagon.cpp b/heptagon.cpp index 82ca7930..c174cedf 100644 --- a/heptagon.cpp +++ b/heptagon.cpp @@ -223,7 +223,7 @@ heptagon *createStep(heptagon *h, int d) { } heptagon *hrmap_standard::create_step(heptagon *h, int d) { - if(!h->move(0) && h->s != hsOrigin && !binarytiling && (geometry != gCrystal)) { + if(!h->move(0) && h->s != hsOrigin && !binarytiling && !cryst) { // cheating: int pard=0; if(S3 == 3) diff --git a/hyper.h b/hyper.h index 98f8ebdc..d7115022 100644 --- a/hyper.h +++ b/hyper.h @@ -111,13 +111,14 @@ void addMessage(string s, char spamtype = 0); #define binarytiling (ginf[geometry].flags & qBINARY) #define archimedean (geometry == gArchimedean) +#define cryst (geometry == gCrystal) #define penrose (ginf[geometry].flags & qPENROSE) /** convenience flag for geometries with major aspects missing */ #define experimental (ginf[geometry].flags & qEXPERIMENTAL) // these geometries do not feature alternate structures for horocycles -#define eubinary (euclid || binarytiling || geometry == gCrystal || nil) +#define eubinary (euclid || binarytiling || cryst || nil) #define cgclass (ginf[geometry].cclass) #define euclid (cgclass == gcEuclid) diff --git a/hypgraph.cpp b/hypgraph.cpp index af1c1c9f..018f4896 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -1292,7 +1292,7 @@ EX void centerpc(ld aspd) { if(dual::split([=] () { centerpc(aspd); })) return; #if CAP_CRYSTAL - if(geometry == gCrystal) + if(cryst) crystal::centerrug(aspd); #endif diff --git a/landgen.cpp b/landgen.cpp index 6159e3d0..4d7bcc27 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -497,7 +497,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) { c->wall = waCavewall; else c->wall = waCavefloor; } - else if(a4 || archimedean || geometry == gCrystal) + else if(a4 || archimedean || cryst) c->wall = hrand(100) < 50 ? waCavefloor : waCavewall; else if(!BITRUNCATED) { if(polarb50(c)) @@ -1661,7 +1661,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) { if(d == 7 && c->wall == waCTree && hrand_monster(GDIM == 2 ? 5000 : 50000) < 100 + items[itPirate] + yendor::hardness()) c->monst = moParrot; ONEMPTY { - if(hrand(1500) < 4 && celldistAlt(c) <= -5 && peace::on && geometry != gCrystal) + if(hrand(1500) < 4 && celldistAlt(c) <= -5 && peace::on && !cryst) c->item = itCompass; if(hrand_monster(16000) < 40 + (items[itPirate] + yendor::hardness())) c->monst = moPirate; @@ -2552,7 +2552,7 @@ EX void setdist(cell *c, int d, cell *from) { // this fixes the following problem: // http://steamcommunity.com/app/342610/discussions/0/1470840994970724215/ - if(!generatingEquidistant && from && d >= 7 && c->land && !binarytiling && !archimedean && geometry != gCrystal && WDIM == 2 && hyperbolic) { + if(!generatingEquidistant && from && d >= 7 && c->land && !binarytiling && !archimedean && !cryst && WDIM == 2 && hyperbolic) { int cdi = celldist(c); if(celldist(from) > cdi) { forCellCM(c2, c) if(celldist(c2) < cdi) { @@ -2629,7 +2629,7 @@ EX void setdist(cell *c, int d, cell *from) { if(0); else if(chaosmode > 1) ; #if CAP_CRYSTAL - else if(geometry == gCrystal) crystal::set_land(c); + else if(cryst) crystal::set_land(c); #endif #if MAXMDIM == 4 else if(euclid && WDIM == 3) euclid3::set_land(c); @@ -2716,7 +2716,7 @@ EX void setdist(cell *c, int d, cell *from) { else placeLocalOrbs(c); #if CAP_CRYSTAL - if(geometry == gCrystal && c->land != laMinefield) + if(cryst && c->land != laMinefield) crystal::may_place_compass(c); #endif } diff --git a/landlock.cpp b/landlock.cpp index 2bf58bfa..b531c6e1 100644 --- a/landlock.cpp +++ b/landlock.cpp @@ -733,7 +733,7 @@ EX land_validity_t& land_validity(eLand l) { } if(l == laBrownian) { - if(quotient || !hyperbolic || geometry == gCrystal) return dont_work; + if(quotient || !hyperbolic || cryst) return dont_work; } if(binarytiling) { @@ -753,7 +753,7 @@ EX land_validity_t& land_validity(eLand l) { #endif #if CAP_CRYSTAL - if(geometry == gCrystal) { + if(cryst) { if(l == laCamelot) return interesting; if(isCrossroads(l)) return full_game; } diff --git a/mapeditor.cpp b/mapeditor.cpp index e17fc14f..1774c184 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -146,7 +146,7 @@ namespace mapstream { } #endif #if CAP_CRYSTAL - if(geometry == gCrystal) { + if(cryst) { f.write(ginf[gCrystal].sides); if(ginf[gCrystal].sides == 8) f.write(ginf[gCrystal].vertex); @@ -293,7 +293,7 @@ namespace mapstream { torusconfig::activate(); } #if CAP_CRYSTAL - if(geometry == gCrystal && f.vernum >= 10504) { + if(cryst && f.vernum >= 10504) { int sides; f.read(sides); #if CAP_CRYSTAL diff --git a/pattern2.cpp b/pattern2.cpp index 0f500329..89a5285c 100644 --- a/pattern2.cpp +++ b/pattern2.cpp @@ -1672,7 +1672,7 @@ EX namespace patterns { if(archimedean) dialog::addSelItem(XLAT("Archimedean"), "Archimedean", 'A'); - if(geometry == gCrystal) + if(cryst) dialog::addSelItem(XLAT("Crystal coordinates"), "Crystal", 'K'); dialog::addSelItem(XLAT("sides"), "sides", 'B'); diff --git a/racing.cpp b/racing.cpp index 1f4950ff..83d7371c 100644 --- a/racing.cpp +++ b/racing.cpp @@ -198,14 +198,14 @@ bool bad(cell *c2, cell *c) { int rcelldist(cell *c) { #if CAP_CRYSTAL - if(geometry == gCrystal) return crystal::space_distance(c, currentmap->gamestart()); + if(cryst) return crystal::space_distance(c, currentmap->gamestart()); #endif return celldist(c); } int pcelldist(cell *c) { #if CAP_CRYSTAL - if(geometry == gCrystal) return crystal::precise_distance(c, currentmap->gamestart()); + if(cryst) return crystal::precise_distance(c, currentmap->gamestart()); #endif return celldist(c); } @@ -1336,7 +1336,7 @@ void markers() { if(cd != DISTANCE_UNKNOWN) queuestr(H, vid.fsize, #if CAP_CRYSTAL - (geometry == gCrystal && !crystal::pure()) ? fts(crystal::space_distance(cwt.at, track.back())) : + (cryst && !crystal::pure()) ? fts(crystal::space_distance(cwt.at, track.back())) : #endif its(cd), 0x10101 * int(128 - 100 * sintick(150))); addauraspecial(H, 0xFFD500, 0); diff --git a/rug.cpp b/rug.cpp index 57c3f214..2607fd88 100644 --- a/rug.cpp +++ b/rug.cpp @@ -1509,7 +1509,7 @@ EX void init_model() { err_zero_current = err_zero; #if CAP_CRYSTAL - if(geometry == gCrystal && surface::sh == surface::dsNone) { + if(cryst && surface::sh == surface::dsNone) { surface::sh = surface::dsCrystal; crystal::init_rotation(); good_shape = true; diff --git a/system.cpp b/system.cpp index f40462a0..6f22e850 100644 --- a/system.cpp +++ b/system.cpp @@ -1198,7 +1198,7 @@ EX void set_variation(eVariation target) { stop_game(); if(euclid6 || binarytiling || sol || penrose) geometry = gNormal; auto& cd = ginf[gCrystal]; - if(target == eVariation::bitruncated && geometry == gCrystal && cd.sides == 8 && cd.vertex == 4) { + if(target == eVariation::bitruncated && cryst && cd.sides == 8 && cd.vertex == 4) { cd.vertex = 3; cd.tiling_name = "{8,3}"; target = eVariation::pure; diff --git a/yendor.cpp b/yendor.cpp index 04a28872..e8f6dabc 100644 --- a/yendor.cpp +++ b/yendor.cpp @@ -1144,7 +1144,7 @@ modecode_t modecode() { #endif #if CAP_CRYSTAL - if(geometry == gCrystal) { + if(cryst) { mct += ll(ginf[geometry].sides) << 29; mct += ll(ginf[geometry].vertex) << 37; }