1
0
forked from metin2/server

Add project files.

This commit is contained in:
2022-03-05 12:44:06 +02:00
parent 453a74459f
commit f4f90b2533
517 changed files with 195610 additions and 0 deletions

48
game/src/check_server.h Normal file
View File

@ -0,0 +1,48 @@
#ifndef _M2_CHECK_SERVER_KEY_H_
#define _M2_CHECK_SERVER_KEY_H_
#include <string>
#include <vector>
#include "CheckServerKey.h"
class CheckServer
{
public:
static FORCEINLINE void AddServerKey(const char* serverKey)
{
keys_.push_back(serverKey);
}
static FORCEINLINE bool CheckIp(const char* ip)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ȱɸ<C8B0><C9B8><EFBFBD> üũ <20><><EFBFBD><EFBFBD>
#ifndef _USE_SERVER_KEY_
fail_ = false;
return true;
#endif
for (int i = 0; i < keys_.size(); i++)
{
// <20>ϳ<EFBFBD><CFB3><EFBFBD><EFBFBD><EFBFBD> <20>´<EFBFBD> <20><><EFBFBD><EFBFBD>Ű<EFBFBD><C5B0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ok
std::string errorString;
if (CheckServerKey(keys_[i].c_str(), ip, "", errorString))
{
fail_ = false;
break;
}
}
return !IsFail();
}
static FORCEINLINE bool IsFail()
{
return fail_;
}
private:
static std::vector<std::string> keys_;
static bool fail_;
};
#endif // #ifndef _M2_CHECK_SERVER_KEY_H_