Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TileChangeManager.cs : How to break out when executing solvers #9

Open
nullorvoid opened this issue Aug 15, 2016 · 0 comments
Open
Labels

Comments

@nullorvoid
Copy link
Contributor

nullorvoid commented Aug 15, 2016

I think we should edit this to be the other way around, so that the solvers returned if they handle is correctly. We can either do this, or have an output doBreak bool to the solve method, so firstly we know if the solver actually executed and the second whether the solver wants us to break from all other solvers.

Something like:

private void ExecuteSolvers(IEntity entity, TileChangedArgs e)
{
    foreach (ISolver solver in solvers)
    {
        bool dobreak;
        solver.Solve(entity, e, doBreak);

        if (doBreak)
        {
            break;
        }
    }
}

We could also have the return value still to do any logging, or other business that is required.

We also need to have tests written for this.

Ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant