mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-30 21:42:59 +00:00 
			
		
		
		
	Prune table of getNewLand() candidates.
This commit is contained in:
		
							
								
								
									
										22
									
								
								landlock.cpp
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								landlock.cpp
									
									
									
									
									
								
							| @@ -675,14 +675,22 @@ EX eLand getNewLand(eLand old) { | |||||||
|  |  | ||||||
|   if(ls::horodisk_structure() && tortoise::seek()) LIKELY tab[cnt++] = laTortoise; |   if(ls::horodisk_structure() && tortoise::seek()) LIKELY tab[cnt++] = laTortoise; | ||||||
|    |    | ||||||
|   int attempts = 0; |   printf("Before pruning: %d entries\n", cnt); | ||||||
|   eLand n = old; |   int idx = 0; | ||||||
|   while(incompatible(n, old) || !isLandIngame(n)) { |   while (idx < cnt) { | ||||||
|     n = tab[hrand(cnt)]; |     eLand n = tab[idx]; | ||||||
|     if(weirdhyperbolic && specialland == laCrossroads4 && isCrossroads(n)) |     if (incompatible(n, old) || !isLandIngame(n)) | ||||||
|       n = laCrossroads4; |       tab[idx] = tab[--cnt]; | ||||||
|     attempts++; if(attempts == 2000) break; |     else | ||||||
|  |       idx++; | ||||||
|     } |     } | ||||||
|  |   printf("After pruning: %d entries\n", cnt); | ||||||
|  |  | ||||||
|  |   eLand n = tab[hrand(cnt)]; | ||||||
|  |   if (weirdhyperbolic && specialland == laCrossroads4 && isCrossroads(n)) | ||||||
|  |     n = laCrossroads4; | ||||||
|  |  | ||||||
|  |   //printf("Took %d attempts.\n", attempts); | ||||||
|    |    | ||||||
|   return n;   |   return n;   | ||||||
|   } |   } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jacob Mandelson
					Jacob Mandelson