Fix capitalization in Modifier.

This commit is contained in:
Michael Pope 2015-06-11 14:59:35 +09:30 committed by Mike Pope
parent dd6675ad99
commit 37f7a14f85
5 changed files with 37 additions and 17 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.102">
<freecol-specification id="classic" version="0.103">
<!-- Modifiers that are not attached to other game object
types. They may be modified, but MUST NOT be removed. -->
@ -54,7 +54,7 @@
<modifier id="model.modifier.colonyGoodsParty"
source="model.source.colonyGoodsParty"
value="50" type="percentage" duration="25"
increment="-2" incrementType="additive" index="90"/>
increment="-2" increment-type="additive" index="90"/>
<modifier id="model.goods.food" value="0" type="additive"/>
<!-- Ship trade penalty modifiers are instantiated on the fly from the
corresponding option and the sense of application. -->

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.102" extends="classic">
<freecol-specification id="freecol" version="0.103" extends="classic">
<goods-types>
<goods-type id="model.goods.horses" is-farmed="false"

View File

@ -45,12 +45,13 @@
<xs:attribute name="value" type="xs:float" use="required" />
<xs:attribute name="type" type="ModifierType" use="required" />
<xs:attribute name="incrementType" type="ModifierType"
use="optional" />
<xs:attribute name="increment-type" type="ModifierType" use="optional" />
<xs:attribute name="increment" type="xs:float" use="optional" />
<xs:attribute name="duration" type="xs:int" use="optional" />
<xs:attribute name="temporary" type="xs:boolean" use="optional" />
<!-- @compat 0.11.3 -->
<xs:attribute name="incrementType" type="ModifierType" use="optional" />
<!-- end @compat 0.11.3 -->
</xs:complexType>
</xs:element>

View File

@ -79,6 +79,7 @@
0.100: Fix capitalization in Nation.
0.101: Fix capitalization in Limit.
0.102: Fix capitalization in UnitTypeChange.
0.103: incrementType -> increment-type
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:annotation>
@ -902,16 +903,11 @@
</xs:attribute>
<xs:attribute name="value" type="xs:float"/>
<xs:attribute name="increment" use="optional" type="xs:float"/>
<xs:attribute name="incrementType" use="optional">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="additive"/>
<xs:enumeration value="multiplicative"/>
<xs:enumeration value="percentage"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="increment-type" type="ModifierType"/>
<xs:attribute name="index" type="xs:nonNegativeInteger"/>
<!-- @compat 0.11.3 -->
<xs:attribute name="incrementType" type="ModifierType"/>
<!-- @compat 0.11.3 -->
</xs:extension>
</xs:complexContent>
</xs:complexType>
@ -1309,6 +1305,19 @@
<xs:attribute name="value" use="required" type="xs:nonNegativeInteger"/>
</xs:complexType>
<xs:simpleType name="ModifierType">
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="additive" />
<xs:enumeration value="multiplicative" />
<xs:enumeration value="percentage" />
<!-- @compat 0.10.7 -->
<xs:enumeration value="ADDITIVE" />
<xs:enumeration value="MULTIPLICATIVE" />
<xs:enumeration value="PERCENTAGE" />
<!-- end @compat -->
</xs:restriction>
</xs:simpleType>
<xs:complexType name="OperandType">
<xs:complexContent>
<xs:extension base="ScopeType">

View File

@ -580,9 +580,12 @@ public class Modifier extends Feature {
// Serialization
private static final String INCREMENT_TAG = "increment";
private static final String INCREMENT_TYPE_TAG = "incrementType";
private static final String INCREMENT_TYPE_TAG = "increment-type";
private static final String INDEX_TAG = "index";
private static final String TYPE_TAG = "type";
// @compat 0.11.3
private static final String OLD_INCREMENT_TYPE_TAG = "incrementType";
// end @compat 0.11.3
/**
@ -619,7 +622,14 @@ public class Modifier extends Feature {
value = xr.getAttribute(VALUE_TAG, UNKNOWN);
if (xr.hasAttribute(INCREMENT_TYPE_TAG)) {
// @compat 0.11.3
if (xr.hasAttribute(OLD_INCREMENT_TYPE_TAG)) {
incrementType = xr.getAttribute(OLD_INCREMENT_TYPE_TAG,
ModifierType.class,
(ModifierType)null);
increment = xr.getAttribute(INCREMENT_TAG, UNKNOWN);
// end @compat 0.11.3
} else if (xr.hasAttribute(INCREMENT_TYPE_TAG)) {
incrementType = xr.getAttribute(INCREMENT_TYPE_TAG,
ModifierType.class,
(ModifierType)null);