[CF-Devel] Death message fix

crossfire-devel at archives.real-time.com crossfire-devel at archives.real-time.com
Tue Nov 16 02:33:19 CST 2004


Salathar wrote:
>
     
      I've tried the patch on localhost and gravestones are generated with
     
     >
     
      the killer's name as they were before applying the patch.
     
     
Strange. I applied the patch to a clean checkout and got the following
gravestone: (note the missing killer name after "by")

arch gravestone
name test's gravestone
name_pl test's gravestone
msg
RIP
Here rests the hero test the dwarf,
who was killed
by .
endmsg
end

>
     
      From what I understand kill_player attempts the kill and does all the
     
     >
     
      aftereffects (creates gravestone, teleport back to last savebed). The
     
     >
     
      function is called everytime the player should die and the everyone is
     
     >
     
      sent the death message.
     
     
I think this is correct except the death message is sent from
kill_object(), not from kill_player(): (about line 1530 in
server/attack.c)

	(void) sprintf(buf,"%s killed %s%s.",hitter->name,op->name,
	       battleg? " (duel)":"");
[...]
    new_draw_info(NDI_ALL, op->type==PLAYER?1:10, NULL, buf);

>
     
      However an item of lifesaving will keep the character alive and the death
     
     >
     
      message should not be sent.
     
     
I agree, this should be changed.

>
     
      I changed kill_player to return 0 if the player does not die and 1 if he
     
     >
     
      does.
     
     
This is fine -- but my concerns are about the variable op->contr->killer
which records the object that has killed the player "op". The
application flow in the unpatched server is:

   1. kill_object() gets called. It checks if the object will die,
      prints the death message and removes/frees the object. But if the
      object is a player, it does *not* remove/free him but sets
      op->contr->killer only.

   2. do_some_living() is called for the player object and calls
      kill_player() if it thinks the player has died.

   3. kill_player() actually kills the player and creates the
      gravestone.

The problem I see with the patch is: step 3 is called before step 1 has
set op->contr->killer to the current killer. Therefore the killer name
on the gravestone is the "old" value. (No value after login or the
previous killer.)

_______________________________________________
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