mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-01-15 22:42:37 -08:00
Fixed accidental +/- of counters
Previously if you middle click on a counter (life/mana) and then click away, depending on the button clicked, the counter would +/-. I have added a fix to make sure the mouse is over the counter to change it.
This commit is contained in:
@@ -88,23 +88,25 @@ void AbstractCounter::setValue(int _value)
|
||||
|
||||
void AbstractCounter::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
Command_IncCounter cmd;
|
||||
cmd.set_counter_id(id);
|
||||
cmd.set_delta(1);
|
||||
player->sendGameCommand(cmd);
|
||||
event->accept();
|
||||
} else if (event->button() == Qt::RightButton) {
|
||||
Command_IncCounter cmd;
|
||||
cmd.set_counter_id(id);
|
||||
cmd.set_delta(-1);
|
||||
player->sendGameCommand(cmd);
|
||||
event->accept();
|
||||
} else if (event->button() == Qt::MidButton) {
|
||||
if (menu)
|
||||
menu->exec(event->screenPos());
|
||||
event->accept();
|
||||
} else
|
||||
if (isUnderMouse()) {
|
||||
if (event->button() == Qt::LeftButton && isUnderMouse()) {
|
||||
Command_IncCounter cmd;
|
||||
cmd.set_counter_id(id);
|
||||
cmd.set_delta(1);
|
||||
player->sendGameCommand(cmd);
|
||||
event->accept();
|
||||
} else if (event->button() == Qt::RightButton && isUnderMouse()) {
|
||||
Command_IncCounter cmd;
|
||||
cmd.set_counter_id(id);
|
||||
cmd.set_delta(-1);
|
||||
player->sendGameCommand(cmd);
|
||||
event->accept();
|
||||
} else if (event->button() == Qt::MidButton && isUnderMouse()) {
|
||||
if (menu)
|
||||
menu->exec(event->screenPos());
|
||||
event->accept();
|
||||
}
|
||||
}else
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user