Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2006:
[Freeciv-Dev] Re: (PR#15169) cannot claim my own island
Home

[Freeciv-Dev] Re: (PR#15169) cannot claim my own island

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#15169) cannot claim my own island
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sun, 15 Jan 2006 15:27:27 -0800
Reply-to: bugs@xxxxxxxxxxx

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

On Sun, 15 Jan 2006, Jason Short wrote:
> > IMO claiming tiles across ocean shouldn't be allowed.
...
> 6.I thought claiming tiles on other islands wasn't possible; that's
> how it used to be and the way it should be.

Patch to fix this attached. I have not tested it much.

It also removes some duplicate code that probably didn't work (hence the
duplication).

  - Per

Index: server/maphand.c
===================================================================
--- server/maphand.c    (revision 11447)
+++ server/maphand.c    (working copy)
@@ -1607,7 +1607,7 @@
 
   /* Now claim ownership of unclaimed tiles for all sources; we
    * grab one circle each turn as long as we have range left
-   * to better visually displaying expansion hurdles. */
+   * to better visually display expansion. */
   whole_map_iterate(ptile) {
 #ifdef DEBUG
     if (ptile->owner == NULL
@@ -1655,24 +1655,16 @@
         if (dist > expand_range || dist > found_unclaimed) {
           continue; /* only expand one extra circle radius each turn */
         }
-        if (map_is_known(atile, ptile->owner)) {
-          if (atile->owner == NULL) {
-            if (!is_ocean(atile->terrain)
-                || is_claimable_ocean(atile, ptile)) {
-              map_claim_ownership(atile, ptile->owner, ptile);
-              atile->owner_source = ptile;
-              if (game.info.happyborders > 0) {
-                add_unique_homecities(cities_to_refresh, atile);
-              }
-            }
-          } else if (atile->owner == ptile->owner
-                     && sq_map_distance(ptile, atile) 
-                        < sq_map_distance(atile->owner_source, atile)) {
-            /* Steal tiles from your own cities when they are closer
-             * to this source than to its current source. This makes
-             * sure that when a source is lost, borders close to
-             * other sources will not go lost as well. */
-            atile->owner_source = ptile;
+        if (map_is_known(atile, ptile->owner)
+            && atile->owner == NULL
+            && ((!is_ocean(atile->terrain) 
+                 && atile->continent == ptile->continent)
+                || (is_ocean(atile->terrain)
+                    && is_claimable_ocean(atile, ptile)))) {
+          map_claim_ownership(atile, ptile->owner, ptile);
+          atile->owner_source = ptile;
+          if (game.info.happyborders > 0) {
+            add_unique_homecities(cities_to_refresh, atile);
           }
         }
       } circle_dxyr_iterate_end;

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