]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bot waypoints: on map start relink autogenerated waypoints for items if they are...
authorterencehill <piuntn@gmail.com>
Sat, 13 Jan 2018 21:18:32 +0000 (22:18 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 13 Jan 2018 21:18:32 +0000 (22:18 +0100)
qcsrc/server/bot/default/bot.qc
qcsrc/server/bot/default/waypoints.qc

index 20af7e71984dfdac24a5895ec91b7bf128f03b8b..a056b25a768de115a62c371f47a351bd6dba2eb6 100644 (file)
@@ -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)
index 856a7574554482d55998a41294614a3d815b7d9b..36c084f0635d40a57d6b590d25952a0a87bf50da 100644 (file)
@@ -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;
 }