Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#9876) PATCH temperature parameters for Earth like gene
Home

[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 via RT" <mburda@xxxxxxxxx>
Date: Thu, 2 Sep 2004 09:38:09 -0700
Reply-to: RT_CorrespondAddressNotSet@xxxxxxxxxxxxxx

<URL: http://RT::WebBaseURL.not.configured:80/Ticket/Display.html?id=9876 >

Update
diff -ruN -Xfreeciv/diff_ignore freeciv__/common/map.c freeciv_/common/map.c
--- freeciv__/common/map.c      2004-09-02 15:20:17.000000000 +0200
+++ freeciv_/common/map.c       2004-09-02 16:38:00.136213400 +0200
@@ -207,6 +207,7 @@
   map.tinyisles             = MAP_DEFAULT_TINYISLES;
   map.separatepoles         = MAP_DEFAULT_SEPARATE_POLES;
   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__/common/map.h freeciv_/common/map.h
--- freeciv__/common/map.h      2004-09-02 15:20:35.000000000 +0200
+++ freeciv_/common/map.h       2004-09-02 16:33:56.938185120 +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__/server/mapgen.c 
freeciv_/server/mapgen.c
--- freeciv__/server/mapgen.c   2004-09-02 15:39:05.000000000 +0200
+++ freeciv_/server/mapgen.c    2004-09-02 16:35:29.438122992 +0200
@@ -122,19 +122,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 an array 'a' of size 'size' with value 'val' in each
@@ -1234,7 +1245,7 @@
 static void make_land(void)
 {
   adjust_hmap();
-  if(!map.alltemperate) {
+  if(HAS_POLES) {
     normalize_hmap_poles();
   }
   hmap_shore_level = (hmap_max_level * (100 - map.landpercent)) / 100;
@@ -1245,7 +1256,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*/
   }
@@ -2402,11 +2413,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__/server/savegame.c 
freeciv_/server/savegame.c
--- freeciv__/server/savegame.c 2004-09-02 15:20:19.000000000 +0200
+++ freeciv_/server/savegame.c  2004-09-02 16:33:56.950183296 +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__/server/stdinhand_info.h 
freeciv_/server/stdinhand_info.h
--- freeciv__/server/stdinhand_info.h   2004-09-02 15:20:50.000000000 +0200
+++ freeciv_/server/stdinhand_info.h    2004-09-02 16:38:58.345364264 +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 and temperate"), 
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,

[Prev in Thread] Current Thread [Next in Thread]