|
From: | Ronald Lamprecht |
Subject: | Re: [Enigma-devel] Questions about enigma.GetPos() |
Date: | Sat, 28 Apr 2007 11:49:50 +0200 |
User-agent: | Mozilla Thunderbird 1.0.7 (Windows/20050923) |
Hi, Markus Laire wrote:
If I use enigma.GetPos() on an item which is currently in inventory or in some bag, it seems to return the position where the item has last been on ground. If this behaviour likely to remain the same?
No. We are aware of this feature but it will change in future. Thus any usage of this feature is depreceated.
Also, I just noticed that using first dynamite = set_item("it-dynamite", orig_x, orig_y) and then later local x, y = enigma.GetPos(dynamite) will cause segmentation fault if the dynamite has been exploded.
This is Berlios bug report #8249 "Enigma Lua functions can segfault":All Enigma Lua functions like SendMessage,... that take an object reference as argument can segfault if the object has been deleted (killed).
Is there a way to check whether the dynamite is still in game without giving it a unique name and using "if enigma.GetNamedObject() == nil"
This is currently the only possible workaround at the moment as you need a second reference besides the volatile object id.
For 1.00 and 1.01 we fixed dozens of crash situations within the C++ engine due to timers and callbacks sending messages to killed objects.
As the current object id used within Lua is additionally a major obstacle in saving and restoring a level game at arbitrary points of time we decided to reengineer Enigma and to introduce a memory address independent object id with a proper management. The reengineering will be transparent for Lua levels (besides the vanishing crashes).
Ronald
[Prev in Thread] | Current Thread | [Next in Thread] |