Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2005:
[Freeciv-Dev] (PR#13705) pubserver S2_0 crash in found_new_tech
Home

[Freeciv-Dev] (PR#13705) pubserver S2_0 crash in found_new_tech

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#13705) pubserver S2_0 crash in found_new_tech
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Tue, 6 Sep 2005 07:11:06 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13705 >

> [jdorje - Fri Aug 19 01:54:19 2005]:
> 
> Player 5 has finished researching Iron Working.  The assertion triggers
> because he already knows iron working.  The crash doesn't really help in
> showing how he got iron working earlier.  But this is surely a teams
> bug; this game has 6 players on 2 teams.
> 
> Mateusz, can you look at this?  If you can find the source we can fix
> it.  But I don't want to do intrusive changes to S2_0; remember team
> research is already a known bug.  The best solution might be to remove
> the assert or add a workaround in find_new_tech (or its caller,
> update_tech).
> 
> -jason
> 
I can't find the source of the bug. This is a patch which makes the bug
little less dangerous.
--
mateusz

Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.330.2.35
diff -u -r1.330.2.35 plrhand.c
--- server/plrhand.c    24 Aug 2005 17:22:06 -0000      1.330.2.35
+++ server/plrhand.c    6 Sep 2005 14:06:46 -0000
@@ -278,12 +278,33 @@
       = (get_player_bonus(aplr, EFT_HAVE_EMBASSIES) > 0);
   } players_iterate_end;
 
+  /* This is a hack which makes buggy team research work somehow
+     in 2.0 branch */
+  if (tech_exists(tech_found)
+      && get_invention(plr, tech_found) == TECH_KNOWN) {
+    freelog(LOG_ERROR, "Error: found_new_tech() was called on already "
+                       "researched technology %s for player %s",
+           get_tech_name(plr, tech_found), plr->name);
+    freelog(LOG_ERROR, "Report this bug at <bugs@xxxxxxxxxxx>\n"
+            "Here is some info you should attach:");
+    players_iterate(eplayer) {
+      freelog(LOG_ERROR, 
+              "Player %s(team %d): researching %s;\n bulbs_researched %d; "
+             "techs_researched: %d; bulbs_last_turn: %d; Researched %s? %s",
+             eplayer->name,
+             eplayer->team,
+             get_tech_name(eplayer, eplayer->research.researching),
+             eplayer->research.bulbs_researched,
+             eplayer->research.techs_researched,
+             eplayer->research.bulbs_last_turn,
+             get_tech_name(plr, tech_found),
+             get_invention(eplayer, tech_found) == TECH_KNOWN ? "yes" : "no");
+    } players_iterate_end;
+  }
+
   /* HACK: A_FUTURE doesn't "exist" and is thus not "available".  This may
    * or may not be the correct thing to do.  For these sanity checks we
    * just special-case it. */
-  assert((tech_exists(tech_found)
-         && get_invention(plr, tech_found) != TECH_KNOWN)
-        || tech_found == A_FUTURE);
   assert(tech_is_available(plr, tech_found) || tech_found == A_FUTURE);
 
   /* got_tech allows us to change research without applying techpenalty

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#13705) pubserver S2_0 crash in found_new_tech, Mateusz Stefek <=