Author: cazfi Date: Sat May 20 13:11:42 2017 New Revision: 35676 URL: http://svn.gna.org/viewcvs/freeciv?rev=35676&view=rev Log: Set ACTIVITY_GOTO persistently for military units heading to target
See hrm Bug #661869 Modified: branches/S2_6/ai/default/aiunit.c branches/S2_6/server/advisors/advgoto.c Modified: branches/S2_6/ai/default/aiunit.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/ai/default/aiunit.c?rev=35676&r1=35675&r2=35676&view=diff ============================================================================== --- branches/S2_6/ai/default/aiunit.c (original) +++ branches/S2_6/ai/default/aiunit.c Sat May 20 13:11:42 2017 @@ -1734,6 +1734,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: branches/S2_6/server/advisors/advgoto.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/advisors/advgoto.c?rev=35676&r1=35675&r2=35676&view=diff ============================================================================== --- branches/S2_6/server/advisors/advgoto.c (original) +++ branches/S2_6/server/advisors/advgoto.c Sat May 20 13:11:42 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