"Buildables" depend on tech graph

* Modified buildable definitions and loader to use technologies from the
tech graph as dependencies instead of the old research system

* Modified planet-related views and functions accordingly
This commit is contained in:
Emmanuel BENOîT 2012-04-08 14:30:43 +02:00
parent 76a01cbf1c
commit 070d55dc05
6 changed files with 89 additions and 104 deletions
legacyworlds-server-main
data
src/main/java/com/deepclone/lw/cli

View file

@ -13,15 +13,15 @@
</building>
<building name="indFactory" description="indFactoryDescription" type="CASH" output="1" workers="500">
<cost build="500" upkeep="20" work="28800" />
<tech name="civTech" level="1" />
<require-technology>indFactTech</require-technology>
</building>
<building name="reanimationCentre" description="reanimationCentreDescription" type="POP" output="1" workers="300">
<cost build="4000" upkeep="200" work="57600" />
<tech name="civTech" level="2" />
<require-technology>reanimationTech</require-technology>
</building>
<building name="superTurret" description="superTurretDescription" type="DEF" output="500" workers="1">
<cost build="4000" upkeep="10" work="20000" />
<tech name="civTech" level="3" />
<require-technology>superTurretTech</require-technology>
</building>
<ship name="fighter" description="fighterDescription" time="3" power="10">
@ -29,15 +29,15 @@
</ship>
<ship name="cruiser" description="cruiserDescription" time="5" power="100">
<cost build="500" upkeep="80" work="5000" />
<tech name="milTech" level="1" />
<require-technology>cruisersTech</require-technology>
</ship>
<ship name="bCruiser" description="bCruiserDescription" time="4" power="335">
<cost build="2500" upkeep="320" work="25000" />
<tech name="milTech" level="2" />
<require-technology>bCruisersTech</require-technology>
</ship>
<ship name="dreadnought" description="dreadnoughtDescription" time="6" power="5000">
<cost build="12500" upkeep="1280" work="125000" />
<tech name="milTech" level="3" />
<require-technology>dreadnoughtsTech</require-technology>
</ship>
</buildables>

View file

@ -26,7 +26,7 @@
<xs:complexType name="buildable" abstract="true">
<xs:sequence>
<xs:element name="cost" type="cost" />
<xs:element name="tech" type="tech" minOccurs="0" />
<xs:element name="require-technology" type="xs:string" minOccurs="0" />
</xs:sequence>
<xs:attribute name="name" use="required" type="xs:string" />
<xs:attribute name="description" use="required" type="xs:string" />

View file

@ -52,7 +52,8 @@ public class ImportBuildables
public CostData cost;
public TechData tech;
@XStreamAlias( "require-technology" )
public String tech;
}
@SuppressWarnings( "serial" )
@ -70,18 +71,6 @@ public class ImportBuildables
public int work;
}
@SuppressWarnings( "serial" )
@XStreamAlias( "tech" )
public static class TechData
implements Serializable
{
@XStreamAsAttribute
public String name;
@XStreamAsAttribute
public int level;
}
@SuppressWarnings( "serial" )
@XStreamAlias( "building" )
public static class BuildingData
@ -163,7 +152,7 @@ public class ImportBuildables
// Load Hibernate bean
String[] cfg = {
"configuration/transactions.xml"
"configuration/transactions.xml"
};
return new ClassPathXmlApplicationContext( cfg , true , ctx );
}
@ -195,8 +184,7 @@ public class ImportBuildables
this.uocBuildingDep.addParameter( "workers" , Types.INTEGER );
this.uocBuildingDep.addParameter( "output_type" , "building_output_type" );
this.uocBuildingDep.addParameter( "output" , Types.INTEGER );
this.uocBuildingDep.addParameter( "dep_name" , Types.VARCHAR );
this.uocBuildingDep.addParameter( "dep_level" , Types.INTEGER );
this.uocBuildingDep.addParameter( "_technology" , Types.VARCHAR );
this.uocShipNoDep = new StoredProc( dataSource , "tech" , "uoc_ship" );
this.uocShipNoDep.addParameter( "name" , Types.VARCHAR );
@ -215,8 +203,7 @@ public class ImportBuildables
this.uocShipDep.addParameter( "upkeep" , Types.INTEGER );
this.uocShipDep.addParameter( "power" , Types.INTEGER );
this.uocShipDep.addParameter( "flight_time" , Types.INTEGER );
this.uocShipDep.addParameter( "dep_name" , Types.VARCHAR );
this.uocShipDep.addParameter( "dep_level" , Types.INTEGER );
this.uocShipDep.addParameter( "_technology" , Types.VARCHAR );
}
@ -241,7 +228,7 @@ public class ImportBuildables
ship.cost.upkeep , ship.power , ship.time );
} else {
this.uocShipDep.execute( ship.name , ship.description , ship.cost.build , ship.cost.work ,
ship.cost.upkeep , ship.power , ship.time , ship.tech.name , ship.tech.level );
ship.cost.upkeep , ship.power , ship.time , ship.tech );
}
}
@ -256,7 +243,7 @@ public class ImportBuildables
} else {
this.uocBuildingDep.execute( building.name , building.description , building.cost.build ,
building.cost.work , building.cost.upkeep , building.workers , building.type.toString( ) ,
building.output , building.tech.name , building.tech.level );
building.output , building.tech );
}
}