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

Save games should save pending purchase selections #11819 #12084

Conversation

zemjak
Copy link
Contributor

@zemjak zemjak commented Nov 7, 2023

Hi, I hope it works, I tried it on several games - I got to the purchase phase and saved the game... reloaded it again from the file and the data was loaded correctly. Then I tried to play the game further and get into another purchase phase to see if saving to file doesn't affect other purchase phases and actually it does not affect them.

@CLAassistant
Copy link

CLAassistant commented Nov 7, 2023

CLA assistant check
All committers have signed the CLA.

@asvitkine asvitkine self-requested a review November 8, 2023 18:42
Copy link
Contributor

@asvitkine asvitkine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this. I think this is very promising, but I have a few suggestions.

@@ -191,6 +197,7 @@ public void performDone() {
}
}
}
getData().setPendingProductionRules(null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're only relying on clearing this from PurchasePanel, it means it won't work if you load a save game from a human player and then change that player to AI and another player to human before starting, since I assume it won't run this code.

If this is moved to PurchaseDelegete, then I think this likely won't have the problem if this is put in end(). But you should test.

@asvitkine
Copy link
Contributor

Hey, just wanted to ask if you saw my review comments and suggestions? I think it would be great to get this improvement landed so let me know if anything I said is unclear. Once you updated the PR, happy to take another look!

@zemjak
Copy link
Contributor Author

zemjak commented Nov 18, 2023

Hello, yes, your recommendations are quite clear to me, I have already managed to implement some of them, I still need to check locally if it will work in all cases. I will try to push the code in 2 days at the latest.

@zemjak
Copy link
Contributor Author

zemjak commented Nov 23, 2023

Hi, I'm sorry for waiting.. I tried to implement your suggestions mainly in class PurchaseDelegate.. maybe I should have used GameData.Unlocker as you recommended (in PurchasePanel class), but I was mainly inspired by usage of PoliticsDelegate class in AbstractAi class - where is not used that (un)lock. I hope that it is getting closer to the result we wanted.

Copy link
Contributor

@asvitkine asvitkine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks reasonable, I think.

Signed-off-by: Marek Kurej <[email protected]>
@zemjak
Copy link
Contributor Author

zemjak commented Nov 24, 2023

You are right with that condition, I'm gonna remove it.

@asvitkine asvitkine merged commit 3bd2d4a into triplea-game:master Nov 24, 2023
1 check passed
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

Successfully merging this pull request may close these issues.

3 participants