If pCampbot has been asked to shutdown, don't carry on logging in queued bots

0.7.6-extended
Justin Clark-Casey (justincc) 2013-08-14 21:07:29 +01:00
parent 225cf0d010
commit 2c67aa0f41
1 changed files with 11 additions and 1 deletions

View File

@ -51,6 +51,11 @@ namespace pCampBot
public const int DefaultLoginDelay = 5000; public const int DefaultLoginDelay = 5000;
/// <summary>
/// True if pCampbot is in the process of shutting down.
/// </summary>
public bool ShuttingDown { get; private set; }
/// <summary> /// <summary>
/// Delay between logins of multiple bots. /// Delay between logins of multiple bots.
/// </summary> /// </summary>
@ -186,6 +191,9 @@ namespace pCampBot
for (int i = 0; i < botcount; i++) for (int i = 0; i < botcount; i++)
{ {
if (ShuttingDown)
break;
string lastName = string.Format("{0}_{1}", lastNameStem, i + fromBotNumber); string lastName = string.Format("{0}_{1}", lastNameStem, i + fromBotNumber);
// We must give each bot its own list of instantiated behaviours since they store state. // We must give each bot its own list of instantiated behaviours since they store state.
@ -363,7 +371,9 @@ namespace pCampBot
private void HandleShutdown(string module, string[] cmd) private void HandleShutdown(string module, string[] cmd)
{ {
m_log.Info("[BOTMANAGER]: Shutting down bots"); MainConsole.Instance.Output("Shutting down");
ShuttingDown = true;
doBotShutdown(); doBotShutdown();
} }