Don't allow removal of hardwired waypoints in the editor
authorterencehill <piuntn@gmail.com>
Thu, 16 Mar 2017 17:41:05 +0000 (18:41 +0100)
committerterencehill <piuntn@gmail.com>
Thu, 16 Mar 2017 17:42:08 +0000 (18:42 +0100)
qcsrc/server/bot/api.qh
qcsrc/server/impulse.qc

index fbf1a98..b3bc227 100644 (file)
@@ -44,6 +44,7 @@ float skill;
 .float wp24mincost, wp25mincost, wp26mincost, wp27mincost, wp28mincost, wp29mincost, wp30mincost, wp31mincost;
 .float wpconsidered;
 .float wpcost;
+.float wphardwired;
 .int wpflags;
 
 bool bot_aim(entity this, .entity weaponentity, float shotspeed, float shotspeedupward, float maxshottime, float applygravity);
index 6a5354a..a7f9554 100644 (file)
@@ -584,6 +584,13 @@ IMPULSE(navwaypoint_remove)
        entity e = navigation_findnearestwaypoint(this, false);
        if (!e) return;
        if (e.wpflags & WAYPOINTFLAG_GENERATED) return;
+
+       if (e.wphardwired)
+       {
+               LOG_INFO("^1Warning: ^7Removal of hardwired waypoints is not allowed in the editor. Please remove links from/to this waypoint (", vtos(e.origin), ") by hand from maps/", mapname, ".waypoints.hardwired\n");
+               return;
+       }
+
        bprint(strcat("Waypoint removed at ", vtos(e.origin), "\n"));
        waypoint_remove(e);
 }