Author: sveinung
Date: Wed Dec 31 15:05:45 2014
New Revision: 27464

URL: http://svn.gna.org/viewcvs/freeciv?rev=27464&view=rev
Log:
AI: Ask for a help wonder unit when calculating wonder city distance

Ask directly for a unit that can help build a wonder in stead of asking for
a unit with the HelpWonder unit type flag and then checking if it can build
a wonder.

See patch #5631

Modified:
    trunk/ai/default/advdomestic.c

Modified: trunk/ai/default/advdomestic.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/advdomestic.c?rev=27464&r1=27463&r2=27464&view=diff
==============================================================================
--- trunk/ai/default/advdomestic.c      (original)
+++ trunk/ai/default/advdomestic.c      Wed Dec 31 15:05:45 2014
@@ -574,16 +574,15 @@
     return;
   }
 
-  punittype = best_role_unit_for_player(pplayer, UTYF_HELP_WONDER);
+  punittype = best_role_unit_for_player(pplayer,
+      action_get_role(ACTION_HELP_WONDER));
 
   if (!punittype) {
     return;
   }
 
-  if (!utype_can_do_action(punittype, ACTION_HELP_WONDER)) {
-    /* This unit type isn't suitable for wonder building help. */
-    return;
-  }
+  fc_assert_msg(utype_can_do_action(punittype, ACTION_HELP_WONDER),
+                "Non existence of wonder helper unit not caught");
 
   ghost = unit_virtual_create(pplayer, wonder_city, punittype, 0);
   maxrange = unit_move_rate(ghost) * 7;


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

Reply via email to