Fix capitalization in Limit.

This commit is contained in:
Michael Pope 2015-06-11 13:30:18 +09:30 committed by Mike Pope
parent b728cf37d4
commit e59df08415
5 changed files with 82 additions and 43 deletions

View File

@ -20,7 +20,7 @@
In case of incompatible changes, please update version number and
XSD schema for validation.
-->
<freecol-specification id="classic" version="0.100">
<freecol-specification id="classic" version="0.101">
<!-- Modifiers that are not attached to other game object
types. They may be modified, but MUST NOT be removed. -->
@ -65,35 +65,35 @@
<events>
<event id="model.event.declareIndependence" score-value="100">
<limit id="model.limit.independence.rebels" operator="GE">
<leftHandSide scopeLevel="PLAYER" method-name="getSoL" />
<rightHandSide value="50" />
<limit id="model.limit.independence.rebels" operator="ge">
<left-hand-side scopeLevel="PLAYER" method-name="getSoL" />
<right-hand-side value="50" />
</limit>
<limit id="model.limit.independence.coastalColonies" operator="GT">
<leftHandSide operandType="SETTLEMENTS" scopeLevel="PLAYER"
method-name="isConnectedPort" method-value="true" />
<rightHandSide value="0" />
<limit id="model.limit.independence.coastalColonies" operator="gt">
<left-hand-side operandType="SETTLEMENTS" scopeLevel="PLAYER"
method-name="isConnectedPort" method-value="true" />
<right-hand-side value="0" />
</limit>
<limit id="model.limit.independence.year" operator="LE">
<leftHandSide operandType="YEAR" scopeLevel="GAME"/>
<rightHandSide operandType="OPTION" scopeLevel="GAME"
type="model.option.lastColonialYear"/>
<limit id="model.limit.independence.year" operator="le">
<left-hand-side operandType="YEAR" scopeLevel="GAME"/>
<right-hand-side operandType="OPTION" scopeLevel="GAME"
type="model.option.lastColonialYear"/>
</limit>
<ability id="model.ability.independenceDeclared" />
<ability id="model.ability.independentNation" />
</event>
<event id="model.event.spanishSuccession">
<limit id="model.limit.spanishSuccession.year" operator="GE">
<leftHandSide scopeLevel="GAME" operandType="YEAR"/>
<rightHandSide value="1600"/>
<limit id="model.limit.spanishSuccession.year" operator="ge">
<left-hand-side scopeLevel="GAME" operandType="YEAR"/>
<right-hand-side value="1600"/>
</limit>
<limit id="model.limit.spanishSuccession.weakestPlayer" operator="LT">
<leftHandSide scopeLevel="PLAYER" method-name="getSoL" />
<rightHandSide value="50" />
<limit id="model.limit.spanishSuccession.weakestPlayer" operator="lt">
<left-hand-side scopeLevel="PLAYER" method-name="getSoL" />
<right-hand-side value="50" />
</limit>
<limit id="model.limit.spanishSuccession.strongestPlayer" operator="GT">
<leftHandSide scopeLevel="PLAYER" method-name="getSoL" />
<rightHandSide value="50" />
<limit id="model.limit.spanishSuccession.strongestPlayer" operator="gt">
<left-hand-side scopeLevel="PLAYER" method-name="getSoL" />
<right-hand-side value="50" />
</limit>
</event>
</events>
@ -1681,9 +1681,9 @@
offence="0" defence="1" movement="6"
score-value="1" spaceTaken="12" space="2">
<required-goods id="model.goods.hammers" value="40"/>
<limit id="model.limit.wagonTrains" operator="LT">
<leftHandSide operandType="UNITS" scopeLevel="PLAYER" />
<rightHandSide operandType="SETTLEMENTS" scopeLevel="PLAYER" />
<limit id="model.limit.wagonTrains" operator="lt">
<left-hand-side operandType="UNITS" scopeLevel="PLAYER" />
<right-hand-side operandType="SETTLEMENTS" scopeLevel="PLAYER" />
</limit>
<ability id="model.ability.carryGoods" value="true"/>
<ability id="model.ability.canBeCaptured" value="true"/>

View File

@ -20,7 +20,7 @@
In case of incompatible changes, please update version number and
XSD schema for validation.
-->
<freecol-specification id="freecol" version="0.100" extends="classic">
<freecol-specification id="freecol" version="0.101" extends="classic">
<goods-types>
<goods-type id="model.goods.horses" is-farmed="false"

View File

@ -1041,19 +1041,34 @@
<xs:element name="limit">
<xs:complexType>
<xs:sequence>
<xs:element name="leftHandSide" type="OperandType" />
<xs:element name="rightHandSide" type="OperandType" />
</xs:sequence>
<xs:choice minOccurs="1" maxOccurs="1">
<xs:sequence>
<xs:element name="left-hand-side" type="OperandType" />
<xs:element name="right-hand-side" type="OperandType" />
</xs:sequence>
<!-- @compat 0.11.3 -->
<xs:sequence>
<xs:element name="leftHandSide" type="OperandType" />
<xs:element name="rightHandSide" type="OperandType" />
</xs:sequence>
<!-- end @compat 0.11.3 -->
</xs:choice>
<xs:attribute name="id" type="xs:string" />
<xs:attribute name="operator" use="required">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="lt"/>
<xs:enumeration value="le"/>
<xs:enumeration value="gt"/>
<xs:enumeration value="ge"/>
<xs:enumeration value="eq"/>
<!-- @compat 0.11.3 -->
<xs:enumeration value="LT"/>
<xs:enumeration value="LE"/>
<xs:enumeration value="GT"/>
<xs:enumeration value="GE"/>
<xs:enumeration value="EQ"/>
<!-- end @compat 0.11.3 -->
</xs:restriction>
</xs:simpleType>
</xs:attribute>

View File

@ -77,6 +77,7 @@
0.98: Fix capitalization in national settlement type.
0.99: Downcase disaster amount enum.
0.100: Fix capitalization in Nation.
0.101: Fix capitalization in Limit.
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:annotation>
@ -1011,19 +1012,32 @@
<xs:element name="limit">
<xs:complexType>
<xs:sequence>
<xs:element name="leftHandSide" type="OperandType" />
<xs:element name="rightHandSide" type="OperandType" />
</xs:sequence>
<xs:choice minOccurs="1" maxOccurs="1">
<xs:sequence>
<xs:element name="left-hand-side" type="OperandType" />
<xs:element name="right-hand-side" type="OperandType" />
</xs:sequence>
<xs:sequence>
<xs:element name="leftHandSide" type="OperandType" />
<xs:element name="rightHandSide" type="OperandType" />
</xs:sequence>
</xs:choice>
<xs:attribute name="id" type="xs:string" />
<xs:attribute name="operator" use="required">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="lt"/>
<xs:enumeration value="le"/>
<xs:enumeration value="gt"/>
<xs:enumeration value="ge"/>
<xs:enumeration value="eq"/>
<!-- @compat 0.11.3 -->
<xs:enumeration value="LT"/>
<xs:enumeration value="LE"/>
<xs:enumeration value="GT"/>
<xs:enumeration value="GE"/>
<xs:enumeration value="EQ"/>
<!-- end @compat 0.11.3 -->
</xs:restriction>
</xs:simpleType>
</xs:attribute>

View File

@ -83,9 +83,9 @@ public final class Limit extends FreeColGameObjectType {
*/
public Limit(String id, Operand lhs, Operator op, Operand rhs) {
setId(id);
leftHandSide = lhs;
rightHandSide = rhs;
operator = op;
this.leftHandSide = lhs;
this.rightHandSide = rhs;
this.operator = op;
}
@ -290,9 +290,13 @@ public final class Limit extends FreeColGameObjectType {
// Serialization
private static final String LEFT_HAND_SIDE_TAG = "leftHandSide";
private static final String LEFT_HAND_SIDE_TAG = "left-hand-side";
private static final String OPERATOR_TAG = "operator";
private static final String RIGHT_HAND_SIDE_TAG = "rightHandSide";
private static final String RIGHT_HAND_SIDE_TAG = "right-hand-side";
// @compat 0.11.3
private static final String OLD_LEFT_HAND_SIDE_TAG = "leftHandSide";
private static final String OLD_RIGHT_HAND_SIDE_TAG = "rightHandSide";
// end @compat 0.11.3
/**
@ -302,9 +306,7 @@ public final class Limit extends FreeColGameObjectType {
protected void writeAttributes(FreeColXMLWriter xw) throws XMLStreamException {
super.writeAttributes(xw);
// Force operator to be an upper case string (do not use the
// writeAttribute(... Enum) routine which downcases).
xw.writeAttribute(OPERATOR_TAG, operator.toString());
xw.writeAttribute(OPERATOR_TAG, operator);
}
/**
@ -337,10 +339,18 @@ public final class Limit extends FreeColGameObjectType {
protected void readChild(FreeColXMLReader xr) throws XMLStreamException {
final String tag = xr.getLocalName();
if (LEFT_HAND_SIDE_TAG.equals(tag)) {
if (LEFT_HAND_SIDE_TAG.equals(tag)
// @compat 0.11.3
|| OLD_LEFT_HAND_SIDE_TAG.equals(tag)
// end @compat 0.11.3
) {
leftHandSide = new Operand(xr);
} else if (RIGHT_HAND_SIDE_TAG.equals(tag)) {
} else if (RIGHT_HAND_SIDE_TAG.equals(tag)
// @compat 0.11.3
|| OLD_RIGHT_HAND_SIDE_TAG.equals(tag)
// end @compat 0.11.3
) {
rightHandSide = new Operand(xr);
} else {