Prevent a ton of local arrow from spamming a user's UI

Co-authored-by: alyssa.syharath@gmail.com
This commit is contained in:
Zach Halpern
2024-05-12 20:56:32 -04:00
parent 2303880b87
commit 5b55ff883a
2 changed files with 9 additions and 1 deletions

View File

@@ -110,7 +110,7 @@ void PlayerArea::setPlayerZoneId(int _playerZoneId)
} }
Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, TabGame *_parent) Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, TabGame *_parent)
: QObject(_parent), game(_parent), movingCardsUntil(false), shortcutsActive(false), lastTokenDestroy(true), : QObject(_parent), game(_parent), movingCardsUntil(false), isCreatingArrow(false), shortcutsActive(false), lastTokenDestroy(true),
lastTokenTableRow(0), id(_id), active(false), local(_local), judge(_judge), mirrored(false), handVisible(false), lastTokenTableRow(0), id(_id), active(false), local(_local), judge(_judge), mirrored(false), handVisible(false),
conceded(false), zoneId(0), dialogSemaphore(false), deck(nullptr) conceded(false), zoneId(0), dialogSemaphore(false), deck(nullptr)
{ {
@@ -1967,6 +1967,7 @@ void Player::eventRollDie(const Event_RollDie &event)
void Player::eventCreateArrow(const Event_CreateArrow &event) void Player::eventCreateArrow(const Event_CreateArrow &event)
{ {
isCreatingArrow = false;
ArrowItem *arrow = addArrow(event.arrow_info()); ArrowItem *arrow = addArrow(event.arrow_info());
if (!arrow) { if (!arrow) {
return; return;
@@ -3199,7 +3200,13 @@ void Player::actSetPT()
void Player::actDrawArrow() void Player::actDrawArrow()
{ {
if (isCreatingArrow) {
return;
}
isCreatingArrow = true;
if (!game->getActiveCard()) { if (!game->getActiveCard()) {
isCreatingArrow = false;
return; return;
} }

View File

@@ -254,6 +254,7 @@ private:
QString previousMovingCardsUntilExpr = {}; QString previousMovingCardsUntilExpr = {};
FilterString movingCardsUntilFilter; FilterString movingCardsUntilFilter;
bool isCreatingArrow;
bool shortcutsActive; bool shortcutsActive;
int defaultNumberTopCards = 1; int defaultNumberTopCards = 1;
int defaultNumberTopCardsToPlaceBelow = 1; int defaultNumberTopCardsToPlaceBelow = 1;