X-Git-Url: https://git.ucc.asn.au/?p=progcomp2012.git;a=blobdiff_plain;f=judge%2Fmanager%2Fstratego.cpp;h=c9716cf3f6df67831ddd86040346ec172858aeeb;hp=e142a4bd67cc3e39e51cff3d3b2e82a20476e1b2;hb=ac335e7c423d067effae82cc80db518f896271b9;hpb=85cfed04e179dad45eefd9fdf747628addbf93fb diff --git a/judge/manager/stratego.cpp b/judge/manager/stratego.cpp index e142a4b..c9716cf 100644 --- a/judge/manager/stratego.cpp +++ b/judge/manager/stratego.cpp @@ -157,7 +157,7 @@ void Board::Print(FILE * stream, const Piece::Colour & reveal) * @param stream - the stream to print information to * @param reveal - Pieces matching this colour will have their identify revealed, other pieces will be shown as '#' */ -void Board::PrintPretty(FILE * stream, const Piece::Colour & reveal) +void Board::PrintPretty(FILE * stream, const Piece::Colour & reveal, bool showRevealed) { for (int y=0; y < height; ++y) { @@ -168,7 +168,8 @@ void Board::PrintPretty(FILE * stream, const Piece::Colour & reveal) { fprintf(stream, "."); } - else if (piece->colour != Piece::NONE && (piece->colour == reveal || reveal == Piece::BOTH)) + else if ((piece->colour != Piece::NONE && (piece->colour == reveal || reveal == Piece::BOTH)) + || (piece->beenRevealed && showRevealed)) { switch (piece->colour) { @@ -343,6 +344,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.