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

Make number of rounds configurable

parent 1b83bb9a
......@@ -118,6 +118,35 @@
</layout>
</widget>
</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>
</widget>
</item>
......
......@@ -30,5 +30,9 @@
</choices>
<default>PlayerVSComputer</default>
</entry>
<entry key="Rounds" type="int">
<label>Rounds</label>
<default>5</default>
</entry>
</group>
</kcfg>
......@@ -690,6 +690,7 @@ bool Tron::hasWinner()
int Tron::getWinner()
{
const unsigned short int WINNING_DIFF = Settings::rounds();
if (Settings::gameType() != Settings::EnumGameType::Snake)
{
if (players[0]->getScore() >= WINNING_DIFF && players[1]->getScore() < players[0]->getScore() - 1) {
......
......@@ -35,7 +35,6 @@
#include <QPaintEvent>
#include <QFocusEvent>
#define WINNING_DIFF 5
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