Author: jtn
Date: Sat Apr 25 11:02:01 2015
New Revision: 28869

URL: http://svn.gna.org/viewcvs/freeciv?rev=28869&view=rev
Log:
Water tiles next to border sources were sometimes not claimed if they
were also adjacent to another continent. Now they are always claimed.

After a report by Robin Patterson.

See gna bug #23503.

Modified:
    branches/S2_5/server/maphand.c

Modified: branches/S2_5/server/maphand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/maphand.c?rev=28869&r1=28868&r2=28869&view=diff
==============================================================================
--- branches/S2_5/server/maphand.c      (original)
+++ branches/S2_5/server/maphand.c      Sat Apr 25 11:02:01 2015
@@ -1912,6 +1912,7 @@
   Continent_id cont1 = tile_continent(source);
   Continent_id cont2;
   int ocean_tiles;
+  bool other_continent;
 
   if (get_ocean_size(-cont) <= MAXIMUM_CLAIMED_OCEAN_SIZE
       && get_lake_surrounders(cont) == cont1) {
@@ -1928,21 +1929,25 @@
   }
 
   ocean_tiles = 0;
+  other_continent = FALSE;
   adjc_iterate(ptile, tile2) {
     cont2 = tile_continent(tile2);
     if (tile2 == source) {
+      /* Water next to border source is always claimable */
       return TRUE;
     }
     if (cont2 == cont) {
       ocean_tiles++;
     } else if (cont1 <= 0) {
-      /* First adjacent land */
+      /* First adjacent land (only if border source is not on land) */
       cont1 = cont2;
     } else if (cont2 != cont1) {
-      return FALSE; /* two land continents adjacent, punt! */
+      /* This water has two land continents adjacent, or land adjacent
+       * that is of a different continent from the border source */
+      other_continent = TRUE;
     }
   } adjc_iterate_end;
-  if (ocean_tiles <= 2) {
+  if (!other_continent && ocean_tiles <= 2) {
     return TRUE;
   } else {
     return FALSE;
@@ -2097,16 +2102,19 @@
 
       if (strength_new <= strength_old) {
         /* Stronger shall prevail,
-         * in case of equel strength older shall prevail */
+         * in case of equal strength older shall prevail */
         continue;
       }
     }
 
     if (is_ocean_tile(dtile)) {
+      /* Only certain water tiles are claimable */
       if (is_claimable_ocean(dtile, ptile, owner)) {
         map_claim_ownership(dtile, owner, ptile);
       }
     } else {
+      /* Only land tiles on the same island as the border source
+       * are claimable */
       if (tile_continent(dtile) == tile_continent(ptile)) {
         map_claim_ownership(dtile, owner, ptile);
       }


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to