mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
More formatting
This commit is contained in:
parent
d4cc005882
commit
b4025fa1d6
@ -86,10 +86,8 @@ AttackPossibility AttackPossibility::evaluate(const BattleAttackInfo & attackInf
|
||||
|
||||
for(BattleHex defHex : defenderHex)
|
||||
{
|
||||
if(defHex == hex) {
|
||||
// should be impossible but check anyway
|
||||
if(defHex == hex) // should be impossible but check anyway
|
||||
continue;
|
||||
}
|
||||
|
||||
AttackPossibility ap(hex, defHex, attackInfo);
|
||||
ap.attackerState = attacker->acquireState();
|
||||
@ -109,20 +107,22 @@ AttackPossibility AttackPossibility::evaluate(const BattleAttackInfo & attackInf
|
||||
|
||||
// ensure the defender is also affected
|
||||
bool addDefender = true;
|
||||
for(auto unit : units) {
|
||||
if (unit->unitId() == defender->unitId()) {
|
||||
for(auto unit : units)
|
||||
{
|
||||
if (unit->unitId() == defender->unitId())
|
||||
{
|
||||
addDefender = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(addDefender) {
|
||||
units.push_back(defender);
|
||||
}
|
||||
|
||||
for(auto u : units) {
|
||||
if(!ap.attackerState->alive()) {
|
||||
if(addDefender)
|
||||
units.push_back(defender);
|
||||
|
||||
for(auto u : units)
|
||||
{
|
||||
if(!ap.attackerState->alive())
|
||||
break;
|
||||
}
|
||||
|
||||
assert(u->unitId() != attacker->unitId());
|
||||
|
||||
|
@ -1475,16 +1475,15 @@ std::vector<const battle::Unit*> CBattleInfoCallback::getAttackedBattleUnits(con
|
||||
|
||||
units = battleGetUnitsIf([=](const battle::Unit * unit)
|
||||
{
|
||||
if (unit->isGhost() || !unit->alive()) {
|
||||
if (unit->isGhost() || !unit->alive())
|
||||
return false;
|
||||
}
|
||||
for (BattleHex hex : battle::Unit::getHexes(unit->getPosition(), unit->doubleWide(), unit->unitSide())) {
|
||||
if (vstd::contains(at.hostileCreaturePositions, hex)) {
|
||||
|
||||
for (BattleHex hex : battle::Unit::getHexes(unit->getPosition(), unit->doubleWide(), unit->unitSide()))
|
||||
{
|
||||
if (vstd::contains(at.hostileCreaturePositions, hex))
|
||||
return true;
|
||||
}
|
||||
if (vstd::contains(at.friendlyCreaturePositions, hex)) {
|
||||
if (vstd::contains(at.friendlyCreaturePositions, hex))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
@ -141,9 +141,9 @@ EConsoleTextColor::EConsoleTextColor CBasicLogConfigurator::getConsoleColor(cons
|
||||
throw std::runtime_error("Color " + colorName + " unknown.");
|
||||
}
|
||||
|
||||
void CBasicLogConfigurator::deconfigure() {
|
||||
void CBasicLogConfigurator::deconfigure()
|
||||
{
|
||||
auto l = CLogger::getGlobalLogger();
|
||||
if(l != nullptr) {
|
||||
if(l != nullptr)
|
||||
l->clearTargets();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user