Index: server/plrhand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v retrieving revision 1.227 diff -u -r1.227 plrhand.c --- server/plrhand.c 2002/04/04 18:53:29 1.227 +++ server/plrhand.c 2002/04/04 19:17:40 @@ -220,7 +220,6 @@ bool bonus_tech_hack = FALSE; bool was_first = FALSE; bool macro_polo_was_obsolete = wonder_obsolete(B_MARCO); - int saved_bulbs; struct city *pcity; plr->got_tech = TRUE; @@ -285,7 +284,7 @@ if (tech_found==plr->research.researching) { /* need to pick new tech to research */ - saved_bulbs = plr->research.bulbs_researched; + int saved_bulbs = plr->research.bulbs_researched; if (choose_goal_tech(plr) != 0) { notify_player(plr, @@ -405,20 +404,21 @@ } /************************************************************************** -Called from each city to update the research. + Called from each city to update the research. **************************************************************************/ void update_tech(struct player *plr, int bulbs) { - int missing = total_bulbs_required(plr) - plr->research.bulbs_researched; + int excessive_bulbs; - assert(missing > 0); + plr->research.bulbs_researched += bulbs; + + excessive_bulbs = + (plr->research.bulbs_researched - total_bulbs_required(plr)); - if (bulbs >= missing) { - plr->research.bulbs_researched += missing; + if (excessive_bulbs >= 0) { tech_researched(plr); - plr->research.bulbs_researched += (bulbs - missing); - } else { - plr->research.bulbs_researched += bulbs; + plr->research.bulbs_researched += excessive_bulbs; + update_tech(plr, 0); } }