From: terencehill Date: Sat, 13 Jan 2018 21:18:32 +0000 (+0100) Subject: Bot waypoints: on map start relink autogenerated waypoints for items if they are... X-Git-Tag: xonotic-v0.8.5~2378^2~3^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e54485e323c9df5abb34447ce4f80982d678be07;p=xonotic%2Fxonotic-data.pk3dir.git Bot waypoints: on map start relink autogenerated waypoints for items if they are unlinked and save waypoint links. It automatically fixes waypoints previously automatically updated (or manually saved by the user) without ctf flag links if the map is started in DM mode --- diff --git a/qcsrc/server/bot/default/bot.qc b/qcsrc/server/bot/default/bot.qc index 20af7e719..a056b25a7 100644 --- a/qcsrc/server/bot/default/bot.qc +++ b/qcsrc/server/bot/default/bot.qc @@ -759,8 +759,7 @@ void bot_serverframe() { botframe_spawnedwaypoints = true; waypoint_loadall(); - if(!waypoint_load_links()) - waypoint_schedulerelinkall(); // link all the autogenerated waypoints (teleporters) + waypoint_load_links(); } if (bot_list) diff --git a/qcsrc/server/bot/default/waypoints.qc b/qcsrc/server/bot/default/waypoints.qc index 856a75745..36c084f06 100644 --- a/qcsrc/server/bot/default/waypoints.qc +++ b/qcsrc/server/bot/default/waypoints.qc @@ -703,6 +703,7 @@ bool waypoint_load_links() if (file < 0) { LOG_TRACE("waypoint links load from ", filename, " failed"); + waypoint_schedulerelinkall(); return false; } @@ -731,6 +732,7 @@ bool waypoint_load_links() else { LOG_TRACE("automatically updating..."); + waypoint_schedulerelinkall(); fclose(file); return false; } @@ -745,6 +747,7 @@ bool waypoint_load_links() { // bad file format fclose(file); + waypoint_schedulerelinkall(); // link all the autogenerated waypoints (teleporters) return false; } @@ -802,6 +805,18 @@ bool waypoint_load_links() LOG_TRACE("loaded ", ftos(c), " waypoint links from ", filename); + bool scheduled = false; + IL_EACH(g_waypoints, it.wpflags & WAYPOINTFLAG_ITEM, + { + if (!it.wp00) + { + waypoint_schedulerelink(it); + scheduled = true; + } + }); + if (scheduled) + return false; + botframe_cachedwaypointlinks = true; return true; }