SERVER/FTE: Start of NZ:P Beta Waypoint loading

This commit is contained in:
cypress 2023-12-30 12:25:07 -05:00
parent 21ce43b477
commit dc574c4a20
2 changed files with 69 additions and 1 deletions

View File

@ -325,6 +325,7 @@ void CalcDistances() {
void creator_way_touch();
void() Compat_TryLoadBetaWaypoints;
void LoadWaypointData() {
float file, point;
string h;
@ -336,7 +337,8 @@ void LoadWaypointData() {
if (file == -1)
{
dprint("Error: file not found \n");
dprint("LoadWaypointData: No .way file found, trying Beta format..\n");
Compat_TryLoadBetaWaypoints();
return;
}

View File

@ -26,6 +26,72 @@
*/
//
// NZ:P Beta Waypoints
//
//
// Compat_TryLoadBetaWaypoints()
// Called by FTE in LoadWaypointData(), if
// it can't find a traditional .way file, it'll
// look for an old one here.
//
void() Compat_TryLoadBetaWaypoints =
{
float file;
file = fopen(mapname, FILE_READ);
if (file == -1) {
dprint("Compat_TryLoadBetaWaypoints: No Beta waypoint data found.\n");
return;
}
float loop;
string line;
loop = true;
vector orig;
float id;
float link1, link2, link3, link4;
while(loop) {
line = fgets(file);
if not (line) {
loop = false;
break;
}
orig = stov(line);
dprint(strcat("origin: ", line, "\n"));
line = fgets(file);
id = stof(line);
dprint(strcat("id: ", line, "\n"));
line = fgets(file);
dprint(strcat("link1: ", line, "\n"));
link1 = stof(line);
line = fgets(file);
dprint(strcat("link2: ", line, "\n"));
link2 = stof(line);
line = fgets(file);
dprint(strcat("link3: ", line, "\n"));
link3 = stof(line);
line = fgets(file);
dprint(strcat("link4: ", line, "\n"));
link4 = stof(line);
// ignore 'owner'
line = fgets(file);
line = fgets(file);
line = fgets(file);
line = fgets(file);
// end ignorance
Create_Waypoint(orig, id, "", ftos(link1), ftos(link2), ftos(link3), ftos(link4), "0", "0", "0", "0");
}
fclose(file);
}
//
// NZ:P Beta Props
//