Author: sveinung
Date: Thu Sep 15 17:02:58 2016
New Revision: 33807

URL: http://svn.gna.org/viewcvs/freeciv?rev=33807&view=rev
Log:
AI: near city blocking "Found City" not an error.

Do not give error message about AI settler being unable to build city when
the reason is that there's another one too close.

Based on the 2.6 patch by Marko Lindqvist <cazfi>

See bug #24094

Modified:
    trunk/ai/default/aisettler.c

Modified: trunk/ai/default/aisettler.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aisettler.c?rev=33807&r1=33806&r2=33807&view=diff
==============================================================================
--- trunk/ai/default/aisettler.c        (original)
+++ trunk/ai/default/aisettler.c        Thu Sep 15 17:02:58 2016
@@ -1250,9 +1250,21 @@
                         0, city_name_suggestion(pplayer, ptile),
                         ACTION_FOUND_CITY);
   pcity = tile_city(ptile);
-  if (!pcity) {
-    log_error("%s: Failed to build city at (%d, %d)",
-              player_name(pplayer), TILE_XY(ptile));
+  if (!pcity && punit) {
+    enum ane_kind reason = action_not_enabled_reason(punit,
+                                                     ACTION_FOUND_CITY,
+                                                     ptile, NULL, NULL);
+
+    if (reason == ANEK_CITY_TOO_CLOSE_TGT) {
+      /* This is acceptable. A hut in the path to the tile may have created
+       * a city that now is too close. */
+      log_debug("%s: Failed to build city at (%d, %d)",
+                player_name(pplayer), TILE_XY(ptile));
+    } else {
+      /* The request was illegal to begin with. */
+      log_error("%s: Failed to build city at (%d, %d). Reason id: %d",
+                player_name(pplayer), TILE_XY(ptile), reason);
+    }
     return FALSE;
   }
 


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

Reply via email to