forked from External/mage
Fixed some more exception and/or logging problems.
This commit is contained in:
parent
9268281c4b
commit
2f016c8ea6
11 changed files with 63 additions and 47 deletions
|
|
@ -668,17 +668,20 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
if (!simulation && !this.hasEnded()) { // if player left or game is over no undo is possible - this could lead to wrong winner
|
||||
if (bookmark != 0) {
|
||||
if (!savedStates.contains(bookmark - 1)) {
|
||||
throw new UnsupportedOperationException("It was not possible to do the requested undo operation (bookmark " + (bookmark - 1) + " does not exist) context: " + context);
|
||||
}
|
||||
int stateNum = savedStates.get(bookmark - 1);
|
||||
removeBookmark(bookmark);
|
||||
GameState restore = gameStates.rollback(stateNum);
|
||||
if (restore != null) {
|
||||
state.restore(restore);
|
||||
playerList.setCurrent(state.getPlayerByOrderId());
|
||||
logger.error("It was not possible to do the requested undo operation (bookmark " + (bookmark - 1) + " does not exist) context: " + context);
|
||||
logger.info("Saved states: " + savedStates.toString());
|
||||
} else {
|
||||
int stateNum = savedStates.get(bookmark - 1);
|
||||
removeBookmark(bookmark);
|
||||
GameState restore = gameStates.rollback(stateNum);
|
||||
if (restore != null) {
|
||||
state.restore(restore);
|
||||
playerList.setCurrent(state.getPlayerByOrderId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1355,7 +1358,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
logger.fatal(ex.getStackTrace());
|
||||
}
|
||||
this.fireErrorEvent("Game exception occurred: ", ex);
|
||||
restoreState(bookmark, "");
|
||||
restoreState(bookmark, "Game exception: " + ex.getMessage());
|
||||
bookmark = 0;
|
||||
Player activePlayer = this.getPlayer(getActivePlayerId());
|
||||
if (errorContinueCounter > 15) {
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
|||
Map<UUID, Integer> assigned = new HashMap<>();
|
||||
if (blocked) {
|
||||
boolean excessDamageToDefender = true;
|
||||
for (UUID blockerId : blockerOrder) {
|
||||
for (UUID blockerId : new ArrayList<>(blockerOrder)) { // prevent ConcurrentModificationException
|
||||
Permanent blocker = game.getPermanent(blockerId);
|
||||
if (blocker != null) {
|
||||
int lethalDamage;
|
||||
|
|
|
|||
|
|
@ -703,7 +703,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
}
|
||||
}
|
||||
if (getSpellAbility() == null) {
|
||||
logger.info("FATAL : no spell ability for attach to permanent: " + getName());
|
||||
// Can happen e.g. for Token Equipments like Stoneforged Blade
|
||||
return;
|
||||
}
|
||||
if (!getSpellAbility().getTargets().isEmpty() && (getSpellAbility().getTargets().get(0) instanceof TargetCard)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue