return false;
}
+ bool parse_comments = true;
+ float ver = 0;
+
while ((s = fgets(file)))
{
+ if(parse_comments)
+ {
+ if(substring(s, 0, 2) == "//")
+ {
+ if(substring(s, 2, 8) == "VERSION ")
+ ver = stof(substring(s, 10, -1));
+ continue;
+ }
+ else
+ {
+ if(ver < WAYPOINT_VERSION)
+ return false;
+ parse_comments = false;
+ }
+ }
+
tokens = tokenizebyseparator(s, "*");
if (tokens!=2)
return;
}
+ fputs(file, strcat("//", "VERSION ", ftos_decimals(WAYPOINT_VERSION, 2), "\n"));
+
int c = 0;
IL_EACH(g_waypoints, true,
{
return;
}
+ // add 3 comments to not break compatibility with older Xonotic versions
+ // (they are read as a waypoint with origin '0 0 0' and flag 0 though)
+ fputs(file, strcat("//", "VERSION ", ftos_decimals(WAYPOINT_VERSION, 2), "\n"));
+ fputs(file, strcat("//", "\n"));
+ fputs(file, strcat("//", "\n"));
+
int c = 0;
IL_EACH(g_waypoints, true,
{
filename = strcat(filename, ".waypoints");
file = fopen(filename, FILE_READ);
+ bool parse_comments = true;
+ float ver = 0;
+
if (file < 0)
{
LOG_TRACE("waypoint load from ", filename, " failed");
while ((s = fgets(file)))
{
+ if(parse_comments)
+ {
+ if(substring(s, 0, 2) == "//")
+ {
+ if(substring(s, 2, 8) == "VERSION ")
+ ver = stof(substring(s, 10, -1));
+ continue;
+ }
+ else
+ {
+ if(floor(ver) < floor(WAYPOINT_VERSION))
+ LOG_TRACE("waypoints for this map are outdated");
+ parse_comments = false;
+ }
+ }
m1 = stov(s);
s = fgets(file);
if (!s)
* Globals and Fields
*/
+// increase by 0.01 when changes require only waypoint relinking
+// increase by 1 when changes require to manually edit waypoints
+// max 2 decimal places, always specified
+#define WAYPOINT_VERSION 1.00
+
// fields you can query using prvm_global server to get some statistics about waypoint linking culling
float relink_total, relink_walkculled, relink_pvsculled, relink_lengthculled;