[A16] Invisible thoughts in the Needs tab still stretch out the scroll view

Started by System.Linq, January 28, 2017, 01:56:51 AM

Previous topic - Next topic

System.Linq


if (!leadingThoughtInGroup.VisibleInNeedsTab)
{
NeedsCardUtility.thoughtGroup.Clear();
return false;
}



if (NeedsCardUtility.DrawThoughtGroup(rect, NeedsCardUtility.thoughtGroupsPresent[i], pawn))
{
num += 24f;
}


These two blocks of code in NeedsTabUtility are intended to prevent thoughts that aren't actually visible (like social memories) from being displayed. However, because the height of the Rect doesn't take this into account (float height = (float)NeedsCardUtility.thoughtGroupsPresent.Count * 24f;), it doesn't work properly, and those thoughts still result in this:



I recommend that PawnNeedsUIUtility.GetThoughtGroupsInDisplayOrder simply discard them instead.


public static void GetThoughtGroupsInDisplayOrder(Need_Mood mood, List<Thought> outThoughtGroupsPresent)
{
outThoughtGroupsPresent.Clear();
outThoughtGroupsPresent.AddRange(mood.thoughts.DistinctThoughtGroups().Where(t => t.VisibleInNeedsTab));
outThoughtGroupsPresent.SortByDescending((Thought th) => mood.thoughts.MoodOffsetOfThoughtGroup(th));
}