mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	fixed the Camelot volume computation for bitruncated half-dimension
This commit is contained in:
		
							
								
								
									
										11
									
								
								crystal.cpp
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								crystal.cpp
									
									
									
									
									
								
							| @@ -553,7 +553,7 @@ int dist_relative(cell *c) { | |||||||
|   int r = roundTableRadius(NULL); |   int r = roundTableRadius(NULL); | ||||||
|   cell *start = m->gamestart(); |   cell *start = m->gamestart(); | ||||||
|   if(!cc) { |   if(!cc) { | ||||||
|     printf("Finding Camelot center..."); |     println(hlog, "Finding Camelot center..."); | ||||||
|     cc = start; |     cc = start; | ||||||
|     while(precise_distance(cc, start) < r + 5) |     while(precise_distance(cc, start) < r + 5) | ||||||
|       cc = cc->cmove(hrand(cc->type)); |       cc = cc->cmove(hrand(cc->type)); | ||||||
| @@ -944,7 +944,6 @@ shift_data shift_data_zero; | |||||||
| string get_table_volume() { | string get_table_volume() { | ||||||
|   if(!pure()) { |   if(!pure()) { | ||||||
|     auto m = crystal_map(); |     auto m = crystal_map(); | ||||||
|     m->prepare_east(); |  | ||||||
|     bignum res; |     bignum res; | ||||||
|     manual_celllister cl; |     manual_celllister cl; | ||||||
|     cl.add(m->gamestart()); |     cl.add(m->gamestart()); | ||||||
| @@ -959,9 +958,14 @@ string get_table_volume() { | |||||||
|         } |         } | ||||||
|       static const ld eps = 1e-4; |       static const ld eps = 1e-4; | ||||||
|       if(mincoord >= 0-eps && maxcoord < 4-eps) { |       if(mincoord >= 0-eps && maxcoord < 4-eps) { | ||||||
|  |         ld my_rad2 = rad2; | ||||||
|         auto cshift = (co - m->camelot_coord) / 4; |         auto cshift = (co - m->camelot_coord) / 4; | ||||||
|         auto sd = &shift_data_zero; |         auto sd = &shift_data_zero; | ||||||
|         for(int i=0; i<m->cs.dim; i++) { |         for(int i=0; i<m->cs.dim; i++) { | ||||||
|  |           if(i == m->cs.dim-1 && (m->cs.dir&1)) { | ||||||
|  |             my_rad2 -= pow(cshift[i] / m->camelot_mul, 2); | ||||||
|  |             } | ||||||
|  |           else { | ||||||
|             ld val = cshift[i] - floor(cshift[i]); |             ld val = cshift[i] - floor(cshift[i]); | ||||||
|             if(!sd->children.count(val)) { |             if(!sd->children.count(val)) { | ||||||
|               sd->children[val].parent = sd; |               sd->children[val].parent = sd; | ||||||
| @@ -969,7 +973,8 @@ string get_table_volume() { | |||||||
|               } |               } | ||||||
|             sd = &sd->children[val]; |             sd = &sd->children[val]; | ||||||
|             } |             } | ||||||
|         res.addmul(sd->compute(rad2), 1); |           } | ||||||
|  |         res.addmul(sd->compute(my_rad2), 1); | ||||||
|         } |         } | ||||||
|       if(mincoord < -2 || maxcoord > 6) continue; |       if(mincoord < -2 || maxcoord > 6) continue; | ||||||
|       forCellCM(c2, c) cl.add(c2); |       forCellCM(c2, c) cl.add(c2); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue