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

Making peace and breaking alliances does not clear settings #1

Open
phkb opened this issue Aug 24, 2023 · 2 comments
Open

Making peace and breaking alliances does not clear settings #1

phkb opened this issue Aug 24, 2023 · 2 comments

Comments

@phkb
Copy link

phkb commented Aug 24, 2023

The functions to make peace (DayDiplomacy_040_WarEngine._makePeace) and break an alliance (DayDiplomacy_040_WarEngine._breakAlliance) do not work in their current form. This is because they are missing the second component of the lookup when checking for a "1" or a "-1".
So, lines 151-152 read

    a[aSystemId] && a[aSystemId] === 1 && (delete a[aSystemId][anotherSystemId]); // Breaking alliance
    a[anotherSystemId] && a[anotherSystemId] === 1 && (delete a[anotherSystemId][aSystemId]); // Breaking alliance

and lines 185-186 read

    a[aSystemId] && a[aSystemId] === -1 && (delete a[aSystemId][anotherSystemId]); // Making peace
    a[anotherSystemId] && a[anotherSystemId] === -1 && (delete a[anotherSystemId][aSystemId]); // Making peace

The second statement in all those lines needs an addition component, because the 1 and -1 are set against the opposing system. So, instead, they should look like this:

    a[aSystemId] && a[aSystemId][anotherSystemId] === 1 && (delete a[aSystemId][anotherSystemId]); // Breaking alliance
    a[anotherSystemId] && a[anotherSystemId][aSystemId] === 1 && (delete a[anotherSystemId][aSystemId]); // Breaking alliance
    a[aSystemId] && a[aSystemId][anotherSystemId] === -1 && (delete a[aSystemId][anotherSystemId]); // Making peace
    a[anotherSystemId] && a[anotherSystemId][aSystemId] === -1 && (delete a[anotherSystemId][aSystemId]); // Making peace
@DaymareOn
Copy link
Owner

After reviewing, you're right.
Did you test on your system?

@phkb
Copy link
Author

phkb commented Mar 2, 2024

I did - it stopped a constant cycle of war declarations. If only world peace was as easy to achieve!

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

No branches or pull requests

2 participants