Skip to content

Commit

Permalink
Merge pull request #14241 from smoogipoo/fix-osu-editor-exception
Browse files Browse the repository at this point in the history
Fix out-of-order hits in editor causing exceptions
  • Loading branch information
peppy committed Aug 12, 2021
2 parents 448b66f + ee4fc04 commit 054e0e8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
5 changes: 5 additions & 0 deletions osu.Game.Rulesets.Osu/Edit/DrawableOsuEditorRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ private class OsuEditorPlayfield : OsuPlayfield

protected override GameplayCursorContainer CreateCursor() => null;

public OsuEditorPlayfield()
{
HitPolicy = new AnyOrderHitPolicy();
}

[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Expand Down
22 changes: 22 additions & 0 deletions osu.Game.Rulesets.Osu/UI/AnyOrderHitPolicy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI;

namespace osu.Game.Rulesets.Osu.UI
{
/// <summary>
/// An <see cref="IHitPolicy"/> which allows hitobjects to be hit in any order.
/// </summary>
public class AnyOrderHitPolicy : IHitPolicy
{
public IHitObjectContainer HitObjectContainer { get; set; }

public bool IsHittable(DrawableHitObject hitObject, double time) => true;

public void HandleHit(DrawableHitObject hitObject)
{
}
}
}

0 comments on commit 054e0e8

Please sign in to comment.