create game limit

This commit is contained in:
Kai Philipp
2019-09-11 20:45:52 +02:00
parent ff4c2c5302
commit c3a5c8ec85
5 changed files with 11 additions and 6 deletions
+1 -1
View File
@@ -240,7 +240,7 @@ ServerDBThread::SetPlayerLastGames(unsigned requestId, DB_id playerId, std::vect
LOG_ERROR("ServerDBThread::SetPlayerLastGames() entered.");
std::ostringstream oss;
std::copy(lastGames.begin(), lastGames.end(), std::ostream_iterator<int>(oss, ";"));
std::copy(lastGames.begin(), lastGames.end(), std::ostream_iterator<int>(oss, ","));
std::string lastGamesFieldValue( oss.str() );
list<string> params;
ostringstream paramStream;
+6 -1
View File
@@ -1379,6 +1379,11 @@ ServerLobbyThread::HandleNetPacketCreateGame(boost::shared_ptr<SessionData> sess
SendJoinGameFailed(session, gameId, NTF_NET_JOIN_GUEST_FORBIDDEN);
} else if (!ServerGame::CheckSettings(tmpData, password, GetServerMode())) {
SendJoinGameFailed(session, gameId, NTF_NET_JOIN_INVALID_SETTINGS);
} else if (!session->GetPlayerData()->IsPlayerAllowedToJoinCreateLimitRank()
// @TODO: uncomment in productive
/*&& tmpData.gameType != GAME_TYPE_RANKING*/ ) {
LOG_ERROR('not allowed due to ranklimit')
SendJoinGameFailed(session, gameId, NTF_NET_JOIN_GUEST_FORBIDDEN);
} else {
boost::shared_ptr<ServerGame> game(
new ServerGame(
@@ -1429,7 +1434,7 @@ ServerLobbyThread::HandleNetPacketJoinGame(boost::shared_ptr<SessionData> sessio
SendJoinGameFailed(session, joinGame.gameid(), NTF_NET_JOIN_NOT_INVITED);
} else if (!game->CheckPassword(password)) {
SendJoinGameFailed(session, joinGame.gameid(), NTF_NET_JOIN_INVALID_PASSWORD);
} else if (tmpData.gameType == GAME_TYPE_RANKING && !session->GetPlayerData()->IsPlayerAllowedToJoinLimitRank()) {
} else if (tmpData.gameType == GAME_TYPE_RANKING && !session->GetPlayerData()->IsPlayerAllowedToJoinCreateLimitRank()) {
SendJoinGameFailed(session, joinGame.gameid(), NTF_NET_JOIN_GUEST_FORBIDDEN);
// } else if (tmpData.gameType == GAME_TYPE_RANKING && !joinGame.spectateonly()
// && session->GetClientAddr() != SERVER_ADDRESS_LOCALHOST_STR
+2 -2
View File
@@ -65,8 +65,8 @@ public:
bool IsPlayerConnected(unsigned uniqueId) const;
bool IsClientAddressConnected(const std::string &clientAddress) const;
bool IsGuestAllowedToConnect(const std::string &clientAddress) const;
bool IsPlayerAllowedToJoinLimitRank(const std::string &playerName) const;
bool IsPlayerAllowedToJoinLimitRank(unsigned uniqueId) const;
bool IsPlayerAllowedToJoinCreateLimitRank(const std::string &playerName) const;
bool IsPlayerAllowedToJoinCreateLimitRank(unsigned uniqueId) const;
void ForEach(boost::function<void (boost::shared_ptr<SessionData>)> func);
+1 -1
View File
@@ -269,7 +269,7 @@ PlayerData::GetPlayerLastGames()
}
bool
PlayerData::IsPlayerAllowedToJoinLimitRank()
PlayerData::IsPlayerAllowedToJoinCreateLimitRank()
{
bool retVal = false;
+1 -1
View File
@@ -120,7 +120,7 @@ public:
void AddPlayerLastGame(long lastGames);
void SetPlayerLastGames(std::vector<long> lastGames);
std::vector<long> GetPlayerLastGames();
bool IsPlayerAllowedToJoinLimitRank();
bool IsPlayerAllowedToJoinCreateLimitRank();
bool operator<(const PlayerData &other) const;