Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2003:
[Freeciv-Dev] Re: (PR#4181)
Home

[Freeciv-Dev] Re: (PR#4181)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rt-guest@xxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#4181)
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Wed, 7 May 2003 04:31:00 -0700
Reply-to: rt@xxxxxxxxxxxxxx

On Tue, 6 May 2003, Per I. Mathisen wrote:

> 
> On Tue, 6 May 2003, Guest wrote:
> > I am customizing my tech file and Freeciv-cvs as of April broke. It says
> > that it starts but then hangs my linux machine. I do not see any error
> > mesages. It severly slows down my system and still does not display a
> > map. why is that?
> 
> It is because of this:
> 
>       [advance_mobile_warfare10]
>       name     = _("Mobile Warfare10")
>       req1     = "Mobile Warfare10"
>       req2     = "None"
>       flags    = ""
> 
> You have this tech as its own requirement. Hence the tech tree code (which
> is recursive) loops until it runs out of stack, I guess.
> 
> The attached patch will detect this condition and print the following
> error message:
> 
>   0: tech "Mobile Warfare10": requires itself (data/new/techs.ruleset)

Well detected but a bad fix.  You can still have a loop of length more 
than 1, eg

Fusion requires Fission
and
Fission requires Fusion

The proper fix, IMO, is to put 
if (advances[tech].req[0] == goal  ||  advances[tech].req[1] == goal) {
  die("%s is an indirect prerequisite for itself", advances[goal].name);
} 
just before two recursive calls to 
build_required_tech_helper in the function
build_required_tech_helper  (common/tech.c:92)

G.




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