git.ucc.asn.au
/
progcomp2012.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Added check for rubbish move multipliers
[progcomp2012.git]
/
judge
/
manager
/
stratego.cpp
diff --git
a/judge/manager/stratego.cpp
b/judge/manager/stratego.cpp
index
e142a4b
..
7894378
100644
(file)
--- a/
judge/manager/stratego.cpp
+++ b/
judge/manager/stratego.cpp
@@
-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