Author: cazfi Date: Sun Jan 17 22:29:44 2016 New Revision: 31478 URL: http://svn.gna.org/viewcvs/freeciv?rev=31478&view=rev Log: Made adding an unit to a city to emit "city_size_change" signal to lua scripts.
See bug #24308 Modified: branches/S2_6/server/unithand.c Modified: branches/S2_6/server/unithand.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/unithand.c?rev=31478&r1=31477&r2=31478&view=diff ============================================================================== --- branches/S2_6/server/unithand.c (original) +++ branches/S2_6/server/unithand.c Sun Jan 17 22:29:44 2016 @@ -1592,11 +1592,17 @@ static void city_add_unit(struct player *pplayer, struct unit *punit) { struct city *pcity = tile_city(unit_tile(punit)); - - fc_assert_ret(unit_pop_value(punit) > 0); - city_size_add(pcity, unit_pop_value(punit)); + int amount = unit_pop_value(punit); + + fc_assert_ret(amount > 0); + + script_server_signal_emit("city_size_change", 3, + API_TYPE_CITY, pcity, + API_TYPE_INT, amount, + API_TYPE_STRING, "unit_added"); + city_size_add(pcity, amount); /* Make the new people something, otherwise city fails the checks */ - pcity->specialists[DEFAULT_SPECIALIST] += unit_pop_value(punit); + pcity->specialists[DEFAULT_SPECIALIST] += amount; citizens_update(pcity, unit_nationality(punit)); /* Refresh the city data. */ city_refresh(pcity); _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits