Merge remote-tracking branch 'origin/master' into code-cleanup

# Conflicts:
#	forge-ai/src/main/java/forge/ai/ability/PlayAi.java
#	forge-core/src/main/java/forge/util/collect/FCollection.java
#	forge-game/src/main/java/forge/game/ability/effects/PlayEffect.java
This commit is contained in:
Jetz
2024-12-05 08:27:25 -05:00
19 changed files with 699 additions and 861 deletions

View File

@@ -760,7 +760,13 @@ public class FSkin {
public static SkinIcon getIcon(final FSkinProp s0) {
final SkinIcon icon = SkinIcon.icons.get(s0);
if (icon == null) {
throw new NullPointerException("Can't find an icon for FSkinProp " + s0);
final SkinIcon blank = SkinIcon.icons.get(FSkinProp.ICO_BLANK);
if (blank == null) // if blank is null at this point then the skin is bugged or GC?
throw new NullPointerException("Can't find an icon for FSkinProp " + s0);
else { // this should be 2 or less unless a new required image icon is needed.
System.err.println("Missing image icon for FSkinProp " + s0 + ". Blank image will be used instead.");
return blank;
}
}
return icon;
}

View File

@@ -5,7 +5,6 @@ import forge.game.card.CardCollection;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@@ -15,7 +14,7 @@ public class FCollectionTest {
/**
* Just a quick test for FCollection.
*/
@Test
/*@Test
void testBadIteratorLogic() {
List<Card> cards = new ArrayList<>();
for (int i = 1; i < 5; i++)
@@ -27,7 +26,7 @@ public class FCollectionTest {
assertEquals(cc.size(), 3);
}
@Test
/*@Test
void testBadIteratorLogicTwo() {
List<Card> cards = new ArrayList<>();
for (int i = 1; i <= 10; i++)
@@ -40,7 +39,7 @@ public class FCollectionTest {
i++;
}
assertEquals(cc.size(), 1);
}
}*/// Commented out since we use synchronized collection and it doesn't support modification while iteration
@Test
void testCompletableFuture() {
@@ -49,7 +48,7 @@ public class FCollectionTest {
cards.add(new Card(i, null));
CardCollection cc = new CardCollection(cards);
List<CompletableFuture<Integer>> futures = new ArrayList<>();
for (Card c : cc) {
for (Card c : cc.threadSafeIterable()) {
futures.add(CompletableFuture.supplyAsync(() -> {
if (c.getId() % 2 > 0)
cc.remove(c);