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-17 11:21:49 +03:00
parent b4025fa1d6
commit f68b449e5e
4 changed files with 23 additions and 13 deletions

View File

@ -129,7 +129,8 @@ AttackPossibility AttackPossibility::evaluate(const BattleAttackInfo & attackInf
auto defenderState = u->acquireState(); auto defenderState = u->acquireState();
ap.affectedUnits.push_back(defenderState); ap.affectedUnits.push_back(defenderState);
for(int i = 0; i < totalAttacks; i++) { for(int i = 0; i < totalAttacks; i++)
{
si64 damageDealt, damageReceived; si64 damageDealt, damageReceived;
TDmgRange retaliation(0, 0); TDmgRange retaliation(0, 0);
@ -173,10 +174,9 @@ AttackPossibility AttackPossibility::evaluate(const BattleAttackInfo & attackInf
} }
} }
if(!bestAp.dest.isValid() || ap.attackValue() > bestAp.attackValue()) { if(!bestAp.dest.isValid() || ap.attackValue() > bestAp.attackValue())
bestAp = ap; bestAp = ap;
} }
}
// check how much damage we gain from blocking enemy shooters on this hex // check how much damage we gain from blocking enemy shooters on this hex
bestAp.shootersBlockedDmg = evaluateBlockedShootersDmg(attackInfo, hex, state); bestAp.shootersBlockedDmg = evaluateBlockedShootersDmg(attackInfo, hex, state);

View File

@ -1436,7 +1436,8 @@ void handleQuit(bool ask)
SDL_Quit(); SDL_Quit();
} }
if(logConfig != nullptr) { if(logConfig != nullptr)
{
logConfig->deconfigure(); logConfig->deconfigure();
delete logConfig; delete logConfig;
logConfig = nullptr; logConfig = nullptr;

View File

@ -265,29 +265,37 @@ std::vector<BattleHex> CStack::meleeAttackHexes(const battle::Unit * attacker, c
BattleHex otherAttackerPos = attackerPos + (attacker->unitSide() == BattleSide::ATTACKER ? -1 : 1); BattleHex otherAttackerPos = attackerPos + (attacker->unitSide() == BattleSide::ATTACKER ? -1 : 1);
BattleHex otherDefenderPos = defenderPos + (defender->unitSide() == BattleSide::ATTACKER ? -1 : 1); BattleHex otherDefenderPos = defenderPos + (defender->unitSide() == BattleSide::ATTACKER ? -1 : 1);
if(BattleHex::mutualPosition(attackerPos, defenderPos) >= 0) { //front <=> front if(BattleHex::mutualPosition(attackerPos, defenderPos) >= 0) //front <=> front
if((mask & 1) == 0) { {
if((mask & 1) == 0)
{
mask |= 1; mask |= 1;
res.push_back(defenderPos); res.push_back(defenderPos);
} }
} }
if (attacker->doubleWide() //back <=> front if (attacker->doubleWide() //back <=> front
&& BattleHex::mutualPosition(otherAttackerPos, defenderPos) >= 0) { && BattleHex::mutualPosition(otherAttackerPos, defenderPos) >= 0)
if((mask & 1) == 0) { {
if((mask & 1) == 0)
{
mask |= 1; mask |= 1;
res.push_back(defenderPos); res.push_back(defenderPos);
} }
} }
if (defender->doubleWide()//front <=> back if (defender->doubleWide()//front <=> back
&& BattleHex::mutualPosition(attackerPos, otherDefenderPos) >= 0) { && BattleHex::mutualPosition(attackerPos, otherDefenderPos) >= 0)
if((mask & 2) == 0) { {
if((mask & 2) == 0)
{
mask |= 2; mask |= 2;
res.push_back(otherDefenderPos); res.push_back(otherDefenderPos);
} }
} }
if (defender->doubleWide() && attacker->doubleWide()//back <=> back if (defender->doubleWide() && attacker->doubleWide()//back <=> back
&& BattleHex::mutualPosition(otherAttackerPos, otherDefenderPos) >= 0) { && BattleHex::mutualPosition(otherAttackerPos, otherDefenderPos) >= 0)
if((mask & 2) == 0) { {
if((mask & 2) == 0)
{
mask |= 2; mask |= 2;
res.push_back(otherDefenderPos); res.push_back(otherDefenderPos);
} }

View File

@ -403,6 +403,7 @@ void CLogFileTarget::write(const LogRecord & record)
const CLogFormatter & CLogFileTarget::getFormatter() const { return formatter; } const CLogFormatter & CLogFileTarget::getFormatter() const { return formatter; }
void CLogFileTarget::setFormatter(const CLogFormatter & formatter) { this->formatter = formatter; } void CLogFileTarget::setFormatter(const CLogFormatter & formatter) { this->formatter = formatter; }
CLogFileTarget::~CLogFileTarget() { CLogFileTarget::~CLogFileTarget()
{
file.close(); file.close();
} }