Issue901

Title Teleport Anchor not being initialized
Priority important Status resolved
Assigned To fluzz Keywords
Linked issues Watchers fluzz

Submitted on 2017-11-03 16h42 by jesusalva, last changed by fluzz.

Messages
Author: jesusalva Date: 2017-11-03   16h42
This is a simple bug which takes only one extra C code line to fix, however, 
without that line player can be trapped and is therefore important. (If it 
crashed it would be critical)

You see, the Lua function has_teleport_anchor() prevents you from being 
teleported to an invalid position if Me.teleport_anchor.z is set to -1.
This works fairly well, except for one thing: Me.teleport_anchor.z is not 
declared in influ.c
As a result, when has_teleport_anchor() is called by the first time, 
Me.teleport_anchor.z may NOT exist, and therefore, C will report so, by sending 
a default value of ZERO.
We have a problem, though. Zero is a valid level. In fact, (0,0,0) are 
perfectly valid coordinates, and therefore, the game teleports Tux to this 
position... which is at the middle of the Sea.

You cannot walk off to level -1 to there, but you are trapped nonetheless.

Fixing this bug should be accomplishable by adding the following line to 
influ.c:1704

	Me.teleport_anchor.z = -1;

And this is all that you need, to initialize the value as -1, and the bug shall 
vanish. It can be reproduced by creating a new character and using Town 
Teleporter. I advise walking from level 12 to that spot.
Author: jesusalva Date: 2017-11-04   13h43
Bug was introduced by accident in commit 01ba2e5dcec9910bd41637ae9b4c6694a2931442

https://gitlab.com/freedroid/freedroid-
src/commit/01ba2e5dcec9910bd41637ae9b4c669
4a2931442
Author: jesusalva Date: 2017-11-29   04h12
http://rb.freedroid.org/r/2369/
Author: fluzz Date: 2017-12-29   11h31
Proposed patch pushed in commit efbca556d78ed45db996251f1fb07989b2c24b67

Thx.
History
Date User Action Args
2017-12-29 11:31:59fluzzsetstatus: open -> resolved
messages: + msg3529
2017-11-29 04:12:54jesusalvasetmessages: + msg3512
2017-11-04 13:43:57jesusalvasetmessages: + msg3504
2017-11-03 16:42:03jesusalvacreate