Jump to content
Eternal Lands Official Forums
Sign in to follow this  
teranoz

Cannot Run Latest Cvs Version (cause :translate.c)

Recommended Posts

As soon as I run el.exe it crashes.

 

After commenting all add_xml_distringid(....

in void init_spells(),

and free_xml_parser(DIGROUP,sigils_str,SIGILS_STR);

module translate.c

it runs normal again.

 

No compilation errors.

 

OS : W2K

Share this post


Link to post
Share on other sites

Can you do a backtrace? It's not reproducable on GNU/Linux. The strings need to be initiated so commenting them out is not an option.

 

Is it a clean compile?

 

Try changing:

add_xml_distringid(sigils_str,"change",&sig_change,"Change","");

into

add_xml_distringid(sigils_str,"change",&sig_change,"Change"," ");

(Added a space in the description) Could be caused by a buggy strncpy - otherwise I don't have any more ideas untill you give me a backtrace. My first guess would be line 449...

 

Another possible fix that'll only require 1 change:

 

void add_xml_distringid(group_id_di * group, char * xml_id, dichar * var, char * str, char * desc)
{      group->distrings=(distring_item**)realloc(group->distrings,(group->no+1)*sizeof(distring_item*));
       group->distrings[group->no]=(distring_item*)calloc(1,sizeof(distring_item));
       strcpy(group->distrings[group->no]->xml_id,xml_id);
       group->distrings[group->no]->var=var;
       if(*name)strncpy(var->str, str, 30);
       else var->name[0]=0
       if(*desc)strncpy(var->desc, desc, 100);
       else var->desc[0]=0;
       group->no++;
}

Share this post


Link to post
Share on other sites

error C2065: 'name' : undeclared identifier

error C2100: illegal indirection

 

it goes wrong here :

group->distrings=(distring_item**)realloc(group->distrings,(group->no+1)*sizeof(distring_item*));

Share this post


Link to post
Share on other sites

Shit... Gotta love memory allocation errors that are not reproducable.

 

It's just peculiar - I know that it works for some windows users... You use MS Visual C++, right?

Share this post


Link to post
Share on other sites

Then for now the only fix I can show you is to change the group_id_di structure to:

 

typedef struct
{
       char xml_id[15];
       int no;
       distring_item * distrings[100];
#ifdef WRITE_XML
       int saved;
#endif
} group_id_di;

And add_xml_distringid:

 

void add_xml_distringid(group_id_di * group, char * xml_id, dichar * var, char * str, char * desc)
{
       group->distrings[group->no]=(distring_item*)calloc(1,sizeof(distring_item));
       strcpy(group->distrings[group->no]->xml_id,xml_id);
       group->distrings[group->no]->var=var;
       if(*str)strncpy(var->str, str, 30);
       else var->str[0]=0;
       if(*desc)strncpy(var->desc, desc, 100);
       else var->desc[0]=0;
       group->no++;
}

And free_xml_parser:

void free_xml_parser(int type, void * gPtr, int no)
{
       group_id * grp=gPtr;
       group_id_di * Grp=gPtr;
#ifdef ELC
       group_stat * stat=gPtr;
#endif
       int i=0,j;
       switch(type)
               {
                       case GROUP:
                               for(;i<no;i++)
                                       {
                                               for(j=0;j<grp[i].no;j++)
                                                       {
                                                               free(grp[i].strings[j]);
                                                       }
                                               free(grp[i].strings);
                                       }
                               free(grp);
                               break;
                       case DIGROUP:
                               for(;i<no;i++)
                                       {
                                               for(j=0;j<Grp[i].no;j++)
                                                       {
                                                               free(Grp[i].distrings[j]);
                                                       }
                                       }
                               free(Grp);
                               break;
#ifdef ELC
                       case STAT_GROUP:
                               for(;i<no;i++)
                                       {
                                               for(j=0;j<stat[i].no;j++)
                                                       {
                                                               free(stat[i].statstrings[j]);
                                                       }
                                               free(stat[i].statstrings);
                                       }
                               free(stat);
#endif
                       default: break;
               }
}

 

Untill someone with access to Visual C++ can find and fix the error -there's no way I can reproduce this ;)

Share this post


Link to post
Share on other sites

No, still nothing.

 

This causes compilation error :

 

if(*name)strncpy(var->str, str, 30);

 

 

error C2065: 'name' : undeclared identifier

Share this post


Link to post
Share on other sites
No, still nothing.

 

This causes compilation error :

 

if(*name)strncpy(var->str, str, 30);

 

 

error C2065: 'name' : undeclared identifier

Yea, that's just caused by me smoking crack. It's str, not name :0)

Share this post


Link to post
Share on other sites

I'll have to leave that bug to someone who has access to Visual C++ then. Works fine for everyone else apparently :-/ I think it's your compiler messing up to be honest...

 

If you can, try compiling with Dev-C++.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×