ToString() public method

public ToString ( ) : string
return string
Example #1
0
        public void Update(idCvar var)
        {
            // if this is a statically declared variable
            if ((var.Flags & CvarFlags.Static) == CvarFlags.Static)
            {
                if ((_flags & CvarFlags.Static) == CvarFlags.Static)
                {
                    // the code has more than one static declaration of the same variable, make sure they have the same properties
                    if (_resetString.ToLower() == var.ToString().ToLower())
                    {
                        idConsole.Warning("cvar '{0}' declared multiple times with different initial value", _nameString);
                    }

                    if ((_flags & (CvarFlags.Bool | CvarFlags.Integer | CvarFlags.Float)) == 0)
                    {
                        idConsole.Warning("cvar '{0}' declared multiple times with different type", _nameString);
                    }

                    if ((_valueMin != var.MinValue) || (_valueMax != var.MaxValue))
                    {
                        idConsole.Warning("cvar '{0}' declared multiple times with different minimum/maximum", _nameString);
                    }
                }

                // the code is now specifying a variable that the user already set a value for, take the new value as the reset value
                _resetString       = var.ToString();
                _descriptionString = var.Description;
                _description       = var.Description;
                _valueMin          = var.MinValue;
                _valueMax          = var.MaxValue;
                _valueStrings      = var.ValueStrings;
                _valueCompletion   = var.ValueCompletion;

                UpdateValue();

                idE.CvarSystem.ModifiedFlags = var.Flags;
            }

            _flags |= var.Flags;

            UpdateCheat();

            // only allow one non-empty reset string without a warning
            if (_resetString == string.Empty)
            {
                _resetString = var.ToString();
            }
            else if (var.ToString().ToLower() == _resetString.ToLower())
            {
                idConsole.Warning("cvar \"{0}\" given initial values: \"{1}\" and \"{2}\"", _nameString, _resetString, var.ToString());
            }
        }
Example #2
0
        public idInternalCvar(idCvar var)
        {
            _name              = var.Name;
            _nameString        = var.Name;
            _value             = var.ToString();
            _valueString       = var.ToString();
            _resetString       = var.ToString();
            _description       = var.Description;
            _descriptionString = var.Description;
            _flags             = var.Flags | CvarFlags.Modified;
            _valueMin          = var.MinValue;
            _valueMax          = var.MaxValue;
            _valueStrings      = var.ValueStrings;
            _valueCompletion   = var.ValueCompletion;

            UpdateValue();
            UpdateCheat();

            _internal = this;
        }
Example #3
0
		public void Update(idCvar var)
		{
			// if this is a statically declared variable
			if((var.Flags & CvarFlags.Static) == CvarFlags.Static)
			{
				if((_flags & CvarFlags.Static) == CvarFlags.Static)
				{
					// the code has more than one static declaration of the same variable, make sure they have the same properties
					if(_resetString.ToLower() == var.ToString().ToLower())
					{
						idConsole.Warning("cvar '{0}' declared multiple times with different initial value", _nameString);
					}

					if((_flags & (CvarFlags.Bool | CvarFlags.Integer | CvarFlags.Float)) == 0)
					{
						idConsole.Warning("cvar '{0}' declared multiple times with different type", _nameString);
					}

					if((_valueMin != var.MinValue) || (_valueMax != var.MaxValue))
					{
						idConsole.Warning("cvar '{0}' declared multiple times with different minimum/maximum", _nameString);
					}
				}

				// the code is now specifying a variable that the user already set a value for, take the new value as the reset value
				_resetString = var.ToString();
				_descriptionString = var.Description;
				_description = var.Description;
				_valueMin = var.MinValue;
				_valueMax = var.MaxValue;
				_valueStrings = var.ValueStrings;
				_valueCompletion = var.ValueCompletion;

				UpdateValue();

				idE.CvarSystem.ModifiedFlags = var.Flags;
			}

			_flags |= var.Flags;

			UpdateCheat();

			// only allow one non-empty reset string without a warning
			if(_resetString == string.Empty)
			{
				_resetString = var.ToString();
			}
			else if(var.ToString().ToLower() == _resetString.ToLower())
			{
				idConsole.Warning("cvar \"{0}\" given initial values: \"{1}\" and \"{2}\"", _nameString, _resetString, var.ToString());
			}
		}
Example #4
0
		public idInternalCvar(idCvar var)
		{
			_name = var.Name;
			_nameString = var.Name;
			_value = var.ToString();
			_valueString = var.ToString();
			_resetString = var.ToString();
			_description = var.Description;
			_descriptionString = var.Description;
			_flags = var.Flags | CvarFlags.Modified;
			_valueMin = var.MinValue;
			_valueMax = var.MaxValue;
			_valueStrings = var.ValueStrings;
			_valueCompletion = var.ValueCompletion;

			UpdateValue();
			UpdateCheat();

			_internal = this;
		}