e == 1) oI ++; completed (); ++;
}
}
}
}
Field :: paintShip (int size, QColor lColor, QColor deckColor)
{i, j; locI=0;
(i=0; i lt; sizeField; i ++) (j=0; j lt; sizeField; j ++) (player [i] [j] == size)
{(lColor, deckColor, i, j); [i] [j]=0; (size, i, j, locI); ++;
}
}
Field :: getLocation (int size, int i, int j, int locI)
{
(size == 4)
{. location [locI] [0]=i; .location [locI] [1]=j;
}
if (size == 3)
{[thI] .location [locI] [0]=i; [thI] .location [locI] [1]=j;
} if (size == 2)
{[twI] .location [locI] [0]=i; [twI] .location [locI] [1]=j;
} if (size == 1)
{[oI] .location [0] [0]=i; [oI] .location [0] [1]=j;
}
}
Field :: save (QByteArray amp; array)
{i, j;
(i=0; i lt; sizeField; i ++)
{(j=0;jlt;sizeField;j++).append(QString::number(player[i][j]));.append(laquo;nraquo;);
}
}
Field :: saveShips (QByteArray amp; array)
{i; (array, 4, fourDeck.location);
(i=0; i lt; 2; i ++) (array, 3, threeDeck [i] .location);
(i=0; i lt; 3; i ++) (array, 2, twoDeck [i] .location); (i=0; i lt; 4; i ++) (array, 1, oneDeck [ i] .location);
}
Field :: supSaveShips (QByteArray amp; array, int s, int ** m)
{i; (i=0; i lt; s; i ++)
{. append (QString :: number (m [i] [0])) ;. append ( ) ;. append (QString :: number (m [i] [1 ])) ;. append ( n );
}
}
Field :: fire ()
{(player [iShip - 1] [jShip - 1]!=0)
{(player [iShip - 1] [jShip - 1]!=1 amp; amp; player [iShip - 1] [jShip - 1]!=2)
{(lColor, iShip, jShip);=0; miss ();
}
}
{= 1;=1; [lhit] [0]=iShip - 1; [lhit] [1]=jShip - 1;
++; [iShip - 1] [jShip - 1]=1; (iShip - 1, jShip - 1); (iShip, jShip, lColor, hitColor); ++; hit () ; (K == 20) emit endFight ();
}
}
Field :: checkDeath (int i, int j)
{l; fD=0; thD=0; twD=0; oD=0; numShip=0; sizeShip;
(l=0;llt;4;l++)(fourDeck.location[l][0]==iamp;amp;.location[l][1]==j)fD=1;(thI=0;thIlt;2;thI++)(l=0;llt;3;l++)(threeDeck[thI].location[l][0]==iamp;amp;[thI].location[l][1]==j)
{= 1;=thI;
}
(twI=0;twIlt;3;twI++)(l=0;llt;2;l++)(twoDeck[twI].location[l][0]==iamp;amp;[twI].location[l][1]==j)
{= 1;=twI;
}
(oI=0; oI lt; 4; oI ++)
{(oneDeck [oI] .location [0] [0] == i amp; amp; [oI] .location [0] [1] == j)
{= 1;=oI;
}
}
(fD!=0)
{= 4; (sizeShip, fourDeck.location);
} if (thD!=0)
{= 3; (sizeShip, threeDeck [numShip] .location);
} if (twD!=0)
{= 2; (sizeShip, twoDeck [numShip] .location);
} if (oD!=0)
{= 1; (sizeShip, oneDeck [numShip] .location);
}
}
Field :: supCheck (int sizeShip, int ** a)
{fD=0; l; (l=0; l lt; sizeShip; l ++)
{(player [a [l] [0]] [a [l] [1]] == 1) fD ++;
} (fD == sizeShip)
{= 0;=0;=0; (sizeShip, a, lColor);
}
}
Field :: paintPoints (int sizeShip, int ** a, QColor lColor)
{i, j, l; k, m, n, p;
(l=0; l lt; sizeShip; l ++)
{(a [l] [0] == 0) k=0; k=a [l] [0] - 1;
(a [l] [0] == 9) m=9; m=a [l] [0] +1;
(a [l] [1] == 0) p=0; p=a [l] [1] - 1;