Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2002:
[Freeciv-Dev] Re: Assertion fails in get_role_unit() (PR#1365)
Home

[Freeciv-Dev] Re: Assertion fails in get_role_unit() (PR#1365)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Assertion fails in get_role_unit() (PR#1365)
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 9 Apr 2002 13:13:55 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Mon, Apr 08, 2002 at 12:16:22PM -0700, rf13@xxxxxxxxxxxxxxxxxxxxxx wrote:
> On Sun, Apr 07, 2002 at 06:34:56PM +0200, Petr Baudis wrote:
> > Hello,
> > 
> >   I just wanted to test my cleanup patches, so I happily set up autogame..
> > 
> > Option: seed has been set to 16.
> > Option: randseed has been set to 16.
> > Option: huts has been set to 0.
> > Option: aifill has been set to 4.
> > Option: timeout has been set to -1.
> > Created new AI player: Caesar.
> > Caesar is now hard.
> > Setting game.skill_level to 7.
> > 
> >   ..and started it - but after very short delay..
> > 
> > Game saved as civgame-3000.sav
> > > civserver: ../../freeciv-/common/unittype.c:543: get_role_unit: Assertion 
> > > `index>=0 && index<n_with_role[role]' failed.
> > Aborted (core dumped)
> > 
> >   *POOF* Oh well, I said to myself, and tried with official CVS version. And
> > same result. So I debugged this a bit, and the values before assert are..
> > 
> > index 0 - role 1 - nwr 0
> > 
> >   Thus, n_with_role[1] is zero, which is not larger than index. Assertion
> > fails. Simple fix would be to change the assertion so that it won't fail if
> > index==n_with_role[role], however I'm not sure if the problem doesn't lie a 
> > bit
> > deeper. After all, how comes that all units disappeared suddenly from one 
> > role?
> > 
> >   Reproducible with the autogame settings above. For the reference, 
> > backtrace:
> 
> If you don't know Trade yet you don't know a unit which have the
> F_HELP_WONDER flag set.

This is wrong since the roles are calculated independent of the known
tech.

> I have no clue why it worked in the past. 

> The correct fix is to test with num_role_units first.

This is correct.

While the current code isn't robust it works with the current data/. I
think that you have used an old ruleset with no HelpWonder flag or
similar.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Sit, disk, sit. Good boy. Now spin up. Very good. Here's a netscape
  cookie for you. Fetch me some data. Come on, you can do it. No, not that
  data. Bad disk. Bad." 
    -- Calle Dybedahl, alt.sysadmin.recovery


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