Author: sveinung
Date: Thu Jun  9 12:03:13 2016
New Revision: 32805

URL: http://svn.gna.org/viewcvs/freeciv?rev=32805&view=rev
Log:
dai_unit_attack(): add missing "else".

The next attack actions were supposed to be done if the previous alternative
was illegal. Add the missing "else" to "else if".

See bug #24738

Modified:
    trunk/ai/default/aitools.c

Modified: trunk/ai/default/aitools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aitools.c?rev=32805&r1=32804&r2=32805&view=diff
==============================================================================
--- trunk/ai/default/aitools.c  (original)
+++ trunk/ai/default/aitools.c  Thu Jun  9 12:03:13 2016
@@ -840,17 +840,20 @@
   fc_assert_ret_val(is_tiles_adjacent(unit_tile(punit), ptile), TRUE);
 
   unit_activity_handling(punit, ACTIVITY_IDLE);
+  /* FIXME: try the next action if the unit tried to do an illegal action.
+   * That would allow the AI to stop using the omniscient
+   * is_action_enabled_unit_on_*() functions. */
   if (is_action_enabled_unit_on_units(ACTION_CAPTURE_UNITS,
                                       punit, ptile)) {
     /* Choose capture. */
     handle_unit_do_action(unit_owner(punit), punit->id, tile_index(ptile),
                           0, "", ACTION_CAPTURE_UNITS);
-  } if (is_action_enabled_unit_on_units(ACTION_BOMBARD,
+  } else if (is_action_enabled_unit_on_units(ACTION_BOMBARD,
                                         punit, ptile)) {
     /* Choose bombard. */
     handle_unit_do_action(unit_owner(punit), punit->id, tile_index(ptile),
                           0, "", ACTION_BOMBARD);
-  } if (is_action_enabled_unit_on_tile(ACTION_NUKE,
+  } else if (is_action_enabled_unit_on_tile(ACTION_NUKE,
                                        punit, ptile)) {
     /* Choose explode nuclear. */
     handle_unit_do_action(unit_owner(punit), punit->id, tile_index(ptile),


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

Reply via email to