if(vote_tally[0][i].name == NULL
(gdb) p i
$1 = 16154612
if(!str_prefix(argument, "mayor"))
{
for(i = 0; i < 6; i++)
{
if(vote_tally[0][i].name == NULL
|| !str_cmp(vote_tally[0][i].name, "None"))
{
vote_tally[0][i].name = str_dup(nominee->name);
vote_tally[0][i].votes = 1;
break;
}
}
}
void do_group( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
CHAR_DATA *gch;
CHAR_DATA *leader;
leader = (ch->leader != NULL) ? ch->leader : ch;
sprintf( buf, "%s's group:\n\r", PERS(leader, ch) );
send_to_char( buf, ch );
for ( gch = char_list; gch != NULL; gch = gch->next )
{
if ( is_same_group( gch, ch ) )
{
sprintf( buf,
"[ %s ] %-16s %s %5d xp\n\r",
IS_NPC(gch) ? "Mob" : clan_table[gch->clan].who_name,
capitalize( PERS(gch, ch) ),
health_string(gch),
gch->exp );
send_to_char( buf, ch );
}
}
return;
}
if ( ( victim = get_char_room( ch, arg ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( ch->master != NULL || ( ch->leader != NULL && ch->leader != ch ) )
{
send_to_char( "But you are following someone else!\n\r", ch );
return;
}
if ( victim->master != ch && ch != victim )
{
act_new("$N isn't following you.",ch,NULL,victim,TO_CHAR,P_SLEEP,1);
return;
}
if (IS_AFFECTED(victim,AFF_CHARM))
{
send_to_char("You can't remove charmed mobs from your group.\n\r",ch);
return;
}
if (IS_AFFECTED(ch,AFF_CHARM))
{
act_new("You like your master too much to leave $m!",
ch,NULL,victim,TO_VICT,P_SLEEP,1);
return;
}
if ( is_same_group( victim, ch ) && ch != victim )
{
victim->leader = NULL;
act_new("$n removes $N from $s group.",
ch,NULL,victim,TO_NOTVICT,P_REST,1);
act_new("$n removes you from $s group.",
ch,NULL,victim,TO_VICT,P_SLEEP,1);
act_new("You remove $N from your group.",
ch,NULL,victim,TO_CHAR,P_SLEEP,1);
return;
}
victim->leader = ch;
act_new("$N joins $n's group.",ch,NULL,victim,TO_NOTVICT,P_REST,1);
act_new("You join $n's group.",ch,NULL,victim,TO_VICT,P_SLEEP,1);
act_new("$N joins your group.",ch,NULL,victim,TO_CHAR,P_SLEEP,1);
return;
}
2567
2568 for ( gch = char_list; gch != NULL; gch = gch->next )
2569 {
2570 if ( is_same_group( gch, ch ) )
2571 {
2572 sprintf( buf,
2573 "[ %s ] %-16s %s %5d xp\n\r",
2574 IS_NPC(gch) ? "Mob" : clan_table[gch->clan].who_name,
2575 capitalize( PERS(gch, ch) ),
2576 health_string(gch),
#3 0x08049edb in do_rp_ok (ch=0xa, argument=0x1000 <Address 0x1000 out of bounds>) at act_comm.c:2750
#4 0x0804ad24 in do_group (ch=0xa, argument=0x6 <Address 0x6 out of bounds>) at act_comm.c:2572
#5 0x0804c368 in do_quit (ch=0x0, argument=0x8057800 "") at act_comm.c:2205
#6 0x00e28e9c in ?? ()
#7 0x00da1ca0 in ?? () from /lib/ld-linux.so.2
#8 0x08057800 in do_nominate (ch=0x804b550, argument=0xda1ca0 "") at act_info.c:3854
void do_nominate(CHAR_DATA *ch, char *argument)
{
CHAR_DATA *nominee;
char arg[MAX_INPUT_LENGTH];
bool online = FALSE;
bool in_char_list = FALSE;
int i;
argument = one_argument(argument, arg);
if(argument[0] == '\0' || arg[0] == '\0')
{
send_to_char("Nominate whom for which position?\n\r", ch);
return;
}
if(ch->pcdata->last_vote > current_time - 24*60*60 && !IS_ADMIN(ch))
{
send_to_char("Only one vote per 24 hours.\n\r", ch);
return;
}
if(is_online(arg)) online = TRUE;
if(pc_in_char_list(arg)) in_char_list = TRUE;
if((nominee = get_player(arg)) == NULL)
{
send_to_char("No such person.\n\r", ch);
return;
}
if(nominee->race != race_lookup("human"))
{
send_to_char("Only the mortal should be in the public eye.\n\r", ch);
return;
}
if(is_nominee(nominee, 0))
{
send_to_char("They're already nominated to be mayor!\n\r", ch);
return;
}
else if(is_nominee(nominee, 1))
{
send_to_char("They're already nominated to be an alderman!\n\r", ch);
return;
}
else if(is_nominee(nominee, 2))
{
send_to_char("They're already nominated to be a judge!\n\r", ch);
return;
}
if(!str_prefix(argument, "mayor"))
{
for(i = 0; i < 6; i++)
{
if(vote_tally[0][i].name == NULL
|| !str_cmp(vote_tally[0][i].name, "None"))
{
vote_tally[0][i].name = str_dup(nominee->name);
vote_tally[0][i].votes = 1;
break;
}
}
}
else if(!str_prefix(argument, "alderman"))
{
for(i = 0; i < 6; i++)
{
if(vote_tally[1][i].name == NULL
|| !str_cmp(vote_tally[0][i].name, "None"))
{
vote_tally[1][i].name = str_dup(nominee->name);
vote_tally[1][i].votes = 1;
break;
}
}
}
else if(!str_prefix(argument, "judge"))
{
for(i = 0; i < 6; i++)
{
if(vote_tally[2][i].name == NULL
|| !str_cmp(vote_tally[0][i].name, "None"))
{
vote_tally[2][i].name = str_dup(nominee->name);
vote_tally[2][i].votes = 1;
break;
}
}
}
else
{
send_to_char("Positions available are: judge, alderman, mayor.\n\r", ch);
return;
}
ch->pcdata->last_vote = current_time;
fwrite_votes();
send_to_char("Nomination submitted.\n\r", ch);
if(!online && !in_char_list)
{
free_char(nominee);
}
}
void do_quit( CHAR_DATA *ch, char *argument )
{
DESCRIPTOR_DATA *d,*d_next;
int id;
if ( IS_NPC(ch) )
return;
if ( ch->position == P_FIGHT )
{
send_to_char( "No way! You are fighting.\n\r", ch );
return;
}
if ( ch->position < P_STUN )
{
send_to_char( "You're not DEAD yet.\n\r", ch );
return;
}
send_to_char("Parting is such sweet sorrow.\n\r",ch);
act( "$n has left the game.", ch, NULL, NULL, TO_ROOM, 0 );
sprintf( log_buf, "%s has quit.", ch->name );
log_string( log_buf );
wiznet("$N rejoins the real world.",ch,NULL,WIZ_LOGINS,0,get_trust(ch));
/* Added RSS feed information */
sprintf( log_buf, "%s has logged out.", ch->name );
log_to_file(logfile, GLOBAL_XML_IN, log_buf);
/*
* Ditch buildermode mobs and objects.
*/
if(IS_SET(ch->comm, COMM_BUILDER))
{
cleanse_builder_stuff(ch);
REMOVE_BIT(ch->comm, COMM_BUILDER);
}
/*
* After extract_char the ch is no longer valid!
*/
save_char_obj( ch );
id = ch->id;
d = ch->desc;
extract_char( ch, TRUE );
if ( d != NULL )
close_socket( d );
/* toast evil cheating bastards */
for (d = descriptor_list; d != NULL; d = d_next)
{
CHAR_DATA *tch;
d_next = d->next;
tch = d->original ? d->original : d->character;
if (tch && tch->id == id)
{
extract_char(tch,TRUE);
close_socket(d);
}
}
return;
}
wiznet("$N rejoins the real world.",ch,NULL,WIZ_LOGINS,0,get_trust(ch));
void do_rp_ok(CHAR_DATA *ch, char *argument)
{
char buf[MAX_STRING_LENGTH];
if(IS_NPC(ch))
{
return;
}
if(IS_SET(ch->plr_flags, PLR_RP_OK))
{
send_to_char("People will no longer be able to join you for RP.\n\r",
ch);
REMOVE_BIT(ch->plr_flags, PLR_RP_OK);
free_string(ch->pcdata->rpok_string);
ch->pcdata->rpok_string = str_dup("None");
return;
}
else
{
send_to_char("You can now be joined by others for RP.\n\r", ch);
SET_BIT(ch->plr_flags, PLR_RP_OK);
if(argument[0] != '\0')
{
sprintf(buf, "Your RP title has been set to: %s\n\r", argument);
send_to_char(buf, ch);
free_string(ch->pcdata->rpok_string);
ch->pcdata->rpok_string = str_dup(argument);
}
}
}
if(!online && !in_char_list)
{
free_char(nominee);
}
CHAR_DATA *get_player( char *argument )
{
CHAR_DATA *ch;
for ( ch = char_list; ch; ch = ch->next )
{
if ( IS_NPC( ch ) )
continue;
if ( is_name( argument, ch->name ) )
return ch;
}
return get_player_file( argument );
}
I've got a crash bug in my code I inherited and I'm not sure what it is doing. When I go to save a new poll/survey, it crashes, as in completely shuts down the mud. Now, I know how to run gdb to get information, but I'm not sure where to go next.
Can someone help me out and see what I need to do next? I would appreciate an explanation as well so I can learn from this.
Thanks,
Arholly