Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CF: apply() cleanup


Some formulas are broken because the incredients are impossible to get,
e.g. an ogre's arm.  I looked into this and found out that the ogre's
arm is generated sometimes, but as soon as the ogre tries to apply his
throwing skill, he eats his arm.  That's caused by a loop near the
beginning of apply() which looks like it was intended to prevent
players applying invisible objects below them.  I think a cleanup of
apply() is overdue.

The attached patch

* removes apply_inventory() - this function was unused

* moves most of the player specific parts from the beginning of apply()
to a new function player_apply()

-> player_apply() is only called as a result of command_apply() or
ApplyCmd(), the player specific code is not executed in any other
case.  I hope this is correct.

* renames apply_below() to player_apply_below()

* moves the rest of the player specific parts from the beginning of
apply() to player_apply_below()

* no longer prints a "There is nothing to apply." message if apply()
was called with a null pointer, but a BUG message to the server log

* prints "I don't know how to apply the xxx." message much more often

-> There is a problem with the meaning of the return value of apply()
which is now more obvious because you get much more confusing
messages.  This issue is explained in the patch after the FIXME
marker.  I think apply() should be changed to return 0 only if the
object is unusable, and return 1 if there was an error using the
object.  check_good_weapon() and check_good_armour() should call
apply_special() directly.

[you can put yourself on the announcement list only or unsubscribe altogether
by sending an email stating your wishes to ]