mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
game is almost playable again
This commit is contained in:
parent
0d4717f40b
commit
e796af2b89
34 changed files with 309 additions and 320 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#include "counter.h"
|
||||
#include "player.h"
|
||||
#include "client.h"
|
||||
#include "protocol_items.h"
|
||||
#include <QtGui>
|
||||
|
||||
Counter::Counter(Player *_player, int _id, const QString &_name, QColor _color, int _radius, int _value, QGraphicsItem *parent)
|
||||
|
|
@ -77,10 +78,10 @@ void Counter::setValue(int _value)
|
|||
void Counter::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
player->client->incCounter(id, 1);
|
||||
player->sendGameCommand(new Command_IncCounter(-1, id, 1));
|
||||
event->accept();
|
||||
} else if (event->button() == Qt::RightButton) {
|
||||
player->client->incCounter(id, -1);
|
||||
player->sendGameCommand(new Command_IncCounter(-1, id, -1));
|
||||
event->accept();
|
||||
} else if (event->button() == Qt::MidButton) {
|
||||
if (menu)
|
||||
|
|
@ -93,7 +94,7 @@ void Counter::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||
void Counter::incrementCounter()
|
||||
{
|
||||
int delta = static_cast<QAction *>(sender())->data().toInt();
|
||||
player->client->incCounter(id, delta);
|
||||
player->sendGameCommand(new Command_IncCounter(-1, id, delta));
|
||||
}
|
||||
|
||||
void Counter::setCounter()
|
||||
|
|
@ -101,5 +102,5 @@ void Counter::setCounter()
|
|||
bool ok;
|
||||
int newValue = QInputDialog::getInteger(0, tr("Set counter"), tr("New value for counter '%1':").arg(name), value, 0, 2000000000, 1, &ok);
|
||||
if (ok)
|
||||
player->client->setCounter(id, newValue);
|
||||
player->sendGameCommand(new Command_SetCounter(-1, id, newValue));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue