mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 02:08:00 +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) {
|
||||
Entity entity = get(view);
|
||||
if (entity != null) {
|
||||
list.add(entity);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
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
|
||||
PlayerView mindSlaveMaster = controller.getMindSlaveMaster();
|
||||
if (mindSlaveMaster != null && mindSlaveMaster == viewer) {
|
||||
if (mindSlaveMaster != null && mindSlaveMaster != controller && mindSlaveMaster == viewer) {
|
||||
return canBeShownTo(controller);
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -788,13 +788,11 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
GameEntityViewMap<Card, CardView> gameCacheManipulate = GameEntityView.getMap(cards);
|
||||
gameCacheManipulate.putAll(manipulable);
|
||||
List<CardView> views = getGui().manipulateCardList(title, CardView.getCollection(cards), CardView.getCollection(manipulable), toTop, toBottom, toAnywhere);
|
||||
List<Card> result = new CardCollection();
|
||||
gameCacheManipulate.addToList(views, result);
|
||||
return result;
|
||||
return gameCacheManipulate.addToList(views, new CardCollection());
|
||||
}
|
||||
|
||||
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 toTop = new CardCollection();
|
||||
for (int i = 0; i<cards.size() && manipulable.contains(result.get(i)) ; i++ ) {
|
||||
|
||||
Reference in New Issue
Block a user