Restore the ability to use default biomes (without file)

Restore the ability to use default biomes (without file)

Return to topic list

Wed Jul 10 12:10:57 2024   by   Mizuki
In the latest version, it is no longer possible to use the embedded biomes color file, because
    if (NULL == (colfile = fopen(biocolorsname, "r")))
      {
fprintf(stderr, "Cannot open %s\n", biocolorsname);
exit(1);
      }
is always called even if you only specify -z. So default.bio is now always required, even when we have already set the default color right above that code.

This patch aims to restore the ability to generate biomes using the builtin colors in the code, by creating a new variable "biomesFromFile", setting it to 1 if and only if -Z is called (so you *do* want a custom palette), and restricting the above biomes color file checking-if-exist code to only run if the variable is true.

@@ -231,2 +231,3 @@
int makeBiomes = 0; /* if 1, make biome map */
+int biomesFromFile = 0;

@@ -365,2 +366,4 @@
        case 'Z' : sscanf(av[++i],"%255[\n]",biocolorsname);
+                  biomesFromFile = 1;
+                  makeBiomes = 1;
                    break;
@@ -896,2 +899,3 @@

+  if (biomesFromFile == 1) {
    if (NULL == (colfile = fopen(biocolorsname, "r")))
@@ -916,2 +920,3 @@
      }
+    }
  }

or at: https://hastebin.com/share/atimonulim.diff to prevent this forum from screwing up code symbols (like the caret)
 
Thu Jul 11 11:54:44 2024   by   Torben
I found another (simpler) solution to this, but I can not access the web server from where I am now (on holiday), so I will update the files when I get back.

In the meantime, you can just make sure the file default.bio is available from where you run the program.
 
Mon Jul 22 14:49:30 2024   by   Torben
New version now uploaded.
 
Sat Jul 27 05:30:52 2024   by   Mizuki
it seems your solution will simply fallback to default biomes palette if you specify a non-existent biome color file, without warning.
 

Return to topic list



New message:
Topic:
Posted by:

Type the values of the dice shown below:

Return to topic list