mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	clearing:: fixed some bugs when reached too far into the center
This commit is contained in:
		| @@ -914,7 +914,7 @@ EX namespace clearing { | |||||||
|       // printf("R %4d C %4d\n", celldistAlt(bd.root), celldistAlt(c)); |       // printf("R %4d C %4d\n", celldistAlt(bd.root), celldistAlt(c)); | ||||||
|       if(celldistAlt(c) > celldistAlt(bd.root)) { |       if(celldistAlt(c) > celldistAlt(bd.root)) { | ||||||
|         stepcount++; |         stepcount++; | ||||||
|         if(stepcount > 1000) { |         if(stepcount > 100000000) { | ||||||
|           printf("buggy #1\n"); |           printf("buggy #1\n"); | ||||||
|           return; |           return; | ||||||
|           } |           } | ||||||
| @@ -933,7 +933,7 @@ EX namespace clearing { | |||||||
|         } |         } | ||||||
|       else { |       else { | ||||||
|         bd.dist--; |         bd.dist--; | ||||||
|         if(bd.dist < -1000) {  |         if(bd.dist < -100000000) {  | ||||||
|           for(int i=0; i<steps; i++)  |           for(int i=0; i<steps; i++)  | ||||||
|             onpath[i]->item = itBuggy; |             onpath[i]->item = itBuggy; | ||||||
|           for(int i=0; i<(int) rpath.size(); i++)  |           for(int i=0; i<(int) rpath.size(); i++)  | ||||||
|   | |||||||
| @@ -237,7 +237,7 @@ heptagon *hrmap_standard::create_step(heptagon *h, int d) { | |||||||
|       pard = 3; // to do: randomize |       pard = 3; // to do: randomize | ||||||
|     else if(S3 == 4) |     else if(S3 == 4) | ||||||
|       pard = 3; |       pard = 3; | ||||||
|     buildHeptagon(h, 0, h->distance < -10000 ? hsOrigin : hsA, pard); |     buildHeptagon(h, 0, h->distance < -32500 ? hsOrigin : hsA, pard); | ||||||
|     } |     } | ||||||
|   if(h->move(d)) return h->move(d); |   if(h->move(d)) return h->move(d); | ||||||
|   if(h->s == hsOrigin) { |   if(h->s == hsOrigin) { | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								hud.cpp
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								hud.cpp
									
									
									
									
									
								
							| @@ -255,14 +255,8 @@ bool displayglyph(int cx, int cy, int buttonsize, char glyph, color_t color, int | |||||||
|     buttonsize / 3; |     buttonsize / 3; | ||||||
|  |  | ||||||
|   if(id == moMutant + ittypes && clearing::imputed.nonzero()) { |   if(id == moMutant + ittypes && clearing::imputed.nonzero()) { | ||||||
|     ld d = qty + clearing::imputed.approx_ld(); |     bignum bn = clearing::imputed + qty; | ||||||
|     if(d < 100000) str = its(int(d)); |     str = short_form(bn); | ||||||
|     else { |  | ||||||
|       int digits = 0; |  | ||||||
|       while(d >= 10) digits++, d /= 10; |  | ||||||
|       str = its(int(d*100)) + "E" + its(digits); |  | ||||||
|       str.insert(1, "."); |  | ||||||
|       } |  | ||||||
|     bsize = buttonsize / 4; |     bsize = buttonsize / 4; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										23
									
								
								util.cpp
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								util.cpp
									
									
									
									
									
								
							| @@ -514,6 +514,29 @@ string bignum::get_str(int max_length) const { | |||||||
|   return ret; |   return ret; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | EX string short_form(bignum b) { | ||||||
|  |   if(b < 0) return "-" + short_form(0-b); | ||||||
|  |   else if(b < 100000) return its(b.approx_int()); | ||||||
|  |   else { | ||||||
|  |     long long val; | ||||||
|  |     int q; | ||||||
|  |     if(isize(b.digits) >= 2) { | ||||||
|  |       q = max(isize(b.digits) - 2, 0); | ||||||
|  |       val = b.digits[q] + (long long)(bignum::BASE) * b.digits[q+1]; | ||||||
|  |       } | ||||||
|  |     else { | ||||||
|  |       q = 0; | ||||||
|  |       val = b.digits[0]; | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |     int digits = q * 9; | ||||||
|  |     while(val >= 1000) { val /= 10; digits++; } | ||||||
|  |     string str = its(val) + "E" + its(digits + 2); | ||||||
|  |     str.insert(1, "."); | ||||||
|  |     return str; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
| bignum::bignum(ld d) { | bignum::bignum(ld d) { | ||||||
|   if(d == 0) return; |   if(d == 0) return; | ||||||
|   int n = 1; |   int n = 1; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue