enum PTH_Format : int
{
FILE_TYPE = 0,
VERSION = 6,
REVISION = 7,
NODE_COUNT = 8,
FINISH_LINE = 12,
NODE_START = 16,
NODE_LENGTH = 40,
CENTER_X = 0,
CENTER_Y = 4,
CENTER_Z = 8,
DIR_X = 12,
DIR_Y = 16,
DIR_Z =20,
LIMIT_LEFT = 24,
LIMIT_RIGHT = 28,
DRIVE_LEFT = 32,
DRIVE_RIGHT = 36,
}
internal static bool Initialize()
{
string[] files = System.IO.Directory.GetFiles(Program.dataPath + Path.DirectorySeparatorChar + "map", "*.pth");
byte[] buffer;
int nodeCount;
int finishNode;
for(int itr = 0; itr < files.Length; itr++)
{
buffer = File.ReadAllBytes(files[itr]);
if(buffer.Length > 12)
{
if (GetString(buffer, (int)PTH_Format.FILE_TYPE, 6) != "LFSPTH")
{
Log.error(" Invalide FileType map -> "+files[itr]+"\r\n");
return false;
}
if (buffer[(int)PTH_Format.VERSION] > 0)
{
Log.error(" Invalide Version map -> " + files[itr] + "\r\n");
return false;
}
if (buffer[(int)PTH_Format.REVISION] > 0)
{
Log.error(" Invalide Revision map -> " + files[itr] + "\r\n");
return false;
}
nodeCount = GetInt(buffer, (int)PTH_Format.NODE_COUNT);
finishNode = GetInt(buffer, (int)PTH_Format.FINISH_LINE);
MapData mapData = new MapData(nodeCount,finishNode);
int firstIndex;
for(int nodeItr = 0; nodeItr < nodeCount; nodeItr++)
{
firstIndex = ((int)PTH_Format.NODE_START + ((int)PTH_Format.NODE_LENGTH * nodeItr));
mapData.SetNode
(
nodeItr,
GetInt(buffer, firstIndex + (int)PTH_Format.CENTER_X),
GetInt(buffer, firstIndex + (int)PTH_Format.CENTER_Y),
GetInt(buffer, firstIndex + (int)PTH_Format.CENTER_Z),
GetFloat(buffer, firstIndex + (int)PTH_Format.DIR_X),
GetFloat(buffer, firstIndex + (int)PTH_Format.DIR_Y),
GetFloat(buffer, firstIndex + (int)PTH_Format.DIR_Z),
GetFloat(buffer, firstIndex + (int)PTH_Format.LIMIT_LEFT),
GetFloat(buffer, firstIndex + (int)PTH_Format.LIMIT_RIGHT),
GetFloat(buffer, firstIndex + (int)PTH_Format.DRIVE_LEFT),
GetFloat(buffer, firstIndex + (int)PTH_Format.DRIVE_RIGHT)
);
}
string trackPrefix = files[itr].Substring(files[itr].LastIndexOf('\\')+1);
trackPrefix = trackPrefix.Replace(".pth","");
maps.Add(trackPrefix,mapData);
}
}
Log.commandHelp(" Loaded "+files.Length+" Maps.\r\n");
return true;
}
...
i Call that system "RaceTemplate"



This sound simple like this... but a example of what i can do with this is Calculate the Difference between a Drift and a LostControl , since i know where you go and where the track go.


Racing on side Drifting other side! 
i will get up a Demo dedicated to the drift
just for you 

Brute Rock And Roll will be dethroned by LFS very soon! mouhaha! 


haha!
i have 3.2 million of races. i will probaly share thoses data as the default rank data.
i've writen a lot for that small question haha 




i pass beside thoses error , so why i dind't notice before, and you seem to be alone to use it
im sure you will laft a little when you see it in action
try screw it
and he will find you
, what ever i removed most ingenious code from him at the moment, so except better bad word filter later 
Mysql book is well done and all answer you search are there and can be retrive from the search option easy!