void TrySetMatch(RaceMatch match, MatPairStruct mat) { if (creatureRaceList == null) { creatureRaceList = new Dictionary <MatPairStruct, RaceMatch>(); } if (creatureRaceList.ContainsKey(mat)) { if (creatureRaceList[mat].difference < match.difference) //overwrite existing exact matches { return; //the comparitor can be changed to <= if that behavior is not desired. } } creatureRaceList[mat] = match; }
void Setwords(string race, string caste, RaceMatch match) { if (caste == "*") { match.difference |= 1; foreach (var item in CreatureTokenList.CasteIDs.Values) { Setwords(race, item, match); } } else { if (CreatureTokenList.CasteIDs.ContainsKey(caste)) { Setwords(race, CreatureTokenList.CasteIDs[caste], match); } } }
void Setwords(string race, Dictionary <string, MatPairStruct> wordList, RaceMatch match) { if (race == "*") { match.difference |= 2; foreach (var item in wordList.Values) { TrySetMatch(match, item); } } else { if (wordList.ContainsKey(race)) { TrySetMatch(match, wordList[race]); } } }