<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40370 >

 I propose this patch as way to determine border size. It restores
server setting 'borders' to mean border radius, which then is slightly
modified by city size. City area is always covered, fortress can have
smaller area.


 - ML

diff -Nurd -X.diff_ignore freeciv/common/vision.c freeciv/common/vision.c
--- freeciv/common/vision.c     2008-07-06 17:49:04.000000000 +0300
+++ freeciv/common/vision.c     2008-07-21 20:32:01.000000000 +0300
@@ -132,12 +132,7 @@
 
   psite = create_vision_site(-base_number(pbase) - 1, ptile, ptile->owner);
   psite->size = 0;
-  if (game.info.borders) {
-    psite->border_radius_sq = 2; /* FIXME: Should depend on game.info.borders 
value.
-                                  * Currently bigger radius doesn't claim 
territory north */
-  } else {
-    psite->border_radius_sq = 0;
-  }
+  psite->border_radius_sq = game.info.borders * game.info.borders;
   sz_strlcpy(psite->name, base_name_translation(pbase));
 
   return psite;
diff -Nurd -X.diff_ignore freeciv/server/citytools.c freeciv/server/citytools.c
--- freeciv/server/citytools.c  2008-07-18 22:08:35.000000000 +0300
+++ freeciv/server/citytools.c  2008-07-21 20:54:22.000000000 +0300
@@ -2298,13 +2298,16 @@
   int radius_sq = get_city_bonus(pcity, EFT_CITY_VISION_RADIUS_SQ);
 
   if (NULL != psite) {
-    int delta = psite->size - game.info.borders;
-
-    /* TODO: city size effect or ruleset steps instead */
-    if (0 >= delta) {
-      psite->border_radius_sq = 2 * psite->size;
+    /* Exact behavior could be ruleset defined. */
+    if (game.info.borders) {
+      psite->border_radius_sq = game.info.borders * game.info.borders;
+      if (psite->identity > 0) {
+        /* City */
+        psite->border_radius_sq = MAX(psite->border_radius_sq, 2*2+1*1);
+      }
+      psite->border_radius_sq += psite->size;
     } else {
-      psite->border_radius_sq = (2 + delta) * game.info.borders;
+      psite->border_radius_sq = 0;
     }
 
     if (radius_sq < psite->border_radius_sq) {
diff -Nurd -X.diff_ignore freeciv/server/settings.c freeciv/server/settings.c
--- freeciv/server/settings.c   2008-06-18 18:49:38.000000000 +0300
+++ freeciv/server/settings.c   2008-07-21 20:06:45.000000000 +0300
@@ -683,9 +683,11 @@
          SSET_RULES, SSET_MILITARY, SSET_SITUATIONAL, SSET_TO_CLIENT,
          N_("National borders radius"),
          N_("If this is set to greater than 0, then any land tiles "
-            "within the given radius of a city will be owned by that "
-            "nation. Special rules apply for ocean tiles or tiles within "
-            "range of more than one nation's cities."),
+            "within the given radius of a fortress or city "
+             "will be owned by that nation. City always claims at "
+             "least its own area, no matter how low this setting is. "
+             "Special rules apply for ocean tiles or tiles within "
+             "range of more than one nation's cities."),
          NULL,
          GAME_MIN_BORDERS, GAME_MAX_BORDERS, GAME_DEFAULT_BORDERS)
 
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to