Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CF: a button bug (Re: Pupland map bugs)



>>> snishita@cs.takushoku-u.ac.jp(Seikoh Nishita)
> 
[snip]
> I put an item on a small button in these maps by using editor, while I
> expect the item to press the button and to open a gate connected to
> the button just after the player enter the map. In old version of cf,
> these worked well. But in v0.95.4, buttons and gates don't work just
> after a server opens a new map file, do they?

I've found the reason why buttons don't work well as soon as players
enter a new map. 

"ready_map_name()" in common/map.c is a function for reading new maps.
It calls two functions, "load_temporary_map()" and "update_buttons(m)".

ready_map_name() {
	...
	load_temporary_map() 
	/* read map file and make connections among
	   buttons, gates, levers and so on. */
	...
	update_buttons()
	/* check buttons and if there is any item on them,
           push them */
}

But "update_button()" is called in the process of "load_temporary_map()"
before the complete connections of buttons and gates are made.

I ran gdb with the first breakpoint "update_button()". The following is
the result of it. We can see "update_button()" is called from
"load_temporary_map()" and "insert_ob_in_map()".

Breakpoint 1, update_button (op=0x8603588) at button.c:131
131         int tot,any_down=0, old_value=op->value;
(gdb) bt 
#0  update_button (op=0x8603588) at button.c:131
#1  0x804c7f2 in apply (op=0x86036c0, tmp=0x8603588, aflag=0) at apply.c:1120
#2  0x808ee40 in check_walk_on (op=0x86036c0) at object.c:1692
#3  0x808e628 in insert_ob_in_map (op=0x86036c0, m=0x8606710) at object.c:1393
#4  0x808a850 in load_objects (m=0x8606710, fp=0x8278660, block=0) at map.c:591
#5  0x808ac85 in load_original_map (filename=0xbfffeda0 "/pup_land/test", 
    flags=0) at map.c:783
#6  0x808ad82 in load_temporary_map (m=0x8278660) at map.c:820
#7  0x808bdf6 in ready_map_name (name=0x401a4ccc "/pup_land/test", flags=0)
    at map.c:1376
#8  0x805e84f in enter_exit (op=0x8600fc0, exit_ob=0x0) at main.c:378

I'll show you what happens because of this bug.

The following means a small map.

+----------------------+
|                      |
|        g   G         |
|          b           |
|                      |
+----------------------+

'g' and 'G' mean closed gates.
'b' means a small button under a scroll.
The gates and the button are connected.

We suppose CF server inserts 'g','b' and 'G' in the map in this order
when it loads the map. (In my experiment, they seemed to be inserted
in this order.) Then the connection between 'g' and 'b' is made before
'b' is inserted and before it's pressed. (Please remember buttons are
pressed in the process of the function "insert_ob_in_map()".) But the
connection of 'b' and 'G' is made after 'b' is pressed. As the result
when this map is loaded, 'g' is open, but 'G' is closed, because of
the bug.

---------
snishita
-
[you can put yourself on the announcement list only or unsubscribe altogether
by sending an email stating your wishes to crossfire-request@ifi.uio.no]