Author: pepeto Date: Sun Sep 7 10:01:41 2014 New Revision: 26261 URL: http://svn.gna.org/viewcvs/freeciv?rev=26261&view=rev Log: Fix the turns number for client goto when the move rate of the unit is nil, but it still has moves left (due to tech loss, wonder loss etc.). This will causing erroneous message about long path length (=-1).
Originally reported by Jacob Nevins <jtn> See gna bug #22571 Modified: branches/S2_5/client/goto.c Modified: branches/S2_5/client/goto.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/goto.c?rev=26261&r1=26260&r2=26261&view=diff ============================================================================== --- branches/S2_5/client/goto.c (original) +++ branches/S2_5/client/goto.c Sun Sep 7 10:01:41 2014 @@ -909,14 +909,16 @@ mp = MAX(0, mp); - if (goto_map->template.move_rate == 0) { + if (goto_map->template.move_rate > 0) { + /* Round down -- if we can get there this turn with MP left, report 0, + * if we get there with 0 MP, report 1 */ + turns = mp / goto_map->template.move_rate; + } else if (goto_map->template.moves_left_initially > 0) { + turns = (mp == goto_map->template.moves_left_initially); + } else { /* Immobile unit can never reach destination. */ - return FALSE; - } - - /* Round down -- if we can get there this turn with MP left, report 0, - * if we get there with 0 MP, report 1 */ - turns = mp / goto_map->template.move_rate; + continue; + } if (min) { *min = MIN(*min, turns); _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits