本文整理汇总了C++中NetConnection::HitKey方法的典型用法代码示例。如果您正苦于以下问题:C++ NetConnection::HitKey方法的具体用法?C++ NetConnection::HitKey怎么用?C++ NetConnection::HitKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetConnection
的用法示例。
在下文中一共展示了NetConnection::HitKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv)
{
#ifdef PUBLICLOGIN
sprintf(version,"v1.01P");
sprintf(consoletitle,"EQEmu Public Login %s",version);
SetConsoleTitle(consoletitle);
printf("============================\n");
printf("EQEmu Login %s\n",version);
printf("http://eqemu.sourceforge.net\n");
printf("============================\n");
#endif
#ifdef _DEBUG
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
cerr << "Could not set signal handler" << endl;
}
srand(time(NULL));
/* if (argc >= 2) {
if (strcasecmp(argv[1], "port") == 0) {
if (argc == 3 && atoi(argv[2]) > 0 && atoi(argv[2]) < 0xFFFF) {
net.SetPort(atoi(argv[2]));
}
else {
cout << "Usage: Login port <number>" << endl;
return 0;
}
}
else {
cout << "Error: Unknown command line option" << endl;
return 0;
}
}*/
net.ReadLoginConfig();
#ifdef MINILOGIN
net.ReadMiniLoginAccounts();
#endif
#ifndef MINILOGIN
database.LoadVariables();
// if ((net.GetLoginMode() == Master) || (net.GetLoginMode() == Standalone)) {
// database.ClearLSAuthChange();
// }
#endif
if (net.GetLoginMode() == Standalone) {
cout << "Server mode: Standalone" << endl;
}
else if (net.GetLoginMode() == Master) {
cout << "Server mode: Master" << endl;
}
else if (net.GetLoginMode() == Slave) {
cout << "Server mode: Slave" << endl;
}
else if (net.GetLoginMode() == Mesh) {
cout << "Server mode: Mesh" << endl;
}
else {
cout << "Server mode: Unknown" << endl;
return 1;
}
if (net.GetLoginMode() == Slave) {
world_list.ConnectUplink();
}
world_list.Init();
if (eqns.Open(net.GetPort())) {
cout << "Login server listening on port:" << net.GetPort() << endl;
}
else {
cout << "EQNetworkServer.Open() error" << endl;
return 1;
}
Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect
EQNetworkConnection* eqnc;
while(RunLoops) {
Timer::SetCurrentTime();
while (eqnc = eqns.NewQueuePop()) {
#ifdef CLIENT_JOINPART
struct in_addr in;
in.s_addr = eqnc->GetrIP();
cout << Timer::GetCurrentTime() << " New client from ip: " << inet_ntoa(in) << " port: " << ntohs(eqnc->GetrPort()) << endl;
#endif
Client* client = new Client(eqnc);
client_list.Add(client);
}
client_list.Process();
world_list.Process();
#ifdef WIN32
if(kbhit())
{
int hitkey = getch();
net.HitKey(hitkey);
}
#endif
if (InterserverTimer.Check()) {
InterserverTimer.Start();
//.........这里部分代码省略.........