Bug #1618 » 1618_Main.patch
| server/unithand.c | ||
|---|---|---|
|
{
|
||
|
int amount = unit_pop_value(punit);
|
||
|
const struct unit_type *act_utype;
|
||
|
Specialist_type_id spec_id = DEFAULT_SPECIALIST;
|
||
|
int new_food;
|
||
|
int savings_pct = city_growth_granary_savings(pcity);
|
||
| ... | ... | |
|
/* Preserve old food stock, unless granary effect gives us more. */
|
||
|
pcity->food_stock = MAX(pcity->food_stock, new_food);
|
||
|
citizens_update(pcity, unit_nationality(punit));
|
||
|
if (is_super_specialist(act_utype->spec_type)) {
|
||
|
Specialist_type_id sspec = specialist_index(act_utype->spec_type);
|
||
|
fc_assert_ret_val(pcity->specialists[sspec] < MAX_CITY_SIZE, FALSE);
|
||
|
pcity->specialists[sspec]++;
|
||
|
/* Refresh the city data. */
|
||
|
city_refresh(pcity);
|
||
|
} else {
|
||
|
fc_assert_ret_val(amount > 0, FALSE);
|
||
|
/* Hardly much needed but let it be */
|
||
|
spec_id = specialist_index(act_utype->spec_type);
|
||
|
/* Make the new people something, otherwise city fails the checks */
|
||
|
auto_arrange_workers(pcity); /* this calls city_refresh(pcity) */
|
||
|
}
|
||
|
/* Make the new people something, otherwise city fails the checks */
|
||
|
fc_assert_ret_val(MAX_CITY_SIZE - pcity->specialists[spec_id] >= amount,
|
||
|
FALSE);
|
||
|
pcity->specialists[spec_id] += amount;
|
||
|
citizens_update(pcity, unit_nationality(punit));
|
||
|
/* Refresh the city data. */
|
||
|
city_refresh(pcity);
|
||
|
/* Notify the unit owner that the unit successfully joined the city. */
|
||
|
notify_player(pplayer, city_tile(pcity), E_CITY_BUILD, ftc_server,
|
||
- « Previous
- 1
- 2
- Next »