From: terencehill Date: Sun, 30 Jun 2019 15:07:05 +0000 (+0200) Subject: Update WAYPOINT_VERSION to 1.03. Do not allow to edit and save waypoints with a highe... X-Git-Tag: xonotic-v0.8.5~1356^2~32 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5c9e977f147e892f0bf8eb574b3aa0bf0c7e2276;p=xonotic%2Fxonotic-data.pk3dir.git Update WAYPOINT_VERSION to 1.03. Do not allow to edit and save waypoints with a higher version number --- diff --git a/qcsrc/server/bot/default/waypoints.qc b/qcsrc/server/bot/default/waypoints.qc index e9edec6bf2..93f668d5ae 100644 --- a/qcsrc/server/bot/default/waypoints.qc +++ b/qcsrc/server/bot/default/waypoints.qc @@ -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; } diff --git a/qcsrc/server/bot/default/waypoints.qh b/qcsrc/server/bot/default/waypoints.qh index 920d6a8db2..e2448dc894 100644 --- a/qcsrc/server/bot/default/waypoints.qh +++ b/qcsrc/server/bot/default/waypoints.qh @@ -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