# HG changeset patch
# User displacer
# Date 1197326214 0
# Node ID e69b651bb336a37398857ee097455980a33646f0
# Parent  69d7ff3ab6f09e7844f4e62cafecd8bc5ab9dc28
first buggy infinity state for weapons

diff -r 69d7ff3ab6f0 -r e69b651bb336 QTfrontend/hedgewars.qrc
--- a/QTfrontend/hedgewars.qrc	Mon Dec 10 22:05:50 2007 +0000
+++ b/QTfrontend/hedgewars.qrc	Mon Dec 10 22:36:54 2007 +0000
@@ -3,6 +3,7 @@
     <file alias="Ammos.png">../share/hedgewars/Data/Graphics/AmmoMenu/Ammos.png</file>
     <file>res/hh25x25.png</file>
     <file>res/M2Round2.jpg</file>
+    <file>res/infinity.png</file>
     <file>res/botlevels/0.png</file>
     <file>res/botlevels/1.png</file>
     <file>res/botlevels/2.png</file>
diff -r 69d7ff3ab6f0 -r e69b651bb336 QTfrontend/itemNum.cpp
--- a/QTfrontend/itemNum.cpp	Mon Dec 10 22:05:50 2007 +0000
+++ b/QTfrontend/itemNum.cpp	Mon Dec 10 22:36:54 2007 +0000
@@ -22,7 +22,8 @@
 #include <QPainter>
 
 ItemNum::ItemNum(const QImage& im, QWidget * parent, unsigned char min, unsigned char max) :
-  m_im(im), QWidget(parent), nonInteractive(false), minItems(min), maxItems(max), numItems(min)
+  m_im(im), QWidget(parent), nonInteractive(false), minItems(min), maxItems(max), numItems(min),
+  infinityState(false)
 {
 }
 
@@ -35,6 +36,9 @@
   if(nonInteractive) return;
   if(event->button()==Qt::LeftButton) {
     event->accept();
+    if(infinityState && numItems==maxItems) {
+      incItems();
+    }
     if(numItems < maxItems) {
       incItems();
     }
@@ -54,9 +58,14 @@
 {
   QPainter painter(this);
 
-  for(int i=0; i<numItems; i++) {
-    QRect target(11 * i, i % 2, 25, 25);
-    painter.drawImage(target, m_im);
+  if (numItems==maxItems+1) {
+    QRect target(0, 0, 250, 32);
+    painter.drawImage(target, QImage(":/res/infinity.png"));
+  } else {
+    for(int i=0; i<numItems; i++) {
+      QRect target(11 * i, i % 2, 25, 25);
+      painter.drawImage(target, m_im);
+    }
   }
 }
 
@@ -69,3 +78,8 @@
 {
   numItems=num;
 }
+
+void ItemNum::setInfinityState(bool value)
+{
+  infinityState=value;
+}
diff -r 69d7ff3ab6f0 -r e69b651bb336 QTfrontend/itemNum.h
--- a/QTfrontend/itemNum.h	Mon Dec 10 22:05:50 2007 +0000
+++ b/QTfrontend/itemNum.h	Mon Dec 10 22:36:54 2007 +0000
@@ -26,6 +26,9 @@
 {
   Q_OBJECT
 
+  public:
+    void setInfinityState(bool value);
+
   protected:
     ItemNum(const QImage& im, QWidget * parent, unsigned char min=2, unsigned char max=8);
     virtual ~ItemNum()=0;
@@ -47,6 +50,7 @@
     virtual void decItems()=0;
     
   private:
+    bool infinityState;
     QImage m_im;
 };
 
diff -r 69d7ff3ab6f0 -r e69b651bb336 QTfrontend/selectWeapon.cpp
--- a/QTfrontend/selectWeapon.cpp	Mon Dec 10 22:05:50 2007 +0000
+++ b/QTfrontend/selectWeapon.cpp	Mon Dec 10 22:36:54 2007 +0000
@@ -43,6 +43,7 @@
   hbLayout->addWidget(lbl);
 
   WeaponItem* item=new WeaponItem(QImage(":/res/M2Round2.jpg"), this);
+  item->setInfinityState(true);
   hbLayout->addWidget(item);
 
   hbLayout->setStretchFactor(lbl, 1);