Bug #1419 ยป 0033-AI-Avoid-spam-about-failed-city-build-because-of-ena.patch
| ai/default/daisettler.c | ||
|---|---|---|
|
player_name(pplayer), TILE_XY(ptile));
|
||
|
} else {
|
||
|
/* The request was illegal to begin with. */
|
||
|
log_error("%s: Failed to build city at (%d, %d). Reason id: %d",
|
||
|
player_name(pplayer), TILE_XY(ptile), reason);
|
||
|
if (reason == ANEK_UNKNOWN
|
||
|
&& !action_enablers_allow(ACTION_FOUND_CITY,
|
||
|
&(const struct req_context) {
|
||
|
.player = unit_owner(punit),
|
||
|
.city = tile_city(ptile),
|
||
|
.tile = ptile,
|
||
|
.unit = punit,
|
||
|
.unittype = unit_type_get(punit),
|
||
|
},
|
||
|
&(const struct req_context) {
|
||
|
.player = tile_owner(ptile),
|
||
|
.city = tile_city(ptile),
|
||
|
.tile = ptile,
|
||
|
} )) {
|
||
|
log_debug("%s: Failed to build city at (%d, %d). Enablers disallow.",
|
||
|
player_name(pplayer), TILE_XY(ptile));
|
||
|
} else {
|
||
|
log_error("%s: Failed to build city at (%d, %d). Reason id: %d",
|
||
|
player_name(pplayer), TILE_XY(ptile), reason);
|
||
|
}
|
||
|
return CBE_FATAL;
|
||
|
}
|
||
| common/actions.c | ||
|---|---|---|
|
return FALSE;
|
||
|
}
|
||
|
return action_enablers_allow(wanted_action, actor, target);
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
|
Returns whether action enablers would allow action,
|
||
|
assuming hard requirements do.
|
||
|
**************************************************************************/
|
||
|
bool action_enablers_allow(const action_id wanted_action,
|
||
|
const struct req_context *actor,
|
||
|
const struct req_context *target)
|
||
|
{
|
||
|
action_enabler_list_iterate(action_enablers_for_action(wanted_action),
|
||
|
enabler) {
|
||
|
if (is_enabler_active(enabler, actor, target)) {
|
||
| common/actions.h | ||
|---|---|---|
|
bool action_immune_government(struct government *gov, action_id act);
|
||
|
bool action_enablers_allow(const action_id wanted_action,
|
||
|
const struct req_context *actor,
|
||
|
const struct req_context *target);
|
||
|
bool is_action_possible_on_city(action_id act_id,
|
||
|
const struct player *actor_player,
|
||
|
const struct city *target_city);
|
||