Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2002:
[Freeciv-Dev] Re: core file on civserver, http://civserver.freeciv.org/g
Home

[Freeciv-Dev] Re: core file on civserver, http://civserver.freeciv.org/g

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: core file on civserver, http://civserver.freeciv.org/games/43328
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Wed, 9 Oct 2002 16:11:15 +0000 (GMT)

On Mon, 7 Oct 2002 rf13@xxxxxxxxxxxxxxxxx wrote:
> > Core was generated by 
> > `/home/freeciv/.freeciv/code/installed/stable/freeciv-1.13.0+local-1.13.0/share/'.
> > Program terminated with signal 8, Arithmetic exception.
>
> > #00x08074a84 in get_research (pplayer=0x8132224) at report.c:344
> > 344 return (pplayer->score.techout * 100) / (total_bulbs_required(pplayer));

> I expect that total_bulbs_required returns 0 which indicates that the
> player researches a tech which is already known. I have no idea if
> this is allowed to happen. And if yes for which period of time.

In the offending function:
  if (!is_future_tech(tech) && get_invention(pplayer, tech) == TECH_KNOWN) {
    /* A non-future tech which is already known costs nothing. */
    return 0;
  }

So this patch will fix the problem (committed):

Index: server/report.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/report.c,v
retrieving revision 1.33
diff -u -r1.33 report.c
--- server/report.c     2002/10/03 21:34:38     1.33
+++ server/report.c     2002/10/09 16:10:24
@@ -341,7 +341,7 @@

 static int get_research(struct player *pplayer)
 {
-  return (pplayer->score.techout * 100) / (total_bulbs_required(pplayer));
+  return (pplayer->score.techout * 100) / MAX(total_bulbs_required(pplayer), 
1);
 }

 static int get_literacy(struct player *pplayer)

  - Per



[Prev in Thread] Current Thread [Next in Thread]