private static void addUnique(NounVerbCase nvc, List <NounVerbCase> nvcs, bool isAll) { for (int i = 0; i < nvcs.Count; i++) { if (nvcs[i].Noun == nvc.Noun && nvcs[i].Verb == nvc.Verb) { // the "ALL" case seems to be like an "else", where // it is overridden if there are other valid cases. // So since we already have a valid case, ignore this one if it's "ALL". if (isAll) { return; } // compare priorities and keep the higher of the two int oldPriority = CaseUtils.GetCasePriority(nvcs[i].CaseType); int newPriority = CaseUtils.GetCasePriority(nvc.CaseType); if (newPriority > oldPriority) { nvcs[i] = nvc; } return; } } // still here? must be a new case. nvcs.Add(nvc); }
private void add(NounVerbCase nvc) { // apparently GK3 mostly prioritizes NVCs alphabetically // by case, and sometimes that affects which action plays // when the player uses a noun/verb combo. for (int i = 0; i < _nvcs.Count; i++) { if (string.Compare(nvc.Case, _nvcs[i].Case, true) < 0) { _nvcs.Insert(i, nvc); return; } } // still here? add normally _nvcs.Add(nvc); }