Fixed miss copy code in Game object (lki, cards), removed unused code. Possible fixes:

* simulated games was able to change objects from another games (ConcurrentModificationException, related to d202278ccd, details in 3a6cdd2615);
* AI: fixed cards disappear in multiplayer games with computer (details in #6738);
This commit is contained in:
Oleg Agafonov 2021-08-12 00:07:40 +04:00
parent 9f882824a0
commit 1664ee01cf
39 changed files with 201 additions and 125 deletions

View file

@ -1,6 +1,7 @@
package mage.game;
import mage.constants.PhaseStep;
import mage.util.Copyable;
import java.io.Serializable;
import java.util.Collections;
@ -12,7 +13,7 @@ import java.util.Set;
*
* @author ayratn
*/
public class GameOptions implements Serializable {
public class GameOptions implements Serializable, Copyable<GameOptions> {
private static final GameOptions deinstance = new GameOptions();
@ -50,10 +51,28 @@ public class GameOptions implements Serializable {
* Names of users banned from participating in the game
*/
public Set<String> bannedUsers = Collections.emptySet();
/**
* Use planechase variant
*/
public boolean planeChase = false;
public GameOptions() {
super();
}
private GameOptions(final GameOptions options) {
this.testMode = options.testMode;
this.stopOnTurn = options.stopOnTurn;
this.stopAtStep = options.stopAtStep;
this.skipInitShuffling = options.skipInitShuffling;
this.rollbackTurnsAllowed = options.rollbackTurnsAllowed;
this.bannedUsers.addAll(options.bannedUsers);
this.planeChase = options.planeChase;
}
@Override
public GameOptions copy() {
return new GameOptions(this);
}
}