~ubuntu-branches/ubuntu/trusty/hedgewars/trusty-proposed

« back to all changes in this revision

Viewing changes to QTfrontend/hedgehogerWidget.cpp

  • Committer: Package Import Robot
  • Author(s): Dmitry E. Oboukhov
  • Date: 2011-11-20 18:31:17 UTC
  • mfrom: (1.2.12)
  • Revision ID: package-import@ubuntu.com-20111120183117-pjhz1n2pvnmxa246
Tags: 0.9.17-1
* [Paul Wise]
 * Mention the homing bee in the package description (Closes: #577092)
 * Also install the hwengine desktop file (LP: #811770)
 * Depend on ttf-dejavu-core since it is smaller
 * Depend on ttf-wqy-zenhei instead of embedding a copy of it
* [Dmitry E. Oboukhov]
 * New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Hedgewars, a free turn based strategy game
3
 
 * Copyright (c) 2006-2008 Ulyanov Igor <iulyanov@gmail.com>
4
 
 * Copyright (c) 2008-2011 Andrey Korotaev <unC0Rr@gmail.com>
5
 
 *
6
 
 * This program is free software; you can redistribute it and/or modify
7
 
 * it under the terms of the GNU General Public License as published by
8
 
 * the Free Software Foundation; version 2 of the License
9
 
 *
10
 
 * This program is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 * GNU General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU General Public License
16
 
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18
 
 */
19
 
 
20
 
#include "hedgehogerWidget.h"
21
 
 
22
 
#include "frameTeam.h"
23
 
 
24
 
CHedgehogerWidget::CHedgehogerWidget(const QImage& im, const QImage& img, QWidget * parent) :
25
 
    ItemNum(im, img, parent, 1)
26
 
{
27
 
  // TODO: maxHedgehogsPerGame doesn't reset properly and won't match map limits for now
28
 
  /*if(parent) {
29
 
    pOurFrameTeams = dynamic_cast<FrameTeams*>(parent->parentWidget());
30
 
  }
31
 
  if(pOurFrameTeams->overallHedgehogs + 4 > pOurFrameTeams->maxHedgehogsPerGame) {
32
 
    numItems = pOurFrameTeams->maxHedgehogsPerGame - pOurFrameTeams->overallHedgehogs;
33
 
  } else numItems = 4;
34
 
  pOurFrameTeams->overallHedgehogs += numItems;*/
35
 
}
36
 
 
37
 
void CHedgehogerWidget::incItems()
38
 
{
39
 
  //if (pOurFrameTeams->overallHedgehogs < pOurFrameTeams->maxHedgehogsPerGame) {
40
 
    numItems++;
41
 
    //pOurFrameTeams->overallHedgehogs++;
42
 
    emit hedgehogsNumChanged();
43
 
  //}
44
 
}
45
 
 
46
 
void CHedgehogerWidget::decItems()
47
 
{
48
 
  numItems--;
49
 
  //pOurFrameTeams->overallHedgehogs--;
50
 
  emit hedgehogsNumChanged();
51
 
}
52
 
 
53
 
CHedgehogerWidget::~CHedgehogerWidget()
54
 
{
55
 
  // TODO: not called?
56
 
  //pOurFrameTeams->overallHedgehogs-=numItems;
57
 
}
58
 
 
59
 
void CHedgehogerWidget::setNonInteractive()
60
 
{
61
 
  nonInteractive=true;
62
 
}
63
 
 
64
 
void CHedgehogerWidget::setHHNum(unsigned int num)
65
 
{
66
 
  /*unsigned int diff = num - numItems;
67
 
  numItems += diff;
68
 
  pOurFrameTeams->overallHedgehogs += diff;*/
69
 
  numItems = num;
70
 
  repaint();
71
 
}
72
 
 
73
 
unsigned char CHedgehogerWidget::getHedgehogsNum() const
74
 
{
75
 
  return numItems;
76
 
}