mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	product:: big stuff
This commit is contained in:
		| @@ -31,12 +31,13 @@ EX bool checkBarriersFront(cellwalker bb, int q IS(5), bool cross IS(false)) { | |||||||
|   return checkBarriersBack(bb, q); |   return checkBarriersBack(bb, q); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | /** return true if the cell c is not allowed to generate barriers because of other large things already existing nearby. */ | ||||||
| EX bool hasbardir(cell *c) { | EX bool hasbardir(cell *c) { | ||||||
|   return c->bardir != NODIR && c->bardir != NOBARRIERS; |   return c->bardir != NODIR && c->bardir != NOBARRIERS; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| /** return true if the cell c is not allowed to generate barriers because of other large things already existing nearby. */ |  | ||||||
| EX void preventbarriers(cell *c) { | EX void preventbarriers(cell *c) { | ||||||
|  |   if(prod) c = product::get_where(c).first; | ||||||
|   if(c && c->bardir == NODIR) c->bardir = NOBARRIERS; |   if(c && c->bardir == NODIR) c->bardir = NOBARRIERS; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										32
									
								
								bigstuff.cpp
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								bigstuff.cpp
									
									
									
									
									
								
							| @@ -132,6 +132,7 @@ EX bool grailWasFound(cell *c) { | |||||||
|   } |   } | ||||||
|  |  | ||||||
| void hrmap::generateAlts(heptagon *h, int levs, bool link_cdata) { | void hrmap::generateAlts(heptagon *h, int levs, bool link_cdata) { | ||||||
|  |   if(prod) { product::in_underlying_map([&] { generateAlts(h, levs, link_cdata); }); } | ||||||
|   if(!h->alt) return; |   if(!h->alt) return; | ||||||
|   preventbarriers(h->c7); |   preventbarriers(h->c7); | ||||||
|   if(h->c7) forCellEx(c2, h->c7) preventbarriers(c2); |   if(h->c7) forCellEx(c2, h->c7) preventbarriers(c2); | ||||||
| @@ -182,6 +183,13 @@ void hrmap::generateAlts(heptagon *h, int levs, bool link_cdata) { | |||||||
|  |  | ||||||
| EX heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special IS(0)) { | EX heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special IS(0)) { | ||||||
|  |  | ||||||
|  |   if(prod) { | ||||||
|  |     c = product::get_where(c).first; | ||||||
|  |     heptagon *res; | ||||||
|  |     product::in_underlying_map([&] { res = createAlternateMap(c, rad, firststate, special); }); | ||||||
|  |     return res; | ||||||
|  |     } | ||||||
|  |  | ||||||
|   // check for direction |   // check for direction | ||||||
|   int gdir = -1; |   int gdir = -1; | ||||||
|   for(int i=0; i<c->type; i++) { |   for(int i=0; i<c->type; i++) { | ||||||
| @@ -969,6 +977,16 @@ EX void setLandSol(cell *c) { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | EX void setLandProduct(cell *c) { | ||||||
|  |   auto wc = product::get_where(c).first; | ||||||
|  |   c->barleft = wc->barleft; | ||||||
|  |   c->barright = wc->barright; | ||||||
|  |   c->bardir = wc->bardir; | ||||||
|  |   if(wc->land) setland(c, wc->land); | ||||||
|  |   if(among(wc->wall, waBarrier, waMercury) || wc->land == laElementalWall) | ||||||
|  |     c->wall = wc->wall; | ||||||
|  |   } | ||||||
|  |  | ||||||
| EX void setLandNil(cell *c) { | EX void setLandNil(cell *c) { | ||||||
|   setland(c, specialland); |   setland(c, specialland); | ||||||
|    |    | ||||||
| @@ -1257,9 +1275,9 @@ EX int wallchance(cell *c, bool deepOcean) { | |||||||
|     50; |     50; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| EX bool horo_ok() { | /** should we generate the horocycles in the current geometry? */ | ||||||
|   // do the horocycles work in the current geometry? | EX bool horo_ok() {   | ||||||
|   return hyperbolic && !binarytiling && !archimedean && !penrose && !experimental; |   return hyperbolic && !binarytiling && !archimedean && !penrose && !experimental && !prod; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| EX bool gp_wall_test() { | EX bool gp_wall_test() { | ||||||
| @@ -1317,7 +1335,9 @@ EX void buildBigStuff(cell *c, cell *from) { | |||||||
|    |    | ||||||
|   // buildgreatwalls |   // buildgreatwalls | ||||||
|    |    | ||||||
|   if(geometry == gNormal && celldist(c) < 3 && !GOLDBERG) { |   if(prod) ;  /* Great Walls generated via the underlying geometry */ | ||||||
|  |    | ||||||
|  |   else if(geometry == gNormal && celldist(c) < 3 && !GOLDBERG) { | ||||||
|     if(top_land && c == cwt.at->master->move(3)->c7) { |     if(top_land && c == cwt.at->master->move(3)->c7) { | ||||||
|       buildBarrierStrong(c, 6, true, top_land); |       buildBarrierStrong(c, 6, true, top_land); | ||||||
|       } |       } | ||||||
| @@ -1645,6 +1665,10 @@ EX void moreBigStuff(cell *c) { | |||||||
|         else if(geometry == gKiteDart3) { |         else if(geometry == gKiteDart3) { | ||||||
|           if(kite::getshape(c->master) == kite::pKite) c->wall = waColumn; |           if(kite::getshape(c->master) == kite::pKite) c->wall = waColumn; | ||||||
|           } |           } | ||||||
|  |         else if(prod) { | ||||||
|  |           auto d = product::get_where(c); | ||||||
|  |           if(d.first->wall == waColumn || (d.second&1)) c->wall = waColumn; | ||||||
|  |           } | ||||||
|         else if(WDIM == 3) { |         else if(WDIM == 3) { | ||||||
|           if(c->master->zebraval != 1) c->wall = waColumn; |           if(c->master->zebraval != 1) c->wall = waColumn; | ||||||
|           } |           } | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								cell.cpp
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								cell.cpp
									
									
									
									
									
								
							| @@ -448,6 +448,7 @@ EX int compdist(int dx[]) { | |||||||
|  |  | ||||||
| EX int celldist(cell *c) { | EX int celldist(cell *c) { | ||||||
|   if(experimental) return 0; |   if(experimental) return 0; | ||||||
|  |   if(prod) { auto w = product::get_where(c); return PIU(celldist(w.first)) + abs(w.second); } | ||||||
|   if(fulltorus && WDIM == 2)  |   if(fulltorus && WDIM == 2)  | ||||||
|     return torusmap()->dists[decodeId(c->master)]; |     return torusmap()->dists[decodeId(c->master)]; | ||||||
|   if(nil) return DISTANCE_UNKNOWN; |   if(nil) return DISTANCE_UNKNOWN; | ||||||
| @@ -478,6 +479,7 @@ static const int ALTDIST_ERROR = 90000; | |||||||
|  |  | ||||||
| EX int celldistAlt(cell *c) { | EX int celldistAlt(cell *c) { | ||||||
|   if(experimental) return 0; |   if(experimental) return 0; | ||||||
|  |   if(prod) { auto w = product::get_where(c); return PIU(celldistAlt(w.first)) + abs(w.second); } | ||||||
|   if(masterless) { |   if(masterless) { | ||||||
|     if(fulltorus) return celldist(c); |     if(fulltorus) return celldist(c); | ||||||
|     if(euwrap) return cylinder_alt(c); |     if(euwrap) return cylinder_alt(c); | ||||||
| @@ -981,6 +983,8 @@ EX cell *random_in_distance(cell *c, int d) { | |||||||
|   } |   } | ||||||
|  |  | ||||||
| EX int celldistance(cell *c1, cell *c2) { | EX int celldistance(cell *c1, cell *c2) { | ||||||
|  |  | ||||||
|  |   if(prod) { auto w1 = product::get_where(c1), w2 = product::get_where(c2); return PIU(celldistance(w1.first, w2.first) + abs(w1.second - w2.second)); } | ||||||
|    |    | ||||||
|   if((masterless) && (euclid6 || (euclid4 && PURE))) { |   if((masterless) && (euclid6 || (euclid4 && PURE))) { | ||||||
|     if(!euwrap) |     if(!euwrap) | ||||||
|   | |||||||
| @@ -2549,6 +2549,13 @@ EX void setdist(cell *c, int d, cell *from) { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|   if(d <= 10 - getDistLimit()) lastexplore = shmup::on ? shmup::curtime : turncount; |   if(d <= 10 - getDistLimit()) lastexplore = shmup::on ? shmup::curtime : turncount; | ||||||
|  |    | ||||||
|  |   if(prod) { | ||||||
|  |     auto wc = product::get_where(c).first; | ||||||
|  |     auto wf = from ? product::get_where(from).first : NULL; | ||||||
|  |     if(c->land && !wc->land) wc->land = c->land; | ||||||
|  |     product::in_underlying_map([&] { setdist(wc, d, wf); }); | ||||||
|  |     } | ||||||
|  |  | ||||||
|   if(buggyGeneration) { |   if(buggyGeneration) { | ||||||
|     if(d < BARLEV) for(int i=0; i<c->type; i++) { |     if(d < BARLEV) for(int i=0; i<c->type; i++) { | ||||||
| @@ -2612,6 +2619,7 @@ EX void setdist(cell *c, int d, cell *from) { | |||||||
|       #if MAXMDIM == 4 |       #if MAXMDIM == 4 | ||||||
|       else if(euclid && WDIM == 3) euclid3::set_land(c); |       else if(euclid && WDIM == 3) euclid3::set_land(c); | ||||||
|       #endif |       #endif | ||||||
|  |       else if(prod) setLandProduct(c); | ||||||
|       else if(sphere || fulltorus) setLandSphere(c); |       else if(sphere || fulltorus) setLandSphere(c); | ||||||
|       else if(euclid) setLandEuclid(c); |       else if(euclid) setLandEuclid(c); | ||||||
|       else if(quotient) { setland(c, specialland); setLandQuotient(c); } |       else if(quotient) { setland(c, specialland); setLandQuotient(c); } | ||||||
|   | |||||||
| @@ -554,7 +554,6 @@ EX namespace product { | |||||||
|     geometry = gProduct; |     geometry = gProduct; | ||||||
|     ginf[gProduct] = ginf[underlying]; |     ginf[gProduct] = ginf[underlying]; | ||||||
|     ginf[gProduct].cclass = gcProduct; |     ginf[gProduct].cclass = gcProduct; | ||||||
|     ginf[gProduct].flags |= qEXPERIMENTAL; |  | ||||||
|     pmodel = mdPerspective; |     pmodel = mdPerspective; | ||||||
|     } |     } | ||||||
|    |    | ||||||
|   | |||||||
| @@ -372,6 +372,7 @@ EX pair<int, bool> fieldval(cell *c) { | |||||||
|  |  | ||||||
| EX int fieldval_uniq(cell *c) { | EX int fieldval_uniq(cell *c) { | ||||||
|   if(experimental) return 0; |   if(experimental) return 0; | ||||||
|  |   else if(prod) { auto c1 = product::get_where(c).first; return PIU(fieldval_uniq(c1)); } | ||||||
|   else if(sphere) { |   else if(sphere) { | ||||||
|     if(archimedean) return c->master->fiftyval; |     if(archimedean) return c->master->fiftyval; | ||||||
|     #if CAP_IRR |     #if CAP_IRR | ||||||
| @@ -1362,6 +1363,7 @@ EX bool pseudohept(cell *c) { | |||||||
|   #if CAP_IRR |   #if CAP_IRR | ||||||
|   if(IRREGULAR) return irr::pseudohept(c); |   if(IRREGULAR) return irr::pseudohept(c); | ||||||
|   #endif |   #endif | ||||||
|  |   if(prod) { auto d = product::get_where(c); return (d.second & 1) && PIU(pseudohept(d.first)); } | ||||||
|   #if CAP_BT |   #if CAP_BT | ||||||
|   if(nil) return c->master->zebraval & c->master->emeraldval & c->master->fieldval & 1; |   if(nil) return c->master->zebraval & c->master->emeraldval & c->master->fieldval & 1; | ||||||
|   if(sol) return (c->master->emeraldval % 3 == 2) && (c->master->zebraval % 3 == 2) && (c->master->distance % 2); |   if(sol) return (c->master->emeraldval % 3 == 2) && (c->master->zebraval % 3 == 2) && (c->master->distance % 2); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue