Ejemplo n.º 1
0
        public void SetModified(string name)
        {
            idCvar intern = FindInternal(name);

            if (intern != null)
            {
                intern.Flags |= CvarFlags.Modified;
            }
        }
Ejemplo n.º 2
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());
            }
        }
Ejemplo n.º 3
0
        public void Register(idCvar var)
        {
            var.Internal = var;

            idInternalCvar intern = FindInternal(var.Name, true);

            if (intern != null)
            {
                intern.Update(var);
            }
            else
            {
                intern = new idInternalCvar(var);

                _cvarList.Add(intern.Name, intern);
            }

            var.Internal = intern;
        }
Ejemplo n.º 4
0
        private void Init(string name, string value, string description, float valueMin, float valueMax, string[] valueStrings, CvarFlags flags, ArgCompletion valueCompletion)
        {
            _name            = name;
            _value           = value;
            _flags           = flags | CvarFlags.Static;
            _description     = description;
            _valueMin        = valueMin;
            _valueMax        = valueMax;
            _valueStrings    = valueStrings;
            _valueCompletion = valueCompletion;

            _intValue   = 0;
            _floatValue = 0.0f;

            _internal = this;

            idE.CvarSystem.Register(this);
            //idCvarSystem.StaticList.Add(this);
        }
Ejemplo n.º 5
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;
        }
Ejemplo n.º 6
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());
			}
		}
Ejemplo n.º 7
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;
		}
Ejemplo n.º 8
0
		private void Init(string name, string value, string description, float valueMin, float valueMax, string[] valueStrings, CvarFlags flags, ArgCompletion valueCompletion)
		{
			_name = name;
			_value = value;
			_flags = flags | CvarFlags.Static;
			_description = description;
			_valueMin = valueMin;
			_valueMax = valueMax;
			_valueStrings = valueStrings;
			_valueCompletion = valueCompletion;

			_intValue = 0;
			_floatValue = 0.0f;

			_internal = this;

			idE.CvarSystem.Register(this);
			//idCvarSystem.StaticList.Add(this);
		}
Ejemplo n.º 9
0
		public void Register(idCvar var)
		{
			var.Internal = var;

			idInternalCvar intern = FindInternal(var.Name, true);

			if(intern != null)
			{
				intern.Update(var);
			}
			else
			{
				intern = new idInternalCvar(var);

				_cvarList.Add(intern.Name, intern);
			}

			var.Internal = intern;
		}