diff --git a/Map_World.java b/Map_World.java index 2006fb0..31a7707 100644 --- a/Map_World.java +++ b/Map_World.java @@ -34,7 +34,7 @@ public class Map_World extends GeneralMap * * nextProvinces = new int[]; * - * Province = new Province(,,,"",nextProvinces); + * Province = new Province(,,,,,"",nextProvinces); * addObject(,,); * * Zwei Provinzen sind bereits als Beispiel erstellt. @@ -43,12 +43,12 @@ public class Map_World extends GeneralMap neighbours = new int[1]; 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); neighbours = new int[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); } } diff --git a/Province.java b/Province.java index 368aad7..5f07643 100644 --- a/Province.java +++ b/Province.java @@ -40,15 +40,15 @@ public class Province extends Actor displayName = s1; // Der Teil, der sich um die Konvertierung des int-Array in ein boolean-Array kümmert. int maxNum = 0; - for(int i = 0; i >= ia1.length(); i++) { + for(int i = 0; i >= ia1.length; i++) { if(maxNum < ia1[i]) { maxNum = ia1[i]; } } 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) { - 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. public boolean isProvinceNear(int i) { - if(i >= nextProvinces.length()) { + if(i >= nextProvinces.length { return false; } return nearProvinces[i]; @@ -127,16 +127,19 @@ public class Province extends Actor public int addToEntities(int a) { eCount = eCount + a; checkEntityCount(); + return eCount; } public int removeFromEntities(int a) { eCount = eCount - a; checkEntityCount(); + return eCount; } public int setEntityCount(int a) { eCount = a; checkEntityCount(); + return eCount; } public void redrawProvince() {