Split matchmaker.Process into smaller functions for readability #943
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
matchmaker.Process was one big hard to follow function. This PR attempts to extract isolated pieces of logic into own function.
It is probably best to review on commit by commit basis, rather than in PR diff interface.
All commits except last two are either trivial changes or result of IDE's refactor tool, so very mechanical in essence and chance of introducing bugs is minimal. Only manual input required in these refactors was to bubble up
break
/continue
control statements from within function via bool return param.Last two commits are more substantial:
ccf77ab (and preceeding 8de9f0f): unifies conflict check between indexes. We have 3 conflicts checks: hit -> current index, each combo entry -> hit and hit -> each combo entry. All three are now done with the same function accepting 2 indexes and a boolean flag to check whether reverse conflict check is required.
19b9ecf : atomic unit of matchmaking is matchmaking index, but MM logic used to operate on entries, which required converting to index in multiple places. This commits makes MM loop to operate on indexes, producing final entries only at the very end.