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

[Freeciv-Dev] Assertion fails in get_role_unit()

[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] Assertion fails in get_role_unit()
From: Petr Baudis <pasky@xxxxxxxxxxx>
Date: Sun, 7 Apr 2002 18:34:56 +0200

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:

#0  0x40087861 in __kill () from /lib/libc.so.6
(gdb) bt
#0  0x40087861 in __kill () from /lib/libc.so.6
#1  0x40087545 in raise (sig=6) at ../sysdeps/posix/raise.c:27
#2  0x40088d01 in abort () at ../sysdeps/generic/abort.c:88
#3  0x400819e2 in Letext () at assert.c:59
#4  0x80d563d in get_role_unit (role=1, index=0) at 
../../freeciv-/common/unittype.c:543
#5  0x80db88d in domestic_advisor_choose_build (pplayer=0x8184b28, 
pcity=0x82a4ea8, choice=0xbffffa94)
    at ../../freeciv-/ai/advdomestic.c:766
#6  0x80e0854 in ai_city_choose_build (pplayer=0x8184b28, pcity=0x82a4ea8) at 
../../freeciv-/ai/aicity.c:189
#7  0x80e18f1 in ai_manage_cities (pplayer=0x8184b28) at 
../../freeciv-/ai/aicity.c:518
#8  0x80e478a in ai_do_last_activities (pplayer=0x8184b28) at 
../../freeciv-/ai/aihand.c:370
#9  0x808856a in update_player_activities (pplayer=0x8184b28) at 
../../freeciv-/server/plrhand.c:172
#10 0x804ec8e in end_turn () at ../../freeciv-/server/srv_main.c:421
#11 0x8051b65 in main_loop () at ../../freeciv-/server/srv_main.c:1720
#12 0x80523af in srv_main () at ../../freeciv-/server/srv_main.c:1964
#13 0x804a8ac in main (argc=5, argv=0xbffffc64) at 
../../freeciv-/server/civserver.c:153
#14 0x400767d6 in __libc_start_main (main=0x804a1f4 <main>, argc=5, 
ubp_av=0xbffffc64, init=0x80498dc <_init>,
    fini=0x81016c0 <_fini>, rtld_fini=0x4000b5f0 <_dl_fini>, 
stack_end=0xbffffc5c) at ../sysdeps/generic/libc-start.c:129

  Maybe this's also cause of those cores on civserver.freeciv.org..?

  Have fun,

-- 
 
                                Petr "Pasky" Baudis
 
* ELinks maintainer                * IPv6 guy (XS26 co-coordinator)
* IRCnet operator                  * FreeCiv AI hacker
.
Teamwork is essential -- it allows you to blame someone else.
.
Public PGP key && geekcode && homepage: http://pasky.ji.cz/~pasky/


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