Project

General

Profile

Bug #1784 ยป 0047-Make-citizens_unit_nationality-more-robust.patch

Marko Lindqvist, 11/29/2025 09:24 AM

View differences:

server/citizenshand.c
*****************************************************************************/
struct player
*citizens_unit_nationality(const struct city *pcity,
int pop_cost,
unsigned pop_cost,
struct citizens_reduction *pchange)
{
struct {
......
int max_nat = 0; /* Maximal number of a nationality gone into the unit */
struct player_slot *dominant = NULL;
fc_assert_ret_val(pcity, NULL);
fc_assert(pop_cost > 0);
if (!game.info.citizen_nationality) {
/* Nothing to do */
return pcity->owner;
......
pchange->change = 0;
}
fc_assert(dominant != NULL);
if (dominant == NULL) {
return pcity->owner;
}
return player_slot_get_player(dominant);
}
server/citizenshand.h
void citizens_convert_conquest(struct city *pcity);
struct player
*citizens_unit_nationality(const struct city *pcity,
int pop_cost,
struct citizens_reduction *pchange);
unsigned pop_cost,
struct citizens_reduction *pchange)
fc__attribute((nonnull(1)));
void citizens_reduction_apply(struct city *pcity,
const struct citizens_reduction *pchange);
    (1-1/1)