.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Cube Bot (http://forums.bots-united.com/forumdisplay.php?f=77)
-   -   No Waypoints Save (http://forums.bots-united.com/showthread.php?t=3470)

OckHAM 24-01-2005 12:05

No Waypoints Save
 
This game and its bot it's indeed wonderful. The only problem I encounter since now is that I'm not able to save my waypoints automatically generated: when I do wpsave from the console the game just quits. And even if I'm using the autpwp 1 option I see no waypoint file in my Cube directory.

Some help? Thanks in advance

Rick 24-01-2005 14:23

Re: No Waypoints Save
 
Yep, I forgot in the archived file to create a folder called 'waypoints' in the bot folder. Just create it and it should work.

@$3.1415rin 24-01-2005 18:53

Re: No Waypoints Save
 
boo, once again a demonstration what can happen when you forget to check one single pointer :P

just joking

Rick 24-01-2005 20:08

Re: No Waypoints Save
 
Quote:

Originally Posted by @$3.1415rin
boo, once again a demonstration what can happen when you forget to check one single pointer :P

just joking

Hehe yeah, forgot to check the file pointer in the code.... O well :|

Pierre-Marie Baty 24-01-2005 20:23

Re: No Waypoints Save
 
I had some code, there, hold on where is it...

ah here
Code:

// make output directory
length = strlen (output_file);
for (index = 0; index < length; index++)
        if ((output_file[index] == '/') || (output_file[index] == '\\'))
        {
                strncpy (dirname, output_file, index);
                dirname[index] = 0;
                POSIX_mkdir (dirname, 666); // build each subdirectory recursively if needed
        }

output_file is a full pathname
dirname must be a writable string
POSIX_mkdir is #defined like this:
Code:

#ifdef WIN32
#define POSIX_mkdir(a,b) _mkdir(a)
#else
#define POSIX_mkdir(a,b) mkdir(a,b)
#endif

That code will parse the path and call mkdir on each subdirectory recursively. If the directory already exists, it will leave it as is and mkdir will return ; if it doesn't exist, it will be created. This ensures you always have a correct path.

Rick 24-01-2005 20:54

Re: No Waypoints Save
 
Quote:

Originally Posted by Pierre-Marie Baty
I had some code, there, hold on where is it...

ah here
Code:

// make output directory
length = strlen (output_file);
for (index = 0; index < length; index++)
        if ((output_file[index] == '/') || (output_file[index] == '\\'))
        {
                strncpy (dirname, output_file, index);
                dirname[index] = 0;
                POSIX_mkdir (dirname, 666); // build each subdirectory recursively if needed
        }

output_file is a full pathname
dirname must be a writable string
POSIX_mkdir is #defined like this:
Code:

#ifdef WIN32
#define POSIX_mkdir(a,b) _mkdir(a)
#else
#define POSIX_mkdir(a,b) mkdir(a,b)
#endif

That code will parse the path and call mkdir on each subdirectory recursively. If the directory already exists, it will leave it as is and mkdir will return ; if it doesn't exist, it will be created. This ensures you always have a correct path.

Nice one :)
Meh I keep including pieces of code made by you :P


All times are GMT +2. The time now is 23:09.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.