: unblockMenu ()
{gt;actions()(0)-gt;setEnabled(true);gt;actions()(1)-gt;setEnabled(true);gt;actions()(2)-gt;setEnabled(true);
}
MainWindow :: difinMode (int mode, QString PlayerName1, QString PlayerName2, int amp; load)
{= 1;=mode;=PlayerName1;=PlayerName2;
}
MainWindow :: closeSelectionShips ()
{(sShip-gt;fourEdit-gt;text()==laquo;0raquo;amp;amp;sShip-gt;threeEdit-gt;text()==laquo;0raquo;amp;amp;sShip-gt;twoEdit-gt;text()==laquo;0raquo;amp;amp;sShip-gt;oneEdit-gt;text()==laquo;0raquo;)gt;close();::warning(NULL, Warring raquo ;, tr ( Ви повинні побудувати всі кораблі, щоб почати гру! )); (PF1- gt; amount == 10 amp; amp; PF2- gt; amount == 10) playing (); if (gMode!=0 amp; amp; PF1- gt; amount == 10) playing ();
}
MainWindow :: decrement ()
{n; (PF1- gt; size == 4 || PF2- gt; size == 4)
{= sShip- gt; fourEdit- gt; text (). toInt (); -; gt; fourEdit- gt; setText (QString :: number (n)); (n == 0 )
{gt;fourEdit-gt;setEnabled(false);gt;fourBtn-gt;setEnabled(false);(PF1-gt;size==4)PF1-gt;size=- 1; PF2- gt; size=- 1;
}
} if (PF1- gt; size == 3 || PF2- gt; size == 3)
{= sShip- gt; threeEdit- gt; text (). toInt (); -; gt; threeEdit- gt; setText (QString :: number (n)); (n == 0 )
{gt;threeEdit-gt;setEnabled(false);gt;threeBtn-gt;setEnabled(false);(PF1-gt;size==3)PF1-gt;size=- 1; PF2- gt; size=- 1;
}
} if (PF1- gt; size == 2 || PF2- gt; size == 2)
{= sShip- gt; twoEdit- gt; text (). toInt (); -; gt; twoEdit- gt; setText (QString :: number (n)); (n == 0 )
{gt;twoEdit-gt;setEnabled(false);gt;twoBtn-gt;setEnabled(false);(PF1-gt;size==2)PF1-gt;size=- 1; PF2- gt; size=- 1;
}
} if (PF1- gt; size == 1 || PF2- gt; size == 1)
{= sShip- gt; oneEdit- gt; text (). toInt (); -; gt; oneEdit- gt; setText (QString :: number (n)); (n == 0 )
{gt;oneEdit-gt;setEnabled(false);gt;oneBtn-gt;setEnabled(false);(PF1-gt;size==1)PF1-gt;size=- 1; PF2- gt; size=- 1;
}
}
}
MainWindow :: saveAs ()
{str=QApplication::applicationDirPath()+laquo;/users/raquo;;=QFileDialog::getSaveFileName(this, tr ( Збережіть файл ), str, tr ( Save Files (* .xml) ));
}
MainWindow :: saveGame ()
{(path == NULL) saveAs ();
array;
.append(QString::number(gMode));.append(laquo;nraquo;);.append(QString::number(PF1-gt;move));.append(laquo;nraquo;);
. append (PN1) ;. append ( n );
. append (QString :: number (PF1- gt; K)) ;. append ( n );
- gt; save (array);
. append (PN2) ;. append ( n );
(gMode!=1)array.append(QString::number(PF2-gt;K));array.append(QString::number(EF-gt;K));.append(laquo;nraquo;);
(gMode!=1) PF2- gt; save (array); EF- gt; save (array);
-gt;saveShips(array);(gMode!=1)PF2-gt;saveShips(array);EF-gt;saveShips(array);
. setFileName (path) ;. open (QIODevice :: WriteOnly) ;. write (array) ;. close ();
} MainWindow :: MWLoad ()
{loadGame ();
}
MainWindow :: readFile (QString fileName)
{temp; i, j;
. setFileName (fileName) ;. open (QIODevice :: ReadOnly); (! fileEnd ())
{= file.readLine (); (temp);=temp.toInt ();
=file.readLine (); (temp); - gt; move=temp.toInt ();
=file.readLine (); (temp);=temp;
=file.readLine (); (temp); - gt; K=temp.toInt ();
(i=0; i lt; 10; i ++)
{= file.readLine (); (temp); (temp, PF1, i);
}
=file.readLine (); (temp);=temp;
=file.readLine (); (temp); (gMode!=1) PF2- gt; K=temp.toInt (); EF- gt; K=temp.toInt ();
(i=0; i lt; 10; i ++)
{= file.readLine (); (temp); (gMode!=1) getMatrix (temp, PF2, i); getMatrix (temp, EF, i);
} (PF1); (gMode!=1) loadShips (PF2);
{(E...