Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2002:
[Freeciv-Dev] Re: nation.ruleset terrain bug (PR#1554)
Home

[Freeciv-Dev] Re: nation.ruleset terrain bug (PR#1554)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: nation.ruleset terrain bug (PR#1554)
From: Jason Short <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 16 Jun 2002 23:39:41 -0400

Christian Knoke wrote:
On Tue, Jun 11, 2002 at 02:11:46PM -0500, Mike Kaufman wrote:

On Tue, Jun 11, 2002 at 11:53:18AM -0700, Christian Knoke wrote:

You think that the order of the cities in the list matters. I do not.
I think that we have to decide: either a fixed priority for city names
by means of a list _or_ terrain-specific suggestions. To get the first
you can switch the stuff off (set naturalcitynames 0).
As a wild guess, no more than half of the rulesets have the cities
sorted. Are the first cities you build really the biggest later on
in the game? Rather not. I once sorted the german cities and was always
wondering which criteria should be taken. Size? Age? How Boring!


a solution here would be to make naturalcitynames ternary.
one would be no attention paid to terrain. a second would be no attention
paid to city order all attention paid to terrain. the third (which I of
course prefer), would make order very important for the first say
half-dozen cities, then make terrain important. For me, I want to see the
more "famous" cities right off. (But I tend to choose my nation based
entirely on this and/or how cool the flag looks).


Yes, 3 algorithms at choice. I'll try to implement mine. :-)

Making naturalcitynames ternary is quite easy, if a bit ugly. See attached patch. As I said, I prefer things as they are so that nations with a lot of city names (like 1000) will work effectively (you won't be prematurely given the names of cities you've never heard of). But I suppose this could be desirable.

Adding a new "algorithm" to choose the city name is a lot more work, but would only require local changes under the current setup.

jason
? autoconf252.patch
? civ2
? civscore.log
? client-new
? freeciv-patches.tgz
? freeciv.kdevprj
? freeciv.kdevses
? jason-game.gz
? patches
? rc
? test.pl
? data/civ2gfx
? data/civ2gfx.tilespec
? data/civ2gfx_flags.tilespec
? data/engels/Makefile
? data/engels/Makefile.in
? data/hires/Makefile
? data/hires/Makefile.in
Index: common/game.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.h,v
retrieving revision 1.106
diff -u -r1.106 game.h
--- common/game.h       2002/06/07 04:26:00     1.106
+++ common/game.h       2002/06/17 03:33:11
@@ -129,7 +129,7 @@
   int sewer_size;
   int add_to_size_limit;
   bool savepalace;
-  bool natural_city_names;
+  int natural_city_names;
   bool spacerace;
   bool turnblock;
   bool fixedlength;
@@ -339,7 +339,9 @@
 
 #define GAME_DEFAULT_SAVEPALACE      TRUE
 
-#define GAME_DEFAULT_NATURALCITYNAMES TRUE
+#define GAME_DEFAULT_NATURALCITYNAMES CITYNAMES_NATURAL_FROM_LIST
+#define GAME_MIN_NATURALCITYNAMES 0
+#define GAME_MAX_NATURALCITYNAMES CITYNAMES_NATURAL
 
 #define GAME_DEFAULT_FOODBOX         10
 #define GAME_MIN_FOODBOX             5
Index: common/nation.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/nation.h,v
retrieving revision 1.14
diff -u -r1.14 nation.h
--- common/nation.h     2002/06/07 04:26:01     1.14
+++ common/nation.h     2002/06/17 03:33:11
@@ -29,6 +29,16 @@
                    ADV_ATTITUDE, ADV_DOMESTIC, ADV_LAST};
 
 /*
+ * Types of city naming that are available.  See game.natural_city_names and
+ * the naturalcitynames server option.
+ */
+enum natural_name_type {
+  CITYNAMES_FROM_LIST,
+  CITYNAMES_NATURAL_FROM_LIST,
+  CITYNAMES_NATURAL
+};
+
+/*
  * The city_name structure holds information about a default choice for
  * the city name.  The "name" field is, of course, just the name for
  * the city.  The "river" and "terrain" fields are entries recording
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.182
diff -u -r1.182 citytools.c
--- server/citytools.c  2002/06/07 04:26:03     1.182
+++ server/citytools.c  2002/06/17 03:33:12
@@ -54,7 +54,7 @@
 
 static int evaluate_city_name_priority(int x, int y,
                                       struct city_name *city_name,
-                                      int default_priority);
+                                      int city_list_position);
 static char *search_for_city_name(int x, int y, struct city_name *city_names);
 static void server_set_tile_city(struct city *pcity, int city_x, int city_y,
                                 enum city_tile_type type);
@@ -71,10 +71,10 @@
 *****************************************************************/
 static int evaluate_city_name_priority(int x, int y,
                                       struct city_name *city_name,
-                                      int default_priority)
+                                      int city_list_position)
 {
   /* Lower values mean higher priority. */
-  float priority = (float)default_priority;
+  float priority;
   int goodness;
   enum tile_terrain_type type;
 
@@ -91,8 +91,18 @@
    * it elewhere because this localizes everything to this
    * function, even though it's a bit inefficient.
    */
-  if (!game.natural_city_names) {
-    return default_priority;
+  switch (game.natural_city_names) {
+  case CITYNAMES_FROM_LIST:
+    /* no natural city names */
+    return city_list_position;
+  case CITYNAMES_NATURAL_FROM_LIST:
+    /* natural city names, also accounting for the city's position */
+    priority = (float)city_list_position;
+    break;
+  case CITYNAMES_NATURAL:
+    /* natural city names, ignoring the city's list position */
+    priority = (float)1.0;
+    break;
   }
 
   /*
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.230
diff -u -r1.230 stdinhand.c
--- server/stdinhand.c  2002/06/12 07:24:50     1.230
+++ server/stdinhand.c  2002/06/17 03:33:14
@@ -611,12 +611,17 @@
              "choosed city, regardless on the knowledge of Masonry."), NULL, 
           GAME_DEFAULT_SAVEPALACE)
 
-  GEN_BOOL("naturalcitynames", game.natural_city_names,
+  GEN_INT("naturalcitynames", game.natural_city_names,
            SSET_RULES_FLEXIBLE, SSET_TO_CLIENT,
            N_("Whether to use natural city names"),
-           N_("If enabled, the default city names will be determined based "
-              "on the surrounding terrain."),
-           NULL, GAME_DEFAULT_NATURALCITYNAMES)
+           N_("If 0, the default city names will be determined based "
+              "only on their order in the nation's city list.  If 1, "
+             "the position in the list will be used as well as "
+             "the terrain labels for the city.  If 2, only the terrain "
+             "labels will be considered and the ordering of the cities "
+             "doesn't matter at all."), NULL, 
+          GAME_MIN_NATURALCITYNAMES, GAME_MAX_NATURALCITYNAMES,
+          GAME_DEFAULT_NATURALCITYNAMES)
 
 /* Meta options: these don't affect the internal rules of the game, but
  * do affect players.  Also options which only produce extra server

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