mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Prevent losing card reordering in hand
This commit is contained in:
@@ -63,6 +63,11 @@ public class Zone implements java.io.Serializable, Iterable<Card> {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final void reorder(final Card c, final int index) {
|
||||
cardList.remove(c);
|
||||
cardList.add(index, c);
|
||||
}
|
||||
|
||||
public final void add(final Card c) {
|
||||
add(c, null);
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ public class CHand implements ICDoc {
|
||||
synchronized (ordering) {
|
||||
ordering.remove(dragPanel.getCard());
|
||||
ordering.add(index, dragPanel.getCard());
|
||||
matchUI.getGameController(p0).reorderHand(dragPanel.getCard(), index);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -42,4 +42,6 @@ public interface IGameController {
|
||||
void nextGameDecision(NextGameDecision decision);
|
||||
|
||||
String getActivateDescription(CardView card);
|
||||
|
||||
void reorderHand(CardView card, int index);
|
||||
}
|
||||
|
||||
@@ -74,6 +74,9 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
|
||||
public final IGameController getGameController() {
|
||||
return gameControllers.get(getCurrentPlayer());
|
||||
}
|
||||
public final IGameController getGameController(PlayerView p0) {
|
||||
return gameControllers.get(p0);
|
||||
}
|
||||
public final Collection<IGameController> getGameControllers() {
|
||||
return gameControllers.values();
|
||||
}
|
||||
|
||||
@@ -126,4 +126,8 @@ public class NetGameController implements IGameController {
|
||||
send(methodName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reorderHand(CardView card, int index) {
|
||||
send(methodName(), card, index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ import forge.game.spellability.TargetChoices;
|
||||
import forge.game.trigger.Trigger;
|
||||
import forge.game.trigger.WrappedAbility;
|
||||
import forge.game.zone.MagicStack;
|
||||
import forge.game.zone.PlayerZone;
|
||||
import forge.game.zone.Zone;
|
||||
import forge.game.zone.ZoneType;
|
||||
import forge.interfaces.IDevModeCheats;
|
||||
@@ -1795,4 +1796,11 @@ public class PlayerControllerHuman
|
||||
public String getActivateDescription(final CardView card) {
|
||||
return getInputProxy().getActivateAction(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reorderHand(CardView card, int index) {
|
||||
PlayerZone hand = player.getZone(ZoneType.Hand);
|
||||
hand.reorder(game.getCard(card), index);
|
||||
player.updateZoneForView(hand);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user