From f68b449e5e7a3ab62c4998ab16e24b079ffb2121 Mon Sep 17 00:00:00 2001 From: Victor Luchits Date: Sun, 17 May 2020 11:21:49 +0300 Subject: [PATCH] More formatting --- AI/BattleAI/AttackPossibility.cpp | 6 +++--- client/CMT.cpp | 3 ++- lib/CStack.cpp | 24 ++++++++++++++++-------- lib/logging/CLogger.cpp | 3 ++- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/AI/BattleAI/AttackPossibility.cpp b/AI/BattleAI/AttackPossibility.cpp index b54007dbe..e9c3dae5a 100644 --- a/AI/BattleAI/AttackPossibility.cpp +++ b/AI/BattleAI/AttackPossibility.cpp @@ -129,7 +129,8 @@ AttackPossibility AttackPossibility::evaluate(const BattleAttackInfo & attackInf auto defenderState = u->acquireState(); ap.affectedUnits.push_back(defenderState); - for(int i = 0; i < totalAttacks; i++) { + for(int i = 0; i < totalAttacks; i++) + { si64 damageDealt, damageReceived; TDmgRange retaliation(0, 0); @@ -173,9 +174,8 @@ AttackPossibility AttackPossibility::evaluate(const BattleAttackInfo & attackInf } } - if(!bestAp.dest.isValid() || ap.attackValue() > bestAp.attackValue()) { + if(!bestAp.dest.isValid() || ap.attackValue() > bestAp.attackValue()) bestAp = ap; - } } // check how much damage we gain from blocking enemy shooters on this hex diff --git a/client/CMT.cpp b/client/CMT.cpp index 3a58a738c..f21de7d5b 100644 --- a/client/CMT.cpp +++ b/client/CMT.cpp @@ -1436,7 +1436,8 @@ void handleQuit(bool ask) SDL_Quit(); } - if(logConfig != nullptr) { + if(logConfig != nullptr) + { logConfig->deconfigure(); delete logConfig; logConfig = nullptr; diff --git a/lib/CStack.cpp b/lib/CStack.cpp index 9c65a5047..111fe7aad 100644 --- a/lib/CStack.cpp +++ b/lib/CStack.cpp @@ -265,29 +265,37 @@ std::vector CStack::meleeAttackHexes(const battle::Unit * attacker, c BattleHex otherAttackerPos = attackerPos + (attacker->unitSide() == BattleSide::ATTACKER ? -1 : 1); BattleHex otherDefenderPos = defenderPos + (defender->unitSide() == BattleSide::ATTACKER ? -1 : 1); - if(BattleHex::mutualPosition(attackerPos, defenderPos) >= 0) { //front <=> front - if((mask & 1) == 0) { + if(BattleHex::mutualPosition(attackerPos, defenderPos) >= 0) //front <=> front + { + if((mask & 1) == 0) + { mask |= 1; res.push_back(defenderPos); } } if (attacker->doubleWide() //back <=> front - && BattleHex::mutualPosition(otherAttackerPos, defenderPos) >= 0) { - if((mask & 1) == 0) { + && BattleHex::mutualPosition(otherAttackerPos, defenderPos) >= 0) + { + if((mask & 1) == 0) + { mask |= 1; res.push_back(defenderPos); } } if (defender->doubleWide()//front <=> back - && BattleHex::mutualPosition(attackerPos, otherDefenderPos) >= 0) { - if((mask & 2) == 0) { + && BattleHex::mutualPosition(attackerPos, otherDefenderPos) >= 0) + { + if((mask & 2) == 0) + { mask |= 2; res.push_back(otherDefenderPos); } } if (defender->doubleWide() && attacker->doubleWide()//back <=> back - && BattleHex::mutualPosition(otherAttackerPos, otherDefenderPos) >= 0) { - if((mask & 2) == 0) { + && BattleHex::mutualPosition(otherAttackerPos, otherDefenderPos) >= 0) + { + if((mask & 2) == 0) + { mask |= 2; res.push_back(otherDefenderPos); } diff --git a/lib/logging/CLogger.cpp b/lib/logging/CLogger.cpp index 72bb3006a..fc6e57cfe 100644 --- a/lib/logging/CLogger.cpp +++ b/lib/logging/CLogger.cpp @@ -403,6 +403,7 @@ void CLogFileTarget::write(const LogRecord & record) const CLogFormatter & CLogFileTarget::getFormatter() const { return formatter; } void CLogFileTarget::setFormatter(const CLogFormatter & formatter) { this->formatter = formatter; } -CLogFileTarget::~CLogFileTarget() { +CLogFileTarget::~CLogFileTarget() +{ file.close(); }