Ok all,
I gots myself a logic error here. Like usual I see whats going wrong, and my brain stack dumped about an hour ago.
My problem is in act_info.c (function show_list_to_char). Heres the code:
void show_list_to_char( OBJ_DATA *list, CHAR_DATA *ch, bool fShort, bool fShowNothing, const int iDefaultAction )
{
char **prgpstrShow;
char **prgpstrName; /* for MXP */
char **prgpstrShortName; /* for MXP */
int *prgnShow;
int *pitShow;
char *pstrShow;
char *pstrName; /* for MXP */
char *pstrShortName; /* for MXP */
OBJ_DATA *obj;
int nShow;
int iShow;
int count,count2, count3, offcount, tmp, ms, cnt;
bool fCombine;
char * pAction = NULL;
if ( !ch->desc )
return;
/*
* if there's no list... then don't do all this crap! -
-------snip-------------
{ ch_printf (ch, MXPTAG ("%s '%s' '%s'"), pAction, prgpstrName[iShow], prgpstrShortName[iShow]);
count3 = 0;
count2 = 0;
for ( obj = list; obj; obj = obj->next_content )
count3++;
for ( obj = list; obj; obj = obj->next_content )
{
count2++;
if (count3 == 1)
{
send_to_char( prgpstrShow[iShow], ch );
ch_printf( ch, "." );
}
if (count2 < count3 && count3 != 1)
{
send_to_char( prgpstrShow[iShow], ch );
ch_printf( ch, ", " );
}
if ( count2 == count3 && count3 != 1)
{
ch_printf( ch, "and " );
send_to_char( prgpstrShow[iShow], ch );
ch_printf( ch, "." );
}
}
}
---------snip---------
Ok... The code works great when there is only one object in room... Heres an example of what the output looks like.
[Mercuria, Grand Center]
You are standing before a gigantic fountain in the center
of the city. The buildings tower above you, seeming to
climb into the heavens themselves. Never before have you
seen such wonderful architecture. Children run past you,
as townsfolk go about their daily business. You also see
a fountain.
Also here:
a town guard, and a fuzzy grey kitten.
Exits: north east south west.
<1013hp 500m 740mv>
Ok... now the tricky part, when there are two or more objects in the room, I get an output simmilar to this:
[Mercuria, Grand Center]
You are standing before a gigantic fountain in the center
of the city. The buildings tower above you, seeming to
climb into the heavens themselves. Never before have you
seen such wonderful architecture. Children run past you,
as townsfolk go about their daily business. You also see
a fountain, a fountain, and a fountain.a town guard
corpse, a town guard corpse, and a town guard corpse.some
spilled blood, some spilled blood, and some spilled blood.
Also here:
a fuzzy grey kitten.
Exits: north east south west.
Now basically my logic error is this, if there are three objects in the room, it lists all the objects three times.... if there are four.... it lists them all four times. I know my problem is with my for statement, but my brain is just not working.... and help would be appreciated.
-Kelsid
|