add move preconditions
This commit is contained in:
@@ -8,6 +8,10 @@ public class CastlingCommand extends PlayerCommand{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandResult execute(Game game, OutputSystem outputSystem) {
|
public CommandResult execute(Game game, OutputSystem outputSystem) {
|
||||||
|
// we must promote the pending pawn before
|
||||||
|
if (game.pawnShouldBePromoted())
|
||||||
|
return CommandResult.NotAllowed;
|
||||||
|
|
||||||
return CommandResult.NotAllowed;
|
return CommandResult.NotAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ public class GrandCastlingCommand extends PlayerCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandResult execute(Game game, OutputSystem outputSystem) {
|
public CommandResult execute(Game game, OutputSystem outputSystem) {
|
||||||
|
// we must promote the pending pawn before
|
||||||
|
if (game.pawnShouldBePromoted())
|
||||||
|
return CommandResult.NotAllowed;
|
||||||
|
|
||||||
return CommandResult.NotAllowed;
|
return CommandResult.NotAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user