[Freeciv-Dev] (PR#40617) Assertion with RiverNative flag
http://bugs.freeciv.org/Ticket/Display.html?id=40617 > Hi, On the trunk, when giving the trireme "RiverNative" flag, the game forces us to change it's movement type to "Both" in order of it to work. But doing so cause a in advmilitary.c. The backtrace: > civserver: advmilitary.c:1183: kill_something_with: Assertion `SEA_MOVING == > utype_move_type(boattype)' failed. Program received signal SIGABRT, Aborted. 0x7feec1c313c5 in raise () from /lib/libc.so.6 (gdb) backtrace #0 0x7feec1c313c5 in raise () from /lib/libc.so.6 #1 0x7feec1c3273e in abort () from /lib/libc.so.6 #2 0x7feec1c2ab1f in __assert_fail () from /lib/libc.so.6 #3 0x004c415c in kill_something_with (pplayer=0x898100, pcity=0x1bd2b40, myunit=0x1bcecb0, choice=0x1bd38e0) at advmilitary.c:1183 #4 0x004c437a in military_advisor_choose_build (pplayer=0x898100, pcity=0x1bd2b40, choice=0x1bd38e0) at advmilitary.c:1512 #5 0x004ccb33 in ai_manage_cities (pplayer=0x898100) at aicity.c:1754 #6 0x004d1942 in ai_do_last_activities (pplayer=0x898100) at aihand.c:460 #7 0x0046d64d in srv_running () at srv_main.c:795 #8 0x0046dc86 in srv_main () at srv_main.c:2259 #9 0x00404236 in main (argc=3, argv=0x7fffca829328) at civserver.c:283 The AI exepcts the transport to be a boat, moving over seas. Is this check really neccesary? Should we check if the suggested unit can reach the target unit some other way, or at least check that the movement type is not "land"? ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#40617) Assertion with RiverNative flag
http://bugs.freeciv.org/Ticket/Display.html?id=40617 > 2009/1/2 Yoav Luft: > On the trunk, when giving the trireme "RiverNative" flag, the game > forces us to change it's movement type to "Both" in order of it to > work. But doing so cause a in advmilitary.c. > The backtrace: >> civserver: advmilitary.c:1183: kill_something_with: Assertion `SEA_MOVING == >> utype_move_type(boattype)' failed. Interesting. It seems like this has been broken always, and not only since riverboats were introduced. IIRC AI should not even consider using transports other than sea moving. (LAND_MOVING transports would make no sense at all to ferryboat code). > > The AI exepcts the transport to be a boat, moving over seas. Is this > check really neccesary? Should we check if the suggested unit can > reach the target unit some other way, I'm afraid other parts of AI code couldn't handle such a generic case, so... > or at least check that the > movement type is not "land"? ...this sounds like a most sensible solution. I think I have already converted some other similar assertions to this form (hmm... maybe I have caused this particular assertion by allowing "Both" moving units to reach this point of code...) - ML ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#40617) Assertion with RiverNative flag
http://bugs.freeciv.org/Ticket/Display.html?id=40617 > 2009/1/2 Marko Lindqvist: > 2009/1/2 Yoav Luft: >>> civserver: advmilitary.c:1183: kill_something_with: Assertion `SEA_MOVING >>> == utype_move_type(boattype)' failed. > > >> or at least check that the >> movement type is not "land"? > > ...this sounds like a most sensible solution. Mainly untested patch - ML diff -Nurd -X.diff_ignore freeciv/ai/advmilitary.c freeciv/ai/advmilitary.c --- freeciv/ai/advmilitary.c2008-10-27 04:13:32.0 +0200 +++ freeciv/ai/advmilitary.c2009-01-04 14:35:03.0 +0200 @@ -1180,7 +1180,7 @@ boattype = get_role_unit(L_FERRYBOAT, 0); } } - assert(SEA_MOVING == utype_move_type(boattype)); + assert(LAND_MOVING != utype_move_type(boattype)); go_by_boat = !(WARMAP_COST(ptile) <= (MIN(6, move_rate) * THRESHOLD) && goto_is_sane(myunit, acity->tile, TRUE)); diff -Nurd -X.diff_ignore freeciv/server/ruleset.c freeciv/server/ruleset.c --- freeciv/server/ruleset.c2008-12-28 14:53:34.0 +0200 +++ freeciv/server/ruleset.c2009-01-04 14:50:00.0 +0200 @@ -1334,11 +1334,15 @@ ival = find_unit_role_by_rule_name(sval); if (ival==L_LAST) { freelog(LOG_ERROR, "\"%s\" unit_type \"%s\": bad role name \"%s\".", -filename, -utype_rule_name(u), -sval); +filename, utype_rule_name(u), sval); + } else if ((ival == L_FERRYBOAT || ival == L_BARBARIAN_BOAT) + && u->uclass->move_type == LAND_MOVING) { +freelog(LOG_ERROR, +"\"%s\" unit_type \"%s\": role \"%s\" for land moving unit.", +filename, utype_rule_name(u), sval); + } else { +BV_SET(u->roles, ival - L_FIRST); } - BV_SET(u->roles, ival - L_FIRST); assert(utype_has_role(u, ival)); } free(slist); ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev