Skip to content

Commit fecf244

Browse files
Fixed index error when loading custom challenges
1 parent 8106b43 commit fecf244

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

InscryptionAPI/Ascension/AscensionChallengePaginator.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public void AddPage(List<AscensionChallengeInfo> challengeInfos)
7979
int numBossesAdded = 0;
8080

8181
// 14 = regular + boss * 2
82-
//Debug.Log($"NumIcons for Page: {numIcons}: {regularChallengeInfos.Count} {bossChallengeInfos.Count} | {bossStartingIndex}");
82+
//Debug.Log($"NumIcons for Page: {numIcons}: {regularChallengeInfos.Count} {numBosses} | {bossStartingIndex}");
8383

8484
for (int i = 0; i < 14; i++)
8585
{
@@ -88,7 +88,7 @@ public void AddPage(List<AscensionChallengeInfo> challengeInfos)
8888
int columnIndex = i % 7;
8989
//Debug.Log($"{i} ({columnIndex}) | {bossStartingIndex + numBosses} / {bossStartingIndex}");
9090

91-
if (columnIndex >= bossStartingIndex && columnIndex < bossStartingIndex + numBosses)
91+
if (numBosses > 0 && columnIndex >= bossStartingIndex && columnIndex < bossStartingIndex + numBosses)
9292
{
9393
//Debug.Log($"In boss column {i}");
9494
if (numBossesAdded < numBosses)
@@ -125,11 +125,11 @@ public void AddPage(List<AscensionChallengeInfo> challengeInfos)
125125
int infoCount = challengeInfos.Count;
126126
for (int i = 0; i < newPage.Count; i++)
127127
{
128-
AscensionChallengeInfo info = challengeInfos[infoIdx];
129128
AscensionIconInteractable interactable = newPage[i].GetComponent<AscensionIconInteractable>();
130-
//Debug.Log($"Checking icon [{i}] info at {infoIdx} : {info.title}");
129+
//Debug.Log($"Checking icon [{i}] info at {infoIdx} : ({infoCount}) ({newPage.Count})");
131130
if (i < infoCount)
132131
{
132+
AscensionChallengeInfo info = challengeInfos[infoIdx];
133133
// if we're assigning boss info to an icon that isn't a boss icon
134134
if (info.GetFullChallenge().Boss && (interactable.coll2D as BoxCollider2D).size.y < 1f)
135135
{
@@ -146,6 +146,7 @@ public void AddPage(List<AscensionChallengeInfo> challengeInfos)
146146
}
147147
else
148148
{
149+
//Debug.Log("Missing challenge");
149150
interactable.challengeInfo = missingChallengeInfo;
150151
newPage[i].AddComponent<NoneChallengeDisplayer>();
151152
}

0 commit comments

Comments
 (0)