Fixing game admin stuff.
This commit is contained in:
@@ -24,7 +24,6 @@
|
|||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <playerdata.h>
|
|
||||||
#include <game_defs.h>
|
#include <game_defs.h>
|
||||||
#include <gamedata.h>
|
#include <gamedata.h>
|
||||||
|
|
||||||
@@ -51,8 +50,8 @@ public:
|
|||||||
virtual void SignalNetClientGameListPlayerLeft(unsigned gameId, unsigned playerId) = 0;
|
virtual void SignalNetClientGameListPlayerLeft(unsigned gameId, unsigned playerId) = 0;
|
||||||
|
|
||||||
virtual void SignalNetClientGameStart(boost::shared_ptr<Game> game) = 0;
|
virtual void SignalNetClientGameStart(boost::shared_ptr<Game> game) = 0;
|
||||||
virtual void SignalNetClientSelfJoined(unsigned playerId, const std::string &playerName, PlayerRights rights) = 0;
|
virtual void SignalNetClientSelfJoined(unsigned playerId, const std::string &playerName, bool isGameAdmin) = 0;
|
||||||
virtual void SignalNetClientPlayerJoined(unsigned playerId, const std::string &playerName, PlayerRights rights) = 0;
|
virtual void SignalNetClientPlayerJoined(unsigned playerId, const std::string &playerName, bool isGameAdmin) = 0;
|
||||||
virtual void SignalNetClientPlayerChanged(unsigned playerId, const std::string &newPlayerName) = 0;
|
virtual void SignalNetClientPlayerChanged(unsigned playerId, const std::string &newPlayerName) = 0;
|
||||||
virtual void SignalNetClientPlayerLeft(unsigned playerId, const std::string &playerName, int removeReason) = 0;
|
virtual void SignalNetClientPlayerLeft(unsigned playerId, const std::string &playerName, int removeReason) = 0;
|
||||||
virtual void SignalNetClientNewGameAdmin(unsigned playerId, const std::string &playerName) = 0;
|
virtual void SignalNetClientNewGameAdmin(unsigned playerId, const std::string &playerName) = 0;
|
||||||
|
|||||||
@@ -994,9 +994,9 @@ ClientThread::AddPlayerData(boost::shared_ptr<PlayerData> playerData)
|
|||||||
{
|
{
|
||||||
m_playerDataList.push_back(playerData);
|
m_playerDataList.push_back(playerData);
|
||||||
if (playerData->GetUniqueId() == GetGuiPlayerId())
|
if (playerData->GetUniqueId() == GetGuiPlayerId())
|
||||||
GetCallback().SignalNetClientSelfJoined(playerData->GetUniqueId(), playerData->GetName(), playerData->GetRights());
|
GetCallback().SignalNetClientSelfJoined(playerData->GetUniqueId(), playerData->GetName(), playerData->IsGameAdmin());
|
||||||
else
|
else
|
||||||
GetCallback().SignalNetClientPlayerJoined(playerData->GetUniqueId(), playerData->GetName(), playerData->GetRights());
|
GetCallback().SignalNetClientPlayerJoined(playerData->GetUniqueId(), playerData->GetName(), playerData->IsGameAdmin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -566,7 +566,7 @@ ServerGame::GracefulRemoveSession(SessionWrapper session, int reason)
|
|||||||
void
|
void
|
||||||
ServerGame::RemovePlayerData(boost::shared_ptr<PlayerData> player, int reason)
|
ServerGame::RemovePlayerData(boost::shared_ptr<PlayerData> player, int reason)
|
||||||
{
|
{
|
||||||
if (player->GetRights() == PLAYER_RIGHTS_ADMIN)
|
if (player->IsGameAdmin())
|
||||||
{
|
{
|
||||||
// Find new admin for the game
|
// Find new admin for the game
|
||||||
PlayerDataList playerList(GetSessionManager().GetPlayerDataList());
|
PlayerDataList playerList(GetSessionManager().GetPlayerDataList());
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ AbstractServerGameStateReceiving::ProcessPacket(boost::shared_ptr<ServerGame> se
|
|||||||
// Only admins are allowed to kick, and only in the lobby.
|
// Only admins are allowed to kick, and only in the lobby.
|
||||||
// After leaving the lobby, a vote needs to be initiated to kick.
|
// After leaving the lobby, a vote needs to be initiated to kick.
|
||||||
KickPlayerRequestMessage_t *netKickRequest = &packet->GetMsg()->choice.kickPlayerRequestMessage;
|
KickPlayerRequestMessage_t *netKickRequest = &packet->GetMsg()->choice.kickPlayerRequestMessage;
|
||||||
if (session.playerData->GetRights() == PLAYER_RIGHTS_ADMIN && !server->IsRunning() && netKickRequest->gameId == server->GetId())
|
if (session.playerData->IsGameAdmin() && !server->IsRunning() && netKickRequest->gameId == server->GetId())
|
||||||
{
|
{
|
||||||
server->InternalKickPlayer(netKickRequest->playerId);
|
server->InternalKickPlayer(netKickRequest->playerId);
|
||||||
}
|
}
|
||||||
@@ -430,7 +430,7 @@ ServerGameStateInit::InternalProcessPacket(boost::shared_ptr<ServerGame> server,
|
|||||||
{
|
{
|
||||||
StartEventMessage_t *netStartEvent = &packet->GetMsg()->choice.startEventMessage;
|
StartEventMessage_t *netStartEvent = &packet->GetMsg()->choice.startEventMessage;
|
||||||
// Only admins are allowed to start the game.
|
// Only admins are allowed to start the game.
|
||||||
if (session.playerData->GetRights() == PLAYER_RIGHTS_ADMIN && netStartEvent->gameId == server->GetId())
|
if (session.playerData->IsGameAdmin() && netStartEvent->gameId == server->GetId())
|
||||||
{
|
{
|
||||||
// Fill up with computer players.
|
// Fill up with computer players.
|
||||||
server->ResetComputerPlayerList();
|
server->ResetComputerPlayerList();
|
||||||
@@ -463,7 +463,7 @@ ServerGameStateInit::InternalProcessPacket(boost::shared_ptr<ServerGame> server,
|
|||||||
}
|
}
|
||||||
else if (packet->GetMsg()->present == PokerTHMessage_PR_resetTimeoutMessage)
|
else if (packet->GetMsg()->present == PokerTHMessage_PR_resetTimeoutMessage)
|
||||||
{
|
{
|
||||||
if (session.playerData->GetRights() == PLAYER_RIGHTS_ADMIN)
|
if (session.playerData->IsGameAdmin())
|
||||||
{
|
{
|
||||||
RegisterAdminTimer(server);
|
RegisterAdminTimer(server);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user