Author: sveinung Date: Thu Jun 9 12:06:52 2016 New Revision: 32810 URL: http://svn.gna.org/viewcvs/freeciv?rev=32810&view=rev Log: Optimize unit_move_handling() adjacent action.
The function unit_move_handling() can end up canceling the move to ask the player if an action should be done to the adjacent tile the unit tries to move to. This won't happen when move_do_not_act is set. * don't bother starting to calculate actions when move_do_not_act is TRUE. * don't look for target city or target unit if no action will be done. Requested by Marko Lindqvist <cazfi> See patch #7251 Modified: branches/S2_6/server/unithand.c Modified: branches/S2_6/server/unithand.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/unithand.c?rev=32810&r1=32809&r2=32810&view=diff ============================================================================== --- branches/S2_6/server/unithand.c (original) +++ branches/S2_6/server/unithand.c Thu Jun 9 12:06:52 2016 @@ -2386,16 +2386,15 @@ * For tiles occupied by allied cities or units, keep moving if * move_do_not_act tells us to, or if the unit is on goto and the tile * is not the final destination. */ - if (utype_may_act_at_all(unit_type_get(punit))) { - struct unit *tunit = tgt_unit(punit, pdesttile); - struct city *tcity = tgt_city(punit, pdesttile); - - if ((0 < unit_list_size(pdesttile->units) || pcity) - && !(move_do_not_act - && may_non_act_move(punit, pcity, pdesttile, igzoc))) { + if (!move_do_not_act + && utype_may_act_at_all(unit_type_get(punit))) { + if ((0 < unit_list_size(pdesttile->units) || pcity)) { /* A target (unit or city) exists at the tile. If a target is an ally * it still looks like a target since move_do_not_act isn't set. * Assume that the intention is to do an action. */ + + struct unit *tunit = tgt_unit(punit, pdesttile); + struct city *tcity = tgt_city(punit, pdesttile); /* If a tcity or a tunit exists it must be possible to act against it * since tgt_city() or tgt_unit() wouldn't have targeted it _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits