-
Notifications
You must be signed in to change notification settings - Fork 391
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
Only skip giveUnitControl if the value is false or true #8023
Changes from 1 commit
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 |
---|---|---|
|
@@ -55,7 +55,9 @@ public String mapPropertyName(final String propertyName) { | |
return propertyName; | ||
} | ||
|
||
static boolean ignoreOptionName(final String name) { | ||
return name.equalsIgnoreCase("takeUnitControl") || name.equalsIgnoreCase("giveUnitControl"); | ||
static boolean ignoreOptionName(final String name, final String value) { | ||
return name.equalsIgnoreCase("takeUnitControl") | ||
|| (name.equalsIgnoreCase("giveUnitControl") | ||
&& (value.equals("false") || value.equals("true"))); | ||
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 you positive that 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.
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. Considering we just had a NPE in I wonder if there is any type of test coverage around this at all that could/should be updated. 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. Hmm, I may be wrong about the DTD previously requiring a specific value, I'm not sure if it can constrain attribute values vs just requiring them being there. Regardless, it is context dependent if we can expect a value. 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. Good point on the NPE. It will now skip There is some test coverage but it requires creating a brand new xml with these attributes in it. I'm looking at if there is a way to be able to create the xml in memory instead of committing the xml as a resource. 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. If we can get away from XMLs for testing, that would be excellent. The decoupling of XML parsing from the semantic data parsing into GameData was meant to help with this. One should be able to set up a |
||
} | ||
} |
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.
Would you mind explaining why this if block is moved down @trevan ?
If we are going to ignore an option, why should we execute
option.getValue()
oroption.getCount()
, wouldn't those just be dead stores?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.
I moved it because I needed access to
option.getValue()
and I thought it would make more sense to use the local variablevalue
that was going to be created vs passing inoption.getValue()
. But I can move it back up and pass inoption.getValue()
.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.
The local variable IMO is legacy, it's an unnecessary intermediate variable. This class in general followed a C++ pattern (if not older actually, maybe a C pattern or even Pascal) to declar all local variables at the beginning of a method. IMO all usages of 'value' probably should just get inlined.
I did not spot you were using the
value
variable. That answers my question.