Exists() public static method

public static Exists ( string name ) : bool
name string
return bool
Esempio n. 1
0
        // Cmd_AddCommand()
        // called by the init functions of other parts of the program to
        // register commands and functions to call for them.
        public static void Add(string name, xcommand_t function)
        {
            // ??? because hunk allocation would get stomped
            if (Host.IsInitialized)
            {
                Sys.Error("Cmd.Add after host initialized!");
            }

            // fail if the command is a variable name
            if (Cvar.Exists(name))
            {
                Con.Print("Cmd.Add: {0} already defined as a var!\n", name);
                return;
            }

            // fail if the command already exists
            if (Exists(name))
            {
                Con.Print("Cmd.Add: {0} already defined!\n", name);
                return;
            }

            _Functions.Add(name, function);
        }