QTfrontend/ui/widget/itemNum.cpp
author Wuzzy <Wuzzy2@mail.ru>
Mon, 01 Apr 2019 19:16:55 +0200
changeset 14754 c760a2939b9c
parent 10108 c68cf030eded
permissions -rw-r--r--
Hedgehogs: Move setting of random pos to chAddHH This fixes a problem that in missions, all hedgehogs start with Pos=0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
     1
/*
1066
1f1b3686a2b0 Update copyright headers a bit
unc0rr
parents: 883
diff changeset
     2
 * Hedgewars, a free turn based strategy game
6700
e04da46ee43c the most important commit of the year
koda
parents: 6616
diff changeset
     3
 * Copyright (c) 2006-2012 Igor Ulyanov <iulyanov@gmail.com>
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
     4
 *
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
     8
 *
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    12
 * GNU General Public License for more details.
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    13
 *
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
10108
c68cf030eded update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents: 6700
diff changeset
    16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    17
 */
2377
f3fab2b09e0c And in frontend
nemo
parents: 2098
diff changeset
    18
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    19
#include "itemNum.h"
2098
c977d7f2aa09 Toggle for stars ("frontend effects") - also turns off optimisations for stars that were causing problems onone machine
nemo
parents: 2072
diff changeset
    20
#include "hwform.h"
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    21
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    22
#include <QMouseEvent>
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    23
#include <QPainter>
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    24
4412
c9a78ba03679 added disabling option to itemNum and grey images for that. also made default weapon sets uneditable and not deleteable.
Henek
parents: 2377
diff changeset
    25
ItemNum::ItemNum(const QImage& im, const QImage& img, QWidget * parent, unsigned char min, unsigned char max) :
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    26
    QFrame(parent), m_im(im), m_img(img), infinityState(false), nonInteractive(false), minItems(min), maxItems(max),
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    27
    numItems(min+2 >= max ? min : min+2)
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    28
{
4412
c9a78ba03679 added disabling option to itemNum and grey images for that. also made default weapon sets uneditable and not deleteable.
Henek
parents: 2377
diff changeset
    29
    enabled = true;
6428
2d2b5e3c59a7 eyecandy
Oranger
parents: 6153
diff changeset
    30
    //if(frontendEffects) setAttribute(Qt::WA_PaintOnScreen, true);
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    31
}
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    32
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    33
ItemNum::~ItemNum()
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    34
{
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    35
}
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    36
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    37
void ItemNum::mousePressEvent ( QMouseEvent * event )
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    38
{
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    39
    if(nonInteractive) return;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    40
    if(event->button()==Qt::LeftButton && enabled)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    41
    {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    42
        event->accept();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    43
        if((infinityState && numItems <= maxItems) || (!infinityState && numItems < maxItems))
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    44
        {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    45
            incItems();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    46
        }
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    47
        else
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    48
        {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    49
            numItems = minItems+1;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    50
            // appears there's an emit in there
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    51
            decItems();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    52
        }
624
e7673b036db5 weaponItem added
displacer
parents: 612
diff changeset
    53
    }
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    54
    else if (event->button()==Qt::RightButton && enabled)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    55
    {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    56
        event->accept();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    57
        if(numItems > minItems)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    58
        {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    59
            decItems();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    60
        }
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    61
        else
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    62
        {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    63
            numItems = maxItems+(infinityState?0:-1);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    64
            incItems();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    65
        }
624
e7673b036db5 weaponItem added
displacer
parents: 612
diff changeset
    66
    }
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    67
    else
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    68
    {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    69
        event->ignore();
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    70
        return;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    71
    }
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
    72
    repaint();
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    73
}
6153
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    74
void ItemNum::wheelEvent ( QWheelEvent * event )
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    75
{
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    76
    if (nonInteractive) return;
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    77
    if (!enabled)
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    78
    {
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    79
        event->ignore();
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    80
        return;
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    81
    }
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    82
    event->accept();
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    83
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    84
    bool up = (event->delta() > 0); // positive delta is up, negative is down
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    85
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    86
    // negative delta on horizontal wheel is not left, but right
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    87
    if (event->orientation() == Qt::Horizontal)
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    88
        up = !up;
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    89
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    90
    if(up)
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    91
    {
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    92
        if((infinityState && numItems <= maxItems) || (!infinityState && numItems < maxItems))
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    93
            incItems();
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    94
    }
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    95
    else
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    96
    {
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    97
        if(numItems > minItems)
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    98
            decItems();
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
    99
    }
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   100
    repaint();
6153
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6060
diff changeset
   101
}
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
   102
643
281af1f040fb sizeHint for items Widget
displacer
parents: 642
diff changeset
   103
QSize ItemNum::sizeHint () const
281af1f040fb sizeHint for items Widget
displacer
parents: 642
diff changeset
   104
{
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   105
    return QSize((maxItems+1)*12, 32);
643
281af1f040fb sizeHint for items Widget
displacer
parents: 642
diff changeset
   106
}
281af1f040fb sizeHint for items Widget
displacer
parents: 642
diff changeset
   107
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
   108
void ItemNum::paintEvent(QPaintEvent* event)
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
   109
{
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   110
    Q_UNUSED(event);
4560
5d6c7f88db73 - Some work on drawMap widget and scene to allow undo, clear, save and load operations
unc0rr
parents: 4416
diff changeset
   111
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   112
    QPainter painter(this);
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
   113
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   114
    if (numItems==maxItems+1)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   115
    {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   116
        QRect target(0, 0, 100, 32);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   117
        if (enabled)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   118
        {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   119
            painter.drawImage(target, QImage(":/res/infinity.png"));
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   120
        }
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   121
        else
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   122
        {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   123
            painter.drawImage(target, QImage(":/res/infinitygrey.png"));
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   124
        }
4412
c9a78ba03679 added disabling option to itemNum and grey images for that. also made default weapon sets uneditable and not deleteable.
Henek
parents: 2377
diff changeset
   125
    }
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   126
    else
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   127
    {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   128
        for(int i=0; i<numItems; i++)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   129
        {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   130
            QRect target(11 * i, i % 2, 25, 35);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   131
            if (enabled)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   132
            {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   133
                painter.drawImage(target, m_im);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   134
            }
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   135
            else
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   136
            {
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   137
                painter.drawImage(target, m_img);
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   138
            }
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   139
        }
640
e69b651bb336 first buggy infinity state for weapons
displacer
parents: 624
diff changeset
   140
    }
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
   141
}
624
e7673b036db5 weaponItem added
displacer
parents: 612
diff changeset
   142
e7673b036db5 weaponItem added
displacer
parents: 612
diff changeset
   143
unsigned char ItemNum::getItemsNum() const
e7673b036db5 weaponItem added
displacer
parents: 612
diff changeset
   144
{
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   145
    return numItems;
624
e7673b036db5 weaponItem added
displacer
parents: 612
diff changeset
   146
}
e7673b036db5 weaponItem added
displacer
parents: 612
diff changeset
   147
e7673b036db5 weaponItem added
displacer
parents: 612
diff changeset
   148
void ItemNum::setItemsNum(const unsigned char num)
e7673b036db5 weaponItem added
displacer
parents: 612
diff changeset
   149
{
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   150
    numItems=num;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   151
    repaint();
624
e7673b036db5 weaponItem added
displacer
parents: 612
diff changeset
   152
}
640
e69b651bb336 first buggy infinity state for weapons
displacer
parents: 624
diff changeset
   153
e69b651bb336 first buggy infinity state for weapons
displacer
parents: 624
diff changeset
   154
void ItemNum::setInfinityState(bool value)
e69b651bb336 first buggy infinity state for weapons
displacer
parents: 624
diff changeset
   155
{
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   156
    infinityState=value;
640
e69b651bb336 first buggy infinity state for weapons
displacer
parents: 624
diff changeset
   157
}
4412
c9a78ba03679 added disabling option to itemNum and grey images for that. also made default weapon sets uneditable and not deleteable.
Henek
parents: 2377
diff changeset
   158
c9a78ba03679 added disabling option to itemNum and grey images for that. also made default weapon sets uneditable and not deleteable.
Henek
parents: 2377
diff changeset
   159
void ItemNum::setEnabled(bool value)
c9a78ba03679 added disabling option to itemNum and grey images for that. also made default weapon sets uneditable and not deleteable.
Henek
parents: 2377
diff changeset
   160
{
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   161
    enabled=value;
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6428
diff changeset
   162
    repaint();
4412
c9a78ba03679 added disabling option to itemNum and grey images for that. also made default weapon sets uneditable and not deleteable.
Henek
parents: 2377
diff changeset
   163
}