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
Add isDefaultAI and isNonPlayable Player Attributes #1824
Conversation
@@ -81,6 +81,8 @@ | |||
name ID #REQUIRED | |||
optional (true | false) 'false' | |||
canBeDisabled (true | false) 'false' | |||
isDefaultAI (true | false) 'false' | |||
isNonPlayable (true | false) 'false' |
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.
Looking at isNonPlayable
in conditionals, we use it three times in this branch, twice negated and once not, eg: https://github.com/triplea-game/triplea/pull/1824/files#diff-b161056da98b1007729f14654e98597bR466
!isNonPlayable
seems like a double negation. Thinking about alternatives to avoid the double negation, I see that we need the default value to be 'false'. How about 'hiddenPlayer' instead of 'isNonPlayable'.
!isHiddenPlayer
IMO is a bit easier to grok by avoiding the double negation problem of !isNonPlayable
.
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.
Updated both property names.
@@ -13,6 +13,8 @@ | |||
private static final long serialVersionUID = -2284878450555315947L; | |||
private final boolean m_optional; | |||
private final boolean m_canBeDisabled; | |||
private final boolean isDefaultAi; | |||
private final boolean isNonPlayable; |
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.
Just want to confirm that this will not break save game compatibility... As both of these fields will not exist in an old save game, they will not be set when deserializing a PlayerID
, and they will retain their default false
value. Thus, they will match the default values used in the two-arg constructor, and everything should just work, right?
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.
Correct.
Add 2 new game.xml player attribute:
Example:
<player name="Pro-Axis-Neutral" optional="true" isDefaultAI="true" isNonPlayable="true"/>