fix: probably fix for duplicate bot names when save names active (ref #403)
This commit is contained in:
parent
0d4fcdcf4d
commit
9d8318e584
3 changed files with 15 additions and 0 deletions
|
|
@ -711,6 +711,15 @@ void BotConfig::clearUsedName (Bot *bot) {
|
|||
}
|
||||
}
|
||||
|
||||
void BotConfig::setBotNameUsed(const int index, StringRef name) {
|
||||
for (auto &bn : m_botNames) {
|
||||
if (bn.name == name) {
|
||||
bn.usedBy = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BotConfig::initWeapons () {
|
||||
m_weapons.clear ();
|
||||
|
||||
|
|
|
|||
|
|
@ -236,6 +236,9 @@ BotCreateResult BotManager::create (StringRef name, int difficulty, int personal
|
|||
if (botName != nullptr) {
|
||||
botName->usedBy = index; // save by who name is used
|
||||
}
|
||||
else {
|
||||
conf.setBotNameUsed(index, resultName);
|
||||
}
|
||||
m_bots.push (cr::move (object));
|
||||
|
||||
ctrl.msg ("Connecting Bot...");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue