Commit 69a61c40 authored by Ramast Magdy's avatar Ramast Magdy Committed by Albert Astals Cid
Browse files

Make number of rounds configurable

parent 1b83bb9a
...@@ -118,6 +118,35 @@ ...@@ -118,6 +118,35 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="gameOptionsGroup">
<property name="title">
<string>Game Options</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="roundsLabel">
<property name="text">
<string>Rounds to win</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="kcfg_Rounds">
<property name="minimum">
<number>2</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
......
...@@ -30,5 +30,9 @@ ...@@ -30,5 +30,9 @@
</choices> </choices>
<default>PlayerVSComputer</default> <default>PlayerVSComputer</default>
</entry> </entry>
<entry key="Rounds" type="int">
<label>Rounds</label>
<default>5</default>
</entry>
</group> </group>
</kcfg> </kcfg>
...@@ -690,6 +690,7 @@ bool Tron::hasWinner() ...@@ -690,6 +690,7 @@ bool Tron::hasWinner()
int Tron::getWinner() int Tron::getWinner()
{ {
const unsigned short int WINNING_DIFF = Settings::rounds();
if (Settings::gameType() != Settings::EnumGameType::Snake) if (Settings::gameType() != Settings::EnumGameType::Snake)
{ {
if (players[0]->getScore() >= WINNING_DIFF && players[1]->getScore() < players[0]->getScore() - 1) { if (players[0]->getScore() >= WINNING_DIFF && players[1]->getScore() < players[0]->getScore() - 1) {
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include <QPaintEvent> #include <QPaintEvent>
#include <QFocusEvent> #include <QFocusEvent>
#define WINNING_DIFF 5
namespace KBAction namespace KBAction
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment