switched to rank only games

This commit is contained in:
Kai Philipp
2019-10-03 13:49:59 +02:00
parent 0341c26559
commit 95fac5a4f5
2 changed files with 11 additions and 14 deletions
+2 -4
View File
@@ -300,8 +300,7 @@ ServerGame::InternalStartGame()
if (playerData.size() >= 2) {
// Set DB Backend.
// @TODO: check for wec or bbc game with bbcbot as creator
//if (GetGameData().gameType == GAME_TYPE_RANKING)
if (true)
if (GetGameData().gameType == GAME_TYPE_RANKING)
m_database = GetLobbyThread().GetDatabase();
else
m_database.reset(new ServerDBNoAction);
@@ -352,8 +351,7 @@ ServerGame::InternalStartGame()
// @TODO: here to save last_games with mysql per player
//if (GetGameData().gameType == GAME_TYPE_RANKING)
if(true)
if (GetGameData().gameType == GAME_TYPE_RANKING)
StoreLastGames(playerData);
}
+9 -10
View File
@@ -1380,8 +1380,7 @@ ServerLobbyThread::HandleNetPacketCreateGame(boost::shared_ptr<SessionData> sess
} else if (!ServerGame::CheckSettings(tmpData, password, GetServerMode())) {
SendJoinGameFailed(session, gameId, NTF_NET_JOIN_INVALID_SETTINGS);
} else if (!session->GetPlayerData()->IsPlayerAllowedToJoinCreateLimitRank(m_serverConfig.readConfigString("ServerLimitRankNum"), m_serverConfig.readConfigString("ServerLimitRankPeriod"))
// @TODO: uncomment in productive
/*&& tmpData.gameType != GAME_TYPE_RANKING*/ ) {
&& tmpData.gameType != GAME_TYPE_RANKING*/ ) {
LOG_ERROR("not allowed due to ranklimit");
SendJoinGameFailed(session, gameId, NTF_NET_JOIN_IP_BLOCKED);
} else {
@@ -1435,15 +1434,15 @@ 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()->IsPlayerAllowedToJoinCreateLimitRank(m_serverConfig.readConfigString("ServerLimitRankNum"), m_serverConfig.readConfigString("ServerLimitRankPeriod"))) {
} else if (tmpData.gameType == GAME_TYPE_RANKING && !session->GetPlayerData()->IsPlayerAllowedToJoinCreateLimitRank(m_serverConfig.readConfigString("ServerLimitRankNum"), m_serverConfig.readConfigString("ServerLimitRankPeriod"))) {
SendJoinGameFailed(session, joinGame.gameid(), NTF_NET_JOIN_IP_BLOCKED);
// } else if (tmpData.gameType == GAME_TYPE_RANKING && !joinGame.spectateonly()
// && session->GetClientAddr() != SERVER_ADDRESS_LOCALHOST_STR
// && session->GetClientAddr() != SERVER_ADDRESS_LOCALHOST_STR_V4V6
// && session->GetClientAddr() != SERVER_ADDRESS_LOCALHOST_STR_V4
// && game->IsClientAddressConnected(session->GetClientAddr())) {
// ){
// SendJoinGameFailed(session, joinGame.gameid(), NTF_NET_JOIN_IP_BLOCKED);
} else if (tmpData.gameType == GAME_TYPE_RANKING && !joinGame.spectateonly()
&& session->GetClientAddr() != SERVER_ADDRESS_LOCALHOST_STR
&& session->GetClientAddr() != SERVER_ADDRESS_LOCALHOST_STR_V4V6
&& session->GetClientAddr() != SERVER_ADDRESS_LOCALHOST_STR_V4
&& game->IsClientAddressConnected(session->GetClientAddr())) {
){
SendJoinGameFailed(session, joinGame.gameid(), NTF_NET_JOIN_IP_BLOCKED);
} else {
MoveSessionToGame(game, session, joinGame.autoleave(), false);
}