[CF-Devel] Death message fix

crossfire-devel at archives.real-time.com crossfire-devel at archives.real-time.com
Wed Nov 17 09:02:34 CST 2004


Thanks alot for commening :)

>
     
      > +     if (op->type == PLAYER && !kill_player(op))
     
     >
     
      > +          return maxdam;
     
     >
     
     
     >
     
      I'm not sure, but it seems to me that kill_object() should return -1 if
     
     >
     
      op was not killed.
     
     
I wasn't quite sure either. This is the very end of the kill_object() function:
    /* This was return -1 - that doesn't seem correct - if we return -1, process
     * continues in the calling function.
     */
    return maxdam;

That's why I felt I should just leave it as it was.
Searched for some more clues as to what it should be. 
These lines are found at the beginning of kill_object()
    if (op->stats.hp>=0)
        return -1;

kill_object() is called in two places. 

attack.c :
    /* See if the creature has been killed */
    rtn_kill = kill_object(op, maxdam, hitter, type);
    if (rtn_kill != -1)
        return rtn_kill;

plugins.c:

/*****************************************************************************/
/* kill_object wrapper.                                                      */
/*****************************************************************************/
/* 0 - killed object;                                                        */
/* 1 - damage done;                                                          */
/* 2 - killer object;                                                        */
/* 3 - type of killing.                                                      */
/*****************************************************************************/
CFParm* CFWKillObject(CFParm* PParm)
{
    CFParm *CFP;
    static int val;
    CFP = (CFParm*)(malloc(sizeof(CFParm)));
    val = kill_object(
        (object *)(PParm->Value[0]),
        *(int *)(PParm->Value[1]),
        (object *)(PParm->Value[2]),
        *(int *)(PParm->Value[3])
        );
    CFP->Value[0] = &val;
    return CFP;
};

This looks like what you said: kill_object() should return -1 if op is not dead

_______________________________________________
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