public GlobalInt DeepCopy() { GlobalInt copy = new GlobalInt(); copy.Key = this.Key; copy.Value = this.Value; return copy; }
public GlobalInt DeepCopy() { GlobalInt copy = new GlobalInt(); copy.Key = this.Key; copy.Value = this.Value; return(copy); }
//GLOBAL AND LOCAL INTS public void SetGlobalInt(string variableName, string val) { int value = 0; if (val.Equals("++")) { int currentValue = GetGlobalInt(variableName); if (currentValue == -1) //this is our first time using this variable so set to 1 { //SetGlobalInt(p1, 1); value = 1; } else //we have the variable so increment by one { currentValue++; //sf.SetGlobalInt(p1, currentValue); value = currentValue; } } else if (val.Equals("--")) { int currentValue = GetGlobalInt(variableName); if (currentValue == -1) //this is our first time using this variable so set to 0 { //sf.SetGlobalInt(p1, 0); value = 0; } else //we have the variable so decrement by one { currentValue--; if (currentValue < 0) { currentValue = 0; } //sf.SetGlobalInt(p1, currentValue); value = currentValue; } } else { value = Convert.ToInt32(val); //int parm2 = Convert.ToInt32(p2); //sf.SetGlobalInt(p1, parm2); } int exists = 0; foreach (GlobalInt variable in mod.moduleGlobalInts) { if (variable.Key.Equals(variableName)) { variable.Value = value; exists = 1; if (mod.debugMode) //SD_20131102 { gv.cc.addLogText("<font color='yellow'>" + "setGlobal: " + variableName + " = " + value + "</font>" + "<BR>"); } } } if (exists == 0) { GlobalInt newGlobal = new GlobalInt(); newGlobal.Key = variableName; newGlobal.Value = value; mod.moduleGlobalInts.Add(newGlobal); if (mod.debugMode) //SD_20131102 { gv.cc.addLogText("<font color='yellow'>" + "setGlobal: " + variableName + " = " + value + "</font>" + "<BR>"); } } }