forked from metin2/server
Add project files.
This commit is contained in:
48
game/src/check_server.h
Normal file
48
game/src/check_server.h
Normal 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_
|
Reference in New Issue
Block a user