[CF-Devel] patch for generators to create special ability mo

Norbert Irmer norbert.irmer at t-online.de
Wed Apr 17 09:13:10 CDT 2002


Norbert Irmer wrote:

>
     
      Yes, this solves the problem.
     
     >
     
     
     >
     
      I have encountered another problem. When i put fog into the inventory 
     
     >
     
      of a generator,
     
     >
     
      the server crashes after some time. I suppose the reason is, that fog 
     
     >
     
      itself is a
     
     >
     
      generator, which destroys itself after one generation (probably to 
     
     >
     
      achieve the
     
     >
     
      random fog movement?) and it isn't expected that it is in the 
     
     >
     
      inventory of
     
     >
     
      another object. But i am not sure. Is it possible to do a debug build ?
     
     >
     
      Perhaps with 'configure --with-debug' ?
     
     
Ok, i just did

export CFLAGS="-g"
export LDFLAGS="-g"

When doing a stack trace i get

Program received signal SIGSEGV, Segmentation fault.
0x80a05d0 in get_map_from_coord (m=0x0, x=0xbfbff6b0, y=0xbfbff6b4)
    at map.c:1845
1845        if (*x>=0 && *x<MAP_WIDTH(m) && *y>=0 && *y < MAP_HEIGHT(m))
(gdb) info stack
#0  0x80a05d0 in get_map_from_coord (m=0x0, x=0xbfbff6b0, y=0xbfbff6b4)
    at map.c:1845
#1  0x809da4d in blocked (m=0x0, x=0, y=-1) at map.c:315
#2  0x809dc6a in arch_blocked (at=0x8283400, m=0x0, x=0, y=-1) at map.c:438
#3  0x80a3539 in find_free_spot (at=0x8283400, m=0x0, x=0, y=0, start=1,
    stop=9) at object.c:1935
#4  0x8086b10 in generate_monster (gen=0x8bb2c44) at time.c:119
#5  0x8088ac2 in process_object (op=0x8bb2c44) at time.c:1186
#6  0x8066ba9 in process_events (map=0x0) at main.c:922
#7  0x806713d in main (argc=1, argv=0xbfbffc28) at main.c:1147
#8  0x8049d45 in _start ()

As mark wrote in a previous mail, the problem is caused by process_object
processing the object in the inventory of the generator.
But a top level check in process_object like
  if op->type==monster && op->map==NULL continue
is no solution, as the fog example shows.

I would propose to change 'find_free_spot' or even better 'arch_out_of_map',
which is called by 'find_free_spot', so that false is returned if map==NULL.










    
    


More information about the crossfire mailing list