mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-10-31 19:36:16 +00:00
improved tryagain -- more tries if necessary, less tries if not
This commit is contained in:
parent
17a1682e83
commit
c25e1dbdd1
@ -3063,6 +3063,7 @@ namespace windmap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int tries = 0;
|
int tries = 0;
|
||||||
|
int maxtries = specialland == laVolcano || specialland == laWhirlwind || chaosmode ? 20 : 1;
|
||||||
tryagain:
|
tryagain:
|
||||||
|
|
||||||
for(int i=0; i<N; i++) windcodes[i] = hrand(256);
|
for(int i=0; i<N; i++) windcodes[i] = hrand(256);
|
||||||
@ -3099,13 +3100,12 @@ namespace windmap {
|
|||||||
for(int i=0; i<N; i++) ingroup[windcodes[i] >> 6]++;
|
for(int i=0; i<N; i++) ingroup[windcodes[i] >> 6]++;
|
||||||
for(int u=0; u<4; u++) if(!ingroup[u]) {
|
for(int u=0; u<4; u++) if(!ingroup[u]) {
|
||||||
tries++;
|
tries++;
|
||||||
if(tries < 5) goto tryagain;
|
if(tries < maxtries) goto tryagain;
|
||||||
}
|
}
|
||||||
if(tries >= 5) {
|
if(tries >= maxtries && maxtries >= 20) {
|
||||||
addMessage("Failed to generate an interesting wind/lava pattern.");
|
addMessage("Failed to generate an interesting wind/lava pattern.");
|
||||||
}
|
}
|
||||||
|
else if(false) {
|
||||||
if(true) {
|
|
||||||
printf("tocheck size = %d\n", size(tocheck));
|
printf("tocheck size = %d\n", size(tocheck));
|
||||||
printf("if(N == %d) {\n", N);
|
printf("if(N == %d) {\n", N);
|
||||||
printf(" windcodes = {");
|
printf(" windcodes = {");
|
||||||
|
Loading…
Reference in New Issue
Block a user