-
Notifications
You must be signed in to change notification settings - Fork 73
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
Allow to offer a new pact after a pact duration has expired #1563
base: master
Are you sure you want to change the base?
Conversation
Thanks for the PR, looks good to me. I'd very much like to have a test case reproducing the bug first though. That would be best in https://github.com/Return-To-The-Roots/s25client/blob/master/tests/s25Main/integration/testPacts.cpp where you can simply add a new test based on one of the existing ones reproducing the buggy behavior. That test should fail without the fix and succeed afterwards. Feel free to push an incomplete solution and ask questions if you are stuck so we can help you. |
Thank you for answering. I have looked into it for an hour but it is not clear to me how the testing works. I have the following suggestion:
|
Are you willing to try and get a test working? If so I'd suggest the following thoughts:
I hope that makes sense. If you are not up to adding a test (I know it is some annoying work) then I can do that, but might be a couple days or so until I got the time. I'll then use your fix on top of that keeping your authorship of course |
Thank you. I will try to have a look into it once I find the time. Since I think about adding some functionality around the LUA interface, this task would be a good learning ground. |
Ok. I think this should more or less be it. Let me know what you think. Thank you for your detailed directions. This gave me a good understanding of how the testing works. |
You need to manually run them. When using make then Both need to be done after building. |
Thank you. Where do I run make test? I use the build setup for Windows like described in the readme.md
|
Seems you are not using "make" but Visual Studio so that doesn't apply
After building everything (I.e. build the "ALL_BUILD" target) "build" that "RUN_TEST". Simply right-click it and click "build" (or something like that) |
This is my first pull request. Please have mercy :D
GamePlayer::SuggestPact will not allow a request when pact.accepted = true
If you have a pact with a duration that has expired, accepted will never be reset. Just the duration will be set to 0.
I figured this would be the simplest way.
Please let me know if you need more stuff like testing. I am not familiar with that, so I would need more help on that.
A simple test map if it helps...
testpact.zip The AI sends a pact request and (if you accept) will send a new request as soon the previous pact expired.