[CF-Devel] How can this have happened? (crashing bug)

Mark Wedel mwedel at scruz.net
Tue Apr 10 00:11:54 CDT 2001


Peter Mardahl wrote:
>
     
     
     >
     
      Hmm, thanks for your remarks.
     
     >
     
     
     >
     
      I had no idea that "insert_multisquare_ob_in_map" wasn't "atomic".
     
     >
     
     
     >
     
      I take it a better implementation would be to create the whole
     
     >
     
      thing and then insert it into the map?  I think I tried that at one
     
     >
     
      point with rather annoying results:
     
     
 I'm a little unclear of why insert_multisquare_ob_in_map is even needed.

 insert_ob_in_map deals with inserting all the parts.

 If you want to insert an object with minimal processing (ie, don't check walk
on/fly on flags), insert_ob_in_map_simple should work - it doesn't do those
checks.


>
     
      > I've also noticed some unreliable code in nuke_map_region() and
     
     >
     
      > remove_monsters().  Both functions require that there is a floor object
     
     >
     
      > on each map square (they effectively perform a
     
     >
     
      > tmp = get_map_ob(...)->above; whenever they have something deleted).
     
     >
     
      > Fix would be to move that tmp = tmp->above into the loop body as an
     
     >
     
      > else branch.
     
     >
     
     
     >
     
      Hmm, the random map code always places a floor and therefore assumes
     
     >
     
      that there is a floor.  Given that, would you still say these changes
     
     >
     
      are necessary?
     
     
 nuke_map_region looks ok.  after the call to get_map_ob in both areas, we do a
check to see if tmp is NULL, and do the proper thing.

 remove_monsters is missing a tmp==NULL check after the tmp=get_map_ob... call. 
That should probably be added - you never know when someone may try to re-use
your code.

    
    


More information about the crossfire mailing list