[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]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#9876) PATCH temperature parameters for Earth like generators 1,5 |
From: |
"Marcelo Burda" <mburda@xxxxxxxxx> |
Date: |
Mon, 30 Aug 2004 08:23:07 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9876 >
This patch add a map.temperature parameter to patch 9627.
a this point is used to determine the size of zones on a Earth like map,
cold, temperate and tropical, and the dry zones. 0 for a very cold
planet, 100 for a very Hot.
later this has to be used to determine desserts or others temperature
dependent vars of genmerator.
in a temperature == 0 map adn if topology has trip poles, cold zone can
seem to big, the problem is the terrains set is very reduced for cold
planet. but nobody will want to play to cold planets with te today
terrains sets, maybe later.
values form 30 to 70 do good playables planets
this is a pdf with the definitions of the zones, verically is the
lattitude (in %) horizontaly map.temperature
temperature.pdf
Description: Adobe PDF document
diff -ruN -Xfreeciv/diff_ignore freeciv_improved-5/common/map.c
freeciv_/common/map.c
--- freeciv_improved-5/common/map.c 2004-08-29 14:33:13.000000000 +0200
+++ freeciv_/common/map.c 2004-08-29 20:43:41.620907584 +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-5/common/map.h
freeciv_/common/map.h
--- freeciv_improved-5/common/map.h 2004-08-29 14:33:13.000000000 +0200
+++ freeciv_/common/map.h 2004-08-29 21:42:41.494764960 +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-5/server/mapgen.c
freeciv_/server/mapgen.c
--- freeciv_improved-5/server/mapgen.c 2004-08-29 21:46:23.855960920 +0200
+++ freeciv_/server/mapgen.c 2004-08-29 21:41:45.698247320 +0200
@@ -111,19 +111,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, 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
@@ -498,9 +509,9 @@
if(deserts_to_be_placed <= 0) { return; }
if (abs(hmap(x, y) - height) < diff
- && not_placed(x, y) && (count_ocean_near_tile(x,y) <= 2 ||
- /* the myrand is to avoid infinite loops */
- myrand(10) < 2)) {
+ && not_placed(x, y) && (count_ocean_near_tile(x,y) <= 2
+ /* the myrand is to avoid infinite loop */
+ || myrand(10) < 2)) {
map_set_terrain(x, y, T_DESERT);
deserts_to_be_placed--;
cardinal_adjc_iterate(x, y, x1, y1) {
@@ -1207,7 +1218,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)
@@ -1216,7 +1227,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*/
}
@@ -2366,11 +2377,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-5/server/savegame.c
freeciv_/server/savegame.c
--- freeciv_improved-5/server/savegame.c 2004-08-29 14:33:14.000000000
+0200
+++ freeciv_/server/savegame.c 2004-08-29 20:43:41.630906064 +0200
@@ -3105,6 +3105,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");
@@ -3477,6 +3480,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-5/server/stdinhand.c
freeciv_/server/stdinhand.c
--- freeciv_improved-5/server/stdinhand.c 2004-08-29 14:33:49.000000000
+0200
+++ freeciv_/server/stdinhand.c 2004-08-29 21:31:52.532422232 +0200
@@ -347,10 +347,22 @@
GEN_BOOL("alltemperate", map.alltemperate,
SSET_MAP_GEN, SSET_GEOLOGY, SSET_RARE, SSET_TO_CLIENT,
- N_("All the map is temperate"),
- N_("0 = normal Earth-like planet; 1 = all-temperate planet "),
+ N_("All the map has the some temperature"),
+ N_("0 = normal Earth-like planet \n"
+ "1 = all at some temperature"),
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,
- [Freeciv-Dev] (PR#9876) PATCH temperature parameters for Earth like generators 1,5,
Marcelo Burda <=
|
|