@ -25,7 +25,7 @@ public class Province extends Actor
private boolean clicked = false ;
private boolean clicked = false ;
/ * *
/ * *
* Ü berpr ü ft , ob die Provinz angeklickt wurde .
* Ü berpr ü ft , ob die Provinz angeklickt wurde .
* /
* /
public void act ( )
public void act ( )
{
{
@ -45,7 +45,7 @@ public class Province extends Actor
stars = st ;
stars = st ;
}
}
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 <EFBFBD> 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 ] ) {
@ -60,7 +60,7 @@ public class Province extends Actor
}
}
}
}
// Zweiter Konstruktor, um auch das boolean-Array gegebenenfalls verwenden zu k ö nnnen.
// Zweiter Konstruktor, um auch das boolean-Array gegebenenfalls verwenden zu k <EFBFBD> nnnen.
public Province ( int pID , int cID , int x , int y , int st , String s1 , boolean [ ] ba1 )
public Province ( int pID , int cID , int x , int y , int st , String s1 , boolean [ ] ba1 )
{
{
provinceID = pID ;
provinceID = pID ;
@ -98,7 +98,7 @@ public class Province extends Actor
return continentID ;
return continentID ;
}
}
// Fragt ab, ob die angegebene Provinz in der N ä he von dieser liegt.
// Fragt ab, ob die angegebene Provinz in der N <EFBFBD> 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 ;
@ -124,7 +124,7 @@ public class Province extends Actor
return owner ;
return owner ;
}
}
// Setzt den Owner, ben ö tigt String
// Setzt den Owner, ben <EFBFBD> tigt String
public void setOwner ( int o )
public void setOwner ( int o )
{
{
if ( o < - 1 ) {
if ( o < - 1 ) {
@ -146,36 +146,58 @@ public class Province extends Actor
public int addToEntities ( int a ) {
public int addToEntities ( int a ) {
eCount = eCount + a ;
eCount = eCount + a ;
checkEntityCount ( ) ;
checkEntityCount ( ) ;
redrawProvince ( ) ;
redrawProvince ( 1 ) ;
return eCount ;
return eCount ;
}
}
public int removeFromEntities ( int a ) {
public int removeFromEntities ( int a ) {
eCount = eCount - a ;
eCount = eCount - a ;
checkEntityCount ( ) ;
checkEntityCount ( ) ;
redrawProvince ( ) ;
redrawProvince ( 1 ) ;
return eCount ;
return eCount ;
}
}
public int setEntityCount ( int a ) {
public int setEntityCount ( int a ) {
eCount = a ;
eCount = a ;
checkEntityCount ( ) ;
checkEntityCount ( ) ;
redrawProvince ( ) ;
redrawProvince ( 1 ) ;
return eCount ;
return eCount ;
}
}
public void redrawProvince ( )
public void redrawProvince ( )
{
redrawProvince ( 1 ) ;
}
public void redrawProvince ( int ColorInt )
{
{
int textSize ;
int textSize ;
textSize = 20 ;
textSize = 20 ;
GreenfootImage province = new GreenfootImage ( 120 , 100 ) ;
GreenfootImage province = new GreenfootImage ( 120 , 100 ) ;
if ( ColorInt = = 1 )
{
GreenfootImage provinceName = new GreenfootImage ( displayName , textSize , new Color ( 0 , 0 , 0 ) , new Color ( 1.0f , 1.0f , 1.0f , 0.5f ) ) ;
GreenfootImage provinceName = new GreenfootImage ( displayName , textSize , new Color ( 0 , 0 , 0 ) , new Color ( 1.0f , 1.0f , 1.0f , 0.5f ) ) ;
province . drawImage ( provinceName , 0 , 0 ) ;
province . drawImage ( provinceName , 0 , 0 ) ;
setImage ( province ) ;
setImage ( province ) ;
oDecide ( province , textSize , owner , eCount ) ;
oDecide ( province , textSize , owner , eCount ) ;
}
if ( ColorInt = = 2 )
{
GreenfootImage provinceName = new GreenfootImage ( displayName , textSize , new Color ( 0 , 0 , 0 ) , Color . GREEN ) ;
province . drawImage ( provinceName , 0 , 0 ) ;
setImage ( province ) ;
oDecide ( province , textSize , owner , eCount ) ;
}
if ( ColorInt = = 3 )
{
GreenfootImage provinceName = new GreenfootImage ( displayName , textSize , new Color ( 0 , 0 , 0 ) , Color . RED ) ;
province . drawImage ( provinceName , 0 , 0 ) ;
setImage ( province ) ;
oDecide ( province , textSize , owner , eCount ) ;
}
}
}
public void oDecide ( GreenfootImage province , int textSize , int owner , int eCount )
public void oDecide ( GreenfootImage province , int textSize , int owner , int eCount )
{
{
String ownerString ;
String ownerString ;
@ -205,7 +227,7 @@ public class Province extends Actor
eCalculate ( province , ownerString , textSize ) ;
eCalculate ( province , ownerString , textSize ) ;
break ;
break ;
case 5 :
case 5 :
ownerString = "gr ++ n";
ownerString = "gr ü n";
eCalculate ( province , ownerString , textSize ) ;
eCalculate ( province , ownerString , textSize ) ;
break ;
break ;
case 6 :
case 6 :
@ -516,7 +538,6 @@ public class Province extends Actor
setImage ( province ) ;
setImage ( province ) ;
}
}
public boolean hasClicked ( )
public boolean hasClicked ( )
{
{
boolean b = clicked ;
boolean b = clicked ;