Author: sveinung Date: Fri Oct 2 14:54:58 2015 New Revision: 30009 URL: http://svn.gna.org/viewcvs/freeciv?rev=30009&view=rev Log: Fix sabotage city target building validation
The sabotage city target building is encoded on the line and in the save game. The target building validation for unit orders checked it as if it was in the decoded form. This made the validation off by one. Fix it. See bug #23915 Modified: trunk/server/savegame3.c trunk/server/unithand.c Modified: trunk/server/savegame3.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame3.c?rev=30009&r1=30008&r2=30009&view=diff ============================================================================== --- trunk/server/savegame3.c (original) +++ trunk/server/savegame3.c Fri Oct 2 14:54:58 2015 @@ -5225,8 +5225,8 @@ switch (order->action) { case ACTION_SPY_TARGETED_SABOTAGE_CITY: /* Sabotage target is production (-1) or a building. */ - if (!(order_tgt == -1 - || improvement_by_number(order_tgt))) { + if (!(order_tgt - 1 == -1 + || improvement_by_number(order_tgt - 1))) { /* Sabotage target is invalid. */ log_sg("Cannot find building %d for %s to sabotage", order_tgt, unit_rule_name(punit)); Modified: trunk/server/unithand.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=30009&r1=30008&r2=30009&view=diff ============================================================================== --- trunk/server/unithand.c (original) +++ trunk/server/unithand.c Fri Oct 2 14:54:58 2015 @@ -3923,8 +3923,8 @@ break; case ACTION_SPY_TARGETED_SABOTAGE_CITY: /* Sabotage target is production (-1) or a building. */ - if (!(packet->target[i] == -1 - || improvement_by_number(packet->target[i]))) { + if (!(packet->target[i] - 1 == -1 + || improvement_by_number(packet->target[i] - 1))) { /* Sabotage target is invalid. */ log_error("handle_unit_orders() can't do %s without a target. " _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits