mirror of https://github.com/FreeCol/freecol.git
Improvements to experts-connections option.
This commit is contained in:
parent
ad84af1438
commit
8b6e464855
|
@ -20,7 +20,7 @@
|
|||
In case of incompatible changes, please update version number and
|
||||
XSD schema for validation.
|
||||
-->
|
||||
<freecol-specification id="classic" version="0.108">
|
||||
<freecol-specification id="classic" version="0.110">
|
||||
|
||||
<!-- Modifiers that are not attached to other game object
|
||||
types. They may be modified, but MUST NOT be removed. -->
|
||||
|
@ -2063,6 +2063,7 @@
|
|||
<building-type id="model.building.ironWorks"
|
||||
extends="model.building.blacksmithShop"
|
||||
upgrades-from="model.building.blacksmithShop"
|
||||
experts-with-connections-production="4"
|
||||
required-population="8" upkeep="15">
|
||||
<production>
|
||||
<input goods-type="model.goods.ore" value="6"/>
|
||||
|
@ -2098,6 +2099,7 @@
|
|||
<building-type id="model.building.cigarFactory"
|
||||
extends="model.building.tobacconistShop"
|
||||
upgrades-from="model.building.tobacconistShop"
|
||||
experts-with-connections-production="4"
|
||||
required-population="8" upkeep="15">
|
||||
<production>
|
||||
<input goods-type="model.goods.tobacco" value="6"/>
|
||||
|
@ -2133,6 +2135,7 @@
|
|||
<building-type id="model.building.textileMill"
|
||||
extends="model.building.weaverShop"
|
||||
upgrades-from="model.building.weaverShop"
|
||||
experts-with-connections-production="4"
|
||||
required-population="8" upkeep="15">
|
||||
<production>
|
||||
<input goods-type="model.goods.cotton" value="6"/>
|
||||
|
@ -2168,6 +2171,7 @@
|
|||
<building-type id="model.building.rumFactory"
|
||||
extends="model.building.rumDistillery"
|
||||
upgrades-from="model.building.rumDistillery"
|
||||
experts-with-connections-production="4"
|
||||
required-population="8" upkeep="15">
|
||||
<production>
|
||||
<input goods-type="model.goods.sugar" value="6"/>
|
||||
|
@ -2203,6 +2207,7 @@
|
|||
<building-type id="model.building.furFactory"
|
||||
extends="model.building.furTradingPost"
|
||||
upgrades-from="model.building.furTradingPost"
|
||||
experts-with-connections-production="4"
|
||||
required-population="6" upkeep="15">
|
||||
<production>
|
||||
<input goods-type="model.goods.furs" value="6"/>
|
||||
|
@ -2274,6 +2279,7 @@
|
|||
<building-type id="model.building.arsenal"
|
||||
extends="model.building.magazine"
|
||||
upgrades-from="model.building.magazine"
|
||||
experts-with-connections-production="4"
|
||||
upkeep="15">
|
||||
<production>
|
||||
<input goods-type="model.goods.tools" value="9"/>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
In case of incompatible changes, please update version number and
|
||||
XSD schema for validation.
|
||||
-->
|
||||
<freecol-specification id="freecol" version="0.108" extends="classic">
|
||||
<freecol-specification id="freecol" version="0.110" extends="classic">
|
||||
|
||||
<goods-types>
|
||||
<goods-type id="model.goods.horses" is-farmed="false"
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
<xs:attribute name="preserve" use="optional" type="xs:boolean"/>
|
||||
|
||||
<xs:attribute name="abstract" use="optional" type="xs:boolean" />
|
||||
<xs:attribute name="experts-with-connections-production" use="optional"
|
||||
type="xs:int"/>
|
||||
<xs:attribute name="maximum-skill" type="xs:int"/>
|
||||
<xs:attribute name="minimum-skill" type="xs:int"/>
|
||||
<xs:attribute name="priority" type="xs:nonNegativeInteger"/>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with FreeCol. If not, see http://www.gnu.org/licenses
|
||||
|
||||
XSD for specification version 0.109
|
||||
XSD for specification version 0.110
|
||||
CHANGELOG:
|
||||
0.26: add capture-equipment
|
||||
0.27: add limits
|
||||
|
@ -107,6 +107,7 @@
|
|||
0.107: Improve unit changes.
|
||||
0.108: Migrate change to tile-type-change.
|
||||
0.109: Big reorganization.
|
||||
0.110: Add experts-with-connections-production attribute to BuildingType.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
|
||||
|
|
|
@ -279,15 +279,16 @@ public class Building extends WorkLocation
|
|||
// Experts in factory level buildings may produce a
|
||||
// certain amount of goods even when no input is available.
|
||||
// Factories have the EXPERTS_USE_CONNECTIONS ability.
|
||||
long minimumGoodsInput;
|
||||
if (available < required
|
||||
&& hasAbility(Ability.EXPERTS_USE_CONNECTIONS)
|
||||
&& spec.getBoolean(GameOptions.EXPERTS_HAVE_CONNECTIONS)) {
|
||||
final UnitType expertType = getExpertUnitType();
|
||||
long minimumGoodsInput = 4 // FIXME: magic number
|
||||
* count(getUnits(), matchKey(expertType, Unit::getType));
|
||||
if (minimumGoodsInput > available) {
|
||||
available = minimumGoodsInput;
|
||||
}
|
||||
&& spec.getBoolean(GameOptions.EXPERTS_HAVE_CONNECTIONS)
|
||||
&& ((minimumGoodsInput = getType()
|
||||
.getExpertWithConnectionsProduction()
|
||||
* count(getUnits(),
|
||||
matchKey(getExpertUnitType(), Unit::getType)))
|
||||
> available)) {
|
||||
available = minimumGoodsInput;
|
||||
}
|
||||
// Scale production by limitations on availability.
|
||||
if (available < required) {
|
||||
|
|
|
@ -55,6 +55,9 @@ public final class BuildingType extends BuildableType {
|
|||
/** Consumption order. */
|
||||
private int priority = Consumer.BUILDING_PRIORITY;
|
||||
|
||||
/** Maximum production from the "experts have connections" option. */
|
||||
private int expertConnectionProduction = 0;
|
||||
|
||||
/** The building type this upgrades from. */
|
||||
private BuildingType upgradesFrom = null;
|
||||
|
||||
|
@ -105,6 +108,15 @@ public final class BuildingType extends BuildableType {
|
|||
return upkeep;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum production for the Experts-With-Connections option.
|
||||
*
|
||||
* @return The production amount.
|
||||
*/
|
||||
public int getExpertWithConnectionsProduction() {
|
||||
return this.expertConnectionProduction;
|
||||
}
|
||||
|
||||
/**
|
||||
* The consumption priority of a Building of this type. The higher
|
||||
* the priority, the earlier will the Consumer be allowed to
|
||||
|
@ -341,6 +353,8 @@ public final class BuildingType extends BuildableType {
|
|||
|
||||
// Serialization
|
||||
|
||||
private static final String EXPERTS_WITH_CONNECTION_PRODUCTION_TAG
|
||||
= "experts-with-connections-production";
|
||||
private static final String MAXIMUM_SKILL_TAG = "maximum-skill";
|
||||
private static final String MINIMUM_SKILL_TAG = "minimum-skill";
|
||||
private static final String PRIORITY_TAG = "priority";
|
||||
|
@ -389,6 +403,8 @@ public final class BuildingType extends BuildableType {
|
|||
xw.writeAttribute(PRIORITY_TAG, priority);
|
||||
}
|
||||
|
||||
xw.writeAttribute(EXPERTS_WITH_CONNECTION_PRODUCTION_TAG,
|
||||
this.expertConnectionProduction);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -451,6 +467,10 @@ public final class BuildingType extends BuildableType {
|
|||
|
||||
priority = xr.getAttribute(PRIORITY_TAG, parent.priority);
|
||||
|
||||
this.expertConnectionProduction
|
||||
= xr.getAttribute(EXPERTS_WITH_CONNECTION_PRODUCTION_TAG,
|
||||
parent.expertConnectionProduction);
|
||||
|
||||
// @compat 0.10.6
|
||||
int basicProduction = xr.getAttribute(BASIC_PRODUCTION_TAG, -1);
|
||||
if (basicProduction > 0) {
|
||||
|
@ -495,6 +515,12 @@ public final class BuildingType extends BuildableType {
|
|||
} else {
|
||||
super.readChild(xr);
|
||||
}
|
||||
|
||||
// @compat 0.11.6
|
||||
if (hasAbility(Ability.EXPERTS_USE_CONNECTIONS)
|
||||
&& this.expertConnectionProduction == 0)
|
||||
this.expertConnectionProduction = 4;
|
||||
// end @compat 0.11.6
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -179,9 +179,9 @@ public class ProductionInfo {
|
|||
public String toString() {
|
||||
StringBuilder result = new StringBuilder();
|
||||
append(result, "Production", production);
|
||||
append(result, "Consumption", consumption);
|
||||
append(result, "Maximum Production", maximumProduction);
|
||||
append(result, "Maximum Consumption", maximumConsumption);
|
||||
append(result, " Consumption", consumption);
|
||||
append(result, " Maximum Production", maximumProduction);
|
||||
append(result, " Maximum Consumption", maximumConsumption);
|
||||
return result.toString();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue