-
Notifications
You must be signed in to change notification settings - Fork 105
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
12632 - Broaden search for "solo" PlayerSide. #12636
Changes from 9 commits
fba93fc
583e6eb
903d382
b9be8a5
85ca949
f5bc754
1a9056b
843c2e8
6b4a330
b9005f7
65da192
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -622,13 +622,36 @@ protected boolean allSidesAllocated() { | |
|
||
/** | ||
* @param side Name of a side to see if it's a "solo side" | ||
* @return True if the side is "Solitaire", "Solo", "Moderator", or "Referee" | ||
* @return True if the side is "Solo" or begins "Solitaire", "Solo:", "Moderator", "Referee" or a Side | ||
* found in the Global Translatable Message Property: VassalSkipSideList (a comma-separated list). | ||
* To test specifically for Referee/Moderator, use isRefereeSide() | ||
*/ | ||
public static boolean isSoloSide(String side) { | ||
return Resources.getString("PlayerRoster.solitaire").equals(side) || | ||
Resources.getString("PlayerRoster.solo").equals(side) || | ||
Resources.getString("PlayerRoster.moderator").equals(side) || | ||
Resources.getString("PlayerRoster.referee").equals(side); | ||
// FIXME: A future version of Vassal may provide a Side Type attribute in Definition of Sides that would allow this function to be rationalised. | ||
// See also isRefereeSide() | ||
return side.startsWith(Resources.getString("PlayerRoster.solitaire")) || | ||
side.equals(Resources.getString("PlayerRoster.solo")) || | ||
side.startsWith(Resources.getString("PlayerRoster.solo") + ":") || | ||
side.startsWith(Resources.getString("PlayerRoster.moderator")) || | ||
side.startsWith(Resources.getString("PlayerRoster.referee")) || | ||
side.startsWith(Resources.getString("PlayerRoster.auxiliarySidePrefix")) || // auxiliary side prefix | ||
side.startsWith(SOLITAIRE) || // these checks needed in case a translated module has not localised these side names | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these really needed? If a translated module hasn't localized the side names don't they come through in English anyway? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the actual problem is in the ChessClock which calling isSoloSide with the translated Sides, it should be checking untranslated sides, but displaying translated sides, The concern is that ChessClocks now have translated sides recorded in them?, they should be untranslated sides. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @BrentEaston So you think this usage is okay? Also are you okay with the various changes to "startsWith"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @BrentEaston And we're comparing both Resources.getString("Some String") and the literal "Some String" in here. Surely only one is right? Or is one way being left in because ChessClock is broken? (are other things broken too?) |
||
side.startsWith(SOLO) || | ||
side.startsWith(SOLO + ":") || | ||
side.startsWith(MODERATOR) || | ||
side.startsWith(REFEREE); | ||
} | ||
|
||
/** | ||
* @param side Name of a side to see if it's a "referee side" | ||
* @return True if the side is begins "Moderator" or "Referee" | ||
* To test for non-player sides in general, use isSoloSide() | ||
*/ | ||
public static boolean isRefereeSide(String side) { | ||
return side.startsWith(Resources.getString("PlayerRoster.moderator")) || | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again I'm fuzzy on the change to startsWith and also the need to compare to the raw strings There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The raw strings comparison arises from a concern that I have about this along the following lines...
Have I got that right? |
||
side.startsWith(Resources.getString("PlayerRoster.referee")) || | ||
side.startsWith(MODERATOR) || // these checks needed for a translated module has not localised these side names | ||
side.startsWith(REFEREE); | ||
} | ||
|
||
/** | ||
|
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.
Why "startsWith" here where it used to only check equals? Are we expecting "Moderator Left" and "Moderator Right"?
If so, why are we requiring a different format here from Solo (where it requires the colon e.g. "Solo:")? And for that matter why do we only eg allow "Solo:" and not "Solitaire:"
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.
My thinking on prefixes (startsWith) is to allow more options for filtering out Solitaire or Referee sides. I think multiple moderator sides is a possibility but mainly it didn't seem harmful to allow this.
I introduced "Solo:" specifically because "Solo" prefix has the remote possibility of conflicting with an actual side name. I could use this to enable choosing one of 3 solo modes directly from the side selection phase.