X-Git-Url: https://git.ucc.asn.au/?p=progcomp2012.git;a=blobdiff_plain;f=manager%2Fcontroller.cpp;h=1b0a35d0dca0b1972b78a095b710f077a90cd293;hp=982f0fc94a0a86ee859c861cdfedf2b39d2ba390;hb=7f7bc05439b70b3139086086608996de3c9ae2ed;hpb=17a20de4017ccfadef219d830a28ecccfe6f5106;ds=sidebyside diff --git a/manager/controller.cpp b/manager/controller.cpp index 982f0fc..1b0a35d 100644 --- a/manager/controller.cpp +++ b/manager/controller.cpp @@ -117,8 +117,10 @@ MovementResult Controller::MakeMove(string & buffer) } else { - //fprintf(stderr, "BAD_RESPONSE \"%s\"\n", buffer.c_str()); - return MovementResult::BAD_RESPONSE; //Player gave bogus direction - it will lose by default. + if (Game::theGame->allowIllegalMoves) + return MovementResult::OK; + else + return MovementResult::BAD_RESPONSE; //Player gave bogus direction - it will lose by default. } int multiplier = 1; @@ -158,10 +160,15 @@ MovementResult Controller::MakeMove(string & buffer) } + if (!Board::LegalResult(moveResult)) { + if (Game::theGame->allowIllegalMoves) + { + return MovementResult::OK; //HACK - Illegal results returned as legal! (Move not made) + } else if (this->HumanController()) //Cut human controllers some slack and let them try again... { //Yes, checking type of object is "not the C++ way"