Project

General

Profile

Feature #1084 ยป 0074-AI-Reduce-want-of-settlers-if-Found-City-action-is-n.patch

Marko Lindqvist, 11/09/2024 06:30 AM

View differences:

ai/default/daidomestic.c
}
}
if (adv->max_num_cities <= city_list_size(pplayer->cities)) {
if (adv->max_num_cities <= city_list_size(pplayer->cities)
|| !player_can_do_action_result(pplayer, ACTRES_FOUND_CITY)) {
founder_want /= 100;
}
common/player.c
fc_assert(plrstate_type_is_valid(state));
return FALSE;
}
/*******************************************************************//**
Can player do some action for the result?
@param pplayer Player to do the action
@param result Action result to look for
@return Whether player can do some action for the result
***********************************************************************/
bool player_can_do_action_result(struct player *pplayer,
enum action_result result)
{
action_by_result_iterate(paction, result) {
action_enabler_list_iterate(action_enablers_for_action(action_id(paction)),
penabler) {
struct universal u[2] = {
{.kind = VUT_GOVERNMENT, .value = {.govern = (pplayer->government)}},
{.kind = VUT_MINCITIES, .value = {.min_cities = (city_list_size(pplayer->cities))}},
};
if (!universals_mean_unfulfilled(&(penabler->actor_reqs), u, 2)) {
return TRUE;
}
} action_enabler_list_iterate_end;
} action_by_result_iterate_end;
return FALSE;
}
common/player.h
int player_multiplier_target_value(const struct player *pplayer,
const struct multiplier *pmul);
/* iterate over all player slots */
bool player_can_do_action_result(struct player *pplayer,
enum action_result result);
/* Iterate over all player slots */
#define player_slots_iterate(_pslot) \
if (player_slots_initialised()) { \
struct player_slot *_pslot = player_slot_first(); \
    (1-1/1)