Author: sveinung Date: Fri Mar 24 12:50:13 2017 New Revision: 35158 URL: http://svn.gna.org/viewcvs/freeciv?rev=35158&view=rev Log: Always initialize probabilities to ACTPROB_NA.
Simplify handle_unit_get_actions() by always initializing the unit_actions packet's probabilities field to ACTPROB_NA. See hrm Feature #647145 Modified: branches/S3_0/server/unithand.c Modified: branches/S3_0/server/unithand.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/unithand.c?rev=35158&r1=35157&r2=35158&view=diff ============================================================================== --- branches/S3_0/server/unithand.c (original) +++ branches/S3_0/server/unithand.c Fri Mar 24 12:50:13 2017 @@ -1457,14 +1457,14 @@ actor_unit = game_unit_by_number(actor_unit_id); target_tile = index_to_tile(target_tile_id); + /* Initialize the action probabilities. */ + action_iterate(act) { + probabilities[act] = ACTPROB_NA; + } action_iterate_end; + /* Check if the request is valid. */ if (!target_tile || !actor_unit || !actor_player || actor_unit->owner != actor_player) { - action_iterate(act) { - /* No probability can exist when the request is invalid. */ - probabilities[act] = ACTPROB_NA; - } action_iterate_end; - dsend_packet_unit_actions(pc, actor_unit_id, IDENTITY_NUMBER_ZERO, IDENTITY_NUMBER_ZERO, target_tile_id, @@ -1501,7 +1501,6 @@ action_iterate(act) { if (action_id_get_actor_kind(act) != AAK_UNIT) { /* Not relevant. */ - probabilities[act] = ACTPROB_NA; continue; } _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits