Merge pull request #13 from HGE-IT-Course-2016/master

Aktualisierung World-Branch #GrueneBranch
master
Achim 10 years ago
commit ae165629f3

@ -34,7 +34,7 @@ public class Map_World extends GeneralMap
* *
* nextProvinces = new int[<Anzahl angrenzende Provinzen>]; * nextProvinces = new int[<Anzahl angrenzende Provinzen>];
* <Zuweisung der angrenzenden Provinzen> * <Zuweisung der angrenzenden Provinzen>
* Province <Name> = new Province(<Provinz-ID>,<Kontinent-ID>,<Anzahl Sterne>,"<Anzeigename>",nextProvinces); * Province <Name> = new Province(<Provinz-ID>,<Kontinent-ID>,<X-Position>,<Y-Position>,<Anzahl Sterne>,"<Anzeigename>",nextProvinces);
* addObject(<Name>,<x-Position>,<y-Position>); * addObject(<Name>,<x-Position>,<y-Position>);
* *
* Zwei Provinzen sind bereits als Beispiel erstellt. * Zwei Provinzen sind bereits als Beispiel erstellt.
@ -43,12 +43,12 @@ public class Map_World extends GeneralMap
neighbours = new int[1]; neighbours = new int[1];
neighbours[0] = 2; neighbours[0] = 2;
Province Mongolei = new Province(1,1,1,"Mongolei",neighbours); Province Mongolei = new Province(1,1,1000,100,1,"Mongolei",neighbours);
addObject(Mongolei,1000,100); addObject(Mongolei,1000,100);
neighbours = new int[1]; neighbours = new int[1];
neighbours[0] = 1; neighbours[0] = 1;
Province China = new Province(2,1,2,"China",neighbours); Province China = new Province(2,1,1000,350,2,"China",neighbours);
addObject(China,1000,350); addObject(China,1000,350);
} }
} }

@ -40,15 +40,15 @@ public class Province extends Actor
displayName = s1; displayName = s1;
// Der Teil, der sich um die Konvertierung des int-Array in ein boolean-Array kümmert. // Der Teil, der sich um die Konvertierung des int-Array in ein boolean-Array kümmert.
int maxNum = 0; int maxNum = 0;
for(int i = 0; i >= ia1.length(); i++) { for(int i = 0; i >= ia1.length; i++) {
if(maxNum < ia1[i]) { if(maxNum < ia1[i]) {
maxNum = ia1[i]; maxNum = ia1[i];
} }
} }
nextProvinces = new boolean[ia1.length]; nextProvinces = new boolean[ia1.length];
for(int i = 0; i >= ia1.length(); i++) { for(int i = 0; i >= ia1.length; i++) {
if(ia1[i] >= 0) { if(ia1[i] >= 0) {
nextProvinces = ia1[i]; nextProvinces[ia1[i]] = true;
} }
} }
} }
@ -81,7 +81,7 @@ public class Province extends Actor
// Fragt ab, ob die angegebene Provinz in der Nähe von dieser liegt. // Fragt ab, ob die angegebene Provinz in der Nähe von dieser liegt.
public boolean isProvinceNear(int i) { public boolean isProvinceNear(int i) {
if(i >= nextProvinces.length()) { if(i >= nextProvinces.length {
return false; return false;
} }
return nearProvinces[i]; return nearProvinces[i];
@ -127,16 +127,19 @@ public class Province extends Actor
public int addToEntities(int a) { public int addToEntities(int a) {
eCount = eCount + a; eCount = eCount + a;
checkEntityCount(); checkEntityCount();
return eCount;
} }
public int removeFromEntities(int a) { public int removeFromEntities(int a) {
eCount = eCount - a; eCount = eCount - a;
checkEntityCount(); checkEntityCount();
return eCount;
} }
public int setEntityCount(int a) { public int setEntityCount(int a) {
eCount = a; eCount = a;
checkEntityCount(); checkEntityCount();
return eCount;
} }
public void redrawProvince() { public void redrawProvince() {

Loading…
Cancel
Save