problem with vict being uninitialized/ crashing

From: Josh Harris (jharris2@ACSU.BUFFALO.EDU)
Date: 01/26/02


ok, I'm trying to expand the jail command that I got from the ftp site.
I'm using cygwin to compile, have version circle bpl17 with olc, and OS of
Windows 2k.

I have it set up so I have GET_BAIL(ch) saved into the player file, through
structs.h, and utils. h, however, I'm trying to set up a bail command which
allows a character to bail them out of jail.  I am getting vict is
uninitialized and then I searched the archives, and changed my declaration
of it to
struct char_data *vict=NULL;

It compiled fine, but when I actually tried to use the bail command it
crashed my mud.  Here is my bail command:

ACMD(do_bail)
{
struct char_data *vict=NULL;
half_chop(argument, arg, buf);

skip_spaces(&argument);
delete_doubledollar(argument);

if(ch==vict)
  send_to_char("You can't bail yourself out of this one...\r\n", ch);

if(!*argument)
  send_to_char("Were you going to try and bail them out?\r\n", ch);

if (!(vict = get_char_vis(ch, arg, FIND_CHAR_WORLD)))
   send_to_char("Player isn't playing, try again...\r\n", ch);

if (GET_LEVEL(ch)<=GET_LEVEL(vict))
   send_to_char("You aren't high enough level to bail them out!\r\n", ch);
if (!PLR_FLAGGED(vict, PLR_CRIMINAL))
   send_to_char("There not in jail, their just visiting!\r\n", ch);

if (GET_GOLD(ch)<GET_BAIL(vict))
   send_to_char("You can't afford to get them out of jail!\r\n",ch);
else {
   GET_BAIL(vict)=0;
   GET_GOLD(ch) = GET_GOLD(ch)-GET_BAIL(vict);
   act("The door on the cell begins to slowly open, someone has bailed you
out!\r\n",FALSE, ch, 0, 0, TO_VICT);
   act("You bail your friend out of jail!\r\n", FALSE, ch, 0, 0, TO_CHAR);
   REMOVE_BIT(PLR_FLAGS(vict), PLR_CRIMINAL);
   }
}

Thanks for any help.

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT