-
Notifications
You must be signed in to change notification settings - Fork 291
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
Facilitating other game types: disconnecting Force and Entity #4094
Conversation
# Conflicts: # megamek/src/megamek/client/ui/swing/PlayerListDialog.java # megamek/src/megamek/common/Mech.java # megamek/src/megamek/common/SmallCraft.java # megamek/src/megamek/common/Tank.java # megamek/src/megamek/common/weapons/MissileWeaponHandler.java
Codecov ReportBase: 22.95% // Head: 23.01% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #4094 +/- ##
============================================
+ Coverage 22.95% 23.01% +0.06%
- Complexity 4816 4817 +1
============================================
Files 2277 2280 +3
Lines 250300 249555 -745
Branches 46373 46282 -91
============================================
- Hits 57463 57444 -19
+ Misses 191385 190660 -725
+ Partials 1452 1451 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.
# Conflicts: # megamek/src/megamek/client/ui/swing/PlayerListDialog.java
This PR has no visible results but tries to form the code to facilitate other types of game than the TW game we have now for some unforeseeable future when someone wants to implement MegaSBF or something.
So, the main goal of this PR is to allow other types of unit than Entity to be held in an MM Force because a Force is mostly a list of IDs and there's no reason not to be able to put Alpha Strike Elements or anything else in it. To do this, an interface ForceAssignable is added. To give this a bit of useful structure and relieve the unit classes of utility method code while actually adding utility some more interfaces are added:
In addition, the IGame interface is slightly extended with a few methods that I expect every type of game would use and an AbstractGame base implementation to IGame is added that removes the unit, player and team list management from Game (which could be renamed TWGame but I kept myself from doing that for now). AbstractGame also makes use of the new interfaces by keeping not a Map of ID to Entity but ID to InGameObject.
Finally this removes a small piece of code from Team to make it more or less fully game-type agnostic. Also removed is some old Enumeration-style code.
My hope would be that while Game/GameManager are (and should remain) TW-specific, Player, Team, Force, ideally ChatLounge=Lobby, Server and (maybe) Princess should be game-type agnostic thus make no reference to Entity and Game, rather use InGameObject and IGame.