X-Git-Url: https://git.ucc.asn.au/?p=progcomp2012.git;a=blobdiff_plain;f=manager%2Fcontroller.cpp;h=982f0fc94a0a86ee859c861cdfedf2b39d2ba390;hp=e68c1dccc4ac7d5e26f49e6a06e59384a07db4c1;hb=17a20de4017ccfadef219d830a28ecccfe6f5106;hpb=2120cc40abf9e3fd763c84a1e09b61064bb40be6 diff --git a/manager/controller.cpp b/manager/controller.cpp index e68c1dc..982f0fc 100644 --- a/manager/controller.cpp +++ b/manager/controller.cpp @@ -158,9 +158,20 @@ MovementResult Controller::MakeMove(string & buffer) } - if (Game::theGame->allowIllegalMoves && !Board::LegalResult(moveResult)) - return MovementResult::OK; //HACK - Illegal results returned as legal! - else - return moveResult; + 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" + // But sometimes its bloody useful to know!!! + Message("Bad move: \'" + buffer + "\' <- Please try again!"); + buffer = ""; + return this->MakeMove(buffer); + } + } + + return moveResult; }