Author: sveinung Date: Sun Sep 6 13:04:43 2015 New Revision: 29787 URL: http://svn.gna.org/viewcvs/freeciv?rev=29787&view=rev Log: Declare act prob parameters const
The parameters of the action probability functions shouldn't be modified during action probability calculation. See patch #6320 Modified: trunk/common/actions.c trunk/common/actions.h Modified: trunk/common/actions.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=29787&r1=29786&r2=29787&view=diff ============================================================================== --- trunk/common/actions.c (original) +++ trunk/common/actions.c Sun Sep 6 13:04:43 2015 @@ -1595,9 +1595,9 @@ Get the actor unit's probability of successfully performing the chosen action on the target city. **************************************************************************/ -action_probability action_prob_vs_city(struct unit* actor_unit, - int action_id, - struct city* target_city) +action_probability action_prob_vs_city(const struct unit* actor_unit, + const int action_id, + const struct city* target_city) { if (actor_unit == NULL || target_city == NULL) { /* Can't do an action when actor or target are missing. */ @@ -1630,9 +1630,9 @@ Get the actor unit's probability of successfully performing the chosen action on the target unit. **************************************************************************/ -action_probability action_prob_vs_unit(struct unit* actor_unit, - int action_id, - struct unit* target_unit) +action_probability action_prob_vs_unit(const struct unit* actor_unit, + const int action_id, + const struct unit* target_unit) { if (actor_unit == NULL || target_unit == NULL) { /* Can't do an action when actor or target are missing. */ @@ -1667,9 +1667,9 @@ Get the actor unit's probability of successfully performing the chosen action on all units at the target tile. **************************************************************************/ -action_probability action_prob_vs_units(struct unit* actor_unit, - int action_id, - struct tile* target_tile) +action_probability action_prob_vs_units(const struct unit* actor_unit, + const int action_id, + const struct tile* target_tile) { int prob_all; @@ -1744,9 +1744,9 @@ Get the actor unit's probability of successfully performing the chosen action on the target tile. **************************************************************************/ -action_probability action_prob_vs_tile(struct unit* actor_unit, - int action_id, - struct tile* target_tile) +action_probability action_prob_vs_tile(const struct unit* actor_unit, + const int action_id, + const struct tile* target_tile) { if (actor_unit == NULL || target_tile == NULL) { /* Can't do an action when actor or target are missing. */ Modified: trunk/common/actions.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.h?rev=29787&r1=29786&r2=29787&view=diff ============================================================================== --- trunk/common/actions.h (original) +++ trunk/common/actions.h Sun Sep 6 13:04:43 2015 @@ -245,17 +245,21 @@ const struct unit *actor_unit, const struct tile *target_tile); -action_probability action_prob_vs_city(struct unit* actor, int action_id, - struct city* victim); - -action_probability action_prob_vs_unit(struct unit* actor, int action_id, - struct unit* victim); - -action_probability action_prob_vs_units(struct unit* actor, int action_id, - struct tile* victims); - -action_probability action_prob_vs_tile(struct unit* actor, int action_id, - struct tile* victims); +action_probability action_prob_vs_city(const struct unit* actor, + const int action_id, + const struct city* victim); + +action_probability action_prob_vs_unit(const struct unit* actor, + const int action_id, + const struct unit* victim); + +action_probability action_prob_vs_units(const struct unit* actor, + const int action_id, + const struct tile* victims); + +action_probability action_prob_vs_tile(const struct unit *actor, + const int action_id, + const struct tile *victims); bool action_prob_possible(action_probability probability); _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits