From 90b75d5ffa3828305b4df3403c97066fc9b6cb35 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 7 Nov 2021 23:08:40 +0200 Subject: [PATCH 17/17] Fix assert failure when client is handling dead player's research See osdn #42988 Signed-off-by: Marko Lindqvist --- common/research.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/common/research.c b/common/research.c index 904a7bed27..e3c212fedf 100644 --- a/common/research.c +++ b/common/research.c @@ -545,7 +545,15 @@ void research_update(struct research *presearch) ? TECH_PREREQS_KNOWN : TECH_UNKNOWN); } } else { - fc_assert(state == TECH_UNKNOWN); + /* We used to assert here that state already is TECH_UNKNOWN. However, there is + * a special case where it can be e.g. TECH_PREREQS_KNOWN and still + * unreachable (like in above research_get_reachable() call) because + * player is dead. Dead player's don't research anything. More accurately + * research_players_iterate() for a dead player's research iterates over + * zero players in research_allowed(), so it falls through to default of FALSE. + * + * Now we set the state to TECH_UNKNOWN instead of asserting that it already is. */ + state = TECH_UNKNOWN; } presearch->inventions[i].state = state; presearch->inventions[i].reachable = reachable; -- 2.30.2