comparison api/Objects/UnitType.cs @ 38:548cfc776f54

Fixes #34 - Remove "Choices" and "Base/Increment" from Category * Remove Choices and Base/Increment from code Re #47: Remove magic numbers * Replace "-1" magic number with WarFoundryCore.INFINITY * Use INFINITY instead of -1 in code * Use INF in schemas instead of -1 * Handle and parse INF as a special value in XML Factory
author IBBoard <dev@ibboard.co.uk>
date Thu, 19 Mar 2009 20:11:07 +0000
parents b28be912adab
children a5855fcd75ab
comparison
equal deleted inserted replaced
37:465a215a21a2 38:548cfc776f54
83 public int MaxSize 83 public int MaxSize
84 { 84 {
85 get { return maxSize; } 85 get { return maxSize; }
86 set 86 set
87 { 87 {
88 maxSize = (value >= -1 ? value : -1); 88 maxSize = (value >= 0 ? value : WarFoundryCore.INFINITY);
89 CheckMinimumSize(); 89 CheckMinimumSize();
90 } 90 }
91 } 91 }
92 92
93 public int BaseSize 93 public int BaseSize
108 public int MaxNumber 108 public int MaxNumber
109 { 109 {
110 get { return max; } 110 get { return max; }
111 set 111 set
112 { 112 {
113 max = (value >= -1 ? value : -1); 113 max = (value >= 0 ? value : WarFoundryCore.INFINITY);
114 CheckMinimumNumber(); 114 CheckMinimumNumber();
115 } 115 }
116 } 116 }
117 117
118 private void CheckMinimumNumber() 118 private void CheckMinimumNumber()
119 { 119 {
120 if (MinNumber > MaxNumber && MaxNumber!=-1) 120 if (MinNumber > MaxNumber && MaxNumber!=WarFoundryCore.INFINITY)
121 { 121 {
122 MinNumber = MaxNumber; 122 MinNumber = MaxNumber;
123 LogNotifier.WarnFormat(GetType(), "Unit type {0} ({1}) had a minimum number greater than their maximum number.", Name, ID); 123 LogNotifier.WarnFormat(GetType(), "Unit type {0} ({1}) had a minimum number greater than their maximum number.", Name, ID);
124 } 124 }
125 } 125 }
126 126
127 private void CheckMinimumSize() 127 private void CheckMinimumSize()
128 { 128 {
129 if (MinSize > MaxSize && MaxSize!=-1) 129 if (MinSize > MaxSize && MaxSize!=WarFoundryCore.INFINITY)
130 { 130 {
131 MinSize = MaxSize; 131 MinSize = MaxSize;
132 LogNotifier.WarnFormat(GetType(), "Unit type {0} ({1}) had a minimum size greater than their maximum size.", Name, ID); 132 LogNotifier.WarnFormat(GetType(), "Unit type {0} ({1}) had a minimum size greater than their maximum size.", Name, ID);
133 } 133 }
134 } 134 }