Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2004:
[Freeciv-Dev] (PR#7912) server_remove_unit resets ai role and triggers a
Home

[Freeciv-Dev] (PR#7912) server_remove_unit resets ai role and triggers a

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#7912) server_remove_unit resets ai role and triggers assert
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 13 Mar 2004 13:20:34 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7912 >

ai_unit_new_role is being called when the unit has orders.  This is a 
trivial case to handle.

jason

Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.285
diff -u -r1.285 unittools.c
--- server/unittools.c  12 Mar 2004 06:20:32 -0000      1.285
+++ server/unittools.c  13 Mar 2004 21:19:08 -0000
@@ -1636,7 +1636,8 @@
      are built, so that no two settlers head towards the same city
      spot, we need to ensure this reservation is cleared should
      the settler die on the way. */
-  if (unit_owner(punit)->ai.control) {
+  if ((unit_owner(punit)->ai.control || punit->ai.control)
+      && punit->ai.ai_role != AIUNIT_NONE) {
     ai_unit_new_role(punit, AIUNIT_NONE, -1, -1);
   }
 
# examining core.24824 in /games/275432/. ...
# using $FREECIV_PATH 
/home/freeciv/.freeciv/code/installed/cvs/HEAD/2004-03-11_10.00+cmdquestions/share/freeciv
# running: (echo bt; echo quit; exec yes '') | gdb  
/home/freeciv/.freeciv/code/installed/cvs/HEAD/2004-03-11_10.00+cmdquestions/share/freeciv/../../bin/civserver
 core.24824
GNU gdb Red Hat Linux (5.2-2)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
Core was generated by 
`/home/freeciv/.freeciv/code/installed/cvs/HEAD/2004-03-11_10.00+cmdquestions/sh'.
Program terminated with signal 6, Aborted.
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /usr/lib/libz.so.1...done.
Loaded symbols for /usr/lib/libz.so.1
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
Reading symbols from /lib/libnss_nisplus.so.2...done.
Loaded symbols for /lib/libnss_nisplus.so.2
Reading symbols from /lib/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib/libnss_dns.so.2...done.
Loaded symbols for /lib/libnss_dns.so.2
Reading symbols from /lib/libresolv.so.2...done.
Loaded symbols for /lib/libresolv.so.2
#0  0x400750a1 in kill () from /lib/libc.so.6
(gdb) #0  0x400750a1 in kill () from /lib/libc.so.6
#1  0x40074e99 in raise () from /lib/libc.so.6
#2  0x40076364 in abort () from /lib/libc.so.6
#3  0x4006f15d in __assert_fail () from /lib/libc.so.6
#4  0x080e7a21 in ai_unit_new_role (punit=0x8a90d10, task=AIUNIT_NONE, x=-1, 
    y=-1) at aitools.c:438
#5  0x080573a5 in server_remove_unit (punit=0x8a90d10) at unittools.c:1618
#6  0x0805764a in wipe_unit_spec_safe (punit=0x8a90d10, wipe_cargo=false)
    at unittools.c:1691
#7  0x08057e37 in kill_unit (pkiller=0x892f080, punit=0x8a90d10)
    at unittools.c:1861
#8  0x0808f245 in handle_unit_attack_request (punit=0x892f080, 
    pdefender=0x8a90d10) at unithand.c:820
#9  0x0808f732 in handle_unit_move_request (punit=0x892f080, x=73, y=23, 
    igzoc=false, move_diplomat_city=false) at unithand.c:1041
#10 0x0808eabf in handle_unit_move (pplayer=0x8287aa8, unit_id=1186, x=73, 
    y=23) at unithand.c:600
#11 0x080e7e4c in ai_unit_attack (punit=0x892f080, x=73, y=23) at aitools.c:577
#12 0x080e7131 in ai_unit_execute_path (punit=0x892f080, path=0x8633790)
    at aitools.c:118
#13 0x080e9d90 in ai_military_rampage (punit=0x892f080, thresh_adj=1, 
    thresh_move=1) at aiunit.c:1069
#14 0x080eacc6 in ai_military_gohome (pplayer=0x8287aa8, punit=0x892f080)
    at aiunit.c:1462
#15 0x080ecd72 in ai_manage_military (pplayer=0x8287aa8, punit=0x892f080)
    at aiunit.c:2537
#16 0x080ed25c in ai_manage_units (pplayer=0x8287aa8) at aiunit.c:2682
#17 0x0804ce27 in ai_start_turn () at srv_main.c:433
#18 0x0804e2b3 in main_loop () at srv_main.c:1334
#19 0x0804e4c1 in srv_main () at srv_main.c:1479
#20 0x08049c70 in main (argc=9, argv=0xbfffe944) at civserver.c:157
#21 0x400641c4 in __libc_start_main () from /lib/libc.so.6
(gdb) 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#7912) server_remove_unit resets ai role and triggers assert, Jason Short <=