MudBytes
Pages: << prev 1, 2 next >>
Calloc help
Bojack
Magician




Group: Members
Posts: 69
Joined: Jul 26, 2009

Go to the bottom of the page Go to the top of the page
#16 id:41669 Posted Feb 7, 2010, 7:56 pm

Alright now it loads 2 clans, which are the beginning of the file, and the end of the file clans but nothing in between. Here's what I changed:
Code (text):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
 
This is in load_clans (void)
        clan_first = NULL;
        clan_last = NULL;
 
        for (;;)
        {
            char *word;
 
            word = feof( fp ) ? "$" : fread_word( fp );
 
            if (!str_cmp( word, "#CLAN" ) )
                fread_clan( fp );
 
            else if (!str_cmp(word, "$") )
                break;
 
            else
            {
                char error[MSL];
 
                sprintf( error, "Load_clans: bad string found '%s'", word );
                logstr( LOG_BUG, error, 0 );
                break;
            }
        }
        fclose( fp );
 
This is in fread_clan (FILE *fp)
                case 'E':
                    if (!str_cmp (string, "End") )
                    {
                        if (clan_first == NULL)
                        {
                            clan_first = pClan;
                            clan_last = pClan;
                        }
 
                        else {
                            clan_last->next = pClan;
                        }
                        pClan->next = NULL;
                        top_clan++;
                        fMatch = TRUE;
 
                        return;
                    }
                    break;
 

Weird thing is top_clan counts 4 clans in the mud but only display's 2.

Last edited Feb 7, 2010, 7:58 pm by Bojack
Bojack
Magician




Group: Members
Posts: 69
Joined: Jul 26, 2009

Go to the bottom of the page Go to the top of the page
#17 id:41672 Posted Feb 7, 2010, 8:57 pm

I figured it out, I forgot to add before pClan->next = NULL, clan_last = pClan; Thanks for everyone's help! I should be able to do deleting now by back tracking how its loaded.

Last edited Feb 7, 2010, 8:58 pm by Bojack
Pages:<< prev 1, 2 next >>
Tags
[+]

Valid XHTML 1.1! Valid CSS!