From 1b9748a703d2a7d83cb4eebfc10ea762fc3e9562 Mon Sep 17 00:00:00 2001 From: INeedBots Date: Sat, 14 Nov 2020 03:37:58 -0600 Subject: [PATCH] [Bots] Readded bot name numbering when no bots.txt is found --- src/Components/Modules/Bots.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/Components/Modules/Bots.cpp b/src/Components/Modules/Bots.cpp index 7ee2517d..4cbbde53 100644 --- a/src/Components/Modules/Bots.cpp +++ b/src/Components/Modules/Bots.cpp @@ -88,6 +88,7 @@ namespace Components void Bots::BuildConnectString(char* buffer, const char* connectString, int num, int, int protocol, int checksum, int statVer, int statStuff, int port) { static int botId = 0; + const char* botName; if (Bots::BotNames.empty()) { @@ -108,15 +109,19 @@ namespace Components } } } - - if (Bots::BotNames.empty()) - { - Bots::BotNames.push_back("bot"); - } } - botId %= Bots::BotNames.size(); - strncpy_s(buffer, 0x400, Utils::String::VA(connectString, num, Bots::BotNames[botId++].data(), protocol, checksum, statVer, statStuff, port), 0x400); + if (!Bots::BotNames.empty()) + { + botId %= Bots::BotNames.size(); + botName = Bots::BotNames[botId++].data(); + } + else + { + botName = Utils::String::VA("bot%d", ++botId); + } + + strncpy_s(buffer, 0x400, Utils::String::VA(connectString, num, botName, protocol, checksum, statVer, statStuff, port), 0x400); } void Bots::Spawn(unsigned int count)