author | sheepluva |
Sat, 28 Apr 2012 11:56:09 +0200 | |
changeset 6947 | 1be3e48e1d53 |
parent 6700 | e04da46ee43c |
child 6952 | 7f70f37bbf08 |
permissions | -rw-r--r-- |
184 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
883 | 3 |
* Copyright (c) 2006-2008 Ulyanov Igor <iulyanov@gmail.com> |
6700 | 4 |
* Copyright (c) 2008-2012 Andrey Korotaev <unC0Rr@gmail.com> |
184 | 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 |
||
4412
c9a78ba03679
added disabling option to itemNum and grey images for that. also made default weapon sets uneditable and not deleteable.
Henek
parents:
3871
diff
changeset
|
24 |
CHedgehogerWidget::CHedgehogerWidget(const QImage& im, const QImage& img, QWidget * parent) : |
c9a78ba03679
added disabling option to itemNum and grey images for that. also made default weapon sets uneditable and not deleteable.
Henek
parents:
3871
diff
changeset
|
25 |
ItemNum(im, img, parent, 1) |
184 | 26 |
{ |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
27 |
// TODO: maxHedgehogsPerGame doesn't reset properly and won't match map limits for now |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
28 |
/*if(parent) { |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
29 |
pOurFrameTeams = dynamic_cast<FrameTeams*>(parent->parentWidget()); |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
30 |
} |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
31 |
if(pOurFrameTeams->overallHedgehogs + 4 > pOurFrameTeams->maxHedgehogsPerGame) { |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
32 |
numItems = pOurFrameTeams->maxHedgehogsPerGame - pOurFrameTeams->overallHedgehogs; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
33 |
} else numItems = 4; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
34 |
pOurFrameTeams->overallHedgehogs += numItems;*/ |
612
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
579
diff
changeset
|
35 |
} |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
579
diff
changeset
|
36 |
|
1300 | 37 |
void CHedgehogerWidget::incItems() |
612
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
579
diff
changeset
|
38 |
{ |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
39 |
//if (pOurFrameTeams->overallHedgehogs < pOurFrameTeams->maxHedgehogsPerGame) { |
624 | 40 |
numItems++; |
3871 | 41 |
//pOurFrameTeams->overallHedgehogs++; |
624 | 42 |
emit hedgehogsNumChanged(); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
43 |
//} |
612
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
579
diff
changeset
|
44 |
} |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
579
diff
changeset
|
45 |
|
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
579
diff
changeset
|
46 |
void CHedgehogerWidget::decItems() |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
579
diff
changeset
|
47 |
{ |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
48 |
numItems--; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
49 |
//pOurFrameTeams->overallHedgehogs--; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
50 |
emit hedgehogsNumChanged(); |
184 | 51 |
} |
52 |
||
53 |
CHedgehogerWidget::~CHedgehogerWidget() |
|
54 |
{ |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
55 |
// TODO: not called? |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
56 |
//pOurFrameTeams->overallHedgehogs-=numItems; |
184 | 57 |
} |
58 |
||
362
b28e0dd48269
hedgehogs num modification now allowed to chief client only
displacer
parents:
352
diff
changeset
|
59 |
void CHedgehogerWidget::setNonInteractive() |
b28e0dd48269
hedgehogs num modification now allowed to chief client only
displacer
parents:
352
diff
changeset
|
60 |
{ |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
61 |
nonInteractive=true; |
362
b28e0dd48269
hedgehogs num modification now allowed to chief client only
displacer
parents:
352
diff
changeset
|
62 |
} |
b28e0dd48269
hedgehogs num modification now allowed to chief client only
displacer
parents:
352
diff
changeset
|
63 |
|
352 | 64 |
void CHedgehogerWidget::setHHNum(unsigned int num) |
65 |
{ |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
66 |
/*unsigned int diff = num - numItems; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
67 |
numItems += diff; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
68 |
pOurFrameTeams->overallHedgehogs += diff;*/ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
69 |
numItems = num; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
70 |
repaint(); |
352 | 71 |
} |
72 |
||
207 | 73 |
unsigned char CHedgehogerWidget::getHedgehogsNum() const |
184 | 74 |
{ |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6060
diff
changeset
|
75 |
return numItems; |
184 | 76 |
} |