Merge branch 'master' into 'master'

Memory Leaks, Unused code, compiler warnings, etc.

See merge request core-developers/forge!423
This commit is contained in:
Michael Kamensky
2018-04-18 15:40:37 +00:00
78 changed files with 214 additions and 9838 deletions

View File

@@ -40,6 +40,7 @@ import forge.game.zone.ZoneType;
import forge.util.TextUtil;
import org.apache.commons.lang3.StringUtils;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -215,7 +216,7 @@ public final class GameActionUtil {
// reset static abilities
if (lkicheck) {
game.getAction().checkStaticAbilities(false, Sets.newHashSet(), CardCollection.EMPTY);
game.getAction().checkStaticAbilities(false, new HashSet<Card>(), CardCollection.EMPTY);
}
}

View File

@@ -34,7 +34,6 @@ import forge.item.PaperCard;
import forge.util.FileSection;
import forge.util.FileUtil;
import forge.util.storage.StorageBase;
import forge.util.storage.StorageReaderFileSections;
import forge.util.storage.StorageReaderFolder;
import java.io.File;

View File

@@ -47,6 +47,10 @@ import forge.util.TextUtil;
* @version $Id$
*/
public class Cost implements Serializable {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
private boolean isAbility = true;
private final List<CostPart> costParts = Lists.newArrayList();
private boolean isMandatory = false;

View File

@@ -32,6 +32,11 @@ import forge.game.spellability.SpellAbility;
* The Class CostAddMana.
*/
public class CostAddMana extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* CostCostAddMana.
* @param amount

View File

@@ -25,6 +25,11 @@ import forge.game.spellability.SpellAbility;
*/
public class CostChooseCreatureType extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost mill.
*

View File

@@ -27,6 +27,11 @@ import forge.game.spellability.SpellAbility;
*/
public class CostDamage extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
public CostDamage(final String amount) {
this.setAmount(amount);
}

View File

@@ -34,6 +34,11 @@ public class CostDiscard extends CostPartWithList {
// Inputs
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost discard.
*

View File

@@ -28,6 +28,11 @@ import java.util.List;
* The Class CostPayLife.
*/
public class CostDraw extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* CostDraw.
* @param amount

View File

@@ -29,6 +29,11 @@ import forge.game.zone.ZoneType;
*/
public class CostExert extends CostPartWithList {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost Exert.
*

View File

@@ -38,6 +38,10 @@ public class CostExile extends CostPartWithList {
// ExileFromTop<Num/Type{/TypeDescription}> (of library)
// ExileSameGrave<Num/Type{/TypeDescription}>
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
public final ZoneType from;
public final boolean sameZone;

View File

@@ -33,6 +33,11 @@ public class CostExileFromStack extends CostPart {
// ExileFromStack<Num/Type{/TypeDescription}>
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost exile.
*

View File

@@ -29,6 +29,11 @@ import forge.game.zone.ZoneType;
* This is for the "ExiledMoveToGrave" Cost.
*/
public class CostExiledMoveToGrave extends CostPartWithList {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
// ExiledMoveToGrave<Num/Type{/TypeDescription}>
public CostExiledMoveToGrave(final String amount, final String type, final String description) {
super(amount, type, description);

View File

@@ -27,6 +27,11 @@ import forge.game.spellability.SpellAbility;
*/
public class CostFlipCoin extends CostPartWithList {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost FlipCoin.
*

View File

@@ -31,6 +31,11 @@ import forge.game.zone.ZoneType;
public class CostGainControl extends CostPartWithList {
// GainControl<Num/Type{/TypeDescription}>
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost return.
*

View File

@@ -28,6 +28,10 @@ import java.util.List;
* The Class CostGainLife.
*/
public class CostGainLife extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
private final int cntPlayers; // MAX_VALUE means ALL/EACH PLAYERS
/**

View File

@@ -31,6 +31,11 @@ import forge.game.zone.ZoneType;
*/
public class CostMill extends CostPartWithList {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost mill.
*

View File

@@ -31,6 +31,10 @@ import java.io.Serializable;
* The Class CostPart.
*/
public abstract class CostPart implements Comparable<CostPart>, Cloneable, Serializable {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
private String originalAmount;
private String amount;
private final String originalType, originalTypeDescription;

View File

@@ -22,12 +22,14 @@ import forge.card.mana.ManaCostShard;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import java.io.Serializable;
/**
* The mana component of any spell or ability cost
*/
public class CostPartMana extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
// "Leftover"
private final ManaCost cost;
private boolean xCantBe0 = false;

View File

@@ -28,6 +28,10 @@ import forge.game.spellability.SpellAbility;
* The Class CostPartWithList.
*/
public abstract class CostPartWithList extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/** The lists: one for LKI, one for the actual cards. */
private final CardCollection lkiList = new CardCollection();
protected final CardCollection cardList = new CardCollection();

View File

@@ -27,6 +27,11 @@ import forge.game.spellability.SpellAbility;
public class CostPayEnergy extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
int paidAmount = 0;
/**

View File

@@ -26,6 +26,10 @@ import forge.game.spellability.SpellAbility;
* The Class CostPayLife.
*/
public class CostPayLife extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
int paidAmount = 0;
/**

View File

@@ -36,6 +36,10 @@ public class CostPutCardToLib extends CostPartWithList {
// PutCardToLibFromSameGrave<Num/LibPos/Type{/TypeDescription}>
// PutCardToLibFromGrave<Num/LibPos/Type{/TypeDescription}>
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
public final ZoneType from;
public final boolean sameZone;
private String libPosition = "0";

View File

@@ -32,7 +32,11 @@ import java.util.List;
* The Class CostPutCounter.
*/
public class CostPutCounter extends CostPartWithList {
// Put Counter doesn't really have a "Valid" portion of the cost
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
// Put Counter doesn't really have a "Valid" portion of the cost
private final CounterType counter;
private int lastPaidAmount = 0;

View File

@@ -30,6 +30,10 @@ import java.util.Map;
* The Class CostRemoveAnyCounter.
*/
public class CostRemoveAnyCounter extends CostPartWithList {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
// RemoveAnyCounter<Num/Type/{TypeDescription}>
// Power Conduit and Chisei, Heart of Oceans
// Both cards have "Remove a counter from a permanent you control"

View File

@@ -40,6 +40,10 @@ public class CostRemoveCounter extends CostPartWithList {
// Quillspike, Rift Elemental, Sage of Fables, Spike Rogue
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
public final CounterType counter;
public final ZoneType zone;
private int cntRemoved;

View File

@@ -30,6 +30,12 @@ import forge.game.zone.ZoneType;
public class CostReturn extends CostPartWithList {
// Return<Num/Type{/TypeDescription}>
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost return.
*

View File

@@ -33,6 +33,11 @@ import forge.game.zone.ZoneType;
public class CostReveal extends CostPartWithList {
// Reveal<Num/Type/TypeDescription>
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
public CostReveal(final String amount, final String type, final String description) {
super(amount, type, description);
}

View File

@@ -30,6 +30,11 @@ import forge.game.zone.ZoneType;
*/
public class CostSacrifice extends CostPartWithList {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost sacrifice.
*

View File

@@ -26,6 +26,11 @@ import forge.game.spellability.SpellAbility;
*/
public class CostTap extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost tap.
*/

View File

@@ -32,6 +32,10 @@ import forge.util.TextUtil;
*/
public class CostTapType extends CostPartWithList {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
public final boolean canTapSource;
/**

View File

@@ -32,6 +32,12 @@ public class CostUnattach extends CostPartWithList {
// Unattach<CARDNAME> if ability is on the Equipment
// Unattach<Card.Attached+namedHeartseeker/Equipped Heartseeker> if equipped creature has the ability
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost unattach.
*/

View File

@@ -26,6 +26,11 @@ import forge.game.spellability.SpellAbility;
*/
public class CostUntap extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost untap.
*/

View File

@@ -29,6 +29,10 @@ import forge.game.zone.ZoneType;
* The Class CostUntapType.
*/
public class CostUntapType extends CostPartWithList {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
public final boolean canUntapSource;
public CostUntapType(final String amount, final String type, final String description, boolean hasUntapInPrice) {

View File

@@ -20,8 +20,6 @@ package forge.game.mana;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import forge.card.ColorSet;
import forge.card.MagicColor;
import forge.card.mana.IParserManaCost;

View File

@@ -5,6 +5,10 @@ import forge.game.cost.Cost;
import java.io.Serializable;
public class OptionalCostValue implements Serializable {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
private OptionalCost type;
private Cost cost;