- Code: Select all
int count=0;
int cx[10000];
int cy[10000];
int mx,my;
void calc_field(int i, int x1, int y1){
int th=0;
int tmpi;
int j;
if (strcmp(getactor(x1,y1)->name,"pMountain")==0){i-=3;}
if (strcmp(getactor(x1,y1)->name,"pWater")==0){i-=3;}
if (strcmp(getactor(x1,y1)->name,"pGrass")==0){i-=1;}
if (strcmp(getactor(x1,y1)->name,"pHills")==0){i-=2;}
if (strcmp(getactor(x1,y1)->name,"pForest")==0){i-=2;}
if (i>0){
th=0;
j=0;
if (x1<=mx){
while (j<count){
if (cx[j]==x1-32){
if (cy[j]==y1){
th++;
break;
}
}
j++;
}
if (th==0){
cx[count]=x1-32;
cy[count]=y1;
count++;
tmpi=i;
i--;
calc_field(i,x1-32,y1);
i=tmpi;
}
}
th=0;
j=0;
if (x1>=mx){
while (j<count){
if (cx[j]==x1+32){
if (cy[j]==y1){
th++;
break;
}
}
j++;
}
if (th==0){
cx[count]=x1+32;
cy[count]=y1;
count++;
tmpi=i;
i--;
calc_field(i,x1+32,y1);
i=tmpi;
}
}
th=0;
j=0;
if (y1>=my){
while (j<count){
if (cx[j]==x1){
if (cy[j]==y1+32){
th++;
break;
}
}
j++;
}
if (th==0){
cx[count]=x1;
cy[count]=y1+32;
count++;
tmpi=i;
i--;
calc_field(i,x1,y1+32);
i=tmpi;
}
}
th=0;
j=0;
if (y1<=my){
while (j<count){
if (cx[j]==x1){
if (cy[j]==y1-32){
th++;
break;
}
}
j++;
}
if (th==0){
cx[count]=x1;
cy[count]=y1-32;
count++;
tmpi=i;
i--;
calc_field(i,x1,y1-32);
i=tmpi;
}
}
}
}
And this one for depicting:
- Code: Select all
void draw_field(){
int k;
for(k=0; k<count; k++){
CreateActor("objBB", "bb", "(none)", "(none)", cx[k], cy[k], true);
}
}
But there is mistake somewhere

I'm completely stuck with this task, the calculation works incorrectly somehow(
Could some guru help with this object???