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

From: Ron Cole (rcole@ezy.net)
Date: 11/14/98


>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?

Yup... you're storing a single byte, probably the the first letter of the
player's name... possibly corrupting whatever is stored after it, depending
on how you set it.  Is there a reason to save this?  If so, the best thing to
do is use the player's idnum, assuming mobs can't play paintball.  If you
need to save the name, you'll need a fixed length char array, and if mobs can
play, you'll have to keep an eye out for overflows.

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