Stop pCampbot from firing connected event twice, which results in double counting.

This commit is contained in:
Justin Clark-Casey (justincc)
2011-10-31 21:33:25 +00:00
parent a9a24062a5
commit e3f51df3c2
2 changed files with 11 additions and 10 deletions

View File

@@ -81,16 +81,16 @@ namespace pCampBot
m_console.Commands.AddCommand("bot", false, "shutdown",
"shutdown",
"Gracefully shut down bots", HandleShutdown);
"Shutdown bots and exit", HandleShutdown);
m_console.Commands.AddCommand("bot", false, "quit",
"quit",
"Force quit (DANGEROUS, try shutdown first)",
"Shutdown bots and exit",
HandleShutdown);
m_console.Commands.AddCommand("bot", false, "add bots",
"add bots <number>",
"Add more bots", HandleAddBots);
// m_console.Commands.AddCommand("bot", false, "add bots",
// "add bots <number>",
// "Add more bots", HandleAddBots);
m_lBot = new List<PhysicsBot>();
}
@@ -177,14 +177,14 @@ namespace pCampBot
switch (eventt)
{
case EventType.CONNECTED:
m_log.Info("[ " + callbot.firstname + " " + callbot.lastname + "]: Connected");
m_log.Info("[" + callbot.firstname + " " + callbot.lastname + "]: Connected");
numbots++;
break;
case EventType.DISCONNECTED:
m_log.Info("[ " + callbot.firstname + " " + callbot.lastname + "]: Disconnected");
m_log.Info("[" + callbot.firstname + " " + callbot.lastname + "]: Disconnected");
m_td[m_lBot.IndexOf(callbot)].Abort();
numbots--;
if (numbots >1)
if (numbots <= 0)
Environment.Exit(0);
break;
}