[Bots]: I misread std::string docs (#943)
This commit is contained in:
parent
ed059c280a
commit
70be263918
@ -61,16 +61,6 @@ namespace Components
|
||||
std::ranges::shuffle(BotNames, gen);
|
||||
}
|
||||
|
||||
std::string Bots::TruncBotString(const std::string& input, const std::size_t length)
|
||||
{
|
||||
if (length > input.size())
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
return input.substr(length);
|
||||
}
|
||||
|
||||
void Bots::LoadBotNames()
|
||||
{
|
||||
FileSystem::File bots("bots.txt");
|
||||
@ -102,14 +92,13 @@ namespace Components
|
||||
// Only start copying over from non-null characters (otherwise it can be "<=")
|
||||
if ((pos + 1) < entry.size())
|
||||
{
|
||||
clanAbbrev = entry.substr(pos + 1);
|
||||
clanAbbrev = entry.substr(pos + 1, ClanTags::MAX_CLAN_NAME_LENGTH - 1);
|
||||
}
|
||||
|
||||
entry = entry.substr(0, pos);
|
||||
}
|
||||
|
||||
entry = TruncBotString(entry, MAX_NAME_LENGTH - 1);
|
||||
clanAbbrev = TruncBotString(clanAbbrev, ClanTags::MAX_CLAN_NAME_LENGTH - 1);
|
||||
entry = entry.substr(0, MAX_NAME_LENGTH - 1);
|
||||
|
||||
BotNames.emplace_back(entry, clanAbbrev);
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ namespace Components
|
||||
static const Game::dvar_t* sv_replaceBots;
|
||||
|
||||
static void RandomizeBotNames();
|
||||
static std::string TruncBotString(const std::string& input, std::size_t length);
|
||||
static void LoadBotNames();
|
||||
static int BuildConnectString(char* buffer, const char* connectString, int num, int, int protocol, int checksum, int statVer, int statStuff, int port);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user