[Freeciv-Dev] (PR#9876) PATCH temperature parameters for Earth like gene
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://RT::WebBaseURL.not.configured:80/Ticket/Display.html?id=9876 >
UPDATED
This patch do Earth like maps, this are based on a simplified view of
hitory of Earth.
in Dinosaurus time, all the planets was tropical, temperature = 100
20000 year befor ago, a big part of planet was frized, temperature = 0
today is the temperate value temperature = 50
Marcelo
diff -ruN -Xfreeciv/diff_ignore freeciv_improved/common/map.c
freeciv_/common/map.c
--- freeciv_improved/common/map.c 2004-08-31 09:01:26.648590496 +0200
+++ freeciv_/common/map.c 2004-08-31 10:47:44.593995416 +0200
@@ -206,7 +206,8 @@
map.generator = MAP_DEFAULT_GENERATOR;
map.tinyisles = MAP_DEFAULT_TINYISLES;
map.separatepoles = MAP_DEFAULT_SEPARATE_POLES;
- map.alltemperate = MAP_DEFAULT_ALLTEMPERATE;
+ map.alltemperate = MAP_DEFAULT_ALLTEMPERATE;
+ map.temperature = MAP_DEFAULT_TEMPERATURE;
map.tiles = NULL;
map.num_continents = 0;
map.num_oceans = 0;
diff -ruN -Xfreeciv/diff_ignore freeciv_improved/common/map.h
freeciv_/common/map.h
--- freeciv_improved/common/map.h 2004-08-31 09:01:26.648590496 +0200
+++ freeciv_/common/map.h 2004-08-31 10:47:44.597994808 +0200
@@ -173,6 +173,7 @@
bool tinyisles;
bool separatepoles;
bool alltemperate;
+ int temperature;
int num_start_positions;
bool have_specials;
bool have_huts;
@@ -677,6 +678,9 @@
#define MAP_MIN_ALLTEMPERATE FALSE
#define MAP_MAX_ALLTEMPERATE TRUE
+#define MAP_DEFAULT_TEMPERATURE 50
+#define MAP_MIN_TEMPERATURE 0
+#define MAP_MAX_TEMPERATURE 100
/*
* Inline function definitions. These are at the bottom because they may use
diff -ruN -Xfreeciv/diff_ignore freeciv_improved/server/mapgen.c
freeciv_/server/mapgen.c
--- freeciv_improved/server/mapgen.c 2004-08-31 10:47:15.497418768 +0200
+++ freeciv_/server/mapgen.c 2004-08-31 11:47:18.489680688 +0200
@@ -110,19 +110,30 @@
and a dry region, this last one can ovelap others
DRY_MIN_LEVEL- DRY_MAX_LEVEL
+
+ if all temperate: no poles, dessert on all the map, all is temperate,
+ some TROPICAL or COLD terrains can be placed anyway
*/
-#define COLD_LEVEL (10 * MAX_TEMP / 100)
-#define TROPICAL_LEVEL (70 * MAX_TEMP / 100)
-#define DRY_MIN_LEVEL (65 * MAX_TEMP / 100)
-#define DRY_MAX_LEVEL (80 * MAX_TEMP / 100)
+#define COLD_LEVEL \
+ (MAX(0, MAX_TEMP * (60*7 - map.temperature * 6 ) / 700))
+#define TROPICAL_LEVEL\
+ (MIN(MAX_TEMP, MAX_TEMP * (143*7 - map.temperature * 10) / 700))
+#define DRY_MIN_LEVEL (MAX_TEMP * (7300 - map.temperature * 18 ) / 10000)
+#define DRY_MAX_LEVEL (MAX_TEMP * (7300 + map.temperature * 17 ) / 10000)
/* used to create the poles and for separating them. In a
* mercator projection map we don't want the poles to be too big. */
#define ICE_BASE_LEVEL \
((!topo_has_flag(TF_WRAPX) || !topo_has_flag(TF_WRAPY)) \
- /* 5% for little maps; 2% for big ones */ \
- ? MAX_TEMP * (3 + 2 * SQSIZE) / (100 * SQSIZE) \
- : COLD_LEVEL / 2 /* for all maps */)
+ /* 5% for little maps; 2% for big ones, if map.temperature == 50 */\
+ ? (MAX(0, 100 * COLD_LEVEL / 3 - 2 * MAX_TEMP) + 2 * MAX_TEMP * SQSIZE)\
+ / (100 * SQSIZE) \
+ : COLD_LEVEL / 3 /* for all maps */)
+/*
+ * at some map.temperature there is no more poles at all
+ * COLD_LEVEL > 0 if HAS_POLES
+ */
+#define HAS_POLES (map.temperature < 70 && !map.alltemperate )
/********************************************************************
* used to initialize a array with some value
@@ -1210,7 +1221,7 @@
static void make_land(void)
{
adjust_hmap();
- if(!map.alltemperate) { normalize_hmap_poles(); }
+ if(HAS_POLES) { normalize_hmap_poles(); }
seaval = (maxval *(100 - map.landpercent)) / 100;
whole_map_iterate(x, y) {
if (hmap(x, y) < seaval)
@@ -1219,7 +1230,7 @@
map_set_terrain(x, y, T_NOT_PLACED);
}
} whole_map_iterate_end;
- if(!map.alltemperate) {
+ if(HAS_POLES) {
renormalize_hmap_poles();
make_polar_land(); /* make extra land at poles*/
}
@@ -2369,11 +2380,12 @@
map_clear_all_specials(x, y);
map_set_owner(x, y, NULL);
} whole_map_iterate_end;
- if (!map.alltemperate) { make_polar(); }
- /* Set poles numbers. After the map is generated continents will
- * be renumbered. */
- assign_continent_numbers();
+ if(HAS_POLES) { make_polar(); }
+ /* Set poles numbers. After the map is generated continents and srtart
+ * pos will be renumbered. */
+ assign_continent_numbers();
+
make_island(0, 0, pstate, 0);
for(i = 0; i <= map.num_continents; i++ ) {
islands[i].starters = 0;
diff -ruN -Xfreeciv/diff_ignore freeciv_improved/server/savegame.c
freeciv_/server/savegame.c
--- freeciv_improved/server/savegame.c 2004-08-31 09:01:27.981387880 +0200
+++ freeciv_/server/savegame.c 2004-08-31 10:47:44.623990856 +0200
@@ -3104,6 +3104,9 @@
map.forestsize = secfile_lookup_int(file, "map.forestsize");
map.have_huts = secfile_lookup_bool_default(file, TRUE,
"map.have_huts");
+ map.temperature =
+ secfile_lookup_int_default(file,
+ MAP_DEFAULT_TEMPERATURE, "map.temperature");
map.alltemperate
= secfile_lookup_bool_default(file, MAP_DEFAULT_ALLTEMPERATE,
"map.alltemperate");
@@ -3476,6 +3479,7 @@
secfile_insert_int(file, map.huts, "map.huts");
secfile_insert_int(file, map.generator, "map.generator");
secfile_insert_bool(file, map.have_huts, "map.have_huts");
+ secfile_insert_int(file, map.temperature, "map.temperature");
secfile_insert_bool(file, map.alltemperate, "map.alltemperate");
secfile_insert_bool(file, map.tinyisles, "map.tinyisles");
secfile_insert_bool(file, map.separatepoles, "map.separatepoles");
diff -ruN -Xfreeciv/diff_ignore freeciv_improved/server/stdinhand_info.h
freeciv_/server/stdinhand_info.h
--- freeciv_improved/server/stdinhand_info.h 2004-08-31 10:47:15.500418312
+0200
+++ freeciv_/server/stdinhand_info.h 2004-08-31 11:40:52.220402544 +0200
@@ -249,6 +249,17 @@
N_("0 = normal Earth-like planet; 1 = all-temperate planet "),
NULL, MAP_DEFAULT_ALLTEMPERATE)
+ GEN_INT("temperature", map.temperature,
+ SSET_MAP_GEN, SSET_GEOLOGY, SSET_SITUATIONAL, SSET_TO_CLIENT,
+ N_("medium temperature of planet"),
+ N_("100 a very dry and hot planet: no poles, all tropical or dry \n"
+ "70 hot planet, frized poles disapear near this point \n"
+ "50 a temperate planet: poles, cold, temperate and tropical\n"
+ " zone with a dessert zone overlaping bot tropical and temperate\n"
+ "30 cold planet, tropical disapear near this point \n"
+ "0 very cold planet, big poles, and any else cold"), NULL,
+ MAP_MIN_TEMPERATURE, MAP_MAX_TEMPERATURE, MAP_DEFAULT_TEMPERATURE)
+
GEN_INT("landmass", map.landpercent,
SSET_MAP_GEN, SSET_GEOLOGY, SSET_SITUATIONAL, SSET_TO_CLIENT,
N_("Amount of land vs ocean"), "", NULL,
|
|