[CF-Devel] Death message fix

crossfire-devel at archives.real-time.com crossfire-devel at archives.real-time.com
Tue Nov 16 07:49:34 CST 2004


Andreas Kirschbaum  wrote:
>
     
      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
     
     
Yes, you are perfectly right! op->contr->killer was not updated
properly, I did not notice this on localhost because only the first
gravestone had a name missing. All the other gravestones had names
from a previous killer too.
Thanks alot for pointing this out!

>
     
         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.)
     
     
What I have done now is move death message code to the very end of
kill_object()  function and add the check to see if the the player did
die just before it. That way all of kill_object() is executed and kill
message is displayed only if kill_player() succeeds. Calling
kill_player() in kill_object() makes sure the player will not
regenerate hp before next call to do_some_living().
What do you think of it now? I hope I did not miss anything important out.

_______________________________________________
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