ACR_BuilderPlugin.ModuleValidator.ValidateVariableType C# (CSharp) Méthode

ValidateVariableType() private méthode

Verifies that a given variable on an object is of the correct type.
private ValidateVariableType ( string reference, NWN2WaypointTemplate waypoint, string variable, NWN2ScriptVariableType type, bool enforce = true ) : void
reference string
waypoint NWN2WaypointTemplate
variable string
type NWN2ScriptVariableType
enforce bool If true, this function will try to fix the variable's type.
Résultat void
        private void ValidateVariableType(string reference, NWN2WaypointTemplate waypoint, string variable, NWN2ScriptVariableType type, bool enforce = true)
        {
            if (waypoint == null) return;
            if (waypoint.Variables.GetVariable(variable) == null) return;
            if (waypoint.Variables.GetVariable(variable).VariableType != type)
            {
                if (enforce)
                {
                    waypoint.Variables.GetVariable(variable).VariableType = type;
                    log.WriteLine("FIXED: Waypoint blueprint \"{0}\" has variable \"{1}\" not of type {2}.", reference, variable, type.ToString());
                }
                else
                {
                    log.WriteLine("ERROR: Waypoint blueprint \"{0}\" has variable \"{1}\" not of type {2}.", reference, variable, type.ToString());
                }
            }
        }