From b8d3b45e92a83c0a210fce09070db7fa91991a4e Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 23 Aug 2022 20:14:34 +0300 Subject: [PATCH 58/58] Disallow selecting more Future techs after losing a real tech One has to researh the real tech again to regain ability to continue researching more future techs Reported anonymously See osdn #44592 Signed-off-by: Marko Lindqvist --- server/techtools.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/server/techtools.c b/server/techtools.c index a78d301a48..a33c422c69 100644 --- a/server/techtools.c +++ b/server/techtools.c @@ -488,8 +488,28 @@ void found_new_tech(struct research *presearch, Tech_type_id tech_found, (presearch, presearch->tech_goal)); } else { if (is_future_tech(tech_found)) { - /* Continue researching future tech. */ - next_tech = A_FUTURE; + /* Use pick_random_tech() to determine if there now is + * a regular tech to research, e.g., if one was lost + * due to tech upkeep since we started researching future techs. */ + next_tech = pick_random_tech(presearch); + + /* Continue researching future tech, if possible. */ + if (next_tech != A_FUTURE) { + bool ai_found = FALSE; + + /* Otherwise check if there's an AI player to support + * randomly selected tech (one that "made" the decision) */ + research_players_iterate(presearch, aplayer) { + if (is_ai(aplayer)) { + ai_found = TRUE; + } + } research_players_iterate_end; + + if (!ai_found) { + /* Decision is humans' to make */ + next_tech = A_UNSET; + } + } } else { /* If there is at least one AI player still alive, then pick * a random tech, else keep A_UNSET. */ -- 2.35.1