Skip to content
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

Merged
merged 7 commits into from Jun 9, 2017

Conversation

ron-murhammer
Copy link
Member

Add 2 new game.xml player attribute:

  1. isDefaultAI - defaults to false, if true then sets player selection dropdown to Hard AI (replaces "AI" name prefix)
  2. isNonPlayable - defaults to false, if true sets player to Hard AI and doesn't display player on player selection screen as it isn't meant to be played

Example:
<player name="Pro-Axis-Neutral" optional="true" isDefaultAI="true" isNonPlayable="true"/>

@@ -81,6 +81,8 @@
name ID #REQUIRED
optional (true | false) 'false'
canBeDisabled (true | false) 'false'
isDefaultAI (true | false) 'false'
isNonPlayable (true | false) 'false'
Copy link
Member

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.

Copy link
Member Author

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;
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct.

@DanVanAtta DanVanAtta merged commit ccb6a56 into master Jun 9, 2017
@DanVanAtta DanVanAtta deleted the Update_AI_Bonus_Property_5 branch June 9, 2017 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants