Bas Wijnen <[EMAIL PROTECTED]> writes:

> On Tue, May 16, 2006 at 01:55:28AM +0200, Goswin Brederlow wrote:
>> Hi,
>
> Hi,
>
>> when I play a certain way on the star map the pioneersai crashes on
>> the second round of setting up the game.
>
> Yes, I've seen this problem, and fixed it.  It is caused by the AI trying to
> find out where to place a road and wandering off the board.  I think there is
> no way not to trigger it on the star map. :-)
>
> I prepared a fix for this bug upstream.  You can find it at
> http://sourceforge.net/tracker/index.php?func=detail&aid=1488229&group_id=5095&atid=305095
>
> If you don't feel like compiling from source, then you'll have to wait a bit.
> We'll make an upstream release including this patch soon, probably within a
> few weeks.
>
> Thanks for reporting this,
> Bas Wijnen

I compiled with DEB_BUILD_OPTIONS=debug,nostrip and found the problem
to be somewhat different (on a different map though):

Program received signal SIGSEGV, Segmentation fault.
can_road_be_built (edge=0x0, owner=0) at map_query.c:379
379     map_query.c: No such file or directory.
        in map_query.c
(gdb) bt
#0  can_road_be_built (edge=0x0, owner=0) at map_query.c:379
#1  0x000000000040314d in best_road_to_road_spot (n=0x55ef00, 
    score=0x7ffffffc1374, resval=0x7ffffffc1430) at greedy.c:629
#2  0x000000000040327d in best_road_to_road (resval=0x7ffffffc1430)
    at greedy.c:673
#3  0x0000000000402900 in should_buy (assets=0x7ffffffc13f0, bt=BUILD_NONE, 
    resval=0x7ffffffc1430, need=0x0) at greedy.c:198
#4  0x0000000000403ac6 in greedy_turn () at greedy.c:1184
#5  0x000000000040906d in mode_turn_rolled (sm=0x5227f0, event=10003)
    at client.c:1822
#6  0x0000000000412b6c in route_event (sm=0x5227f0, event=10003) at state.c:107
#7  0x0000000000413c68 in sm_pop (sm=0x5227f0) at state.c:598
#8  0x0000000000407ed5 in mode_build_response (sm=0x5227f0, event=10005)
    at client.c:1154
#9  0x0000000000412ba3 in route_event (sm=0x5227f0, event=10005) at state.c:91
#10 0x0000000000412cc8 in net_event (event=NET_READ, sm=0x5227f0, 
    line=0x522995 "built settlement 0 11 3") at state.c:137
#11 0x0000000000411a9f in notify (ses=0x0, event=NET_CLOSE, 
    line=0x1 <Address 0x1 out of bounds>) at network.c:130
#12 0x0000000000412116 in read_ready (ses=0x522950) at network.c:364
#13 0x000000000040e58a in evl_glib_call_func (source=0x0, condition=0, 
    data=0x1) at common_glib.c:50
#14 0x00002b1ae5dd3ddb in g_vasprintf () from /usr/lib/libglib-2.0.so.0
---Type <return> to continue, or q <return> to quit---q 
Quit
(gdb) up
#1  0x000000000040314d in best_road_to_road_spot (n=0x55ef00, 
    score=0x7ffffffc1374, resval=0x7ffffffc1430) at greedy.c:629
629     greedy.c: No such file or directory.
        in greedy.c
(gdb) print n
$1 = (Node *) 0x55ef00
(gdb) print *n
$2 = {map = 0x551aa0, x = 0, y = 11, pos = 3, hexes = {0x55a620, 0x0, 
    0x55af80}, edges = {0x55ef60, 0x55f1c0, 0x55f010}, owner = 0, 
  type = BUILD_SETTLEMENT, visited = 0, no_setup = 0}
(gdb) print i
$3 = 1
(gdb) print n->edges[i] 
$4 = (Edge *) 0x55f1c0
(gdb) print *n->edges[i]
$5 = {map = 0x551aa0, x = 0, y = 12, pos = 2, hexes = {0x55af80, 0x0}, 
  nodes = {0x55ef00, 0x55f160}, owner = 0, type = BUILD_ROAD, visited = 0}
(gdb) print othernode
$6 = (Node *) 0x55f160
(gdb) print *othernode
$7 = {map = 0x551aa0, x = 0, y = 12, pos = 2, hexes = {0x0, 0x0, 0x55af80}, 
  edges = {0x55f1c0, 0x0, 0x55f270}, owner = -1, type = BUILD_NONE, 
  visited = 0, no_setup = 0}


The relevant code is:

        for (i = 0; i < 3; i++) {
                Edge *e = n->edges[i];
                if (e) {
                        Node *othernode = other_node(e, n);

                        if (can_road_be_built(e, my_player_num())) {

                                for (j = 0; j < 3; j++) {
                                        Edge *e2 = othernode->edges[j];

                                        /* We need to look further, temporarily 
mark this edge as having our road on it. */
                                        e->owner = my_player_num();
                                        e->type = BUILD_ROAD;

                                        if (can_road_be_built
                                            (e2, my_player_num())) {

at which point e2 can be NULL and it crashes.

This doesn't look like it involves the iterator function you patched.

MfG
        Goswin

PS: I will check for NULL and continue in the j loop too.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to