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:

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


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

  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);
   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_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);

Thanks for any help.

   | FAQ: |
   | Archives: |
   | Newbie List:   |

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