Added check for rubbish move multipliers
authorSam Moore <matches@ucc.asn.au>
Thu, 2 Feb 2012 10:29:52 +0000 (18:29 +0800)
committerSam Moore <matches@ucc.asn.au>
Thu, 2 Feb 2012 10:29:52 +0000 (18:29 +0800)
judge/manager/stratego.cpp

index e142a4b..7894378 100644 (file)
@@ -343,6 +343,8 @@ MovementResult Board::MovePiece(int x, int y, const Direction & direction, int m
        {
                return MovementResult(MovementResult::IMMOBILE_UNIT);
        }
+       if (multiplier < 1)
+               return MovementResult(MovementResult::INVALID_DIRECTION); //Don't allow moves that don't actually move forward
        if (multiplier > 1 && target->type != Piece::SCOUT)
        {
                return MovementResult(MovementResult::INVALID_DIRECTION); //Can only move a scout multiple times.

UCC git Repository :: git.ucc.asn.au