.:: Bots United ::.  
filebase forums irc server wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps waypoints yapb

Go Back   .:: Bots United ::. > Cyborg Factory > Cube Bot
Cube Bot A bot for the Cube game, by Rick Cube

Reply
 
Thread Tools
No Waypoints Save
Old
  (#1)
OckHAM
Member
 
Status: Offline
Posts: 1
Join Date: Jan 2004
Default No Waypoints Save - 24-01-2005

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
   
Reply With Quote
Re: No Waypoints Save
Old
  (#2)
Rick
Council Member
 
Rick's Avatar
 
Status: Offline
Posts: 689
Join Date: Dec 2003
Location: Holland
Default Re: No Waypoints Save - 24-01-2005

Yep, I forgot in the archived file to create a folder called 'waypoints' in the bot folder. Just create it and it should work.
   
Reply With Quote
Re: No Waypoints Save
Old
  (#3)
@$3.1415rin
Council Member, Author of JoeBOT
 
@$3.1415rin's Avatar
 
Status: Offline
Posts: 1,381
Join Date: Nov 2003
Location: Germany
Default Re: No Waypoints Save - 24-01-2005

boo, once again a demonstration what can happen when you forget to check one single pointer

just joking


   
Reply With Quote
Re: No Waypoints Save
Old
  (#4)
Rick
Council Member
 
Rick's Avatar
 
Status: Offline
Posts: 689
Join Date: Dec 2003
Location: Holland
Default Re: No Waypoints Save - 24-01-2005

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

just joking
Hehe yeah, forgot to check the file pointer in the code.... O well
   
Reply With Quote
Re: No Waypoints Save
Old
  (#5)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 4643'60N 043'0W 0.187A
Default Re: No Waypoints Save - 24-01-2005

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.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."

Last edited by Pierre-Marie Baty; 24-01-2005 at 19:24..
   
Reply With Quote
Re: No Waypoints Save
Old
  (#6)
Rick
Council Member
 
Rick's Avatar
 
Status: Offline
Posts: 689
Join Date: Dec 2003
Location: Holland
Default Re: No Waypoints Save - 24-01-2005

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
   
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com