Пример #1
0
void Phase::ProcessCmdMessage(const Input::CmdMessage& msg, CommitSession& session, const Player& player)
{
	LiveGame& game = GetGame();
	VERIFY_MODEL_MSG(player.GetName(), &game == player.GetCurrentLiveGame());

	const Colour colour = game.GetTeam(player).GetColour();
	Cmd* pCmd = GetCurrentCmd(colour);
	VERIFY_MODEL_MSG("No current command", !!pCmd);

	Cmd::ProcessResult result = pCmd->Process(msg, session); // Might be null.

	CmdStack& cmdStack = GetCmdStack(colour);
	cmdStack.AddCmd(std::move(result.next), std::move(result.queue));
	
	if (cmdStack.GetCurrentCmd() == nullptr)
		OnCmdFinished(*pCmd, session); 

	// This phase might have finished, get potentially new phase.
	game.GetPhase().UpdateClient(session.GetController(), &player);
}