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: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Tue, 6 May 2003 23:37:47 -0700
Reply-to: rt@xxxxxxxxxxxxxx

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)

  - Per

Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.140
diff -u -r1.140 ruleset.c
--- server/ruleset.c    4 Apr 2003 15:47:50 -0000       1.140
+++ server/ruleset.c    7 May 2003 06:36:31 -0000
@@ -558,6 +558,11 @@
   for( i=A_FIRST; i<game.num_tech_types; i++ ) {
     if (tech_exists(i)) {
       a = &advances[i];
+      if (a->req[0] == i || a->req[1] == i) {
+        freelog(LOG_FATAL, "tech \"%s\": requires itself (%s)", a->name,
+                filename);
+        exit(EXIT_FAILURE);
+      }
       if (!tech_exists(a->req[0])) {
        freelog(LOG_FATAL, "tech \"%s\": req1 leads to removed tech \"%s\" 
(%s)",
             a->name, advances[a->req[0]].name, filename);

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