URL:
  <http://gna.org/bugs/?13092>

                 Summary: Formula AI causes an assertion failure if a unit
dies while attacking
                 Project: Battle for Wesnoth
            Submitted by: shadowmaster
            Submitted on: Sunday 03/01/2009 at 13:43
                Category: Bug
                Severity: 4 - Important
                Priority: 5 - Normal
              Item Group: Artificial Intelligence
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 1.5.11+svn (r33244)
        Operating System: Debian lenny

    _______________________________________________________

Details:

With the following formula:

++
faifile 'dark-hive-drone-guardian.formula'

if(attack, attack, move(me.loc, choose(unit_moves(me.loc),
-distance_between(self, me.vars.guard_loc))))
    where attack = choose(filter(attacks, units = [me.loc] and
distance_between(me.vars.guard_loc, target) <= me.vars.guard_radius),
avg_damage_inflicted)

faiend
--

And the following unit code:

++
{RANDOM (8..10) (8..12) (9..13)}
[unit]
    ...
    ai_special=guardian
    formula="{a path to the formula ai code file}"
    x={X}
    y={Y}
    [ai_vars]
        guard_loc="loc( {X} , {Y} )"
        guard_radius="$random"
    [/ai_vars]
[/unit]
--

And no special formula used for the controlling [side], if one of these AI
units gets killed while attacking their enemies, the game will abort due to
an assertion failure as follows:

++
wesnoth-debug: src/unit_map.cpp:69: std::pair<map_location, unit>*
unit_map::unit_iterator::operator->() const: Assertion `valid()' failed.
--

gdb backtrace of an -O0 build with debug symbols:

++
Program received signal SIGABRT, Aborted.
0x00007f47e122aed5 in raise () from /lib/libc.so.6
(gdb) bt
#0  0x00007f47e122aed5 in raise () from /lib/libc.so.6
#1  0x00007f47e122c3f3 in abort () from /lib/libc.so.6
#2  0x00007f47e1223dc9 in __assert_fail () from /lib/libc.so.6
#3  0x00000000006bace3 in unit_map::unit_iterator::operator->
(this=0x7fffec219590) at src/unit_map.cpp:69
#4  0x00000000008c3c18 in formula_ai::play_turn (this=0xf69c0e0) at
src/formula_ai.cpp:1417
#5  0x00000000005d5bd3 in playsingle_controller::play_ai_turn
(this=0x7fffec21ac40) at src/playsingle_controller.cpp:827
#6  0x00000000005d7514 in playsingle_controller::play_side
(this=0x7fffec21ac40, team_index=4, save=false) at
src/playsingle_controller.cpp:635
#7  0x00000000005d7ee7 in playsingle_controller::play_turn
(this=0x7fffec21ac40, save=false) at src/playsingle_controller.cpp:563
#8  0x00000000005d9f60 in playsingle_controller::play_scenario
(this=0x7fffec21ac40, sto...@0x1097d90, l...@0x7fffec21cc60,
skip_replay=false,
    end_level_result=0x75331c0) at src/playsingle_controller.cpp:314
#9  0x00000000005c73dc in playsingle_scenario (game_conf...@0x7fffec21cee8,
level=0x7fffec21d190, di...@0x2a17a50, state_of_ga...@0x7fffec21cfa0,
    sto...@0x1097d90, l...@0x7fffec21cc60, skip_replay=false,
end_level=0x75331c0) at src/playcampaign.cpp:130
#10 0x00000000005cb298 in play_game (di...@0x2a17a50,
gamesta...@0x7fffec21cfa0, game_conf...@0x7fffec21cee8, l...@0x7fffec21cc60,
io_type=IO_NONE,
    skip_replay=false) at src/playcampaign.cpp:375
#11 0x0000000000418917 in launch_game (this=0x7fffec21ce80, reload=(anonymous
namespace)::game_controller::NO_RELOAD_DATA) at src/game.cpp:1633
#12 0x00000000004265db in do_gameloop (argc=1, argv=0x7fffec21d708) at
src/game.cpp:2152
#13 0x0000000000426a9c in main (argc=1, argv=0x7fffec21d708) at
src/game.cpp:2208
--





    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?13092>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs

Reply via email to