mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 00:24:47 -07:00
context menu for a message sender's name in chat; also display the user level icon next to the name; minor consistency and type-safety changes
This commit is contained in:
parent
f9e0b6fe9e
commit
95cd293b9c
30 changed files with 283 additions and 195 deletions
|
|
@ -1,7 +1,7 @@
|
|||
message ServerInfo_User {
|
||||
enum UserLevelFlags {
|
||||
IsNothing = 0;
|
||||
IsUser = 1;
|
||||
enum UserLevelFlag {
|
||||
IsNothing = 0;
|
||||
IsUser = 1;
|
||||
IsRegistered = 2;
|
||||
IsModerator = 4;
|
||||
IsAdmin = 8;
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@ void Server_Game::addPlayer(Server_AbstractUserInterface *userInterface, Respons
|
|||
newPlayer->moveToThread(thread());
|
||||
|
||||
Event_Join joinEvent;
|
||||
joinEvent.mutable_player_properties()->CopyFrom(newPlayer->getProperties(true));
|
||||
newPlayer->getProperties(*joinEvent.mutable_player_properties(), true);
|
||||
sendGameEventContainer(prepareGameEvent(joinEvent, -1));
|
||||
|
||||
const QString playerName = QString::fromStdString(newPlayer->getUserInfo()->name());
|
||||
|
|
|
|||
|
|
@ -240,9 +240,8 @@ void Server_Player::clearZones()
|
|||
lastDrawList.clear();
|
||||
}
|
||||
|
||||
ServerInfo_PlayerProperties Server_Player::getProperties(bool withUserInfo)
|
||||
void Server_Player::getProperties(ServerInfo_PlayerProperties &result, bool withUserInfo)
|
||||
{
|
||||
ServerInfo_PlayerProperties result;
|
||||
result.set_player_id(playerId);
|
||||
if (withUserInfo)
|
||||
result.mutable_user_info()->CopyFrom(*userInfo);
|
||||
|
|
@ -253,8 +252,6 @@ ServerInfo_PlayerProperties Server_Player::getProperties(bool withUserInfo)
|
|||
if (deck)
|
||||
result.set_deck_hash(deck->getDeckHash().toStdString());
|
||||
result.set_ping_seconds(pingTime);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void Server_Player::addZone(Server_CardZone *zone)
|
||||
|
|
@ -1668,7 +1665,7 @@ void Server_Player::disconnectClient()
|
|||
|
||||
void Server_Player::getInfo(ServerInfo_Player *info, Server_Player *playerWhosAsking, bool omniscient, bool withUserInfo)
|
||||
{
|
||||
info->mutable_properties()->CopyFrom(getProperties(withUserInfo));
|
||||
getProperties(*info->mutable_properties(), withUserInfo);
|
||||
if (playerWhosAsking == this)
|
||||
if (deck)
|
||||
info->set_deck_list(deck->writeToString_Native().toStdString());
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public:
|
|||
|
||||
int getPingTime() const { return pingTime; }
|
||||
void setPingTime(int _pingTime) { pingTime = _pingTime; }
|
||||
ServerInfo_PlayerProperties getProperties(bool withUserInfo);
|
||||
void getProperties(ServerInfo_PlayerProperties &result, bool withUserInfo);
|
||||
|
||||
int newCardId();
|
||||
int newCounterId() const;
|
||||
|
|
|
|||
10
common/user_level.h
Normal file
10
common/user_level.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef USER_LEVEL_H
|
||||
#define USER_LEVEL_H
|
||||
|
||||
#include "pb/serverinfo_user.pb.h"
|
||||
#include <QFlags>
|
||||
|
||||
Q_DECLARE_FLAGS(UserLevelFlags, ServerInfo_User::UserLevelFlag)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(UserLevelFlags)
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue