comparison API/Objects/GameSystem.cs @ 421:b622937ac879

Fixes #362: Files fail to complete loading in GTK# UI (IBDev) * Change GameSystem hashcode to rely on unchanging values
author IBBoard <dev@ibboard.co.uk>
date Wed, 28 Sep 2011 20:33:10 +0100
parents 71fceea2725b
children
comparison
equal deleted inserted replaced
420:22561233df69 421:b622937ac879
236 } 236 }
237 } 237 }
238 238
239 public override int GetHashCode() 239 public override int GetHashCode()
240 { 240 {
241 return ID.GetHashCode() + Name.GetHashCode() + GetCategoryHash() + warnOnError.GetHashCode(); 241 return ID.GetHashCode() + Name.GetHashCode();
242 }
243
244 private int GetCategoryHash()
245 {
246 int hash = 0;
247
248 foreach (Category cat in RawCategories.Values)
249 {
250 hash += cat.ID.GetHashCode();
251 }
252
253 return hash;
254 } 242 }
255 243
256 public bool UnitTypeMaxed(UnitType unitType, Army army) 244 public bool UnitTypeMaxed(UnitType unitType, Army army)
257 { 245 {
258 return unitType.MaxNumber != WarFoundryCore.INFINITY && army.GetUnitTypeCount(unitType) >= unitType.MaxNumber; 246 return unitType.MaxNumber != WarFoundryCore.INFINITY && army.GetUnitTypeCount(unitType) >= unitType.MaxNumber;