Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2002:
[Freeciv-Dev] Re: civserver segfault with new research system (PR#1221)
Home

[Freeciv-Dev] Re: civserver segfault with new research system (PR#1221)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: civserver segfault with new research system (PR#1221)
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 12 Jan 2002 19:33:25 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Sat, Jan 12, 2002 at 05:14:51PM +0000, Gregory Berkolaiko wrote:
>  --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
> > On Fri, Jan 11, 2002 at 03:00:54PM -0800, jdorje@xxxxxxxxxxxxxxxxxxxxx
> > wrote:
> > > 
> > >  > civserver: tech.c:349: base_total_bulbs_required: Assertion 
> > > `!is_barbarian(pplayer)' failed.
> > > Aborted (core dumped)
> 
> > I'm not sure about the correct way to solve this. "How much" tech do
> > barbarians need?
> 
> Do barbarians research at all?

That is the question.

> Why did you put the assert in the first place?

get_num_human_and_ai_players() returns 0 for them. Divide by zero.

> > A robust solution IMHO is:
> > 
> > + if(!is_barbarian(pplayer)) {
> >   if (game.rgame.tech_leakage == 0) {
> > ...
> >     exit(1);
> >   }
> > + }
> 
> Sounds fine.  However since the bracketed statement is rather long, I
> would prefer another exit point:
> 
> if (is_barabrian(pplayer)) {
>   return cost;
> }

I initially decided against it since it may happen that we add another
modifier like the game.year test after the leakage. But you are right
this doesn't matter for barbarians.

> BTW, I know it's too late now, but I remember suggesting it before and
> the suggestion was obviously ignored.  It would look so much better IMHO
> if the "if - else if - else if"s in base_total_bulbs_required were
> converted into a switch statement.

It was initially a switch statement. I converted it. Because there
were duplicated code: future techs are the same as style 0 and style 2
is style 1 is there are unset values.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  "Real Users find the one combination of bizarre
   input values that shuts down the system for days."


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