(i posted this earlier under a longer subject, I have been
trying some things of my own, looking at do_remove and
do_goto, but am still having no luck. If anyone could just
offer maybe a different approach, I might be able to figure
it out myself.)
I recently installed object and room progs and was able to
get everything to compile nicely. everything runs nicely
also...or so it seems, untill you remove an item you are
wearing, at which point I get a segmentation fault in
number_argument...
according to GDB, the pointer 'argument' is null. and I
think this is causing the Seg fault but, I cannot figure out
where the null is coming from since im typing something
in...after some exploration, it seems to crash after you
reference something that doesnt exist...with goto or stat,
trans works for nonexistant things and so so the similar
spells but it also crashes if you remove eq, putting it on
is ok, getting it zapped off is ok, just when you remove.
since there is no mob named forest:
heres my variables, crashed after i entered 'goto forest':
argument (char *) 0x0
arg (char *) 0x263e1cc "forest"
argument (char *) 0x0
arg (char *) 0x263e1cc "forest"
pdot (char *) 0x0
number 77172002
after i typed 'rem tiny':
argument (char *) 0x0
arg (char *) 0x263e26c ""
argument (char *) 0x0
arg (char *) 0x263e26c ""
pdot (char *) 0x0
number 77172649
any insight as to what is happening would be nice...i have included
number_argument at the
bottom for reference.
thanks,
Brian
<snp>
/*
*Given a string like 14.foo, return 14 and 'foo'
*/
int number_argument( char *argument, char *arg )
{
char *pdot;
int number;
for ( pdot = argument; *pdot != '\0'; pdot++ )
{
if ( *pdot == '.' )
{
*pdot = '\0';
number = atoi( argument );
*pdot = '.';
strcpy( arg, pdot+1 );
return number;
}
}
strcpy( arg, argument );
return 1;
}
</snp>