Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. *Read more...*

Feature #877391 ยป 0028-dai_upgrade_units-by-action-result.patch

Sveinung Kvilhaugsvik, 2020-06-11 12:03 PM

View differences:

ai/default/daicity.c
**************************************************************************/
static void dai_upgrade_units(struct city *pcity, int limit, bool military)
{
action_id upgrade_actions[MAX_NUM_ACTIONS];
struct player *pplayer = city_owner(pcity);
int expenses;
{
/* Find upgrade unit actions */
int i = 0;
action_list_add_all_by_result(upgrade_actions, &i, ACTRES_UPGRADE_UNIT);
action_list_end(upgrade_actions, i);
}
dai_calc_data(pplayer, NULL, &expenses, NULL);
unit_list_iterate(pcity->tile->units, punit) {
......
continue;
}
if (punittype) {
if (punittype == NULL) {
continue;
}
action_list_iterate(upgrade_actions, act_id) {
const struct action *paction = action_by_number(act_id);
int cost = unit_upgrade_price(pplayer, old_type, punittype);
int real_limit = limit;
......
military ? "military" : "civilian");
unit_do_action(city_owner(pcity), punit->id,
pcity->id, 0, "",
ACTION_UPGRADE_UNIT);
paction->id);
} else {
increase_maxbuycost(pplayer, cost);
}
}
} action_list_iterate_end;
}
} unit_list_iterate_end;
}
    (1-1/1)