Author: sveinung
Date: Mon Jan  5 14:35:21 2015
New Revision: 27536

URL: http://svn.gna.org/viewcvs/freeciv?rev=27536&view=rev
Log:
A transport assigned to war isn't (yet) on a spy mission.

Use AIUNIT_NONE in stead of AIUNIT_ATTACK to signal that a transport unit
that also is an attack unit is to be used for attacking. This avoids a crash
when the unit capable of attacking and transporting also is capable of doing
spy actions to cities.

Reported by Marko Lindqvist <cazfi>

See bug #23107

Modified:
    branches/S2_4/ai/default/aidata.c
    branches/S2_4/ai/default/aiferry.c

Modified: branches/S2_4/ai/default/aidata.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_4/ai/default/aidata.c?rev=27536&r1=27535&r2=27536&view=diff
==============================================================================
--- branches/S2_4/ai/default/aidata.c   (original)
+++ branches/S2_4/ai/default/aidata.c   Mon Jan  5 14:35:21 2015
@@ -244,6 +244,9 @@
     if (unit_has_type_flag(punit, F_DIPLOMAT)
         && def_ai_unit_data(punit)->task == AIUNIT_ATTACK) {
       /* Heading somewhere on a mission, reserve target. */
+
+      fc_assert_msg(punit->goto_tile, "No target city for spy action");
+
       struct city *pcity = tile_city(punit->goto_tile);
 
       if (pcity) {

Modified: branches/S2_4/ai/default/aiferry.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_4/ai/default/aiferry.c?rev=27536&r1=27535&r2=27536&view=diff
==============================================================================
--- branches/S2_4/ai/default/aiferry.c  (original)
+++ branches/S2_4/ai/default/aiferry.c  Mon Jan  5 14:35:21 2015
@@ -1111,7 +1111,7 @@
   if (IS_ATTACKER(punit) && punit->moves_left > 0) {
      /* AI used to build frigates to attack and then use them as ferries 
       * -- Syela */
-     ai_unit_new_task(punit, AIUNIT_ATTACK, NULL);
+     ai_unit_new_task(punit, AIUNIT_NONE, NULL);
      UNIT_LOG(LOGLEVEL_FERRY, punit, "passing ferry over to attack code");
      ai_manage_military(pplayer, punit);
      return;


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

Reply via email to