mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 00:24:47 -07:00
Crash fixes (bug #0000006). Also cleaned up some includes to speed up compilation.
This commit is contained in:
parent
8fea71782d
commit
62bf2572a9
22 changed files with 208 additions and 41 deletions
|
|
@ -1,10 +1,13 @@
|
|||
#include "counter.h"
|
||||
#include "player.h"
|
||||
#include "protocol_items.h"
|
||||
#include <QtGui>
|
||||
#include <QPainter>
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
|
||||
Counter::Counter(Player *_player, int _id, const QString &_name, QColor _color, int _radius, int _value, QGraphicsItem *parent)
|
||||
: QGraphicsItem(parent), player(_player), id(_id), name(_name), color(_color), radius(_radius), value(_value), aDec(0), aInc(0)
|
||||
: QGraphicsItem(parent), player(_player), id(_id), name(_name), color(_color), radius(_radius), value(_value), aDec(0), aInc(0), dialogSemaphore(false), deleteAfterDialog(false)
|
||||
{
|
||||
if (radius > Player::counterAreaWidth / 2)
|
||||
radius = Player::counterAreaWidth / 2;
|
||||
|
|
@ -38,6 +41,14 @@ Counter::~Counter()
|
|||
delete menu;
|
||||
}
|
||||
|
||||
void Counter::delCounter()
|
||||
{
|
||||
if (dialogSemaphore)
|
||||
deleteAfterDialog = true;
|
||||
else
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
void Counter::retranslateUi()
|
||||
{
|
||||
if (menu) {
|
||||
|
|
@ -112,7 +123,13 @@ void Counter::incrementCounter()
|
|||
void Counter::setCounter()
|
||||
{
|
||||
bool ok;
|
||||
dialogSemaphore = true;
|
||||
int newValue = QInputDialog::getInteger(0, tr("Set counter"), tr("New value for counter '%1':").arg(name), value, 0, 2000000000, 1, &ok);
|
||||
if (deleteAfterDialog) {
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
dialogSemaphore = false;
|
||||
if (ok)
|
||||
player->sendGameCommand(new Command_SetCounter(-1, id, newValue));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue