Re: [CODE] [Newbie] format arguments, %d vs. %s.

From: Brandon Brown (ViperBrd@aol.com)
Date: 11/14/98


>  Or, is it a player id number?  If so, you need to call get_name_by_id() to
>  retrieve the name.

It shouldn't be, no... it's a player's name, defined in structs.h. (   ubyte
paintball;    )

And then defined in utils.h:
#define GET_PAINTBALL(ch) ((ch)->player_specials->saved.paintball)

It's set in magic.c when a player casts paintball on another player...
GET_PAINTBALL(victim) = GET_NAME(ch)

Am I making some simple mistake here?

 - Viper  -- UIN 10883068

> >Alright, here's the problem... I generally had the %d below as a %s, but
> that
>  >would error ( warning: format argument is not a pointer (arg 3) ) , and
> crash
>  >the mud if anybody ever Look'ed into a room.
>  >
>  >In act.informative.c...
>  >  if (AFF_FLAGGED(i, AFF_PAINTBALL)) {
>  >  sprintf(buf2,"...is covered in %d's paintballs!\r\n",GET_PAINTBALL(i));
>  >    send_to_char(buf2, ch);
>  >
>  >So I replaced it with a %d, and now I get a number:
>  >Catherine the Grape is standing here.
>  >...is covered in 136's paintballs!
>
>  What is the value?  Is it a char_data pointer? (bad idea, they get
extracted)
>
>  Or, is it a player id number?  If so, you need to call get_name_by_id() to
>  retrieve the name.
>
>  Ron


     +------------------------------------------------------------+
     | 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/15/00 PST