Program received signal SIGSEGV, Segmentation fault.
0x0000028a in ?? ()
Program terminated with signal 11, Segmentation fault.
#0 0x38062011 in do_clone (ch=0x0, argument=0x0) at act_wiz.c:2307
2307 clone_object(obj,clone);
(gdb) bt
#0 0x38062011 in do_clone (ch=0x0, argument=0x0) at act_wiz.c:2307
#1 0x38052454 in find_keeper (ch=0x0, argument=0xbeec259e "\354\276\f&\354\276\314%\354\276K\311\003\070\f&\354\276\020%") at act_obj.c:2626
#2 0x380526c5 in do_shoplift (ch=0x3802780d, argument=<value optimized out>) at act_obj.c:3425
#3 0x380526f1 in do_shoplift (ch=0x1, argument=0x0) at act_obj.c:3434
#4 0x3803c20b in do_count (ch=0x3802780d, argument=0x0) at act_info.c:2560
#5 0x3803c2bb in do_who (ch=0xbeec266c, argument=0xbeec266c "\rx\002\070") at act_info.c:2346
#6 0x38027874 in ?? ()
#7 0xbeec266c in ?? ()
#8 0x00000001 in ?? ()
#9 0x00000064 in ?? ()
#10 0x00000000 in ?? ()
(gdb) frame 0
#0 0x38062011 in do_clone (ch=0x0, argument=0x0) at act_wiz.c:2307
2307 clone_object(obj,clone);
(gdb) info locals
clone = 0x0
arg = '\000' <repeats 840 times>, "\002\000\000\000\000\000\001\001\030\340\355gi\001\000\000H\200\rh\rx\002\070T%\354\276 %\354\276K#\005\070H\200\rh\rx\002\070\001\000\000\000\001\000\000\000\265\261\t\001P%\354\276"
rest = <value optimized out>
mob = <value optimized out>
obj = 0x67e3197e
(gdb)
void do_clone(CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
char *rest;
CHAR_DATA *mob;
OBJ_DATA *obj;
rest = one_argument(argument,arg);
if (arg[0] == '\0')
{
send_to_char("Clone what?\n\r",ch);
return;
}
if (!str_prefix(arg,"object"))
{
mob = NULL;
obj = get_obj_here(ch,rest);
if (obj == NULL)
{
send_to_char("You don't see that here.\n\r",ch);
return;
}
}
else if (!str_prefix(arg,"mobile") || !str_prefix(arg,"character"))
{
obj = NULL;
mob = get_char_room(ch,rest);
if (mob == NULL)
{
send_to_char("You don't see that here.\n\r",ch);
return;
}
}
else /* find both */
{
mob = get_char_room(ch,argument);
obj = get_obj_here(ch,argument);
if (mob == NULL && obj == NULL)
{
send_to_char("You don't see that here.\n\r",ch);
return;
}
}
/* clone an object */
if (obj != NULL)
{
OBJ_DATA *clone;
if (!obj_check(ch,obj))
{
send_to_char(
"Your powers are not great enough for such a task.\n\r",ch);
return;
}
clone = create_object(obj->pIndexData);
clone_object(obj,clone);
if (obj->carried_by != NULL)
obj_to_char(clone,ch);
else
obj_to_room(clone,ch->in_room);
recursive_clone(ch,obj,clone);
act("$n has created $p.",ch,clone,NULL,TO_ROOM,0);
act("You clone $p.",ch,clone,NULL,TO_CHAR,0);
wiznet("$N clones $p.",ch,clone,WIZ_LOAD,WIZ_SECURE,get_trust(ch));
return;
}
else if (mob != NULL)
{
CHAR_DATA *clone;
OBJ_DATA *new_obj;
char buf[MAX_STRING_LENGTH];
if (!IS_NPC(mob))
{
send_to_char("You can only clone mobiles.\n\r",ch);
return;
}
if (!IS_TRUSTED(ch,LEVEL_IMMORTAL))
{
send_to_char(
"Your powers are not great enough for such a task.\n\r",ch);
return;
}
clone = create_mobile(mob->pIndexData);
clone_mobile(mob,clone);
for (obj = mob->carrying; obj != NULL; obj = obj->next_content)
{
if (obj_check(ch,obj))
{
new_obj = create_object(obj->pIndexData);
clone_object(obj,new_obj);
recursive_clone(ch,obj,new_obj);
obj_to_char(new_obj,clone);
new_obj->wear_loc = obj->wear_loc;
}
}
char_to_room(clone,ch->in_room);
act("$n has created $N.",ch,NULL,clone,TO_ROOM,0);
act("You clone $N.",ch,NULL,clone,TO_CHAR,0);
sprintf(buf,"$N clones %s.",clone->short_descr);
wiznet(buf,ch,NULL,WIZ_LOAD,WIZ_SECURE,get_trust(ch));
return;
}
}
#0 0x38062011 in do_clone (ch=0x0, argument=0x0) at act_wiz.c:2307
#1 0x38052454 in find_keeper (ch=0x0, argument=0xbeec259e "\354\276\f&\354\276\314%\354\276K\311\003\070\f&\354\276\020%") at act_obj.c:2626
#2 0x380526c5 in do_shoplift (ch=0x3802780d, argument=<value optimized out>) at act_obj.c:3425
#3 0x380526f1 in do_shoplift (ch=0x1, argument=0x0) at act_obj.c:3434
#4 0x3803c20b in do_count (ch=0x3802780d, argument=0x0) at act_info.c:2560
#5 0x3803c2bb in do_who (ch=0xbeec266c, argument=0xbeec266c "\rx\002\070") at act_info.c:2346
void do_who( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
BUFFER *output;
DESCRIPTOR_DATA *d;
int iRace;
int iClan;
int iLevelLower;
int iLevelUpper;
int nNumber;
int nMatch;
int app;
bool rgfClan[MAX_CLAN];
bool rgfRace[MAX_PC_RACE];
bool fClanRestrict = FALSE;
bool fClan = FALSE;
bool fRaceRestrict = FALSE;
bool fImmortalOnly = FALSE;
bool fRPOK = FALSE;
bool fPack = FALSE;
PACK_DATA *pack = NULL;
/*
* Set default arguments.
*/
iLevelLower = 0;
iLevelUpper = MAX_LEVEL;
for ( iRace = 0; iRace < MAX_PC_RACE; iRace++ )
rgfRace[iRace] = FALSE;
for (iClan = 0; iClan < MAX_CLAN; iClan++)
rgfClan[iClan] = FALSE;
send_to_char("\n\r", ch);
send_to_char( "\t[F220]************************************************************\tn\n\r", ch);
send_to_char( "\t[F220]***\tn \tWThese are the people currently on Project Twilight\tn \t[F220]***\tn\n\r", ch );
send_to_char( "\t[F220]************************************************************\tn\n\r", ch);
/*
* Parse arguments.
*/
nNumber = 0;
for ( ;; )
{
char arg[MAX_STRING_LENGTH];
argument = one_argument( argument, arg );
if ( arg[0] == '\0' )
break;
/*
* Look for clan to turn on.
*/
if (!str_prefix(arg,"admin") || !str_prefix(arg,"staff"))
{
fImmortalOnly = TRUE;
send_to_char( "\t[F220]***\tn \tW PT Staff \tn \t[F220]***\tn\n\r", ch );
send_to_char( "\t[F220]************************************************************\tn\n\r", ch);
}
else if (!str_prefix(arg, "available") || !str_prefix(arg, "rpok") || !str_prefix(arg, "rpmod"))
{
fRPOK = TRUE;
send_to_char( "\t[F220]***\tn \tW RP Available \tn \t[F220]***\tn\n\r", ch );
send_to_char( "\t[F220]************************************************************\tn\n\r", ch);
}
else if (!str_prefix(arg, "pack"))
{
fPack = TRUE;
if(!IS_ADMIN(ch) || argument[0] == '\0')
pack = pack_lookup(ch->pack);
else
pack = pack_lookup(argument);
if(pack == NULL)
{
if(!IS_ADMIN(ch) || argument[0] == '\0')
send_to_char("You aren't part of a pack.\n\r", ch);
else
send_to_char("No such pack.\n\r", ch);
}
}
else if(IS_ADMIN(ch))
{
iRace = race_lookup(arg);
if (iRace == 0 || iRace >= MAX_PC_RACE)
{
if (!str_prefix(arg,"clan"))
fClan = TRUE;
else
{
iClan = clan_lookup(arg);
if (iClan)
{
fClanRestrict = TRUE;
rgfClan[iClan] = TRUE;
}
else
{
send_to_char("That's not a valid race, kith, tribe or clan.\n\r", ch);
return;
}
}
}
else
{
fRaceRestrict = TRUE;
rgfRace[iRace] = TRUE;
}
}
}
/*
* Add a header.
*/
if(fPack && pack != NULL)
{
sprintf(buf, "The %s Pack\n\r", pack->name);
send_to_char(buf, ch);
}
/*
* Now show matching chars.
*/
nMatch = 0;
buf[0] = '\0';
output = new_buf();
for ( d = descriptor_list; d != NULL; d = d->next )
{
CHAR_DATA *wch;
char const *clan;
/*
* Check for match against restrictions.
*/
if ( d->connected != CON_PLAYING || !can_see_main( ch, d->character ) )
continue;
wch = ( d->original != NULL ) ? d->original : d->character;
if (!can_see_main(ch,wch))
continue;
if ( ( fImmortalOnly && !IS_ADMIN(wch) )
|| ( fRaceRestrict && !rgfRace[wch->race])
|| ( fClan && !is_clan(wch))
|| ( fClanRestrict && !rgfClan[wch->clan])
|| ( fRPOK && !IS_SET(wch->plr_flags, PLR_RP_OK)))
continue;
if ( fPack && pack != pack_lookup(wch->pack) )
continue;
nMatch++;
/*
* Figure out stuff to print.
*/
clan = clan_table[wch->clan].who_name;
app = get_curr_stat(wch, STAT_APP);
send_to_char("\n\r", ch);
/*
* Format it up.
*/
if(IS_SET(ch->comm, COMM_BRIEF))
{
if(IS_ADMIN(ch))
{
sprintf( buf, "[\tY%4s %s\tn][\tY%6s] %s%s%s\tW%s\tn\n\r",
wch->race < MAX_PC_RACE ? pc_race_table[wch->race].who_name
: " ",
clan,
gender_string(wch),
wch->invis_level >= LEVEL_IMMORTAL ? "[\tYWIZI\tn]" : "",
IS_SET(wch->act2, ACT2_STORY) ? "[\t[F205]ST\tn]": "",
IS_SET(wch->comm, COMM_AFK) ? "[\tYAFK\tn]": "",
wch->name);
}
else
{
sprintf( buf, "[%s] %s%s\tW%s\tn\n\r",
gender_string(wch),
IS_SET(wch->act2, ACT2_STORY) ? "[\t[F205]ST\tn]": "",
IS_SET(wch->comm, COMM_AFK) ? "[\tYAFK\tn]": "",
wch->name );
}
}
else
{
if(IS_ADMIN(ch))
sprintf( buf,
"[\tY%4s %s\tn][\tY%s %6s\tn]%s%s%s \tW%s%s%s\tn %s%s%s\tn\n\r",
wch->race < MAX_PC_RACE ? pc_race_table[wch->race].who_name
: " ",
clan,
appearance_string(wch),
gender_string(wch),
wch->invis_level >= LEVEL_IMMORTAL ? "[\tYWIZI\tn]" : "",
IS_SET(wch->act2, ACT2_STORY) ? "[\t[F205]ST\tn]": "",
IS_SET(wch->comm, COMM_AFK) ? "[\tYAFK\tn]": "",
wch->name,
wch->surname[0] != '\0' ? " ":"",
wch->surname,
fRPOK ? " [": "",
IS_NPC(wch) ? "" : !fRPOK ? wch->pcdata->title : wch->pcdata->rpok_string,
fRPOK ? "]": "");
else
sprintf( buf, "[%s]%s%s \tW%s%s%s\tn\tR%s\tn%s\tR%s\tn\n\r",
gender_string(wch),
IS_SET(wch->act2, ACT2_STORY) ? "[\t[F205]ST\tn]": "",
IS_SET(wch->comm, COMM_AFK) ? "[\tYAFK\tn]": "",
wch->name,
wch->surname[0] != '\0' ? " ":"",
wch->surname,
fRPOK ? " [": "",
IS_NPC(wch) ? "" : !fRPOK ? wch->pcdata->title : wch->pcdata->rpok_string,
fRPOK ? "]": "");
}
add_buf(output,buf);
}
sprintf( buf2, "\n\rPlayers found: %d\n\r", nMatch );
add_buf(output,buf2);
page_to_char( buf_string(output), ch );
free_buf(output);
return;
}
void do_count ( CHAR_DATA *ch, char *argument )
{
int count;
DESCRIPTOR_DATA *d;
char buf[MAX_STRING_LENGTH];
count = 0;
for ( d = descriptor_list; d != NULL; d = d->next )
if ( d->connected == CON_PLAYING && can_see_main( ch, d->character ) )
count++;
max_on = UMAX(count,max_on);
if (max_on == count)
sprintf(buf,"There are %d characters on, the most so far today.\n\r",count);
else
sprintf(buf,"There are %d characters on, the most on today was %d.\n\r",count,max_on);
send_to_char(buf,ch);
}
void do_shoplift( CHAR_DATA *ch, char *argument )
{
CHAR_DATA *victim;
OBJ_DATA *obj;
OBJ_DATA *t_obj;
EXTRA_DESCR_DATA *ed, *objed;
int percent, fail;
char buf [MAX_STRING_LENGTH];
char arg1 [MAX_INPUT_LENGTH];
char arg2 [MAX_INPUT_LENGTH];
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if(IS_SET(ch->plr_flags, PLR_RP_OK))
{
send_to_char("For your own safety, you can't shoplift in RP mode.\n\r", ch);
return;
}
if ( arg1[0] == '\0' || arg2[0] == '\0' )
{
send_to_char( "Steal what from whom?\n\r", ch );
return;
}
if ( ( victim = find_keeper( ch, arg2 ) ) == NULL )
{
send_to_char( "There's no shop here.\n\r", ch );
return;
}
if ( victim == ch )
{
send_to_char( "That's pointless.\n\r", ch );
return;
}
WAIT_STATE( ch, skill_table[gsn_steal].beats );
percent = get_curr_stat(victim, STAT_DEX) + victim->ability[ALERTNESS].value;
if (!IS_AWAKE(victim))
percent -= 1;
else if (!can_see(victim,ch))
percent += 2;
else
percent += 3;
if (percent > 10) percent = 10;
if (percent < 6) percent = 6;
fail = dice_rolls(ch, get_curr_stat(ch, STAT_DEX) + ch->ability[SUBTERFUGE].value, percent);
if ( ( !IS_NPC(ch) && (fail <= 0) )
|| ( !IS_NPC(ch) && !is_clan(ch)) )
{
/*
* Failure.
*/
send_to_char( "Oops.\n\r", ch );
affect_strip(ch,gsn_sneak);
REMOVE_BIT(ch->affected_by,AFF_SNEAK);
act( "$n tried to steal from you.\n\r", ch, NULL, victim, TO_VICT, 0 );
act( "$n tried to steal from $N.\n\r", ch, NULL, victim, TO_NOTVICT,0);
snprintf( buf, MSL, "%s is a thief!", ch->name );
if (!IS_AWAKE(victim))
do_function(victim, &do_wake, "");
if (IS_AWAKE(victim) && IS_NPC(victim))
{
do_function(victim, &do_yell, buf);
}
if ( !IS_NPC(ch) )
{
if ( IS_NPC(victim) )
{
multi_hit( victim, ch, TYPE_UNDEFINED );
}
else
{
snprintf(buf, MSL, "$N tried to steal from %s.",victim->name);
wiznet(buf,ch,NULL,WIZ_FLAGS,0,0);
}
}
if(!IS_SET(victim->act2, ACT2_NOWARRANT))
add_warrant(ch, 3, TRUE);
return;
}
if(!IS_SET(victim->act2, ACT2_NOWARRANT))
add_warrant(ch, 3, FALSE);
if ( ( obj = get_obj_carry( victim, arg1, ch ) ) == NULL )
{
send_to_char( "You can't find it.\n\r", ch );
return;
}
if ( !can_drop_obj( ch, obj ) )
{
send_to_char( "You can't pry it away.\n\r", ch );
return;
}
if ( ch->carry_number + get_obj_number( obj ) > can_carry_n( ch ) )
{
send_to_char( "You have your hands full.\n\r", ch );
return;
}
if ( ch->carry_weight + get_obj_weight( obj ) > can_carry_w( ch ) )
{
send_to_char( "You can't carry that much weight.\n\r", ch );
return;
}
if ( IS_SET( obj->extra_flags, ITEM_INVENTORY ) && IS_NPC(victim) )
{
t_obj = create_object( obj->pIndexData );
if(IS_SET(t_obj->extra_flags, ITEM_INVENTORY))
REMOVE_BIT(t_obj->extra_flags, ITEM_INVENTORY);
if(IS_SET(victim->act2, ACT2_NEWS_STAND))
{
free_string(t_obj->name);
t_obj->name = str_dup(obj->name);
free_string(t_obj->short_descr);
t_obj->short_descr = str_dup(obj->short_descr);
free_string(t_obj->description);
t_obj->description = str_dup(obj->description);
t_obj->cost = obj->cost;
for(objed=obj->extra_descr;objed;objed=objed->next)
{
/* Set extra descriptions for articles */
ed = alloc_perm( sizeof(*ed) );
ed->keyword = str_dup(objed->keyword);
ed->description = str_dup(objed->description);
ed->next = t_obj->extra_descr;
t_obj->extra_descr = ed;
}
t_obj->wear_loc = -1;
free_string(t_obj->full_desc);
t_obj->full_desc = str_dup(obj->full_desc);
}
}
else
{
t_obj = obj;
obj = obj->next_content;
obj_from_char( t_obj );
if(IS_SET(t_obj->extra_flags, ITEM_INVENTORY))
REMOVE_BIT(t_obj->extra_flags, ITEM_INVENTORY);
}
if (t_obj->timer > 0 && !IS_OBJ_STAT(t_obj,ITEM_HAD_TIMER))
t_obj->timer = 0;
REMOVE_BIT(t_obj->extra_flags,ITEM_HAD_TIMER);
obj_to_char( t_obj, ch );
act("You pocket $p.",ch,obj,NULL,TO_CHAR,0);
send_to_char( "Got it!\n\r", ch );
return;
}
CHAR_DATA *find_keeper( CHAR_DATA *ch, char *argument )
{
/*char buf[MAX_STRING_LENGTH];*/
CHAR_DATA *keeper;
SHOP_DATA *pShop;
pShop = NULL;
if(argument[0] == '\0')
{
send_to_char( "You must supply a valid shopkeeper.\n\r", ch );
return NULL;
}
for ( keeper = ch->in_room->people; keeper; keeper = keeper->next_in_room )
{
if ( ( IS_NPC(keeper) && (pShop = keeper->pIndexData->pShop) != NULL )
|| ( !IS_NPC(keeper) && !str_cmp(keeper->profession, "Salesman") )
|| ( !IS_NPC(keeper) && (!str_cmp(keeper->profession, "Chef")
|| !str_cmp(keeper->profession, "Maker")) && !str_cmp(ch->profession, "Salesman") ) )
if(ch != keeper && keeper == get_char_room(ch, argument))
break;
}
if(keeper == NULL)
{
send_to_char( "You can't do that here.\n\r", ch );
return NULL;
}
if ( pShop == NULL && !(!str_cmp(keeper->profession,"Chef") || !str_cmp(keeper->profession,"Salesman")
|| !str_cmp(keeper->profession,"Maker")) )
{
send_to_char( "You can't do that here.\n\r", ch );
return NULL;
}
if(str_cmp(ch->profession,"Salesman") && (!str_cmp(keeper->profession, "Chef") || !str_cmp(keeper->profession, "Maker")))
{
send_to_char( "You can't do that here.\n\r", ch );
return NULL;
}
/*
* Shop hours.
*/
if(pShop)
{
if ( time_info.hour < pShop->open_hour )
{
do_function(keeper, &do_say, "Sorry, I am closed. Come back later.");
return NULL;
}
if ( time_info.hour > pShop->close_hour )
{
do_function(keeper, &do_say, "Sorry, I am closed. Come back tomorrow.");
return NULL;
}
}
/*
* Invisible or hidden people.
*/
if ( !can_see( keeper, ch ) )
{
do_function(keeper, &do_say, "I don't trade with folks I can't see.");
return NULL;
}
return keeper;
}
void do_clone(CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
char *rest;
CHAR_DATA *mob;
OBJ_DATA *obj;
rest = one_argument(argument,arg);
if (arg[0] == '\0')
{
send_to_char("Clone what?\n\r",ch);
return;
}
if (!str_prefix(arg,"object"))
{
mob = NULL;
obj = get_obj_here(ch,rest);
if (obj == NULL)
{
send_to_char("You don't see that here.\n\r",ch);
return;
}
}
else if (!str_prefix(arg,"mobile") || !str_prefix(arg,"character"))
{
obj = NULL;
mob = get_char_room(ch,rest);
if (mob == NULL)
{
send_to_char("You don't see that here.\n\r",ch);
return;
}
}
else /* find both */
{
mob = get_char_room(ch,argument);
obj = get_obj_here(ch,argument);
if (mob == NULL && obj == NULL)
{
send_to_char("You don't see that here.\n\r",ch);
return;
}
}
/* clone an object */
if (obj != NULL)
{
OBJ_DATA *clone;
if (!obj_check(ch,obj))
{
send_to_char( "Your powers are not great enough for such a task.\n\r",ch);
return;
}
clone = create_object(obj->pIndexData);
clone_object(obj,clone);
if (obj->carried_by != NULL)
obj_to_char(clone,ch);
else
obj_to_room(clone,ch->in_room);
recursive_clone(ch,obj,clone);
act("$n has created $p.",ch,clone,NULL,TO_ROOM,0);
act("You clone $p.",ch,clone,NULL,TO_CHAR,0);
wiznet("$N clones $p.",ch,clone,WIZ_LOAD,WIZ_SECURE,get_trust(ch));
return;
}
else if (mob != NULL)
{
CHAR_DATA *clone;
OBJ_DATA *new_obj;
char buf[MAX_STRING_LENGTH];
if (!IS_NPC(mob))
{
send_to_char("You can only clone mobiles.\n\r",ch);
return;
}
if (!IS_TRUSTED(ch,LEVEL_IMMORTAL))
{
send_to_char( "Your powers are not great enough for such a task.\n\r",ch);
return;
}
clone = create_mobile(mob->pIndexData);
clone_mobile(mob,clone);
for (obj = mob->carrying; obj != NULL; obj = obj->next_content)
{
if (obj_check(ch,obj))
{
new_obj = create_object(obj->pIndexData);
clone_object(obj,new_obj);
recursive_clone(ch,obj,new_obj);
obj_to_char(new_obj,clone);
new_obj->wear_loc = obj->wear_loc;
}
}
char_to_room(clone,ch->in_room);
act("$n has created $N.",ch,NULL,clone,TO_ROOM,0);
act("You clone $N.",ch,NULL,clone,TO_CHAR,0);
snprintf(buf, MSL, "$N clones %s.",clone->short_descr);
wiznet(buf,ch,NULL,WIZ_LOAD,WIZ_SECURE,get_trust(ch));
return;
}
}
So, I tried using Valgrind on my mud, because I was told it can help make things more efficient memory wise, and seeing how I'm based off of ROM2.4, I know that it isn't the most effective beast in the pack. Now, my mud normally starts up fine with no problems. It get's up running and carries on it's happy little way. However, when I tried doing Valgrind on it, this is what I got.
Clearly, it's crashing on startup when I run Valgrind, that much I can figure out. The rest though I have no idea about. Can anyone help me out?
Thanks in advance,
Arholly