Re: Problems with my Scan skill/command

From: Trey T. Morita (tmorita@texas.net)
Date: 10/27/95


On Fri, 27 Oct 1995, Rasmus Rxnlev wrote:

> 
> After several days of headache, and tons of coffee (soemthing like that 
> :), I decided to see if someone on this list could solve my lousy coding 
> of the mentioned SCAN command.
> 
> Basicaly I just added it as a ACMD, so that all players could use it, 
> just to avoid confusion.
> Now I looked at the do_exit procedure, and a little at the room-file 
> structure, and to me it seems, that this piece of code should work fine...
> 
> [Code begins]
> ACMD(do_scan)
> {
>  struct char_data *i, *list;
>  struct room_data *world;
>  int door;
> 
>  if(IS_AFFECTED(ch, AFF_BLIND))
>  {
>   sprintf(buf, "You're blinded and can't see a damn thing!");
>   act(buf, FALSE, ch, 0, 0, TO_CHAR);
>   return;
>  }
> 
>  *buf = '\0';
> 
>  for (door = 0; door < NUM_OF_DIRS; door++)
>  {
>   if (EXIT(ch, door))
>   {
>    sprintf("%sEXIT(ch, door) = %d\r\n", buf, door);
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If this code is copied correctly, this is a bug. The first arg to sprintf 
should be a destination string, such as buf.

Didn't look at the rest after this, if it's still buggy after you fix 
this, then ask again :)

Trey



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