Skip to content

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

@nullorvoid

Description

@nullorvoid

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions