aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tools/pCampBot/BotManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tools/pCampBot/BotManager.cs')
-rw-r--r--OpenSim/Tools/pCampBot/BotManager.cs38
1 files changed, 20 insertions, 18 deletions
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs
index 8abab1d..f54d586 100644
--- a/OpenSim/Tools/pCampBot/BotManager.cs
+++ b/OpenSim/Tools/pCampBot/BotManager.cs
@@ -333,31 +333,33 @@ namespace pCampBot
333 m_log.DebugFormat("[BOT MANAGER]: BotsSendAgentUpdates is {0}", InitBotSendAgentUpdates); 333 m_log.DebugFormat("[BOT MANAGER]: BotsSendAgentUpdates is {0}", InitBotSendAgentUpdates);
334 m_log.DebugFormat("[BOT MANAGER]: InitBotRequestObjectTextures is {0}", InitBotRequestObjectTextures); 334 m_log.DebugFormat("[BOT MANAGER]: InitBotRequestObjectTextures is {0}", InitBotRequestObjectTextures);
335 335
336 int connectedBots = 0; 336 List<Bot> botsToConnect = new List<Bot>();
337 337
338 for (int i = 0; i < m_bots.Count; i++) 338 lock (m_bots)
339 { 339 {
340 lock (m_bots) 340 foreach (Bot bot in m_bots)
341 { 341 {
342 if (DisconnectingBots) 342 if (bot.ConnectionState == ConnectionState.Disconnected)
343 { 343 botsToConnect.Add(bot);
344 MainConsole.Instance.Output( 344
345 "[BOT MANAGER]: Aborting bot connection due to user-initiated disconnection"); 345 if (botsToConnect.Count >= botCount)
346 break; 346 break;
347 } 347 }
348 }
348 349
349 if (m_bots[i].ConnectionState == ConnectionState.Disconnected) 350 foreach (Bot bot in botsToConnect)
350 { 351 {
351 m_bots[i].Connect(); 352 if (DisconnectingBots)
352 connectedBots++; 353 {
354 MainConsole.Instance.Output(
355 "[BOT MANAGER]: Aborting bot connection due to user-initiated disconnection");
356 break;
357 }
353 358
354 if (connectedBots >= botCount) 359 bot.Connect();
355 break;
356 360
357 // Stagger logins 361 // Stagger logins
358 Thread.Sleep(LoginDelay); 362 Thread.Sleep(LoginDelay);
359 }
360 }
361 } 363 }
362 364
363 ConnectingBots = false; 365 ConnectingBots = false;