Skip to content

Commit

Permalink
Fix berry checkpoint reassignment if first checkpoint has no berries
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalobi committed Feb 20, 2024
1 parent d3cab63 commit adc2719
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Celeste.Mod.mm/Mod/Core/CoreMapDataProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,12 @@ public override void Reset() {
// assign berries with invalid checkpoint ID to final checkpoint
if (checkpoint > Checkpoint) {
Logger.Log(LogLevel.Warn, "core", $"Invalid checkpoint ID {checkpoint} for berries in map {Mode.Path}. Reassigning to last checkpoint.");
int order = MaximumBerryOrderPerCheckpoint.GetValueOrDefault(Checkpoint, -1);
foreach (var placedBerry in placedBerries.OrderBy(kv => kv.Key)) {
BinaryPacker.Element berry = placedBerry.Value;
berry.SetAttr("checkpointID", Checkpoint);
berry.SetAttr("order", MaximumBerryOrderPerCheckpoint[Checkpoint] + 1);
MaximumBerryOrderPerCheckpoint[Checkpoint]++;
berry.SetAttr("order", order + 1);
order++;
}
}
}
Expand Down

0 comments on commit adc2719

Please sign in to comment.