Update of bug #22359 (project freeciv): Summary: Infinite loop in pick_random_tech => Infinite loop in choose_random_tech()
_______________________________________________________ Follow-up Comment #5: I'm not understanding the recent changes to techs well enough to know the right answer, but there's an infinite loop available in choose_random_tech() when choose_tech() fails to set a research target (as it does when passed an unresearchable target). This patch worked for me, but I'm not at all confident it's right, so won't even consider putting it in SVN (although anyone else is welcome to swipe it if they understand the situation and like this solution). It may be useful to folk running public servers who want to avoid this issue (but it may break other things: I don't know). --- a/server/techtools.c +++ b/server/techtools.c @@ -924,7 +924,11 @@ void choose_random_tech(struct player *plr) { struct research* research = research_get(plr); do { - choose_tech(plr, pick_random_tech(plr)); + Tech_type_id tech = pick_random_tech(plr); + choose_tech(plr, tech); + if (research_invention_state(research, tech) != TECH_PREREQS_KNOWN) { + break; + } } while (research->researching == A_UNSET); } Despite the backtraces, the call to pick_random_tech() where the interruptions happen is always from choose_random_tech(), and pick_random_tech() is iterating properly over all available advances, and returning, and re-interating when called again (I did reproduce this several times with instrumented builds to confirm this). _______________________________________________________ Reply to this item at: <http://gna.org/bugs/?22359> _______________________________________________ Message sent via/by Gna! http://gna.org/ _______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev