idTech4.idCmdSystem.ExecuteTokenizedString C# (CSharp) Method

ExecuteTokenizedString() private method

private ExecuteTokenizedString ( idCmdArgs args ) : void
args idCmdArgs
return void
		private void ExecuteTokenizedString(idCmdArgs args)
		{
			// execute the command line.
			if(args.Length == 0)
			{
				return; // no tokens.
			}

			CommandDefinition cmd;

			// check registered command functions.
			if(_commands.TryGetValue(args.Get(0), out cmd) == true)
			{
				if(((cmd.Flags & (CommandFlags.Cheat | CommandFlags.Tool)) != 0) 
					&& (idE.Session.IsMultiplayer == true) && (idE.CvarSystem.GetBool("net_allowCheats") == false))
				{
					idConsole.WriteLine("Command '{0}' not valid in multiplayer mode.", cmd.Name);
					return;
				}

				// perform the action.
				if(cmd.Handler != null)
				{
					cmd.Handler(this, new CommandEventArgs(args));
				}

				return;
			}

			// check cvars.
			if(idE.CvarSystem.Command(args) == true)
			{
				return;
			}

			idConsole.WriteLine("Unknown command '{0}'", args.Get(0));
		}