fa
fa copied to clipboard
Refactor draw functionality
Description of the proposed changes
The current code has a flaw and a bug in it:
- Flaw: the vote does not expire. If you offer it at the start of the game and forget about it then your opponent can 'randomly' draw the game later.
- Bug: it relies on a user input to determine what army we make the draw offer for. It uses
OkayToMessWithArmyto validate the army. This does not work in union mode. In union mode you can technically forfeit for other, allied armies.
We try to fix both issues with these changes. I took the route to refactor it into a separate component. The implementation is quite simple. It's not a huge refactor.
Testing done on the proposed changes
Start a game of 4 players with 2 teams and validate whether the game draws.
Additional context
A few things that we may want to add:
- [ ] A message when the draw offer expired.
- [ ] The 'Draw' button needs to uncheck when the draw offer expires.
Checklist
- [x] Changes are annotated, including comments where useful
- [ ] Changes are documented in a changelog snippet according to the guidelines.
- [ ] Request 2-3 reviewers from the list of reviewers and their areas of knowledge.