error msg

This commit is contained in:
Kai Philipp
2019-09-15 18:06:31 +02:00
parent 5c4983fb1e
commit 5b369cfaf7
2 changed files with 3 additions and 8 deletions
+2 -2
View File
@@ -1383,7 +1383,7 @@ ServerLobbyThread::HandleNetPacketCreateGame(boost::shared_ptr<SessionData> sess
// @TODO: uncomment in productive // @TODO: uncomment in productive
/*&& tmpData.gameType != GAME_TYPE_RANKING*/ ) { /*&& tmpData.gameType != GAME_TYPE_RANKING*/ ) {
LOG_ERROR("not allowed due to ranklimit"); LOG_ERROR("not allowed due to ranklimit");
SendJoinGameFailed(session, gameId, NTF_NET_JOIN_GAME_INVALID); SendJoinGameFailed(session, gameId, ERR_NET_PLAYER_BLOCKED);
} else { } else {
boost::shared_ptr<ServerGame> game( boost::shared_ptr<ServerGame> game(
new ServerGame( new ServerGame(
@@ -1436,7 +1436,7 @@ ServerLobbyThread::HandleNetPacketJoinGame(boost::shared_ptr<SessionData> sessio
} else if (!game->CheckPassword(password)) { } else if (!game->CheckPassword(password)) {
SendJoinGameFailed(session, joinGame.gameid(), NTF_NET_JOIN_INVALID_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_GAME_INVALID); SendJoinGameFailed(session, joinGame.gameid(), ERR_NET_PLAYER_BLOCKED);
// } else if (tmpData.gameType == GAME_TYPE_RANKING && !joinGame.spectateonly() // } else if (tmpData.gameType == GAME_TYPE_RANKING && !joinGame.spectateonly()
// && session->GetClientAddr() != SERVER_ADDRESS_LOCALHOST_STR // && session->GetClientAddr() != SERVER_ADDRESS_LOCALHOST_STR
// && session->GetClientAddr() != SERVER_ADDRESS_LOCALHOST_STR_V4V6 // && session->GetClientAddr() != SERVER_ADDRESS_LOCALHOST_STR_V4V6
+1 -6
View File
@@ -32,9 +32,6 @@
#include <ctime> #include <ctime>
#include <core/loghelper.h> // @TODO: remove in productive #include <core/loghelper.h> // @TODO: remove in productive
#define SERVER_ALLOWED_RANKING_GAMES_PER_MINUTES 5
#define SERVER_ALLOWED_RANKING_GAMES_MINUTES 60
using namespace std; using namespace std;
PlayerData::PlayerData(unsigned uniqueId, int number, PlayerType type, PlayerRights rights, bool isGameAdmin) PlayerData::PlayerData(unsigned uniqueId, int number, PlayerType type, PlayerRights rights, bool isGameAdmin)
@@ -275,9 +272,7 @@ PlayerData::IsPlayerAllowedToJoinCreateLimitRank(string num, string period)
{ {
bool retVal = false; bool retVal = false;
LOG_ERROR("checking IsPlayerAllowedToJoinCreateLimitRank() "); LOG_ERROR("checking IsPlayerAllowedToJoinCreateLimitRank() ");
// #define SERVER_ALLOWED_RANKING_GAMES_PER_MINUTES 5
// #define SERVER_ALLOWED_RANKING_GAMES_MINUTES 60
boost::mutex::scoped_lock lock(m_dataMutex); boost::mutex::scoped_lock lock(m_dataMutex);
long then = (long)time(NULL) - (long)(stoi(period) * 10); long then = (long)time(NULL) - (long)(stoi(period) * 10);