[CF-Devel] Flying monster stealing patch

crossfire-devel at archives.real-time.com crossfire-devel at archives.real-time.com
Tue Nov 18 12:24:48 CST 2003


On Mon, Nov 17, 2003 at 11:40:39PM -0800, Mark Wedel wrote:
>
     
      H. S. Teoh wrote:
     
     >
     
      >Hi all,
     
     >
     
      >
     
     >
     
      >After testing my new flying monster, Katia & I found out that it cannot
     
     >
     
      >steal because it's flying (pick_up() fails). In the process, we uncovered
     
     >
     
      >a bug in the stealing code, that tells the player something was stolen
     
     >
     
      >even if pick_up() subsequently fails. I tried to move the call to
     
     >
     
      >esrv_del_item to inside the if-statement that checks if the item was
     
     >
     
      >picked up, but it didn't work (apparently it's not as simple as I thought; 
     
     >
     
      >if the thief wasn't a player, the if-statement fails). Perhaps Mark or
     
     >
     
      >somebody can figure out the correct fix for this bug. 
     
     >
     
     
     >
     
       Well, ideally, pick_up() returns status on if it works or not.
     
     
In fact, I've done this fix, and it seems to work quite nicely, except
that I forgot I needed to save backup values for the stolen item as you
describe below.

>
     
      Saving that, the following would need to be done:
     
     >
     
      The tag of the object stored away (because pick_up could merge it with 
     
     >
     
      another).
     
     
Ahh, I didn't think of that.

>
     
      Check to see if tmp->env changes - if so, the object was stolen.
     
     >
     
      This means storing the old ->env field away.  If that succeeds, then
     
     >
     
      send the esrv_del_item with the tag that was stored away.
     
     
Given that I've changed pick_up() to return a true/false value indicating
whether the pickup was successful, I probably don't need this anymore,
right?

Also, do you think it makes more sense to send esrv_del_item *inside*
pick_up() or pick_up_item() instead? It would seem that fixing it once in
pick_up() will save us the headache of fixing the 50 other places where
pick_up() is called, which might have to do the same thing. (I don't know
if there's any other place which needs to do this right now, but it's
conceivable to happen in the future.)

[snip]
>
     
      >But anyway, it seems to be a bad limitation that flying monsters cannot
     
     >
     
      >steal; so I've patched pick_up() to allow pickup by flying monsters. The
     
     >
     
      >patch follows the end of this email. Levitating players still cannot
     
     >
     
      >pick up objects (and cannot steal either---not sure if that's a bug or a
     
     >
     
      >feature), but now flying monsters can pick up stuff and steal as well. I
     
     >
     
      >thought I'd bring it up for discussion before checking it into CVS.
     
     >
     
     
     >
     
       I'm a little concerned on that - I'm not sure, but there could be some 
     
     >
     
      monsters out there that have flying set, that you really don't want picking 
     
     >
     
      something up.    I'd be reluctant to make such a change due to possible 
     
     >
     
      undesirable side effects.
     
     [snip]

Hmm, that's true. So then the question is, is it possible to have a flying
monster that steals, and how would I do it? 


T

-- 
If creativity is stifled by rigid discipline, then it is not true creativity.

_______________________________________________
crossfire-devel mailing list
     
     crossfire-devel at lists.real-time.com
     
     
     https://mailman.real-time.com/mailman/listinfo/crossfire-devel
     
     
    


More information about the crossfire mailing list