pull some validation out of individual lobby/player commands

This commit is contained in:
Chris Forbes
2011-07-12 21:04:51 +12:00
committed by Paul Chote
parent 2ec88a6f64
commit 608bdc8fcd
2 changed files with 30 additions and 40 deletions

View File

@@ -23,16 +23,8 @@ namespace OpenRA.Mods.RA.Server
{
public bool InterpretCommand( S server, Connection conn, Session.Client client, string cmd)
{
if (server.GameStarted)
{
server.SendChatTo(conn, "Cannot change state when game started. ({0})".F(cmd));
if (!LobbyCommands.ValidateCommand(server, conn, client, cmd))
return false;
}
else if (client.State == Session.ClientState.Ready && !(cmd == "ready" || cmd == "startgame"))
{
server.SendChatTo(conn, "Cannot change state when marked as ready.");
return false;
}
var dict = new Dictionary<string, Func<string, bool>>
{