[CF-Devel] Re: Arrow, thrown object and generic attack fixes

Jan Echternach echter at informatik.uni-rostock.de
Thu Nov 2 14:56:54 CST 2000


On Thu, Nov 02, 2000 at 02:42:51PM +0100, Jan Echternach wrote:
>
     
      New version of the patch.  Fixes a bug in stop_item() (you couldn't
     
     >
     
      light torches in your inventory with flint and stell) and includes a
     
     >
     
      complete rewrite of decrease_ob_nr() which had two bugs and now handles
     
     >
     
      removed objects better.  I've also written a detailed change log for
     
     >
     
      the patch.
     
     
This should be the final version.  Even though I've already tested all
modifications to a reasonable extent, it could be tested more in normal
situations (completing some quests etc.) since I have changed even more
basic parts of crossfire (esp. insert_ob_in_map()).

What has changed since patch37c that doesn't appear in the attached
comments:  Fixed a small bug in explode_object() introduced in
patch37c.  Allowed hitter and target to be in any inventory in
get_attack_mode(), not only in each other's inventory, because this is
needed for runes in doors (the rune that strikes back when a door is
attacked is in the door's inventory, not in the hitter's inventory).

Difference between patch37c.comments and patch37d.comments:

+common/object.c: insert_ob_in_map():  Call check_walk_on() after
+update_object() because the latter needs to update some very
+important flags used by a lot of code before this code is called
+by check_walk_on().
+
+server/apply.c: move_apply():  Added recursion limit.
+
+server/apply.c: move_apply(): FBULLET and BULLET:  Call
+check_fired_arch() only when the victim blocks the square (FLAG_NO_PASS
+or FLAG_ALIVE).
+
+server/c_object.c:  Fixed two typos in "can't pick up xxx" messages.
+
+server/rune.c: spring_trap():  Fix unlimited trap recursion.  Since
+traps are triggered by move_apply(), the result of triggering a trap
+may trigger the trap again before it is deactivated.
+
+server/rune.c: spring_trap():  Runes that don't cast spells can only be
+triggered by living objects.

-- 
Jan
-------------- next part --------------
Summary of this patch:  Provide new stop_item() function for properly
handling "moving" items on a map (flying arrows, thrown objects,
active cones); obsoletes the workarounds.  Fix some attack bugs (with
possible server crashes) - many attackers attacked while being
removed, even though much code could only handle the attacker being on
the same map as the victim (not even the attacker being in the
victim's inventory, e.g. poison).

common/object.c: insert_ob_in_map():  Call check_walk_on() after
update_object() because the latter needs to update some very
important flags used by a lot of code before this code is called
by check_walk_on().

common/object.c: get_split_ob():  Completed support for splitting
removed objects.

common/object.c: decrease_ob_nr(): Rewrote this function: Added
support for removed objects.  Removing an object completely didn't
always update the environment's weight properly.  Removing an amount
of 0 from an object with nrof == 0 destroyed the object.  Improved
performance a bit (don't need to update the player's weight if an
object below the player is modified).

server/apply.c: move_apply():  Added recursion limit.

server/apply.c: move_apply(): THROWN_OBJ and ARROW:  Use new
hit_with_arrow() function.

server/apply.c: move_apply(): FBULLET and BULLET:  Call
check_fired_arch() only when the victim blocks the square (FLAG_NO_PASS
or FLAG_ALIVE).

server/attack.c: save_throw_object():  Use new stop_item() function
before trying to modify an object.  Added originator to all
insert_ob_in_map() calls.

server/attack.c: hit_map():  Added log message if the hitter is not on
a map.  Added was_destroyed() check after calling save_throw_object().

server/attack.c: get_attack_mode() and abort_attack():  New functions
to determine the type of attack (simple or full attack).

server/attack.c: attack_ob():  Now only attack_ob_simple() with default
damage and weapon class values.

server/attack.c: attack_ob_simple():  Contains most of old attack_ob(),
but takes damage and weapon class as parameters, needed for
hit_with_arrow().  Uses get_attack_mode() and abort_attack() to
support new "simple" attack mode.

server/attack.c: stick_arrow() and hit_with_arrow():  Moved those parts
of old stop_arrow() and move_arrow() that dealt with attacking a
victim over here.

server/attack.c: hit_player():  Uses get_attack_mode() and
abort_attack() to support new "simple" attack mode.

server/attack.c: paralyze_player():  Use insert_ob_in_map_simple()
instead of insert_ob_in_map() because the callers are not prepared for
this function triggering any complex machinery, and
insert_ob_in_map_simple() should be enough for plain visual effects.

server/attack.c: thrown_item_effect():  Don't need to deal with thrown
objects, hit_with_arrow() already does everything necessary.

server/attack.c: adj_attackroll():  Added log message if hitter and
victim are not on the same map.

server/c_object.c:  Fixed two typos in "can't pick up xxx" messages.

server/c_object.c: pick_up_object():  Removed can_pick() check because
pick_up() already checks this.  Added support for picking up removed
objects because the stop_item() in pick_up() can now call us with
removed objects.  Moved FLAG_STARTEQUIP check to pick_up().  Fixed
weight limit lookup for monsters that have strength > MAX_STAT.

server/c_object.c: pick_up():  Use new stop_item() function.

server/player.c: fire_bow() and server/skills.c: do_throw():  Removed
FLAG_NO_PICK workaround for flying objects.  stop_item() now handles
this correctly.

server/rune.c: spring_trap():  Fix unlimited trap recursion.  Since
traps are triggered by move_apply(), the result of triggering a trap
may trigger the trap again before it is deactivated.

server/rune.c: spring_trap():  Runes that don't cast spells can only be
triggered by living objects.

server/spell_effect.c: move_cancellation():  Don't call hit_map() with
a removed attacker.

server/spell_util.c: cast_cone():  Only print warning message about
cones that don't have FLAG_FLY/WALK_ON if the cone does any damage.

server/spell_util.c: move_cone():  Removed workaround for cones in ice
cubes.  stop_item() now handles this correctly.

server/spell_util.c: explode_object(): Rewrote this function: New
interface - exploding object must not be removed when the function is
called, it must have an other_arch (i.e. it must be able to explode),
and it will be gone for sure when the function terminates.  Removed
some code with no effect.  Don't call any attack functions with
removed attackers.

server/spell_util.c: check_fired_arch():  Rewrote this function.

server/spell_util.c: move_fired_arch():  Rewrote most of this function:
Don't attack with removed attackers.  Call check_fired_arch() instead
of duplicating its code.

server/spell_util.c: move_ball_lightning():  Don't attack with removed
attackers.  Rewrote the movement algorithm to simplify this task.

server/time.c: stop_item() and fix_stopped_item:  New functions.

server/time.c: fix_stopped_arrow():  Contains most of the old
stop_arrow() function.  Unlike stop_arrow(), it takes an arrow that is
not removed.  Removed FLACK_NO_PICK workaround.

server/time.c: stop_arrow():  Stops arrows and thrown objects and puts
them on the map.  Sticking objects into targets is no longer handled
by stop_arrow(), but by hit_with_arrow().

server/time.c: move_arrow():  Don't attack with removed attackers.

socket/item.c: esrv_move_object():  Removed misleading comment.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch37d.gz
Type: application/x-gunzip
Size: 18439 bytes
Desc: not available
Url : 
     
     http://shadowknight.real-time.com/pipermail/crossfire/attachments/20001102/4c9532a6/patch37d.bin
     
     
    


More information about the crossfire mailing list