Skip to content

Commit bde60ae

Browse files
committed
Only compute shouldDisplaySpeedBerryColumn once
1 parent b05c6a8 commit bde60ae

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

UI/OuiJournalCollabProgressInLobby.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ private static bool shouldDisplaySpeedBerryColumn(string levelSet) {
6868
}
6969

7070
public static List<OuiJournalCollabProgressInLobby> GeneratePages(OuiJournal journal, string levelSet, bool showOnlyDiscovered) {
71+
bool displaySpeedBerryColumn = shouldDisplaySpeedBerryColumn(levelSet);
72+
7173
List<OuiJournalCollabProgressInLobby> pages = new List<OuiJournalCollabProgressInLobby>();
7274
int rowCount = 0;
7375

@@ -215,7 +217,7 @@ public static List<OuiJournalCollabProgressInLobby> GeneratePages(OuiJournal jou
215217
row.Add(new IconCell("dot"));
216218
}
217219

218-
if (shouldDisplaySpeedBerryColumn(levelSet)) {
220+
if (displaySpeedBerryColumn) {
219221
if (CollabMapDataProcessor.SpeedBerries.TryGetValue(item.GetSID(), out CollabMapDataProcessor.SpeedBerryInfo speedBerryInfo)
220222
&& CollabModule.Instance.SaveData.SpeedBerryPBs.TryGetValue(item.GetSID(), out long speedBerryPB)) {
221223

UI/OuiJournalCollabProgressInOverworld.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ private static bool shouldDisplaySpeedBerryColumn() {
6666
public OuiJournalCollabProgressInOverworld(OuiJournal journal)
6767
: base(journal) {
6868

69+
bool displaySpeedBerryColumn = shouldDisplaySpeedBerryColumn();
70+
6971
PageTexture = "page";
7072
table = new Table()
7173
.AddColumn(new TextCell(Dialog.Clean("journal_progress"), new Vector2(0f, 0.5f), 1f, Color.Black * 0.7f, 420f))
@@ -124,7 +126,7 @@ public OuiJournalCollabProgressInOverworld(OuiJournal journal)
124126
lobbyTotalTime += lobbyMap.TotalTimePlayed;
125127
lobbyAllMapsCompletedInSingleRun &= lobbyMap.Modes[0].SingleRunCompleted;
126128

127-
if (shouldDisplaySpeedBerryColumn()) {
129+
if (displaySpeedBerryColumn) {
128130
if (CollabMapDataProcessor.SpeedBerries.TryGetValue(lobbyMap.GetSID(), out CollabMapDataProcessor.SpeedBerryInfo mapSpeedBerryInfo)
129131
&& CollabModule.Instance.SaveData.SpeedBerryPBs.TryGetValue(lobbyMap.GetSID(), out long mapSpeedBerryPB)) {
130132

@@ -231,7 +233,7 @@ public OuiJournalCollabProgressInOverworld(OuiJournal journal)
231233
if (lobbyMapLevelSet == null) {
232234
row.Add(new TextCell("-", TextJustify, 0.5f, TextColor)).Add(null);
233235
} else if (lobbySpeedBerryLevel < 4) {
234-
if (shouldDisplaySpeedBerryColumn()) {
236+
if (displaySpeedBerryColumn) {
235237
row.Add(new TextCell(Dialog.Time(lobbySumOfBestTimes), TextJustify, 0.5f, getRankColor(lobbySpeedBerryLevel)));
236238
row.Add(new IconCell(getRankIcon(lobbySpeedBerryLevel)));
237239
sumOfBestTimes += lobbySumOfBestTimes;

0 commit comments

Comments
 (0)