I'm going to take a shot in the dark and say the problem with it is
clan_table[maxClan - 1].who_name = left(argument,10);
Try using 'str_dup(argument);' like you did for the first one. If
who_name is a char array, change it to a pointer.
Davion
On Mon, 14 Feb 2005 12:32:34 +0000, Tristan M <[EMAIL PROTECTED]> wrote:
> Hey list, I've got a problem I can't really figure out what's going on. I've
> created an online clan editor(for standard RoT 1.4 clan system) and it all
> worked fine i thought until i noticed that every time the mud boots and i
> create say 3 clans, the new clan will always overwrite all other clans
> created since the mud was booted, but just theyre who_name's as far as I can
> tell. if i reboot, and boot the mud, all the clans made last time still are
> whonamed like the last one, but now when i create more clans it happens
> again, but only with the ones create since the last reboot...ive posted an
> example of what happens during play, then included the create and delete
> code below, i use this create/delete method for my editors for classes,
> races, groups and skills and have no problems so i assume its something very
> small, i just cant find it. anyway, heres the stuff:
>
> <100hp 100m 100mv> clan list
> * = Pkill Clan
> ----------------------------------------------------------------------
>
> <100hp 100m 100mv> cledit
> ---Editor---
> Name : loner
> Who Name: Loner
> Desc : Unused
> PK? : Yes
> Hall : [3700]
> Entrance: [3700]
> Pit : [3700]
> ---Info---
> Members : 0
> Leaders :
> <100hp 100m 100mv> create clan1
> ---Editor---
> Name : clan1
> Who Name: clan1
> Desc : No description
> PK? : No
> Hall : [0]
> Entrance: [0]
> Pit : [0]
> ---Info---
> Members : 0
> Leaders :
> <100hp 100m 100mv> list
> [ #] Clan WhoN PK? Hall Pit Entrance Description
> [ 0] loner Loner * 3700 3700 3700 Unused
> [ 1] clan1 clan1 0 0 0 No description
>
> <100hp 100m 100mv> create clan2
> ---Editor---
> Name : clan2
> Who Name: clan2
> Desc : No description
> PK? : No
> Hall : [0]
> Entrance: [0]
> Pit : [0]
> ---Info---
> Members : 0
> Leaders :
> <100hp 100m 100mv> list
> [ #] Clan WhoN PK? Hall Pit Entrance Description
> [ 0] loner Loner * 3700 3700 3700 Unused
> [ 1] clan1 clan2 0 0 0 No description
> [ 2] clan2 clan2 0 0 0 No description
>
> <100hp 100m 100mv> create clan3
> ---Editor---
> Name : clan3
> Who Name: clan3
> Desc : No description
> PK? : No
> Hall : [0]
> Entrance: [0]
> Pit : [0]
> ---Info---
> Members : 0
> Leaders :
> <100hp 100m 100mv> clan list
> * = Pkill Clan
> ----------------------------------------------------------------------
> Name: Clan1
> [ clan3 ] Members: 0
> Desc: No description
> Leaders:
> ----------------------------------------------------------------------
> Name: Clan2
> [ clan3 ] Members: 0
> Desc: No description
> Leaders:
> ----------------------------------------------------------------------
> Name: Clan3
> [ clan3 ] Members: 0
> Desc: No description
> Leaders:
> ----------------------------------------------------------------------
>
> CLEDIT( cledit_create )
> {
> CLAN_DATA *pClan;
> struct clan_type *new_table;
> int l;
>
> if ( argument[0] == '\0' )
> {
> send_to_char("Syntax: create (clan name)\n\r",ch);
> return FALSE;
> }
> if( is_number(argument))
> {
> send_to_char("Alphabetical characters only please.\n\r",ch);
> return FALSE;
> }
>
> maxClan++;
> new_table = realloc (clan_table, sizeof(struct clan_type) * (maxClan
> ));
>
> clan_table = new_table;
> clan_table[maxClan - 1].name = str_dup(argument);
> clan_table[maxClan - 1].who_name = left(argument,10);
> clan_table[maxClan - 1].exname = str_dup("No description");
> clan_table[maxClan - 1].pkill = FALSE;
> clan_table[maxClan - 1].entrance = 0;
> clan_table[maxClan - 1].pit = 0;
> clan_table[maxClan - 1].hall = 0;
> clan_table[maxClan - 1].independent = FALSE;
> clan_table[maxClan - 1].flags = 0;
> clan_table[maxClan - 1].members = 0;
> for(l=0;l<5;l++)
> clan_table[maxClan - 1].leaders[l] = NULL;
>
> pClan = get_clan_data( maxClan-1 );
> ch->desc->pEdit = (void *)pClan;
> cledit_show(ch,"");
> save_clans();
> return TRUE;
> }
>
> CLEDIT( cledit_delete )
> {
> int i,j;
> CLAN_DATA *pClan;
> char *FmtString;
> char buf[MSL];
> struct clan_type *new_table = malloc (sizeof(struct clan_type) *
> maxClan);
>
> EDIT_CLAN( ch, pClan) ;
> if( argument[0] != '\0' )
> {
> ptc(ch,"Deleted status removed.\n\r");
> REMOVE_BIT(pClan->flags, CLAN_DELETED );
> return TRUE;
> }
> if( pClan->independent )
> {
> ptc(ch,"%s cannot be deleted because it is for
> loners.\n\r",pClan->name);
> return FALSE;
> }
> if( !IS_SET(pClan->flags, CLAN_DELETED ))
> {
> sprintf(buf,"{3--- Are you sure you want to delete %s?
> ---{x",pClan->name
> );
> FmtString = fsl(buf,53,ALIGN_CENTER);
> ptc( ch,"%s\n\r"
> "{!Warning: {1this process is irreversible.{x\n\r"
> " {1are you certain you want to
> proceed?{x\n\n\r"
> " {3To confirm type '{1delete{3' again with no
> arguments{x\n\r"
> " {3otherwise type delete with an argument to
> reset.{x\n\r",
> str_dup(FmtString) );
> SET_BIT(pClan->flags, CLAN_DELETED );
> return TRUE;
> }
> if (!new_table)
> {
> send_to_char ("Memory allocation failed. Brace for
> impact...\n\r",ch);
> return FALSE;
> }
>
> for (i = 0, j = 0; i < maxClan+1; i++)
> if (i != clan_lookup(pClan->name))
> {
> new_table[j] = clan_table[i];
> j++;
> }
> free (clan_table);
> clan_table = new_table;
>
> maxClan--; /* Important :() */
> pClan = &clan_table[maxClan-1];
> ch->desc->pEdit = (void *)pClan;
>
> send_to_char ("Deleted.\n\r",ch);
> save_clans();
> return FALSE;
> }
>
> --
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom
>