public void RemoveOneMemoryOfDef(ThoughtDef thoughtDef, ref int count) { if (count <= 0) { return; } for (int i = 0; i < Memories.Memories.Count; i++) { if (!(Memories.Memories[i] is Thought_Wish)) { continue; } Thought_Wish thought_Memory = (Thought_Wish)Memories.Memories[i]; if (thought_Memory.def == thoughtDef && thought_Memory.CurStageIndex == TierIndex) { if (thought_Memory.fromWish != def) { continue; } Memories.RemoveMemory(thought_Memory); count--; return; } } Log.Warning("HDream : try to remove a thougth of def :" + thoughtDef.label + " for wish : " + def.label + " but no thought of that def was found for pawn : " + pawn.Label + ""); count = 0; }