Author: cazfi Date: Sat May 20 13:11:29 2017 New Revision: 35674 URL: http://svn.gna.org/viewcvs/freeciv?rev=35674&view=rev Log: Set ACTIVITY_GOTO persistently for military units heading to target
See hrm Bug #661869 Modified: trunk/ai/default/aiunit.c trunk/server/advisors/advgoto.c Modified: trunk/ai/default/aiunit.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aiunit.c?rev=35674&r1=35673&r2=35674&view=diff ============================================================================== --- trunk/ai/default/aiunit.c (original) +++ trunk/ai/default/aiunit.c Sat May 20 13:11:29 2017 @@ -1738,6 +1738,12 @@ * and on a ferry. This fixes the problem (usually). */ UNIT_LOG(LOG_DEBUG, punit, "mil att gothere -> (%d, %d)", TILE_XY(dest_tile)); + + /* Set ACTIVITY_GOTO more permanently than just inside + * adv_follow_path(). This way other units will know we're + * on our way even if we don't reach target yet. */ + punit->goto_tile = dest_tile; + unit_activity_handling(punit, ACTIVITY_GOTO); if (NULL != path && !adv_follow_path(punit, path, dest_tile)) { /* Died. */ pf_path_destroy(path); Modified: trunk/server/advisors/advgoto.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/advisors/advgoto.c?rev=35674&r1=35673&r2=35674&view=diff ============================================================================== --- trunk/server/advisors/advgoto.c (original) +++ trunk/server/advisors/advgoto.c Sat May 20 13:11:29 2017 @@ -59,9 +59,12 @@ unit_activity_handling(punit, ACTIVITY_GOTO); alive = adv_unit_execute_path(punit, path); if (alive) { - unit_activity_handling(punit, ACTIVITY_IDLE); - send_unit_info(NULL, punit); /* FIXME: probably duplicate */ - unit_activity_handling_targeted(punit, activity, &tgt); + if (activity != ACTIVITY_GOTO) { + /* Only go via ACTIVITY_IDLE if we are actually changing the activity */ + unit_activity_handling(punit, ACTIVITY_IDLE); + send_unit_info(NULL, punit); /* FIXME: probably duplicate */ + unit_activity_handling_targeted(punit, activity, &tgt); + } punit->goto_tile = old_tile; /* May be NULL. */ send_unit_info(NULL, punit); } _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits