@ -194,7 +194,10 @@ public:
case GAMEWORLD : {
case GAMEWORLD : {
if ( PLAYER_COORDS [ 0 ] > = 8 & & PLAYER_COORDS [ 0 ] < 12 & &
if ( PLAYER_COORDS [ 0 ] > = 8 & & PLAYER_COORDS [ 0 ] < 12 & &
PLAYER_COORDS [ 1 ] > = 2 & & PLAYER_COORDS [ 1 ] < 6 ) {
PLAYER_COORDS [ 1 ] > = 2 & & PLAYER_COORDS [ 1 ] < 6 ) {
cout < < " You are standing over plant " < < getPlantId ( ( int ) PLAYER_COORDS [ 0 ] , ( int ) PLAYER_COORDS [ 1 ] ) < < " in state " < < getPlantStatus ( ( int ) PLAYER_COORDS [ 0 ] , ( int ) PLAYER_COORDS [ 1 ] ) ;
//cout<<"You are standing over plant "<<getPlantId((int)PLAYER_COORDS[0],(int)PLAYER_COORDS[1])<<" in state "<<getPlantStatus((int)PLAYER_COORDS[0],(int)PLAYER_COORDS[1]);
if ( getPlantStatus ( ( int ) PLAYER_COORDS [ 0 ] , ( int ) PLAYER_COORDS [ 1 ] ) = = 2 ) {
setPlantStatus ( ( int ) PLAYER_COORDS [ 0 ] , ( int ) PLAYER_COORDS [ 1 ] , 0 ) ;
}
}
}
} break ;
} break ;
}
}
@ -567,6 +570,13 @@ public:
return plantState > > getPlantId ( x , y ) * 2 & 0b11 ;
return plantState > > getPlantId ( x , y ) * 2 & 0b11 ;
}
}
void setPlantStatus ( int x , int y , char state ) {
int numb = 0b11111111111111111111111111111111 ;
int numb2 = 0 ;
numb - = 3 < < getPlantId ( x , y ) * 2 ;
plantState & = numb ;
}
void DrawDialogBox ( const olc : : vi2d & pos , const olc : : vi2d & size , olc : : Pixel p = olc : : WHITE , olc : : Pixel p2 = olc : : DARK_GREY , olc : : Pixel p3 = olc : : VERY_DARK_GREY ) {
void DrawDialogBox ( const olc : : vi2d & pos , const olc : : vi2d & size , olc : : Pixel p = olc : : WHITE , olc : : Pixel p2 = olc : : DARK_GREY , olc : : Pixel p3 = olc : : VERY_DARK_GREY ) {
FillRectDecal ( { ( float ) pos . x , ( float ) pos . y } , size , p2 ) ;
FillRectDecal ( { ( float ) pos . x , ( float ) pos . y } , size , p2 ) ;
FillRectDecal ( { ( float ) pos . x + 1 , ( float ) pos . y + 1 } , { ( float ) size . x - 2 , ( float ) size . y - 2 } , p ) ;
FillRectDecal ( { ( float ) pos . x + 1 , ( float ) pos . y + 1 } , { ( float ) size . x - 2 , ( float ) size . y - 2 } , p ) ;