Skip to content

Refactor the findUsers code to be less ******* stateful #34

@fmstephe

Description

@fmstephe

Right now we initiate an invitation by first initialising all the variables required to make a game and storing them in some globals. When an invitation is received we store the inited variables (from the invite message) in the same globals. If a game is accepted then these globals are read by both users and a game is started.

This is stupid.

We should simply make an invitation. If the invitation is accepted then the inviter will init some global variables and send them in a gegin-game message. When the accepting user receives the begin-game message it simply begins the game. This removes all the horrible globals and their management.

One issue that may come up with a refactoring like this is that we will get a number of race conditions (mostly with the accepting user). Therefore the turnQ variable may have to stay. We'll see.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions