mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
Fixed mindSlaveMaster == controller causing StackoverflowError
This commit is contained in:
@@ -37,13 +37,17 @@ public class GameEntityViewMap<Entity extends GameEntity, View extends GameEntit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addToList(Iterable<View> views, List<Entity> list) {
|
public List<Entity> addToList(Iterable<View> views, List<Entity> list) {
|
||||||
|
if (views == null) {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
for (View view : views) {
|
for (View view : views) {
|
||||||
Entity entity = get(view);
|
Entity entity = get(view);
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
list.add(entity);
|
list.add(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TrackableCollection<View> getTrackableKeys() {
|
public TrackableCollection<View> getTrackableKeys() {
|
||||||
|
|||||||
@@ -449,7 +449,7 @@ public class CardView extends GameEntityView {
|
|||||||
|
|
||||||
//if viewer is controlled by another player, also check if card can be shown to that player
|
//if viewer is controlled by another player, also check if card can be shown to that player
|
||||||
PlayerView mindSlaveMaster = controller.getMindSlaveMaster();
|
PlayerView mindSlaveMaster = controller.getMindSlaveMaster();
|
||||||
if (mindSlaveMaster != null && mindSlaveMaster == viewer) {
|
if (mindSlaveMaster != null && mindSlaveMaster != controller && mindSlaveMaster == viewer) {
|
||||||
return canBeShownTo(controller);
|
return canBeShownTo(controller);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -788,13 +788,11 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
|||||||
GameEntityViewMap<Card, CardView> gameCacheManipulate = GameEntityView.getMap(cards);
|
GameEntityViewMap<Card, CardView> gameCacheManipulate = GameEntityView.getMap(cards);
|
||||||
gameCacheManipulate.putAll(manipulable);
|
gameCacheManipulate.putAll(manipulable);
|
||||||
List<CardView> views = getGui().manipulateCardList(title, CardView.getCollection(cards), CardView.getCollection(manipulable), toTop, toBottom, toAnywhere);
|
List<CardView> views = getGui().manipulateCardList(title, CardView.getCollection(cards), CardView.getCollection(manipulable), toTop, toBottom, toAnywhere);
|
||||||
List<Card> result = new CardCollection();
|
return gameCacheManipulate.addToList(views, new CardCollection());
|
||||||
gameCacheManipulate.addToList(views, result);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImmutablePair<CardCollection, CardCollection> arrangeForMove(final String title, final FCollectionView<Card> cards, final List<Card> manipulable, final boolean topOK, final boolean bottomOK) {
|
public ImmutablePair<CardCollection, CardCollection> arrangeForMove(final String title, final FCollectionView<Card> cards, final List<Card> manipulable, final boolean topOK, final boolean bottomOK) {
|
||||||
List<Card> result = manipulateCardList(localizer.getMessage("lblMoveCardstoToporBbottomofLibrary"), cards, manipulable, topOK, bottomOK, false);
|
List<Card> result = manipulateCardList(title, cards, manipulable, topOK, bottomOK, false);
|
||||||
CardCollection toBottom = new CardCollection();
|
CardCollection toBottom = new CardCollection();
|
||||||
CardCollection toTop = new CardCollection();
|
CardCollection toTop = new CardCollection();
|
||||||
for (int i = 0; i<cards.size() && manipulable.contains(result.get(i)) ; i++ ) {
|
for (int i = 0; i<cards.size() && manipulable.contains(result.get(i)) ; i++ ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user