Mark more functions as [[nodiscard]] (#6320)

* Fix local variable double declaration.

Took 44 seconds

* Mark functions as [[nodiscard]]

Took 31 minutes

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2025-11-16 01:39:24 +01:00 committed by GitHub
parent 27708d5964
commit 73763b5ee6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
65 changed files with 258 additions and 257 deletions

View file

@ -49,15 +49,15 @@ public:
}
// expose useful actions/menus if PlayerMenu needs them
QMenu *revealLibrary() const
[[nodiscard]] QMenu *revealLibrary() const
{
return mRevealLibrary;
}
QMenu *lendLibraryMenu() const
[[nodiscard]] QMenu *lendLibraryMenu() const
{
return mLendLibrary;
}
QMenu *revealTopCardMenu() const
[[nodiscard]] QMenu *revealTopCardMenu() const
{
return mRevealTopCard;
}

View file

@ -61,7 +61,7 @@ public:
return utilityMenu;
}
bool getShortcutsActive() const
[[nodiscard]] bool getShortcutsActive() const
{
return shortcutsActive;
}

View file

@ -63,7 +63,7 @@ public:
void moveOneCardUntil(CardItem *card);
void stopMoveTopCardsUntil();
bool isMovingCardsUntil() const
[[nodiscard]] bool isMovingCardsUntil() const
{
return movingCardsUntil;
}

View file

@ -28,13 +28,13 @@ public:
{
Type = typeOther
};
int type() const override
[[nodiscard]] int type() const override
{
return Type;
}
explicit PlayerArea(QGraphicsItem *parent = nullptr);
QRectF boundingRect() const override
[[nodiscard]] QRectF boundingRect() const override
{
return bRect;
}
@ -43,7 +43,7 @@ public:
void setSize(qreal width, qreal height);
void setPlayerZoneId(int _playerZoneId);
int getPlayerZoneId() const
[[nodiscard]] int getPlayerZoneId() const
{
return playerZoneId;
}

View file

@ -27,39 +27,39 @@ public:
bool localPlayerIsSpectator;
QMap<int, ServerInfo_User> spectators;
bool isSpectator() const
[[nodiscard]] bool isSpectator() const
{
return localPlayerIsSpectator;
}
bool isJudge() const
[[nodiscard]] bool isJudge() const
{
return localPlayerIsJudge;
}
int getLocalPlayerId() const
[[nodiscard]] int getLocalPlayerId() const
{
return localPlayerId;
}
const QMap<int, Player *> &getPlayers() const
[[nodiscard]] const QMap<int, Player *> &getPlayers() const
{
return players;
}
int getPlayerCount() const
[[nodiscard]] int getPlayerCount() const
{
return players.size();
}
Player *getActiveLocalPlayer(int activePlayer) const;
[[nodiscard]] Player *getActiveLocalPlayer(int activePlayer) const;
bool isLocalPlayer(int playerId);
Player *addPlayer(int playerId, const ServerInfo_User &info);
void removePlayer(int playerId);
Player *getPlayer(int playerId) const;
[[nodiscard]] Player *getPlayer(int playerId) const;
void onPlayerConceded(int playerId, bool conceded);
@ -70,17 +70,17 @@ public:
return playerId == getLocalPlayerId();
}
const QMap<int, ServerInfo_User> &getSpectators() const
[[nodiscard]] const QMap<int, ServerInfo_User> &getSpectators() const
{
return spectators;
}
ServerInfo_User getSpectator(int playerId) const
[[nodiscard]] ServerInfo_User getSpectator(int playerId) const
{
return spectators.value(playerId);
}
QString getSpectatorName(int spectatorId) const
[[nodiscard]] QString getSpectatorName(int spectatorId) const
{
return QString::fromStdString(spectators.value(spectatorId).name());
}
@ -100,7 +100,7 @@ public:
emit spectatorRemoved(spectatorId, spectatorInfo);
}
AbstractGame *getGame() const
[[nodiscard]] AbstractGame *getGame() const
{
return game;
}