Feature #758 ยป 0028-Unhardcode-wld.map-from-action_is_blocked_by.patch
common/actions.c | ||
---|---|---|
An action that can block another blocks when it is forced and possible.
|
||
**************************************************************************/
|
||
struct action *action_is_blocked_by(const struct action *act,
|
||
struct action *action_is_blocked_by(const struct civ_map *nmap,
|
||
const struct action *act,
|
||
const struct unit *actor_unit,
|
||
const struct tile *target_tile_arg,
|
||
const struct city *target_city_arg,
|
||
... | ... | |
const struct city *target_city
|
||
= blocked_find_target_city(act, actor_unit, target_tile,
|
||
target_city_arg, target_unit);
|
||
const struct civ_map *nmap = &(wld.map);
|
||
action_iterate(blocker_id) {
|
||
struct action *blocker = action_by_number(blocker_id);
|
||
... | ... | |
break;
|
||
}
|
||
if (action_is_blocked_by(paction, actor->unit,
|
||
if (action_is_blocked_by(nmap, paction, actor->unit,
|
||
target->tile, target->city, target->unit)) {
|
||
/* Allows an action to block an other action. If a blocking action is
|
||
* legal the actions it blocks becomes illegal. */
|
||
... | ... | |
/* Doesn't leak information since it must be 100% certain from the
|
||
* player's perspective that the blocking action is legal. */
|
||
if (action_is_blocked_by(act, actor_unit,
|
||
if (action_is_blocked_by(nmap, act, actor_unit,
|
||
city_tile(target_city), target_city, NULL)) {
|
||
/* Don't offer to perform an action known to be blocked. */
|
||
return ACTPROB_IMPOSSIBLE;
|
||
... | ... | |
/* Doesn't leak information since it must be 100% certain from the
|
||
* player's perspective that the blocking action is legal. */
|
||
unit_list_iterate(target_tile->units, target_unit) {
|
||
if (action_is_blocked_by(act, actor_unit,
|
||
if (action_is_blocked_by(nmap, act, actor_unit,
|
||
target_tile, tile_city(target_tile),
|
||
target_unit)) {
|
||
/* Don't offer to perform an action known to be blocked. */
|
common/actions.h | ||
---|---|---|
const struct unit_type *act_utype);
|
||
bool action_enabler_possible_actor(const struct action_enabler *ae);
|
||
struct action *action_is_blocked_by(const struct action *act,
|
||
struct action *action_is_blocked_by(const struct civ_map *nmap,
|
||
const struct action *act,
|
||
const struct unit *actor_unit,
|
||
const struct tile *target_tile,
|
||
const struct city *target_city,
|
server/unithand.c | ||
---|---|---|
can_upgrade_unittype(
|
||
act_player, act_utype));
|
||
} else if (paction
|
||
&& (blocker = action_is_blocked_by(paction, punit,
|
||
&& (blocker = action_is_blocked_by(nmap, paction, punit,
|
||
target_tile, target_city,
|
||
target_unit))) {
|
||
explnat->kind = ANEK_ACTION_BLOCKS;
|