QTfrontend/hedgehogerWidget.cpp
changeset 1300 22c03f69e142
parent 1066 1f1b3686a2b0
child 1784 dfe9bafb4590
equal deleted inserted replaced
1299:fc801a832e0e 1300:22c03f69e142
    22 
    22 
    23 CHedgehogerWidget::CHedgehogerWidget(const QImage& im, QWidget * parent) :
    23 CHedgehogerWidget::CHedgehogerWidget(const QImage& im, QWidget * parent) :
    24     ItemNum(im, parent, 1)
    24     ItemNum(im, parent, 1)
    25 {
    25 {
    26   if(parent) {
    26   if(parent) {
    27     pOurFrameTeams=dynamic_cast<FrameTeams*>(parent->parentWidget());
    27     pOurFrameTeams = dynamic_cast<FrameTeams*>(parent->parentWidget());
    28   }
    28   }
    29   if(pOurFrameTeams->overallHedgehogs+4>pOurFrameTeams->maxHedgehogsPerGame) {
    29   if(pOurFrameTeams->overallHedgehogs + 4 > pOurFrameTeams->maxHedgehogsPerGame) {
    30     numItems=pOurFrameTeams->maxHedgehogsPerGame-pOurFrameTeams->overallHedgehogs;
    30     numItems = pOurFrameTeams->maxHedgehogsPerGame - pOurFrameTeams->overallHedgehogs;
    31   } else numItems=4;
    31   } else numItems = 4;
    32   pOurFrameTeams->overallHedgehogs+=numItems;
    32   pOurFrameTeams->overallHedgehogs += numItems;
    33 }
    33 }
    34 
    34 
    35 void CHedgehogerWidget::incItems() 
    35 void CHedgehogerWidget::incItems()
    36 {
    36 {
    37   if (pOurFrameTeams->overallHedgehogs<18) {
    37   if (pOurFrameTeams->overallHedgehogs < 18) {
    38     numItems++;
    38     numItems++;
    39     pOurFrameTeams->overallHedgehogs++;
    39     pOurFrameTeams->overallHedgehogs++;
    40     emit hedgehogsNumChanged();
    40     emit hedgehogsNumChanged();
    41   }
    41   }
    42 }
    42 }
    58   nonInteractive=true;
    58   nonInteractive=true;
    59 }
    59 }
    60 
    60 
    61 void CHedgehogerWidget::setHHNum(unsigned int num)
    61 void CHedgehogerWidget::setHHNum(unsigned int num)
    62 {
    62 {
    63   unsigned int diff=numItems-num;
    63   unsigned int diff = num - numItems;
    64   numItems=num;
    64   numItems += diff;
    65   pOurFrameTeams->overallHedgehogs+=diff;
    65   pOurFrameTeams->overallHedgehogs += diff;
    66   repaint();
    66   repaint();
    67 }
    67 }
    68 
    68 
    69 unsigned char CHedgehogerWidget::getHedgehogsNum() const
    69 unsigned char CHedgehogerWidget::getHedgehogsNum() const
    70 {
    70 {