Re: [Freeciv-Dev] (PR#12550) [Patch] Fix H_HUTS

"Marko Lindqvist" <marko.lindqvist-pL9mn150aekxHbG02/[email protected]> Sun, 20 Mar 2005 12:05:24 -0800
Newsgroups gmane.games.freeciv.ai
Message-ID <[email protected]>
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12550 >


  This version should handle fogged tiles correctly when H_HUTS set.


  - ML
h_huts_fix-2.diff (text/plain, 929 B)
diff -Nurd -X.diff_ignore freeciv/ai/aiexplorer.c freeciv/ai/aiexplorer.c
--- freeciv/ai/aiexplorer.c	2005-03-20 17:26:45.343750000 +0200
+++ freeciv/ai/aiexplorer.c	2005-03-20 21:59:50.843750000 +0200
@@ -226,9 +226,13 @@
     desirable = 0;
   }
 
-  if ((!pplayer->ai.control || !ai_handicap(pplayer, H_HUTS))
-      && map_is_known(ptile, pplayer)
-      && map_has_special(ptile, S_HUT)) {
+  /* AI players without H_HUTS handicap see truth, others
+   * think that there is hut iff private map says so */
+  if ((map_has_special(ptile, S_HUT) && pplayer->ai.control
+       && !ai_handicap(pplayer, H_HUTS))
+      || (((pplayer->private_map + ptile->index)->special & S_HUT)
+          && (!pplayer->ai.control
+              || (pplayer->ai.control && ai_handicap(pplayer, H_HUTS))))) {
     /* we want to explore huts whenever we can,
      * even if doing so will not uncover any tiles. */
     desirable += HUT_SCORE;