From 65adaaf30847e3c53df24e5f6285f5ef0f38e433 Mon Sep 17 00:00:00 2001 From: Steven Soloff Date: Thu, 26 Oct 2017 14:45:21 -0400 Subject: [PATCH] Revert #2080 Users have reported a 2x degradation in the performance of the Battle Calculator since build 3635. Approximately 75% of that degradation was traced to #2080. --- .../triplea/delegate/MustFightBattle.java | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/src/main/java/games/strategy/triplea/delegate/MustFightBattle.java b/src/main/java/games/strategy/triplea/delegate/MustFightBattle.java index 644f1cae30b..2c10e23dd4c 100644 --- a/src/main/java/games/strategy/triplea/delegate/MustFightBattle.java +++ b/src/main/java/games/strategy/triplea/delegate/MustFightBattle.java @@ -773,13 +773,6 @@ List getBattleExecutables(final boolean firstRun) { @Override public void execute(final ExecutionStack stack, final IDelegateBridge bridge) { - if (getBattlePower(true, m_attackingUnits, bridge, new ArrayList<>()) > 0) { - final List unitsToRemove = new ArrayList<>(); - if (getBattlePower(false, m_defendingUnits, bridge, unitsToRemove) == 0) { - remove(new ArrayList<>(Matches.getMatches(unitsToRemove, Matches.unitIsInfrastructure().invert())), - bridge, m_battleSite, true); - } - } clearWaitingToDie(bridge); } }); @@ -2671,19 +2664,6 @@ public void unitsLostInPrecedingBattle(final IBattle battle, final Collection units, final IDelegateBridge bridge, - final List unitsToRemove) { - final Match unitTypes = Matches.unitCanBeInBattle(attack, !m_battleSite.isWater(), 1, false, !attack, true); - final List sortedUnits = new ArrayList<>(Matches.getMatches(units, unitTypes)); - Collections.sort(sortedUnits, new UnitBattleComparator(!attack, - TuvUtils.getCostsForTuv(bridge.getPlayerId(), m_data), - TerritoryEffectHelper.getEffects(m_battleSite), m_data, false, false)); - Collections.reverse(sortedUnits); - unitsToRemove.addAll(sortedUnits); - return DiceRoll.getTotalPower(DiceRoll.getUnitPowerAndRollsForNormalBattles(sortedUnits, units, !attack, - false, m_data, m_battleSite, TerritoryEffectHelper.getEffects(m_battleSite), false, null), m_data); - } - /** * Returns a map of transport -> collection of transported units. */