Title Bot drops on never-visited levels drop to (0,0)
Priority important Status resolved
Assigned To jesusalva Keywords map
Linked issues Watchers jesusalva

Submitted on 2013-10-20 23h36 by infrared, last changed by matthiaskrgr.

Author: infrared Date: 2013-10-20   23h36
When an enemy dies and drops an item on a level the player has never visited,
the item is dropped at the position (0,0). This can result in many items
gathering in one spot. This looks really weird, and that spot might not even be

This happens because the functions that drop items are passed the virtual
position of an enemy when it dies, and not its real position. Apparently, if a
level was never visited, the virtual position of the bots in it is not
initialized and is set by default to (0,0).

The bug can be avoided by adding the following to line 758 in enemy.c:
if (!Me.HaveBeenToLevel[ThisRobot->pos.z]) {
		update_virtual_position(&ThisRobot->virt_pos, &ThisRobot->pos, ThisRobot->pos.z);

or alternatively replace virt_pos with pos in the same function. I don't know
what other effects either of those ways have.

This is not a problem in the game currently, but if we want the bots to actually
drop dead after the game is won it might become a problem when the player comes
across an affected level afterwards. We might also in the future want to have
the player either meet a character or come across his/her corpse and collect an
item, depending on their actions before entering the character's level. That
would be blocked by this issue.
Author: jesusalva Date: 2014-02-25   01h40
Important: kill_faction() was commited, and this will be problematic bug afterwards.

Plus, there is even "how to fix it". I'll test it... If it works, I'll patch it
and link it here.
Author: jesusalva Date: 2014-02-26   20h07
Author: jesusalva Date: 2014-05-14   23h35
...any news on this?
Author: matthiaskrgr Date: 2014-06-29   18h18
Fixed in d70eb86219b3. Thanks!
Date User Action Args
2014-06-29 18:18:34matthiaskrgrsetstatus: open -> resolved
assignedto: jesusalva
messages: + msg2831
nosy: + jesusalva
2014-05-14 23:35:33jesusalvasetmessages: + msg2777
2014-02-26 20:07:21jesusalvasetmessages: + msg2743
2014-02-25 01:40:26jesusalvasetpriority: bug -> important
messages: + msg2739
2013-10-20 23:36:28infraredcreate