/// <summary> /// Called by the public setters /// </summary> /// <param name="which">which blacksmith upgrade to set</param> /// <param name="value">how many of it</param> private void setter(BSUpgrade which, int value) { if (value > bsMaxes[(int)which] && value != -1) { throw new ArgumentOutOfRangeException(String.Format("Value {0} is larger than max {1} for {2}", value, which, bsMaxes[(int)which])); } blacksmith[(int)which] = value; }
public int this[BSUpgrade i] { get { return(blacksmith[(int)i]); } set { setter(i, value); } }