[CODE] FIGHTING(vict) doesn't point to tank's char_data.

From: Tony Skinner (tskinner@GLOBALEYES.NET)
Date: 11/01/97


        I am working within comm.c (specifically the make_prompt function). I am
attempting to display to the prompt the tank's status if the character is
grouped with tank and assisting tank in killing a mobile.
        I tried creating a pointer to the tank like so:

int tank_info(struct char_data *ch)
{
        struct char_data *vict = FIGHTING(ch);
        struct char_data *tank = FIGHTING(vict);

        float tank_max_hit = GET_MAX_HIT(tank);
        float tank_hit     = GET_HIT(tank);

        return (unsigned int)((tank_hit / tank_max_hit) * 10);

}
inside make_prompt function:

        if (IS_AFFECTED(d->character, AFF_GROUP) && ((d->character->master) != NULL)
          && GET_POS(d->character) == POS_FIGHTING)
                sprintf(prompt, "%s tank: %s ", prompt, damage_id[tank_info(d->character)]);

When calling the function tank_info, it returns an incorrect value which I
suspect is a problem with the pointer *tank.  My question is, why is *tank
= FIGHTING(vict) returning gibberish instead of the tank's char_data info?

Thanks
Tony


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST