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

Custom ScenarioObjectives do not change ScenarioStatus in ResolveScenarioWizardDialog #3949

Closed
AaronGullickson opened this issue Apr 1, 2024 · 0 comments · Fixed by #3950
Assignees
Labels

Comments

@AaronGullickson
Copy link
Member

Currently, if you have a custom objective, you need to check manually in the ResolveScenarioWizardDialog whether you completed it or not. However, doing so does not change the current victory status in the final panel, like other objectives. There appears to be two reasons that I can see for this. First, in ScenarioObjectiveProcessor.determineScenarioStatus, you find the following code:

            // some objectives aren't associated with units and their completion is set manually
            // in that case, we continue on
            if (!objectiveUnitCounts.containsKey(objective)) {
                continue;
            }

This kicks out custom objectives right from the get go despite the fact that this method reads in a Map<ScenarioObjective, Boolean> objectiveOverrides object that is supposed to handle this issue with code below this continue check:

     boolean objectiveMet = (objectiveOverrides.containsKey(objective) && objectiveOverrides.get(objective) != null) ?
                objectiveOverrides.get(objective) : objectiveMet(objective, objectiveUnitCounts.get(objective));

This code is unreachable for custom objectives even though the objectiveOverrides object is explicitly designed for custom objectives.

However, here we hit the second issue. The ScenarioObjectiveProcessor.determineScenarioStatus method is only called two places in ResolveScenarioWizardDialog and in both places it reads in an empty HashMap for that object. There is in fact no tracking of HashMap of the needed kind in ResolveScenarioWizardDialog. What is tracked is a Hashmap of check buttons that could be turned into the appropriate output. So it looks like an incomplete project?

@AaronGullickson AaronGullickson self-assigned this Apr 1, 2024
AaronGullickson added a commit to AaronGullickson/mekhq that referenced this issue Apr 1, 2024
AaronGullickson added a commit that referenced this issue Apr 3, 2024
…olution

Fix #3949: Custom ScenarioObjectives do not change ScenarioStatus in ResolveScenarioWizardDialog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant