mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
commit
90fa1718a5
@ -1056,7 +1056,8 @@ void AIGateway::pickBestArtifacts(const CGHeroInstance * h, const CGHeroInstance
|
||||
if(location.slot == ArtifactPosition::MACH4) // don't attempt to move catapult
|
||||
continue;
|
||||
|
||||
auto s = cb->getHero(location.artHolder)->getSlot(location.slot);
|
||||
auto artHolder = cb->getHero(location.artHolder);
|
||||
auto s = artHolder->getSlot(location.slot);
|
||||
if(!s || s->locked) //we can't move locks
|
||||
continue;
|
||||
auto artifact = s->artifact;
|
||||
@ -1084,10 +1085,27 @@ void AIGateway::pickBestArtifacts(const CGHeroInstance * h, const CGHeroInstance
|
||||
if(otherSlot && otherSlot->artifact) //we need to exchange artifact for better one
|
||||
{
|
||||
//if that artifact is better than what we have, pick it
|
||||
if(compareArtifacts(artifact, otherSlot->artifact) && artifact->canBePutAt(target, slot, true)) //combined artifacts are not always allowed to move
|
||||
if(compareArtifacts(artifact, otherSlot->artifact)
|
||||
&& artifact->canBePutAt(target, slot, true)) //combined artifacts are not always allowed to move
|
||||
{
|
||||
ArtifactLocation destLocation(target->id, slot);
|
||||
cb->swapArtifacts(location, ArtifactLocation(target->id, target->getArtPos(otherSlot->artifact)));
|
||||
logAi->trace(
|
||||
"Exchange artifacts %s <-> %s",
|
||||
artifact->artType->getNameTranslated(),
|
||||
otherSlot->artifact->artType->getNameTranslated());
|
||||
|
||||
if(!otherSlot->artifact->canBePutAt(artHolder, location.slot, true))
|
||||
{
|
||||
ArtifactLocation destLocation(target->id, slot);
|
||||
ArtifactLocation backpack(artHolder->id, ArtifactPosition::BACKPACK_START);
|
||||
|
||||
cb->swapArtifacts(destLocation, backpack);
|
||||
cb->swapArtifacts(location, destLocation);
|
||||
}
|
||||
else
|
||||
{
|
||||
cb->swapArtifacts(location, ArtifactLocation(target->id, target->getArtPos(otherSlot->artifact)));
|
||||
}
|
||||
|
||||
changeMade = true;
|
||||
break;
|
||||
}
|
||||
|
@ -136,8 +136,9 @@ void ClientCommandManager::handleControlaiCommand(std::istringstream& singleWord
|
||||
|
||||
for(auto & elem : CSH->client->gameState()->players)
|
||||
{
|
||||
if(elem.second.human ||
|
||||
(colorName.length() && elem.first.getNum() != vstd::find_pos(GameConstants::PLAYER_COLOR_NAMES, colorName)))
|
||||
if(!elem.first.isValidPlayer()
|
||||
|| elem.second.human
|
||||
|| (colorName.length() && elem.first.getNum() != vstd::find_pos(GameConstants::PLAYER_COLOR_NAMES, colorName)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ void ActiveModsInSaveList::verifyActiveMods(const std::map<TModID, ModVerificati
|
||||
missingMods.push_back(VLC->modh->getModInfo(compared.first).getVerificationInfo().name);
|
||||
|
||||
if (compared.second == ModVerificationStatus::EXCESSIVE)
|
||||
excessiveMods.push_back(modList.at(compared.first).name);
|
||||
excessiveMods.push_back(VLC->modh->getModInfo(compared.first).getVerificationInfo().name);
|
||||
}
|
||||
|
||||
if(!missingMods.empty() || !excessiveMods.empty())
|
||||
|
Loading…
Reference in New Issue
Block a user