Apparently you have to do something called "allocating sufficient memory" when adding to things.
Imagine that. Fixed. Replies still welcome, though. :) - Jeremy Hill ----- Original Message ----- From: "Jeremy Hill" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Thursday, January 02, 2003 3:39 AM Subject: input showing up in prompt > For some reason, when I add stuff to a 'friends' field of a player using > strcat, it also adds it to my prompt. > Here's what I mean: > > 21300> friend Evangelion > Evangelion added to your friend list. > > 21300> Evangelion > > 21300> Evangelionsay Uhoh! > Huh? > > The plan is to add friends with strcat rather than to copy 'friends' to a > temp buf, free the old 'friends', add the new friend to the temp buf, and > str_dup buf back over to 'friends'. > > Here's the guts of what 'friend' does: > ========================================================= > void do_friend (CHAR_DATA * ch, char *argument) > { > char buf[MIL]; > static char bufx[42]; > ... > (acquire victim) > > if (!strstr(ch->pcdata->friends, victim->name)) > { > sprintf(bufx, " %s", victim->name); > strcat(ch->pcdata->friends, bufx); > strcpy(bufx, ""); > sprintf(buf, "{C%s{x added to your friend list.\n\r", victim->name); > send_to_char(buf, ch); > } > else > { > send_to_char("That person is already in your friends list.\n\r", > ch); > } > ... > ========================================================= > > Where have I screwed up? > > For the record, I do have 'char *friends' init and clear appropriately, like > how bamfin does. > > Recycle.c, in free_pcdata: > free_string (pcdata->friends); //added 1/2/03 > > Merc.h, struct pc_data: > char * friends; //added 1/2/03 > > Save.c, func load_char_obj: > ch->pcdata->friends = str_dup (""); //added 1/2/03 > > > Any ideas? > Thank you for your time. > > - Jeremy Hill > > > -- > ROM mailing list > [email protected] > http://www.rom.org/cgi-bin/mailman/listinfo/rom >

