using config.xml values for limitrank

This commit is contained in:
Kai Philipp
2019-09-15 17:29:09 +02:00
parent bbd05513fd
commit b3117f3046
3 changed files with 6 additions and 4 deletions
+2
View File
@@ -312,6 +312,8 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
configList.push_back(ConfigInfo("DBServerEncryptionKey", CONFIG_TYPE_STRING, ""));
configList.push_back(ConfigInfo("GameNameBadWordList", CONFIG_TYPE_STRING_LIST, "Regex"));
configList.push_back(ConfigInfo("ServerRestrictGuestLogin", CONFIG_TYPE_INT, "0"));
configList.push_back(ConfigInfo("ServerLimitRankNum", CONFIG_TYPE_INT, "4"));
configList.push_back(ConfigInfo("ServerLimitRankPeriod", CONFIG_TYPE_INT, "60"));
//fill tempList firstTime
configBufferList = configList;
+1 -1
View File
@@ -1379,7 +1379,7 @@ 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()
} else if (!session->GetPlayerData()->IsPlayerAllowedToJoinCreateLimitRank(m_serverConfig.readConfigString("ServerLimitRankNum"), ), m_serverConfig.readConfigString("ServerLimitRankPeriod")))
// @TODO: uncomment in productive
/*&& tmpData.gameType != GAME_TYPE_RANKING*/ ) {
LOG_ERROR("not allowed due to ranklimit");
+3 -3
View File
@@ -271,7 +271,7 @@ PlayerData::GetPlayerLastGames()
}
bool
PlayerData::IsPlayerAllowedToJoinCreateLimitRank()
PlayerData::IsPlayerAllowedToJoinCreateLimitRank(int num, int period)
{
bool retVal = false;
LOG_ERROR("checking IsPlayerAllowedToJoinCreateLimitRank() ");
@@ -280,7 +280,7 @@ LOG_ERROR("checking IsPlayerAllowedToJoinCreateLimitRank() ");
boost::mutex::scoped_lock lock(m_dataMutex);
long then = (long)time(NULL) - (long)(SERVER_ALLOWED_RANKING_GAMES_MINUTES * 10);
long then = (long)time(NULL) - (long)(period * 10);
int count = 0;
int i=0;
@@ -298,7 +298,7 @@ LOG_ERROR("checking IsPlayerAllowedToJoinCreateLimitRank() ");
i++;
}
if(count < SERVER_ALLOWED_RANKING_GAMES_PER_MINUTES)
if(count < num)
retVal = true;
return retVal;