macro data code org
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
105a71de24
commit
8bee3bf71a
@ -205,11 +205,9 @@ public class MacroData {
|
||||
* Adds a civilization
|
||||
* @param race the race founding the civilization
|
||||
*/
|
||||
public Civilization addCivilization(Race race){
|
||||
Civilization civ = new Civilization();
|
||||
public void addCivilization(Civilization civ){
|
||||
civ.setId(civilizations.size());
|
||||
civilizations.add(civ);
|
||||
return civ;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -226,11 +224,9 @@ public class MacroData {
|
||||
* @param radius The radius of the town
|
||||
* @param parentCivId The id of the parent civilization
|
||||
*/
|
||||
public Town addTown(Vector3d center, double radius, int parentCivId){
|
||||
Town rVal = Town.createTown(center, radius, parentCivId);
|
||||
rVal.setId(towns.size());
|
||||
towns.add(rVal);
|
||||
return rVal;
|
||||
public void addTown(Town town){
|
||||
town.setId(towns.size());
|
||||
towns.add(town);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -40,6 +40,23 @@ public class Civilization {
|
||||
*/
|
||||
private List<String> races = new LinkedList<String>();
|
||||
|
||||
/**
|
||||
* Private constructor
|
||||
*/
|
||||
private Civilization(){ }
|
||||
|
||||
/**
|
||||
* Creates a civilization
|
||||
* @param macroData The macro data
|
||||
* @return The civilization
|
||||
*/
|
||||
public static Civilization createCivilization(MacroData macroData, Race race){
|
||||
Civilization rVal = new Civilization();
|
||||
rVal.races.add(race.getId());
|
||||
macroData.addCivilization(rVal);
|
||||
return rVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the id of the civilization
|
||||
* @return The id
|
||||
|
||||
@ -32,10 +32,9 @@ public class CivilizationGenerator {
|
||||
Vector3d spawnPoint = new Vector3d(serverWorldData.getWorldSizeDiscrete() * ServerTerrainChunk.CHUNK_PLACEMENT_OFFSET / 2);
|
||||
spawnPoint.y = serverWorldData.getServerTerrainManager().getElevation(spawnPoint);
|
||||
for(Race race : config.getRaceMap().getRaces()){
|
||||
Civilization newCiv = macroData.addCivilization(race);
|
||||
Civilization newCiv = Civilization.createCivilization(macroData, race);
|
||||
newCiv.addRace(race);
|
||||
Town startingTown = macroData.addTown(spawnPoint, INITIAL_TOWN_RADIUS, newCiv.getId());
|
||||
newCiv.addTown(startingTown);
|
||||
Town.createTown(macroData, spawnPoint, INITIAL_TOWN_RADIUS, newCiv.getId());
|
||||
Road.createRoad(macroData, Spline3d.createCatmullRom(new Vector3d[]{
|
||||
new Vector3d(spawnPoint).add(-20,0,0),
|
||||
new Vector3d(spawnPoint).add(-10,0,0),
|
||||
|
||||
@ -89,11 +89,12 @@ public class Town implements MacroAreaObject {
|
||||
* @param parentCiv The id of the parent civilization
|
||||
* @return The town
|
||||
*/
|
||||
public static Town createTown(Vector3d position, double radius, int parentCiv){
|
||||
public static Town createTown(MacroData macroData, Vector3d position, double radius, int parentCiv){
|
||||
Town rVal = new Town();
|
||||
rVal.position = position;
|
||||
rVal.radius = radius;
|
||||
rVal.parentCivId = parentCiv;
|
||||
macroData.addTown(rVal);
|
||||
return rVal;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user