[crossfire] Weather bug, continued

Nicolas Weeger nicolas.weeger at laposte.net
Sat Nov 5 10:37:33 CST 2005


Hello.

I think I figured out why some tiles disappear under weather.

weather.c:change_the_world handles removal of grown items, including
(for instance) grass. It handles ground by simply checking from the
get_ob_map()->above object.

When the overlay for a map is loaded, by map.c:load_overlay_map, items
are inserted, but for some *under* the grass. The revelant code in
object.c:insert_ob_in_map is:

	originator->below = op;
    } else {
	/* If there are other objects, then */
	if((! (flag & INS_MAP_LOAD)) &&
((top=GET_MAP_OB(op->map,op->x,op->y))!=NULL)) {
	    object *last=NULL;
	    /*
	     * If there are multiple objects on this space, we do some trickier
handling.

what happens is that a tmap overloading, INS_MAP_LOAD is set, so items
are inserted *below* other items.

So next run the change_the_world will simply check from eg the grass,
and remove it if weather conditions prevent it.


My proposed check is to change insert_ob_in_map for:

	originator->below = op;
    } else {
	/* If there are other objects, then */
	if((top=GET_MAP_OB(op->map,op->x,op->y))!=NULL) {
	    object *last=NULL;
	    /*
	     * If there are multiple objects on this space, we do some trickier
handling.

ie search floor & such all the time. The code after handles INS_MAP_LOAD
and INS_ABOVE_FLOOR_ONLY flags.

Btw it looks strange to me that an overlay is always on top.

Ryo

    


More information about the crossfire mailing list