int exchange_check()
{
int ii,kk,ff,tmp;
int[,] tristmp = new int[MAPY,MAPX];
int[,] designtmp = new int[ARR,ARR];

for(ii=0; ii<MAPY; ii++)
for(kk=0; kk<MAPX; kk++)
{
tristmp[ii,kk]=tris[ii,kk];
}

for(ii=0; ii<ARR; ii++)
for(kk=0; kk<ARR; kk++)
{
designtmp[ii,kk]=design[ii,kk];
}

for(ii=0; ii<ARR; ii++)
for(kk=0; kk<ARR; kk++)
{
if(ypos+ii>MAPY-1) continue;
if(xpos+kk>MAPX-1) continue;
if(xpos+kk<0) continue;

if(designtmp[ii,kk]==1) tristmp[ypos+ii,xpos+kk]=0;
}

//exchange//exchange//exchange//exchange//exchange
//exchange//exchange//exchange//exchange//exchange
//exchange//exchange//exchange//exchange//exchange
//exchange//exchange//exchange//exchange//exchange

/*
{0,0},{0,1},{0,2},{0,3},
{1,0},{1,1},{1,2},{1,3},
{2,0},{2,1},{2,2},{2,3},
{3,0},{3,1},{3,2},{3,3},
*/

for(ii=0; ii<3; ii++)
{
//add
}
tmp=designtmp[1,1];
designtmp[1,1]=designtmp[1,2];
designtmp[1,2]=designtmp[2,2];
designtmp[2,2]=designtmp[2,1];
designtmp[2,1]=tmp;

for(ii=0; ii<ARR; ii++)
for(kk=0; kk<ARR; kk++)
{
if(ypos+ii>MAPY-1) continue;
if(xpos+kk>MAPX-1) continue;
if(xpos+kk<0) continue;

if(designtmp[ii,kk]==1) tristmp[ypos+ii,xpos+kk] += 1;
}

ff=0;
for(ii=0; ii<ARR; ii++)
for(kk=0; kk<ARR; kk++)
{
if(ypos+ii>MAPY-1) continue;
if(xpos+kk>MAPX-1) continue;
if(xpos+kk<0) continue;

if(tristmp[ypos+ii,xpos+kk] > 1) ff++;
}

if(ff > 0)
{
return(FAIL);
}
else
{
for(ii=0; ii<MAPY; ii++)
for(kk=0; kk<MAPX; kk++)
{
tris[ii,kk]=tristmp[ii,kk];
}

for(ii=0; ii<ARR; ii++)
for(kk=0; kk<ARR; kk++)
{
design[ii,kk]=designtmp[ii,kk];
}
}
return(SUCC);
}

+ Recent posts