Re: char_player_data problem, again...

From: Zeavon (
Date: 09/23/99

> On Fri, 24 Sep 1999, Emil Nilimaa wrote:
> >#0 do_oasis (ch=0x82e2f70, argument=0xbffff891 "", cmd=205, subcmd=0)
> >   at oasis.c:148
> v2.0:
> oasis.c:148  if (d->olc) {
> Where:
>           d = ch->desc;
> So it will crash if 'ch->desc' is NULL.  It shouldn't be.
> 'print ch->desc'
> in GDB.

Thanks George.

Emil, sounds like you're overwriting a buffer or a char * somewhere. Since
you recently added:
char *titlea; (or something like that)
I would be willing to be that that is the case.

I could be wrong, but I bet you have something like:
ch->titlea = "with a big nose"
ch->titlea = argument;

instead of:
if (ch->titlea)
ch->titlea = str_dup("with a big nose");

Make sure that when you extract the character that you free the memory that
was allocated by str_dup. I'll let you figure that out since it's just a
matter of RTFC'ing.

Try this:
grep long_descr *.[ch] -n

You'll see something like this (NOTE: This grep is on old bpl12 code, not
the more recent versions, so what you see here will most likely be different
from what you see when you do a grep on your code.):
db.c:1027:  mob_proto[i].player.long_descr = fread_string(mob_f, buf2);
db.c:1801:  ch->player.long_descr = NULL;
db.c:2066:    if (ch->player.long_descr)
db.c:2067:      free(ch->player.long_descr);
db.c:2079:      free(ch->player.long_descr);
db.c:2279:  ch->player.long_descr = NULL;
olc.c:245:      olc_string(&olc_mob->player.long_descr, MAX_MOB_DESC, arg);
structs.h:624:   char   *long_descr;   /* for 'look' */

You'll want to look at the files at the line numbers given (eg: structs.h at
line  624) From the code that you see, you'll see how to add a char * to
char_data without messing things up. Be careful of two things:

1) Don't trash your playerfile. I can tell you now that a pfile conversion
or a player wipe will be needed for this change unless you have ASCII pfiles
installed and working.
2) EMULATE the long_descr code, but do not blindly DUPLICATE it. Think about
what you are doing to make sure that you get it right. Otherwise, you may
end up with problems worse than you currently have.

That should be enough help for you to go on from here. Good Luck!

Zeavon Calatin, Spear of Insanity    telnet://
GCS d- s+: a- C+++ U++++ P++ L++ E---- W+++ N+ o-- K w--
O M- V PS+ PE Y+ PGP- t-- 5-- X+ R+++ tv+ b++ DI++ D++
G e h--- r+++ z+++

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

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