Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Thu Mar 28, 2024 2:48 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: path duplicated
PostPosted: Sun Apr 18, 2010 10:38 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
Hi I'm back :)

I noticed the path system was allowing duplicated paths. So I have added a signed char raydium_path_find (char* path) function to check if a certain folder is already in the path.
Also I've modified the raydium_path_add function to avoid adding duplicated paths.

Hope everything is right
(and if someone is going to ask, yes, I'm working on the cal3d animation system).


Top
 Profile  
 
 Post subject: Re: path duplicated
PostPosted: Mon Apr 19, 2010 7:42 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
Nice to see you, vicente ! :)

Nice catch about duplicated paths. The patch looks OK to me, but you should also test path state, since otherwise, you may use strcmp() on uninitialized string.

Hopes everything is right on your side too ;)


Top
 Profile  
 
 Post subject: Re: path duplicated
PostPosted: Tue Apr 20, 2010 12:15 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
something like this?
Code:
signed char raydium_path_find (char *dir)
{   
int a;
if(!dir)return 0;
for(a=0;a<RAYDIUM_MAX_PATHS;a++)
    {
    if(!raydium_path_paths[a].path) continue; // or return 0 ?
    if(!strcmp(raydium_path_paths[a].path,dir))
        {         
        return 1;
        }
    }
return 0;
}


Top
 Profile  
 
 Post subject: Re: path duplicated
PostPosted: Tue Apr 20, 2010 7:03 am 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
There is a "state" member in the data structure:
Quote:
if(strcmp(raydium_path_paths[a].state && !strcmp(raydium_path_paths[a].path,dir))

... should do the trick.


Top
 Profile  
 
 Post subject: Re: path duplicated
PostPosted: Tue Apr 20, 2010 10:16 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
done


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group