Author: sveinung Date: Wed Jul 8 14:06:53 2015 New Revision: 29203 URL: http://svn.gna.org/viewcvs/freeciv?rev=29203&view=rev Log: Cache fake actions for local DiplRel
Cache if a unit is able to perform any action at all (ACTION_ANY) and if it is able to perform any hostile action (ACTION_HOSTILE) given each local DiplRel. See patch #6123 Modified: trunk/common/unittype.c Modified: trunk/common/unittype.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/unittype.c?rev=29203&r1=29202&r2=29203&view=diff ============================================================================== --- trunk/common/unittype.c (original) +++ trunk/common/unittype.c Wed Jul 8 14:06:53 2015 @@ -353,7 +353,7 @@ /* Caches for each unit type */ static bv_ustate_act_cache ustate_act_cache[U_LAST][ACTION_AND_FAKES]; -static bv_diplrel_all_reqs dipl_rel_action_cache[U_LAST][ACTION_COUNT]; +static bv_diplrel_all_reqs dipl_rel_action_cache[U_LAST][ACTION_AND_FAKES]; /************************************************************************** Cache if any action may be possible for a unit of the type putype for @@ -450,6 +450,8 @@ action_iterate(action_id) { BV_CLR_ALL(dipl_rel_action_cache[putype_id][action_id]); } action_iterate_end; + BV_CLR_ALL(dipl_rel_action_cache[putype_id][ACTION_ANY]); + BV_CLR_ALL(dipl_rel_action_cache[putype_id][ACTION_HOSTILE]); if (!is_actor_unit_type(putype)) { /* Not an actor unit. */ @@ -480,11 +482,23 @@ BV_SET(dipl_rel_action_cache[putype_id][enabler->action], requirement_diplrel_ereq(req.source.value.diplrel, REQ_RANGE_LOCAL, TRUE)); + BV_SET(dipl_rel_action_cache[putype_id][ACTION_HOSTILE], + requirement_diplrel_ereq(req.source.value.diplrel, + REQ_RANGE_LOCAL, TRUE)); + BV_SET(dipl_rel_action_cache[putype_id][ACTION_ANY], + requirement_diplrel_ereq(req.source.value.diplrel, + REQ_RANGE_LOCAL, TRUE)); } req.present = FALSE; if (!does_req_contradicts_reqs(&req, &(enabler->actor_reqs))) { BV_SET(dipl_rel_action_cache[putype_id][enabler->action], + requirement_diplrel_ereq(req.source.value.diplrel, + REQ_RANGE_LOCAL, FALSE)); + BV_SET(dipl_rel_action_cache[putype_id][ACTION_HOSTILE], + requirement_diplrel_ereq(req.source.value.diplrel, + REQ_RANGE_LOCAL, FALSE)); + BV_SET(dipl_rel_action_cache[putype_id][ACTION_ANY], requirement_diplrel_ereq(req.source.value.diplrel, REQ_RANGE_LOCAL, FALSE)); } _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits