From: terencehill Date: Sat, 7 Sep 2019 14:30:32 +0000 (+0200) Subject: Bot waypoints: fix creation of a jump / support link from wp A to wp B breaking hardw... X-Git-Tag: xonotic-v0.8.5~1293 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=943bb5a9e2bbbb92b7e7678a825edb26226da2a4;p=xonotic%2Fxonotic-data.pk3dir.git Bot waypoints: fix creation of a jump / support link from wp A to wp B breaking hardwired links of wp B --- diff --git a/qcsrc/server/bot/default/waypoints.qc b/qcsrc/server/bot/default/waypoints.qc index ee847bc6d..7a40f18e8 100644 --- a/qcsrc/server/bot/default/waypoints.qc +++ b/qcsrc/server/bot/default/waypoints.qc @@ -341,6 +341,18 @@ void waypoint_unmark_hardwiredlink(entity wp_from, entity wp_to) return; } +void waypoint_restore_hardwiredlinks(entity wp) +{ + if (wp.wphw00) waypoint_addlink(wp, wp.wphw00); + if (wp.wphw01) waypoint_addlink(wp, wp.wphw01); + if (wp.wphw02) waypoint_addlink(wp, wp.wphw02); + if (wp.wphw03) waypoint_addlink(wp, wp.wphw03); + if (wp.wphw04) waypoint_addlink(wp, wp.wphw04); + if (wp.wphw05) waypoint_addlink(wp, wp.wphw05); + if (wp.wphw06) waypoint_addlink(wp, wp.wphw06); + if (wp.wphw07) waypoint_addlink(wp, wp.wphw07); +} + void waypoint_setupmodel(entity wp) { if (autocvar_g_waypointeditor) @@ -1219,6 +1231,11 @@ void waypoint_think(entity this) } } }); + + // waypoint_clearlinks preserves references to old hardwired links (.wphwXX links) + // so they can be restored here when a wp is spawned over an existing one + waypoint_restore_hardwiredlinks(this); + navigation_testtracewalk = 0; this.wplinked = true; this.dphitcontentsmask = dphitcontentsmask_save; @@ -1241,6 +1258,8 @@ void waypoint_clearlinks(entity wp) wp.wp16mincost = wp.wp17mincost = wp.wp18mincost = wp.wp19mincost = wp.wp20mincost = wp.wp21mincost = wp.wp22mincost = wp.wp23mincost = f; wp.wp24mincost = wp.wp25mincost = wp.wp26mincost = wp.wp27mincost = wp.wp28mincost = wp.wp29mincost = wp.wp30mincost = wp.wp31mincost = f; + // don't remove references to hardwired links (.wphwXX fields) + wp.wplinked = false; }