Re: [CODE] Small Problem

From: Rasmus 'Con' Ronlev (raro94ab@hp4.econ.cbs.dk)
Date: 10/03/96


On Wed, 2 Oct 1996, Brian Guilbault wrote:

> Well, apparently gcc tells me that "victim" might be used uninitialized in
> levels correctly, etc). I don't know what's wrong because I've written
[SNIP]
>   struct char_data *victim;
>   one_argument(argument, arg);
>
>   if (!*arg) {
>     send_to_char("Who do you want to zap?\r\n", ch);
>     return;
>   }
>   if (IS_NPC(victim)) {
>     send_to_char("You can't zap a mob!\r\n", ch);
>     return;

Well, you never get to assign victim to anything at all!

You need to do a:

if (!(vict = get_char_vis(ch, arg))
{
 send_to_char("Better supply a victim, or should you be fried ??\r\n",ch);
 return;
}

Something like that, and put it BEFORE the IS_NPC(victim) check..

Regards,
Con.

d.
--
     Rasmus Rønlev DOEK'94      WWW: http://www.econ.cbs.dk/people/raro94ab
     Student instructor         MUD: exiled.mud.circlemud.org 5000
                                         199.199.16.100 5000
       Student, B.Sc in Computer Science and Business Administration.

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



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