// Get a new command from the player public void GetPlayerCommand() { CommandOutcome outcome = CommandOutcome.FULL; bool hintOrDeathQuestion = false; SuspendCommandProcessing(); // Suspend further command processing until command has been executed // Remind the player of two word limit, if they have entered more than a two word command if (playerInput.NumberOfWords > 2) { textDisplayController.AddTextToLog(playerMessageController.GetMessage("53LongCommand")); } // Count a new turn and deal with any fallout from that AddTurn(); CaveStatus oldCaveStatus = CurrentCaveStatus; // Update the clocks and check for closing UpdateClocks(); // Only do lamp stuff if the cave status hasn't just changed if (oldCaveStatus == CurrentCaveStatus) { // Update the lamp and check for dimming/out of power UpdateLamp(); } // Only process the command if the cave hasn't just closed if (!(oldCaveStatus != CurrentCaveStatus && CurrentCaveStatus == CaveStatus.CLOSED)) { // Process the players's command parserState.ResetParserState(playerInput.Words); outcome = commandsController.ProcessCommand(); } // If the outcome allows, process a turn following the player command if (outcome == CommandOutcome.FULL || outcome == CommandOutcome.DESCRIBE || outcome == CommandOutcome.MESSAGE) { hintOrDeathQuestion = ProcessTurn(outcome); } else if (outcome == CommandOutcome.DISTURBED) { // Player has disturbed the dwarves, so show message before ending game textDisplayController.AddTextToLog(playerMessageController.GetMessage("136DwarvesAttack")); } // If the command has resulted int eh end of game, then end game now if (outcome == CommandOutcome.DISTURBED || outcome == CommandOutcome.ENDED) { EndGame(false); } // Otherwise, wait for the next player command, unless we're waiting for a question response if (outcome != CommandOutcome.QUESTION && !hintOrDeathQuestion) { ResumeCommandProcessing(); } }