[CF-Devel] Flying monster stealing patch

crossfire-devel at archives.real-time.com crossfire-devel at archives.real-time.com
Tue Dec 9 23:56:50 CST 2003


H. S. Teoh wrote:
>
     
      On Tue, Nov 18, 2003 at 11:56:25PM -0800, Mark Wedel wrote:
     
     
>
     
     
     >
     
     
     >
     
      OK, so should pick_up() check to see if the object is in another
     
     >
     
      creature's inventory, and do something different in that case?
     
     
  Well, pick_up() should really be split apart.

  Currently, there is a can_pick() function which says if an object can be 
picked up.

  What you really want is the code from pick_up() that does the container 
handling - make a new function like move_item_into_players_inv() (shorter name 
may be nice).  Change pick_up() to use that for that piece of code also.

  IMO, pick_up shouldn't be designed to handle every case thrown at it - it's 
design is to handle players picking up objects on the ground.  So handling 
special cases for stealing, or other objects that put something into the players 
inventory shouldn't be using pick_up().

  And as said before, at one point, this wasn't a case, because the steal code 
did just use remove_ob and insert_ob functions.

  However, more I look at pick_up, the more it probably needs to be rewritten 
(anythign with a goto is questionable - in this case in particular, as it would 
seem almost everywhere the goto is called doesn't need the processing afterward)

  So all that said, there should probably be these functions for the code:

can_pick (already exists) - is this an object the player can pick up (basic 
sanity checking based on object flags)
can_carry (new function) - can the player carry this object
find_sack_for_ob(new function) - finds the environment to insert the object into.

  with those, pick_up() would become a very basic fucntion, but other functions 
that want to to inventory handling can now do it properly also.


>
     
      Perhaps the most correct way would be for pick_up() to behave differently
     
     >
     
      (eg. skip the is_flying check) if the object being picked up is in another
     
     >
     
      creature's inventory?
     
     
  As said, pick_up was (IMO) only designed to handle cases where the object is 
on the ground.  It really shouldn't be designed for all those special cases.



_______________________________________________
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