[Freeciv-Dev] (PR#6652) don't make poles for a N-S-wrapping map
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
When the map wraps N-S, the map generator shouldn't generally make
poles. For instance with current CVS, if you "/set topology 3" you'll
get some rather arbitrary polar areas.
Originally I just wanted to disable poles when topo_has_flag(TF_WRAPY).
But Ross wants this to be a server variable. So in this patch I add a
"haspoles" server variable with three values. The default value should
give the desired behavior in (almost?) all cases.
For instance with this patch and
set topology 3
set xsize 60
set ysize 60
you can get a nicely formed torus map (using whatever generator you prefer).
jason
Index: common/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.161
diff -u -r1.161 map.h
--- common/map.h 2003/10/27 14:25:24 1.161
+++ common/map.h 2003/10/27 19:44:34
@@ -169,6 +169,7 @@
int riverlength;
int forestsize;
int generator;
+ int has_poles;
bool tinyisles;
bool separatepoles;
int num_start_positions;
@@ -664,6 +665,10 @@
#define MAP_DEFAULT_TOPO TF_WRAPX
#define MAP_MIN_TOPO 0
#define MAP_MAX_TOPO 3
+
+#define MAP_DEFAULT_HASPOLES 0
+#define MAP_MIN_HASPOLES 0
+#define MAP_MAX_HASPOLES 2
#define MAP_DEFAULT_SEED 0
#define MAP_MIN_SEED 0
Index: server/mapgen.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/mapgen.c,v
retrieving revision 1.119
diff -u -r1.119 mapgen.c
--- server/mapgen.c 2003/10/21 22:04:53 1.119
+++ server/mapgen.c 2003/10/27 19:44:34
@@ -59,6 +59,7 @@
static int *height_map;
static int maxval=0;
static int forests=0;
+static bool has_poles;
struct isledata {
int goodies;
@@ -854,7 +855,7 @@
tres*=9;
tres/=10;
} while (abs(total-count)> maxval/40);
- if (map.separatepoles) {
+ if (map.separatepoles && has_poles) {
make_passable();
}
make_mountains(maxval*8/10);
@@ -862,7 +863,9 @@
make_swamps();
make_deserts();
make_plains();
- make_polar();
+ if (has_poles) {
+ make_polar();
+ }
make_fair();
make_rivers();
}
@@ -970,7 +973,7 @@
islands = fc_calloc((map.num_continents + 1), sizeof(struct isledata));
/* the arctic and the antarctic are continents 1 and 2 for generator > 0 */
- if ((map.generator > 0) && map.separatepoles) {
+ if ((map.generator > 0) && map.separatepoles && has_poles) {
firstcont = 3;
} else {
firstcont = 1;
@@ -1154,6 +1157,8 @@
map.seed = (myrand(MAX_UINT32) ^ time(NULL)) & (MAX_UINT32 >> 1);
mysrand(map.seed);
+ has_poles = ((map.has_poles == 0 && !topo_has_flag(TF_WRAPY))
+ || map.has_poles == 2);
/* don't generate tiles with mapgen==0 as we've loaded them from file */
/* also, don't delete (the handcrafted!) tiny islands in a scenario */
@@ -2140,7 +2145,7 @@
for (y = 0; y < ydiv2; y++) {
hmap(0, y * ymax / ydiv) -= avoidedge;
hmap(xmax, y * ymax / ydiv) -= avoidedge;
- if (map.separatepoles) {
+ if (map.separatepoles && has_poles) {
hmap(2, y * ymax / ydiv) = hmap(0, y * ymax / ydiv)
- myrand(3*avoidedge);
hmap(xmax - 2, y * ymax / ydiv)
@@ -2153,7 +2158,7 @@
for (x = 0; x < xdiv2; x++) {
hmap(x * xmax / xdiv, 0) -= avoidedge;
hmap(x * xmax / xdiv, ymax) -= avoidedge;
- if (map.separatepoles){
+ if (map.separatepoles && has_poles) {
hmap(x * xmax / xdiv, 2) = hmap(x * xmax / xdiv, 0)
- myrand(3*avoidedge);
hmap(x * xmax / xdiv, ymax - 2)
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.300
diff -u -r1.300 stdinhand.c
--- server/stdinhand.c 2003/10/27 14:25:25 1.300
+++ server/stdinhand.c 2003/10/27 19:44:35
@@ -267,6 +267,13 @@
"(Zero indicates a scenario map.)"), NULL,
MAP_MIN_GENERATOR, MAP_MAX_GENERATOR, MAP_DEFAULT_GENERATOR)
+ GEN_INT("haspoles", map.has_poles, SSET_MAP_GEN, SSET_TO_CLIENT,
+ N_("Whether the map has polar regions"),
+ N_(" 0 = only if the map doesn't wrap north-south;\n"
+ " 1 = never;\n"
+ " 2 = always"), NULL,
+ MAP_MIN_HASPOLES, MAP_MAX_HASPOLES, MAP_DEFAULT_HASPOLES)
+
GEN_BOOL("tinyisles", map.tinyisles, SSET_MAP_GEN, SSET_TO_CLIENT,
N_("Presence or absence of 1x1 islands"),
N_("0 = no 1x1 islands; 1 = some 1x1 islands"), NULL,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#6652) don't make poles for a N-S-wrapping map,
Jason Short <=
|
|