1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

More formatting

This commit is contained in:
Victor Luchits 2020-05-16 16:14:58 +03:00
parent d4cc005882
commit b4025fa1d6
3 changed files with 20 additions and 21 deletions

View File

@ -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());

View File

@ -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;
});

View File

@ -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();
}
}