mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
* Fixed a problem with UNDO/rollback setting the wrong active player (fixes #2046).
This commit is contained in:
parent
1c0a4a7532
commit
fd60e43a03
2 changed files with 4 additions and 3 deletions
|
|
@ -558,6 +558,7 @@ public abstract class GameImpl implements Game, Serializable {
|
||||||
public void saveState(boolean bookmark) {
|
public void saveState(boolean bookmark) {
|
||||||
if (!simulation && gameStates != null) {
|
if (!simulation && gameStates != null) {
|
||||||
if (bookmark || saveGame) {
|
if (bookmark || saveGame) {
|
||||||
|
state.getPlayerList().setCurrent(playerList.get());
|
||||||
gameStates.save(state);
|
gameStates.save(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -663,7 +664,7 @@ public abstract class GameImpl implements Game, Serializable {
|
||||||
GameState restore = gameStates.rollback(stateNum);
|
GameState restore = gameStates.rollback(stateNum);
|
||||||
if (restore != null) {
|
if (restore != null) {
|
||||||
state.restore(restore);
|
state.restore(restore);
|
||||||
playerList.setCurrent(state.getActivePlayerId());
|
playerList.setCurrent(state.getPlayerList().get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2778,7 +2779,7 @@ public abstract class GameImpl implements Game, Serializable {
|
||||||
if (restore != null) {
|
if (restore != null) {
|
||||||
informPlayers(GameLog.getPlayerRequestColoredText("Player request: Rolling back to start of turn " + restore.getTurnNum()));
|
informPlayers(GameLog.getPlayerRequestColoredText("Player request: Rolling back to start of turn " + restore.getTurnNum()));
|
||||||
state.restoreForRollBack(restore);
|
state.restoreForRollBack(restore);
|
||||||
playerList.setCurrent(state.getActivePlayerId());
|
playerList.setCurrent(state.getPlayerList().get());
|
||||||
// because restore uses the objects without copy each copy the state again
|
// because restore uses the objects without copy each copy the state again
|
||||||
gameStatesRollBack.put(getTurnNum(), state.copy());
|
gameStatesRollBack.put(getTurnNum(), state.copy());
|
||||||
executingRollback = true;
|
executingRollback = true;
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
||||||
|
|
||||||
public void restore(GameState state) {
|
public void restore(GameState state) {
|
||||||
this.activePlayerId = state.activePlayerId;
|
this.activePlayerId = state.activePlayerId;
|
||||||
this.playerList.setCurrent(state.activePlayerId);
|
this.playerList.setCurrent(state.playerList.get());
|
||||||
this.priorityPlayerId = state.priorityPlayerId;
|
this.priorityPlayerId = state.priorityPlayerId;
|
||||||
this.stack = state.stack;
|
this.stack = state.stack;
|
||||||
this.command = state.command;
|
this.command = state.command;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue