1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-17 00:07:41 +02:00

NKAI: reduce double army loss cases

This commit is contained in:
Andrii Danylchenko
2024-07-18 13:37:18 +03:00
parent 73ea0ce7bc
commit 37dc2a38e8
5 changed files with 73 additions and 16 deletions

View File

@ -89,7 +89,7 @@ void ClientCommandManager::handleGoSoloCommand()
// unlikely it will work but just in case to be consistent
for(auto & color : CSH->getAllClientPlayers(CSH->logicConnection->connectionID))
{
if(CSH->client->getStartInfo()->playerInfos.at(color).isControlledByHuman())
if(color.isValidPlayer() && CSH->client->getStartInfo()->playerInfos.at(color).isControlledByHuman())
{
CSH->client->installNewPlayerInterface(std::make_shared<CPlayerInterface>(color), color);
}
@ -102,7 +102,7 @@ void ClientCommandManager::handleGoSoloCommand()
for(auto & color : CSH->getAllClientPlayers(CSH->logicConnection->connectionID))
{
if(CSH->client->getStartInfo()->playerInfos.at(color).isControlledByHuman())
if(color.isValidPlayer() && CSH->client->getStartInfo()->playerInfos.at(color).isControlledByHuman())
{
auto AiToGive = CSH->client->aiNameForPlayer(*CSH->client->getPlayerSettings(color), false, false);
printCommandMessage("Player " + color.toString() + " will be lead by " + AiToGive, ELogLevel::INFO);