-
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 6 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,27 @@ 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); | ||
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")) || | ||
("," + GameModule.getGameModule().getLocalizedProperty("VassalSkipSideList") + ",").contains("," + side + ","); | ||
} | ||
|
||
/** | ||
* @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")); | ||
} | ||
|
||
/** | ||
|
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.