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

View File

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

View File

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