]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Update WAYPOINT_VERSION to 1.03. Do not allow to edit and save waypoints with a highe...
authorterencehill <piuntn@gmail.com>
Sun, 30 Jun 2019 15:07:05 +0000 (17:07 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 2 Jul 2019 07:18:29 +0000 (09:18 +0200)
qcsrc/server/bot/default/waypoints.qc
qcsrc/server/bot/default/waypoints.qh

index e9edec6bf2efb7fda1948b97220f8bcfd82ac8e1..93f668d5ae3508bac392a0fb47f93849547c8f76 100644 (file)
@@ -390,6 +390,13 @@ void waypoint_clear_start_wp(entity pl, bool warn)
 
 void waypoint_spawn_fromeditor(entity pl, bool at_crosshair, bool is_jump_wp)
 {
+       if (WAYPOINT_VERSION < waypoint_version_loaded)
+       {
+               LOG_INFOF("^1Editing waypoints with a higher version number (%f) is not allowed.\n"
+                       "Update Xonotic to make them editable.", waypoint_version_loaded);
+               return;
+       }
+
        entity e = NULL, jp = NULL;
        vector org = pl.origin;
        if (at_crosshair)
@@ -570,6 +577,13 @@ void waypoint_remove(entity wp)
 
 void waypoint_remove_fromeditor(entity pl)
 {
+       if (WAYPOINT_VERSION < waypoint_version_loaded)
+       {
+               LOG_INFOF("^1Editing waypoints with a higher version number (%f) is not allowed.\n"
+                       "Update Xonotic to make them editable.", waypoint_version_loaded);
+               return;
+       }
+
        entity e = navigation_findnearestwaypoint(pl, false);
 
        int ctf_flags = havocbot_symmetry_origin_order;
@@ -1443,6 +1457,12 @@ void waypoint_save_links()
 // save waypoints to gamedir/data/maps/mapname.waypoints
 void waypoint_saveall()
 {
+       if (WAYPOINT_VERSION < waypoint_version_loaded)
+       {
+               LOG_INFOF("^1Overwriting waypoints with a higher version number (%f) is not allowed.\n"
+                       "Update Xonotic to make them editable.", waypoint_version_loaded);
+               return;
+       }
        string gt_ext = GET_GAMETYPE_EXTENSION();
 
        string filename = sprintf("maps/%s.waypoints", strcat(mapname, gt_ext));
@@ -1512,6 +1532,7 @@ void waypoint_saveall()
 
        botframe_loadedforcedlinks = false;
 
+       waypoint_version_loaded = WAYPOINT_VERSION;
        LOG_INFOF("saved %d waypoints to %s", c, filename);
 }
 
@@ -1593,6 +1614,7 @@ float waypoint_loadall()
                        cwb = cwb + 1;
        }
        fclose(file);
+       waypoint_version_loaded = ver;
        LOG_TRACE("loaded ", ftos(cwp), " waypoints and ", ftos(cwb), " wayboxes from maps/", mapname, ".waypoints");
 
        if (autocvar_g_waypointeditor && autocvar_g_waypointeditor_symmetrical_allowload)
@@ -1624,6 +1646,10 @@ float waypoint_loadall()
                LOG_INFO(strcat("g_waypointeditor_symmetrical", " has been set to ", cvar_string("g_waypointeditor_symmetrical")));
        }
 
+       if (WAYPOINT_VERSION < waypoint_version_loaded)
+               LOG_INFOF("^1Editing waypoints with a higher version number (%f) is not allowed.\n"
+                       "Update Xonotic to make them editable.", waypoint_version_loaded);
+
        return cwp + cwb;
 }
 
index 920d6a8db273504ddcc5fb9ff5ac1d6988fade1f..e2448dc8944ad5bb04335dc96b5337a9fbb1025e 100644 (file)
@@ -6,7 +6,8 @@
 // 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
-const float WAYPOINT_VERSION = 1.02;
+const float WAYPOINT_VERSION = 1.03;
+float waypoint_version_loaded;
 string waypoint_time;
 
 // fields you can query using prvm_global server to get some statistics about waypoint linking culling