[crossfire] Pickup Drop Event expansion

Nicolas Weeger nicolas.weeger at laposte.net
Sat May 1 03:24:05 CDT 2010


Hello.

> Quite a minor patch this, but one that has an impact on script/map
> compatibility, so I figure it should probably go here.
> 
> https://sourceforge.net/tracker/?group_id=13833&atid=313833
> 
> This patch changes the meaning of the return types from event_pickup
> and event_drop.
> 
> The initial motivation for this was in developing an implementation of
> draughts (something which is still at quite an early stage) and needing
> to be able to prevent an item from being picked up under certain
> conditions (ie by the player playing the other colour). The current
> behaviour of event pickup isn't helpful for this because the item
> disappears if the pickup fails.
> 
> So what I have done is altered the meaning of the return values, rather
> than 0 meaning 'item may be picked up' and non-zero meaning 'item may
> not be picked up' I have 0 meaning 'item may be picked up' negative
> meaning 'item will disappear rather than being picked up' and positive
> meaning 'item will stay where it is'

That sounds ok for me, but it's actually a bugfix.
The behaviour, up to some undefined time, was that a script returning non 0 to 
a pickup event would just mean the object stayed where it was.


As for negative value, I think it should really be the same as positive, and 
object removal being done from the script itself, instead of from the main 
pickup routine.

The reason is that you have anyway to consider the case where the script will 
remove the object, and must test accordingly - thus "don't pickup" and "make 
the item disappear" are actually handled the same way by the server, checked 
at plugin return through the FLAG_FREED or via the item tag.



Nicolas
-- 
Mon p'tit coin du web - http://nicolas.weeger.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://mailman.metalforge.org/pipermail/crossfire/attachments/20100501/6da21957/attachment.pgp 


More information about the crossfire mailing list