--- a/QTfrontend/hedgehogerWidget.cpp Fri Sep 15 13:47:01 2006 +0000
+++ b/QTfrontend/hedgehogerWidget.cpp Fri Sep 15 15:45:30 2006 +0000
@@ -3,19 +3,33 @@
#include <QMouseEvent>
#include <QPainter>
+int overallHedgehogs=0;
+
CHedgehogerWidget::CHedgehogerWidget(QWidget * parent) :
QWidget(parent), numHedgehogs(4)
{
+ overallHedgehogs+=numHedgehogs;
+}
+
+CHedgehogerWidget::~CHedgehogerWidget()
+{
+ overallHedgehogs-=numHedgehogs;
}
void CHedgehogerWidget::mousePressEvent ( QMouseEvent * event )
{
if(event->button()==Qt::LeftButton) {
event->accept();
- if(numHedgehogs < 8) numHedgehogs++;
+ if(numHedgehogs < 8 && overallHedgehogs<18) {
+ numHedgehogs++;
+ overallHedgehogs++;
+ }
} else if (event->button()==Qt::RightButton) {
event->accept();
- if(numHedgehogs > 3) numHedgehogs--;
+ if(numHedgehogs > 3) {
+ numHedgehogs--;
+ overallHedgehogs--;
+ }
} else {
event->ignore();
return;
--- a/QTfrontend/hedgehogerWidget.h Fri Sep 15 13:47:01 2006 +0000
+++ b/QTfrontend/hedgehogerWidget.h Fri Sep 15 15:45:30 2006 +0000
@@ -9,6 +9,7 @@
public:
CHedgehogerWidget(QWidget * parent = 0);
+ ~CHedgehogerWidget();
unsigned char getHedgehogsNum();
protected:
--- a/QTfrontend/teamselect.cpp Fri Sep 15 13:47:01 2006 +0000
+++ b/QTfrontend/teamselect.cpp Fri Sep 15 15:45:30 2006 +0000
@@ -34,6 +34,8 @@
curDontPlayingTeams.push_back(*itPlay);
curPlayingTeams.erase(itPlay);
} else {
+ // return if max playing teams reached
+ if(curPlayingTeams.size()>2) return;
// dont playing team => playing
curPlayingTeams.push_back(*itDontPlay);
curDontPlayingTeams.erase(itDontPlay);