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
|
* Adds a civilization
|
||||||
* @param race the race founding the civilization
|
* @param race the race founding the civilization
|
||||||
*/
|
*/
|
||||||
public Civilization addCivilization(Race race){
|
public void addCivilization(Civilization civ){
|
||||||
Civilization civ = new Civilization();
|
|
||||||
civ.setId(civilizations.size());
|
civ.setId(civilizations.size());
|
||||||
civilizations.add(civ);
|
civilizations.add(civ);
|
||||||
return civ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -226,11 +224,9 @@ public class MacroData {
|
|||||||
* @param radius The radius of the town
|
* @param radius The radius of the town
|
||||||
* @param parentCivId The id of the parent civilization
|
* @param parentCivId The id of the parent civilization
|
||||||
*/
|
*/
|
||||||
public Town addTown(Vector3d center, double radius, int parentCivId){
|
public void addTown(Town town){
|
||||||
Town rVal = Town.createTown(center, radius, parentCivId);
|
town.setId(towns.size());
|
||||||
rVal.setId(towns.size());
|
towns.add(town);
|
||||||
towns.add(rVal);
|
|
||||||
return rVal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -40,6 +40,23 @@ public class Civilization {
|
|||||||
*/
|
*/
|
||||||
private List<String> races = new LinkedList<String>();
|
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
|
* Gets the id of the civilization
|
||||||
* @return The id
|
* @return The id
|
||||||
|
|||||||
@ -32,10 +32,9 @@ public class CivilizationGenerator {
|
|||||||
Vector3d spawnPoint = new Vector3d(serverWorldData.getWorldSizeDiscrete() * ServerTerrainChunk.CHUNK_PLACEMENT_OFFSET / 2);
|
Vector3d spawnPoint = new Vector3d(serverWorldData.getWorldSizeDiscrete() * ServerTerrainChunk.CHUNK_PLACEMENT_OFFSET / 2);
|
||||||
spawnPoint.y = serverWorldData.getServerTerrainManager().getElevation(spawnPoint);
|
spawnPoint.y = serverWorldData.getServerTerrainManager().getElevation(spawnPoint);
|
||||||
for(Race race : config.getRaceMap().getRaces()){
|
for(Race race : config.getRaceMap().getRaces()){
|
||||||
Civilization newCiv = macroData.addCivilization(race);
|
Civilization newCiv = Civilization.createCivilization(macroData, race);
|
||||||
newCiv.addRace(race);
|
newCiv.addRace(race);
|
||||||
Town startingTown = macroData.addTown(spawnPoint, INITIAL_TOWN_RADIUS, newCiv.getId());
|
Town.createTown(macroData, spawnPoint, INITIAL_TOWN_RADIUS, newCiv.getId());
|
||||||
newCiv.addTown(startingTown);
|
|
||||||
Road.createRoad(macroData, Spline3d.createCatmullRom(new Vector3d[]{
|
Road.createRoad(macroData, Spline3d.createCatmullRom(new Vector3d[]{
|
||||||
new Vector3d(spawnPoint).add(-20,0,0),
|
new Vector3d(spawnPoint).add(-20,0,0),
|
||||||
new Vector3d(spawnPoint).add(-10,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
|
* @param parentCiv The id of the parent civilization
|
||||||
* @return The town
|
* @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();
|
Town rVal = new Town();
|
||||||
rVal.position = position;
|
rVal.position = position;
|
||||||
rVal.radius = radius;
|
rVal.radius = radius;
|
||||||
rVal.parentCivId = parentCiv;
|
rVal.parentCivId = parentCiv;
|
||||||
|
macroData.addTown(rVal);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user