Re: Revamping do_score

From: Ghost Shaidan (ghost@AO.NET)
Date: 09/21/98

> All very pretty but the second sprintf just overwrites the contents of buf
> from the first one, try this ...
> sprintf(buf, "&Y-=-=-=-=-=-&CScore Inforamtion&Y-=-=-=-=-=-=-=-=-&w\r\n",
> sprintf(buf, "%s&C Name&Y: &M%s&C    Class&Y: &M%s   &CAge&Y: &M%d\r\n",
>          buf, GET_NAME(ch), CLASS_ABBREV(ch), GET_AGE(ch));
> Or send_to_char the buf after each sprintf.

Just a picky question, wouldnt it be better (from a design or optimal
standpoint) to have a buf2 that you use to 'hold' each line, such as:

sprintf(buf2, "&Y-=-=-=-=-=-&CScore Inforamtion&Y-=-=-=-=-=-=-=-=-&w\r\n",
strcat(buf, buf2);
sprintf(buf2, "&C Name&Y: &M%s&C    Class&Y: &M%s   &CAge&Y: &M%d\r\n",
       GET_NAME(ch), CLASS_ABBREV(ch), GET_AGE(ch));
strcat(buf, buf2);

Or is the difference negligible?  Score seems to me to be called an awful
lot (not compared to look_at_room) but one of the more used commands in
the game, and making this as optimized as possible would be of interest.

Thanks for any information (even if it tells me I'm on crack ;) )

Ghost Shaidan

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

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