comparison api/Objects/UnitEquipmentItem.cs @ 184:cedf8bba1d52

Re #198: Add equipment slots * Alter handling of setting one limit and other limit matching by checking on Get instead of Set
author IBBoard <dev@ibboard.co.uk>
date Tue, 27 Oct 2009 20:09:40 +0000
parents 36adabb1c3ea
children 12aa4b76d24e
comparison
equal deleted inserted replaced
183:36adabb1c3ea 184:cedf8bba1d52
133 /// </summary> 133 /// </summary>
134 public AbstractLimit MinLimit 134 public AbstractLimit MinLimit
135 { 135 {
136 get 136 get
137 { 137 {
138 return (minLimit == null ? new UnlimitedLimit() : minLimit); 138 AbstractLimit limit = minLimit;
139
140 if (limit == null)
141 {
142 if (maxLimit != null)
143 {
144 limit = maxLimit;
145 }
146 else
147 {
148 limit = new UnlimitedLimit();
149 }
150 }
151
152 return limit;
139 } 153 }
140 set 154 set
141 { 155 {
142 if (value != null) 156 if (value != null)
143 { 157 {
144 minLimit = value; 158 minLimit = value;
145
146 if (maxLimit == null)
147 {
148 maxLimit = minLimit;
149 }
150 } 159 }
151 } 160 }
152 } 161 }
153 162
154 /// <summary> 163 /// <summary>
156 /// </summary> 165 /// </summary>
157 public AbstractLimit MaxLimit 166 public AbstractLimit MaxLimit
158 { 167 {
159 get 168 get
160 { 169 {
161 return (maxLimit == null ? new UnlimitedLimit() : maxLimit); 170 AbstractLimit limit = maxLimit;
171
172 if (limit == null)
173 {
174 if (minLimit != null)
175 {
176 limit = minLimit;
177 }
178 else
179 {
180 limit = new UnlimitedLimit();
181 }
182 }
183
184 return limit;
162 } 185 }
163 set 186 set
164 { 187 {
165 if (value != null) 188 if (value != null)
166 { 189 {
167 maxLimit = value; 190 maxLimit = value;
168
169 if (minLimit == null)
170 {
171 minLimit = maxLimit;
172 }
173 } 191 }
174 } 192 }
175 } 193 }
176 194
177 public EquipmentItem EquipmentItem 195 public EquipmentItem EquipmentItem